	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function wined3d_caps_gl_ctx_destroy
_wined3d_caps_gl_ctx_destroy:           ## @wined3d_caps_gl_ctx_destroy
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
	movq	%rdi, %rbx
	leaq	L_.str(%rip), %rdi
	callq	_TRACE
	movq	40(%rbx), %rdi
	testq	%rdi, %rdi
	jne	LBB0_2
## %bb.1:
	cmpq	$0, 32(%rbx)
	je	LBB0_3
LBB0_2:
	callq	_glDeleteProgram
	movl	%eax, %edi
	callq	_GL_EXTCALL
	leaq	32(%rbx), %rsi
	movl	$1, %edi
	callq	_glDeleteBuffers
	movl	%eax, %edi
	callq	_GL_EXTCALL
LBB0_3:
	xorl	%edi, %edi
	xorl	%esi, %esi
	callq	_wglMakeCurrent
	testl	%eax, %eax
	jne	LBB0_5
## %bb.4:
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_ERR
LBB0_5:
	movl	24(%rbx), %edi
	callq	_wglDeleteContext
	testl	%eax, %eax
	jne	LBB0_7
## %bb.6:
	xorl	%eax, %eax
	callq	_GetLastError
	movl	24(%rbx), %esi
	leaq	L_.str.2(%rip), %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_ERR
LBB0_7:
	movl	16(%rbx), %edi
	movl	20(%rbx), %esi
	callq	_wined3d_release_dc
	movl	16(%rbx), %edi
	callq	_DestroyWindow
	movq	(%rbx), %rsi
	testq	%rsi, %rsi
	je	LBB0_9
## %bb.8:
	movq	8(%rbx), %rdi
	callq	_wglMakeCurrent
	testl	%eax, %eax
	je	LBB0_10
LBB0_9:
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
LBB0_10:
	leaq	L_.str.3(%rip), %rdi
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	jmp	_ERR                            ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Destroying caps GL context.\n"

L_.str.1:                               ## @.str.1
	.asciz	"Failed to disable caps GL context.\n"

L_.str.2:                               ## @.str.2
	.asciz	"wglDeleteContext(%p) failed, last error %#x.\n"

L_.str.3:                               ## @.str.3
	.asciz	"Failed to restore previous GL context.\n"

	.no_dead_strip	_wined3d_caps_gl_ctx_destroy
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function wined3d_caps_gl_ctx_destroy
_wined3d_caps_gl_ctx_destroy:           ; @wined3d_caps_gl_ctx_destroy
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_TRACE
	ldr	x0, [x19, #40]
	cbnz	x0, LBB0_2
; %bb.1:
	ldr	x8, [x19, #32]
	cbz	x8, LBB0_3
LBB0_2:
	bl	_glDeleteProgram
	bl	_GL_EXTCALL
	add	x1, x19, #32
	mov	w0, #1
	bl	_glDeleteBuffers
	bl	_GL_EXTCALL
LBB0_3:
	mov	x0, #0
	mov	x1, #0
	bl	_wglMakeCurrent
	cbnz	w0, LBB0_5
; %bb.4:
Lloh2:
	adrp	x0, l_.str.1@PAGE
Lloh3:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_ERR
LBB0_5:
	ldr	w0, [x19, #24]
	bl	_wglDeleteContext
	cbnz	w0, LBB0_7
; %bb.6:
	bl	_GetLastError
                                        ; kill: def $w0 killed $w0 def $x0
	ldr	w8, [x19, #24]
	stp	x8, x0, [sp]
Lloh4:
	adrp	x0, l_.str.2@PAGE
Lloh5:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_ERR
LBB0_7:
	ldp	w0, w1, [x19, #16]
	bl	_wined3d_release_dc
	ldr	w0, [x19, #16]
	bl	_DestroyWindow
	ldr	x1, [x19]
	cbz	x1, LBB0_9
; %bb.8:
	ldr	x0, [x19, #8]
	bl	_wglMakeCurrent
	cbz	w0, LBB0_10
LBB0_9:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
LBB0_10:
Lloh6:
	adrp	x0, l_.str.3@PAGE
Lloh7:
	add	x0, x0, l_.str.3@PAGEOFF
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	b	_ERR
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Destroying caps GL context.\n"

l_.str.1:                               ; @.str.1
	.asciz	"Failed to disable caps GL context.\n"

l_.str.2:                               ; @.str.2
	.asciz	"wglDeleteContext(%p) failed, last error %#x.\n"

l_.str.3:                               ; @.str.3
	.asciz	"Failed to restore previous GL context.\n"

	.no_dead_strip	_wined3d_caps_gl_ctx_destroy
.subsections_via_symbols
