	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_context_destroy                ## -- Begin function context_destroy
	.p2align	4, 0x90
_context_destroy:                       ## @context_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	%r15
	pushq	%r14
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movq	%rdi, %r14
	leaq	L_.str(%rip), %rdi
	callq	_TRACE
	movl	16(%r14), %edi
	callq	_wined3d_from_cs
	cmpq	$0, 56(%rbx)
	je	LBB0_2
## %bb.1:
	leaq	L_.str.1(%rip), %rdi
	movq	%rbx, %rsi
	callq	_TRACE
	movl	$1, (%rbx)
	movq	$0, 48(%rbx)
LBB0_7:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movq	8(%rbx), %r15
	xorl	%eax, %eax
	callq	_GetCurrentThreadId
	cmpq	%rax, %r15
	je	LBB0_4
## %bb.3:
	cmpl	$0, 40(%rbx)
	je	LBB0_4
## %bb.5:
	movl	$4, %edi
	callq	_heap_alloc
	movq	32(%rbx), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, (%rax)
	movq	%rax, 32(%rbx)
	movl	$1, 16(%rbx)
	movq	_FALSE@GOTPCREL(%rip), %rax
	jmp	LBB0_6
LBB0_4:
	movq	%rbx, %rdi
	callq	_context_destroy_gl_resources
	movq	_wined3d_context_tls_idx@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	xorl	%esi, %esi
	callq	_TlsSetValue
	movq	_TRUE@GOTPCREL(%rip), %rax
LBB0_6:
	movq	8(%r14), %rcx
	movq	(%rax), %r15
	movq	%rbx, %rdi
	callq	*(%rcx)
	movq	(%r14), %rax
	movq	(%rax), %rax
	movq	%rbx, %rdi
	callq	*(%rax)
	movq	24(%rbx), %rdi
	callq	_heap_free
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_device_context_remove
	testq	%r15, %r15
	je	LBB0_7
## %bb.8:
	movq	%rbx, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_heap_free                      ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Destroying ctx %p\n"

L_.str.1:                               ## @.str.1
	.asciz	"Delaying destruction of context %p.\n"

	.comm	_wined3d_context_tls_idx,4,2    ## @wined3d_context_tls_idx
	.comm	_TRUE,8,3                       ## @TRUE
	.comm	_FALSE,8,3                      ## @FALSE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_context_destroy                ; -- Begin function context_destroy
	.p2align	2
_context_destroy:                       ; @context_destroy
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	mov	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_TRACE
	ldr	w0, [x20, #16]
	bl	_wined3d_from_cs
	ldr	x8, [x19, #56]
	cbz	x8, LBB0_3
; %bb.1:
Lloh2:
	adrp	x0, l_.str.1@PAGE
Lloh3:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x19
	bl	_TRACE
	mov	w8, #1
	str	w8, [x19]
	str	xzr, [x19, #48]
LBB0_2:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_3:
	ldr	x21, [x19, #8]
	bl	_GetCurrentThreadId
	cmp	x21, x0
	b.eq	LBB0_6
; %bb.4:
	ldr	w8, [x19, #40]
	cbz	w8, LBB0_6
; %bb.5:
	mov	w0, #4
	bl	_heap_alloc
	ldr	x8, [x19, #32]
	ldr	w8, [x8]
	str	w8, [x0]
	str	x0, [x19, #32]
	mov	w8, #1
	str	w8, [x19, #16]
Lloh4:
	adrp	x8, _FALSE@GOTPAGE
Lloh5:
	ldr	x8, [x8, _FALSE@GOTPAGEOFF]
	b	LBB0_7
LBB0_6:
	mov	x0, x19
	bl	_context_destroy_gl_resources
Lloh6:
	adrp	x8, _wined3d_context_tls_idx@GOTPAGE
Lloh7:
	ldr	x8, [x8, _wined3d_context_tls_idx@GOTPAGEOFF]
Lloh8:
	ldr	w0, [x8]
	mov	x1, #0
	bl	_TlsSetValue
Lloh9:
	adrp	x8, _TRUE@GOTPAGE
Lloh10:
	ldr	x8, [x8, _TRUE@GOTPAGEOFF]
LBB0_7:
	ldr	x21, [x8]
	ldr	x8, [x20, #8]
	ldr	x8, [x8]
	mov	x0, x19
	blr	x8
	ldr	x8, [x20]
	ldr	x8, [x8]
	ldr	x8, [x8]
	mov	x0, x19
	blr	x8
	ldr	x0, [x19, #24]
	bl	_heap_free
	mov	x0, x20
	mov	x1, x19
	bl	_device_context_remove
	cbz	x21, LBB0_2
; %bb.8:
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_heap_free
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Destroying ctx %p\n"

l_.str.1:                               ; @.str.1
	.asciz	"Delaying destruction of context %p.\n"

	.comm	_wined3d_context_tls_idx,4,2    ; @wined3d_context_tls_idx
	.comm	_TRUE,8,3                       ; @TRUE
	.comm	_FALSE,8,3                      ; @FALSE
.subsections_via_symbols
