	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function swapchain_cleanup
_swapchain_cleanup:                     ## @swapchain_cleanup
	.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	%rdi, %r14
	leaq	L_.str(%rip), %rdi
	movq	%r14, %rsi
	xorl	%eax, %eax
	callq	_TRACE
	leaq	88(%r14), %rdx
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_wined3d_swapchain_set_gamma_ramp
	movq	80(%r14), %rdi
	testq	%rdi, %rdi
	je	LBB0_4
## %bb.1:
	xorl	%esi, %esi
	callq	_wined3d_texture_set_swapchain
	movq	80(%r14), %rdi
	callq	_wined3d_texture_decref
	testq	%rax, %rax
	je	LBB0_3
## %bb.2:
	movq	80(%r14), %rsi
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_WARN
LBB0_3:
	movq	$0, 80(%r14)
LBB0_4:
	movq	72(%r14), %rdi
	testq	%rdi, %rdi
	je	LBB0_11
## %bb.5:
	movq	32(%r14), %rbx
	testq	%rbx, %rbx
	je	LBB0_10
## %bb.6:
	decq	%rbx
	leaq	L_.str.2(%rip), %r15
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_7 Depth=1
	movq	72(%r14), %rdi
	addq	$-1, %rbx
	jae	LBB0_10
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%rdi,%rbx,8), %rdi
	xorl	%esi, %esi
	callq	_wined3d_texture_set_swapchain
	movq	72(%r14), %rax
	movq	(%rax,%rbx,8), %rdi
	callq	_wined3d_texture_decref
	testq	%rax, %rax
	je	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	movq	72(%r14), %rax
	movq	(%rax,%rbx,8), %rdx
	movq	%r15, %rdi
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	_WARN
	jmp	LBB0_9
LBB0_10:
	callq	_heap_free
	movq	$0, 72(%r14)
LBB0_11:
	movq	16(%r14), %rax
	movq	16(%rax), %rdi
	movq	_wined3d_swapchain_destroy_object@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdx
	callq	_wined3d_cs_destroy_object
	movq	16(%r14), %rax
	movq	16(%rax), %rdi
	movq	(%rdi), %rax
	movq	_WINED3D_CS_QUEUE_DEFAULT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	callq	*(%rax)
	cmpl	$0, 56(%r14)
	jne	LBB0_17
## %bb.12:
	cmpq	$0, 48(%r14)
	je	LBB0_17
## %bb.13:
	movq	16(%r14), %rax
	movl	8(%rax), %edi
	movq	(%rax), %rax
	movl	(%rax), %esi
	leaq	64(%r14), %rdx
	callq	_wined3d_set_adapter_display_mode
	movl	%eax, %ebx
	movl	%eax, %edi
	callq	_FAILED
	testq	%rax, %rax
	je	LBB0_15
## %bb.14:
	leaq	L_.str.3(%rip), %rdi
	movl	%ebx, %esi
	callq	_ERR
LBB0_15:
	movq	_WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 40(%r14)
	je	LBB0_17
## %bb.16:
	movq	16(%r14), %rdi
	movl	28(%r14), %esi
	leaq	24(%r14), %rdx
	callq	_wined3d_device_restore_fullscreen_window
	movq	16(%r14), %rdi
	callq	_wined3d_device_release_focus_window
LBB0_17:
	movq	8(%r14), %rdx
	testq	%rdx, %rdx
	je	LBB0_18
## %bb.19:
	movslq	(%r14), %rsi
	leaq	L_.str.4(%rip), %rdi
	xorl	%eax, %eax
	callq	_TRACE
	movl	(%r14), %edi
	movq	8(%r14), %rsi
	callq	_wined3d_release_dc
	movl	(%r14), %edi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_DestroyWindow                  ## TAILCALL
LBB0_18:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Destroying swapchain %p.\n"

L_.str.1:                               ## @.str.1
	.asciz	"Something's still holding the front buffer (%p).\n"

L_.str.2:                               ## @.str.2
	.asciz	"Something's still holding back buffer %u (%p).\n"

	.comm	_wined3d_swapchain_destroy_object,4,2 ## @wined3d_swapchain_destroy_object
	.comm	_WINED3D_CS_QUEUE_DEFAULT,4,2   ## @WINED3D_CS_QUEUE_DEFAULT
L_.str.3:                               ## @.str.3
	.asciz	"Failed to restore display mode, hr %#x.\n"

	.comm	_WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT,4,2 ## @WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT
L_.str.4:                               ## @.str.4
	.asciz	"Destroying backup wined3d window %p, dc %p.\n"

	.no_dead_strip	_swapchain_cleanup
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function swapchain_cleanup
_swapchain_cleanup:                     ; @swapchain_cleanup
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	bl	_TRACE
	add	x2, x19, #88
	mov	x0, x19
	mov	w1, #0
	bl	_wined3d_swapchain_set_gamma_ramp
	ldr	x0, [x19, #80]
	cbz	x0, LBB0_4
; %bb.1:
	mov	x1, #0
	bl	_wined3d_texture_set_swapchain
	ldr	x0, [x19, #80]
	bl	_wined3d_texture_decref
	cbz	x0, LBB0_3
; %bb.2:
	ldr	x1, [x19, #80]
Lloh2:
	adrp	x0, l_.str.1@PAGE
Lloh3:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_WARN
LBB0_3:
	str	xzr, [x19, #80]
LBB0_4:
	ldr	x0, [x19, #72]
	cbz	x0, LBB0_11
; %bb.5:
	ldr	x8, [x19, #32]
	cbz	x8, LBB0_10
; %bb.6:
	sub	x20, x8, #1
Lloh4:
	adrp	x21, l_.str.2@PAGE
Lloh5:
	add	x21, x21, l_.str.2@PAGEOFF
	b	LBB0_8
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=1
	ldr	x0, [x19, #72]
	sub	x20, x20, #1
	cmn	x20, #1
	b.eq	LBB0_10
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	lsl	x22, x20, #3
	ldr	x0, [x0, x22]
	mov	x1, #0
	bl	_wined3d_texture_set_swapchain
	ldr	x8, [x19, #72]
	ldr	x0, [x8, x22]
	bl	_wined3d_texture_decref
	cbz	x0, LBB0_7
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	ldr	x8, [x19, #72]
	ldr	x8, [x8, x20, lsl #3]
	str	x8, [sp]
	mov	x0, x21
	mov	x1, x20
	bl	_WARN
	b	LBB0_7
LBB0_10:
	bl	_heap_free
	str	xzr, [x19, #72]
LBB0_11:
	ldr	x8, [x19, #16]
	ldr	x0, [x8, #16]
Lloh6:
	adrp	x8, _wined3d_swapchain_destroy_object@GOTPAGE
Lloh7:
	ldr	x8, [x8, _wined3d_swapchain_destroy_object@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	mov	x2, x19
	bl	_wined3d_cs_destroy_object
	ldr	x8, [x19, #16]
	ldr	x0, [x8, #16]
	ldr	x8, [x0]
	ldr	x8, [x8]
Lloh9:
	adrp	x9, _WINED3D_CS_QUEUE_DEFAULT@GOTPAGE
Lloh10:
	ldr	x9, [x9, _WINED3D_CS_QUEUE_DEFAULT@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x9]
	blr	x8
	ldr	w8, [x19, #56]
	cbnz	w8, LBB0_17
; %bb.12:
	ldr	x8, [x19, #48]
	cbz	x8, LBB0_17
; %bb.13:
	ldr	x8, [x19, #16]
	ldr	w0, [x8, #8]
	ldr	x8, [x8]
	ldr	w1, [x8]
	add	x2, x19, #64
	bl	_wined3d_set_adapter_display_mode
	mov	x20, x0
	bl	_FAILED
	cbz	x0, LBB0_15
; %bb.14:
Lloh12:
	adrp	x0, l_.str.3@PAGE
Lloh13:
	add	x0, x0, l_.str.3@PAGEOFF
	mov	x1, x20
	bl	_ERR
LBB0_15:
	ldr	w8, [x19, #40]
Lloh14:
	adrp	x9, _WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT@GOTPAGE
Lloh15:
	ldr	x9, [x9, _WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_17
; %bb.16:
	ldr	x0, [x19, #16]
	ldr	w1, [x19, #28]
	add	x2, x19, #24
	bl	_wined3d_device_restore_fullscreen_window
	ldr	x0, [x19, #16]
	bl	_wined3d_device_release_focus_window
LBB0_17:
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_19
; %bb.18:
	ldrsw	x1, [x19]
	str	x8, [sp]
Lloh17:
	adrp	x0, l_.str.4@PAGE
Lloh18:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_TRACE
	ldr	w0, [x19]
	ldr	x1, [x19, #8]
	bl	_wined3d_release_dc
	ldr	w0, [x19]
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	b	_DestroyWindow
LBB0_19:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Destroying swapchain %p.\n"

l_.str.1:                               ; @.str.1
	.asciz	"Something's still holding the front buffer (%p).\n"

l_.str.2:                               ; @.str.2
	.asciz	"Something's still holding back buffer %u (%p).\n"

	.comm	_wined3d_swapchain_destroy_object,4,2 ; @wined3d_swapchain_destroy_object
	.comm	_WINED3D_CS_QUEUE_DEFAULT,4,2   ; @WINED3D_CS_QUEUE_DEFAULT
l_.str.3:                               ; @.str.3
	.asciz	"Failed to restore display mode, hr %#x.\n"

	.comm	_WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT,4,2 ; @WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT
l_.str.4:                               ; @.str.4
	.asciz	"Destroying backup wined3d window %p, dc %p.\n"

	.no_dead_strip	_swapchain_cleanup
.subsections_via_symbols
