	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ddraw_surface_update_frontbuffer ## -- Begin function ddraw_surface_update_frontbuffer
	.p2align	4, 0x90
_ddraw_surface_update_frontbuffer:      ## @ddraw_surface_update_frontbuffer
	.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	%r13
	pushq	%r12
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, -64(%rbp)                 ## 8-byte Spill
	movq	%rsi, %r12
	movq	%rdi, %r13
	movq	24(%rdi), %rbx
	testq	%rsi, %rsi
	jne	LBB0_2
## %bb.1:
	movl	16(%r13), %r8d
	movl	20(%r13), %ecx
	leaq	-80(%rbp), %r12
	movq	%r12, %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_SetRect
LBB0_2:
	movl	(%r12), %ecx
	movl	8(%r12), %r14d
	subl	%ecx, %r14d
	jle	LBB0_20
## %bb.3:
	movl	4(%r12), %edx
	movl	12(%r12), %r15d
	subl	%edx, %r15d
	testl	%r15d, %r15d
	jle	LBB0_20
## %bb.4:
	cmpq	$0, 8(%rbx)
	je	LBB0_8
## %bb.5:
	movq	_DDRAW_GDI_FLIP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rbx)
	je	LBB0_6
LBB0_8:
	movq	%rdx, -56(%rbp)                 ## 8-byte Spill
	movq	%rcx, %r12
	movl	(%r13), %esi
	movl	4(%r13), %edi
	leaq	-44(%rbp), %rdx
	callq	_wined3d_texture_get_dc
	movl	%eax, %ebx
	movl	%eax, %edi
	callq	_FAILED
	testq	%rax, %rax
	je	LBB0_10
## %bb.9:
	leaq	L_.str(%rip), %rdi
	movl	%ebx, %esi
	xorl	%eax, %eax
	callq	_ERR
	jmp	LBB0_22
LBB0_10:
	movq	8(%r13), %rax
	testq	%rax, %rax
	je	LBB0_12
## %bb.11:
	movl	(%rax), %edi
	movl	-44(%rbp), %esi
	callq	_wined3d_palette_apply_to_dc
LBB0_12:
	xorl	%edi, %edi
	callq	_GetDC
	testl	%eax, %eax
	je	LBB0_13
## %bb.14:
	movl	%eax, %ebx
	movl	-44(%rbp), %r9d
	movq	_SRCCOPY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpq	$0, -64(%rbp)                   ## 8-byte Folded Reload
	je	LBB0_16
## %bb.15:
	subq	$8, %rsp
	movl	%r9d, %edi
	movl	%r12d, %esi
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movl	%r14d, %ecx
	movl	%r15d, %r8d
	movl	%ebx, %r9d
	jmp	LBB0_17
LBB0_6:
	cmpq	$0, -64(%rbp)                   ## 8-byte Folded Reload
	jne	LBB0_20
## %bb.7:
	movl	4(%rbx), %edi
	movl	(%r13), %r8d
	movl	4(%r13), %ecx
	movq	_WINED3D_TEXF_POINT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	subq	$8, %rsp
	xorl	%esi, %esi
	movq	%r12, %rdx
	movq	%r12, %r9
	pushq	%rax
	pushq	$0
	pushq	$0
	callq	_wined3d_texture_blt
	addq	$32, %rsp
	movl	%eax, %ebx
	jmp	LBB0_22
LBB0_13:
	movl	(%r13), %esi
	movl	4(%r13), %edi
	movl	-44(%rbp), %edx
	callq	_wined3d_texture_release_dc
	leaq	L_.str.1(%rip), %rdi
	jmp	LBB0_19
LBB0_16:
	subq	$8, %rsp
	movl	%ebx, %edi
	movl	%r12d, %esi
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movl	%r14d, %ecx
	movl	%r15d, %r8d
LBB0_17:
	pushq	%rax
	pushq	%rdx
	pushq	%r12
	callq	_BitBlt
	addq	$32, %rsp
	movq	%rax, %r14
	xorl	%edi, %edi
	movl	%ebx, %esi
	callq	_ReleaseDC
	movl	(%r13), %esi
	movl	4(%r13), %edi
	movl	-44(%rbp), %edx
	callq	_wined3d_texture_release_dc
	testq	%r14, %r14
	je	LBB0_18
LBB0_20:
	movq	_DD_OK@GOTPCREL(%rip), %rax
LBB0_21:
	movl	(%rax), %ebx
LBB0_22:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_18:
	leaq	L_.str.2(%rip), %rdi
LBB0_19:
	xorl	%eax, %eax
	callq	_ERR
	movq	_E_FAIL@GOTPCREL(%rip), %rax
	jmp	LBB0_21
	.cfi_endproc
                                        ## -- End function
	.comm	_DD_OK,4,2                      ## @DD_OK
	.comm	_DDRAW_GDI_FLIP,4,2             ## @DDRAW_GDI_FLIP
	.comm	_WINED3D_TEXF_POINT,4,2         ## @WINED3D_TEXF_POINT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to get surface DC, hr %#x.\n"

L_.str.1:                               ## @.str.1
	.asciz	"Failed to get screen DC.\n"

	.comm	_E_FAIL,4,2                     ## @E_FAIL
	.comm	_SRCCOPY,4,2                    ## @SRCCOPY
L_.str.2:                               ## @.str.2
	.asciz	"Failed to blit to/from screen.\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ddraw_surface_update_frontbuffer ; -- Begin function ddraw_surface_update_frontbuffer
	.p2align	2
_ddraw_surface_update_frontbuffer:      ; @ddraw_surface_update_frontbuffer
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x20, x2
	mov	x25, x1
	mov	x19, x0
	ldr	x26, [x0, #24]
	cbnz	x1, LBB0_2
; %bb.1:
	ldp	w4, w3, [x19, #16]
	add	x25, sp, #8
	add	x0, sp, #8
	mov	w2, #0
	bl	_SetRect
LBB0_2:
	ldp	w22, w21, [x25]
	ldp	w8, w9, [x25, #8]
	sub	w24, w8, w22
	sub	w23, w9, w21
	cmp	w24, #1
	ccmp	w23, #0, #4, ge
	b.gt	LBB0_5
LBB0_3:
Lloh0:
	adrp	x8, _DD_OK@GOTPAGE
Lloh1:
	ldr	x8, [x8, _DD_OK@GOTPAGEOFF]
LBB0_4:
	ldr	w25, [x8]
	b	LBB0_9
LBB0_5:
	ldr	x8, [x26, #8]
	cbz	x8, LBB0_7
; %bb.6:
	ldr	w8, [x26]
Lloh2:
	adrp	x9, _DDRAW_GDI_FLIP@GOTPAGE
Lloh3:
	ldr	x9, [x9, _DDRAW_GDI_FLIP@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_15
LBB0_7:
	ldp	w1, w0, [x19]
	add	x2, sp, #28
	bl	_wined3d_texture_get_dc
	mov	x25, x0
	bl	_FAILED
	cbz	x0, LBB0_10
; %bb.8:
	str	x25, [sp]
Lloh5:
	adrp	x0, l_.str@PAGE
Lloh6:
	add	x0, x0, l_.str@PAGEOFF
	bl	_ERR
LBB0_9:
	mov	x0, x25
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_10:
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_12
; %bb.11:
	ldr	w0, [x8]
	ldr	w1, [sp, #28]
	bl	_wined3d_palette_apply_to_dc
LBB0_12:
	mov	x0, #0
	bl	_GetDC
	cbz	w0, LBB0_17
; %bb.13:
	mov	x25, x0
	ldr	w5, [sp, #28]
Lloh7:
	adrp	x8, _SRCCOPY@GOTPAGE
Lloh8:
	ldr	x8, [x8, _SRCCOPY@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	cbz	x20, LBB0_18
; %bb.14:
	str	w8, [sp]
	mov	x0, x5
	mov	x1, x22
	mov	x2, x21
	mov	x3, x24
	mov	x4, x23
	mov	x5, x25
	b	LBB0_19
LBB0_15:
	cbnz	x20, LBB0_3
; %bb.16:
	ldr	w0, [x26, #4]
	ldp	w4, w3, [x19]
Lloh10:
	adrp	x8, _WINED3D_TEXF_POINT@GOTPAGE
Lloh11:
	ldr	x8, [x8, _WINED3D_TEXF_POINT@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	str	w8, [sp]
	mov	w1, #0
	mov	x2, x25
	mov	x5, x25
	mov	w6, #0
	mov	x7, #0
	bl	_wined3d_texture_blt
	mov	x25, x0
	b	LBB0_9
LBB0_17:
	ldp	w1, w0, [x19]
	ldr	w2, [sp, #28]
	bl	_wined3d_texture_release_dc
Lloh13:
	adrp	x0, l_.str.1@PAGE
Lloh14:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_21
LBB0_18:
	str	w8, [sp]
	mov	x0, x25
	mov	x1, x22
	mov	x2, x21
	mov	x3, x24
	mov	x4, x23
LBB0_19:
	mov	x6, x22
	mov	x7, x21
	bl	_BitBlt
	mov	x20, x0
	mov	x0, #0
	mov	x1, x25
	bl	_ReleaseDC
	ldp	w1, w0, [x19]
	ldr	w2, [sp, #28]
	bl	_wined3d_texture_release_dc
	cbnz	x20, LBB0_3
; %bb.20:
Lloh15:
	adrp	x0, l_.str.2@PAGE
Lloh16:
	add	x0, x0, l_.str.2@PAGEOFF
LBB0_21:
	bl	_ERR
Lloh17:
	adrp	x8, _E_FAIL@GOTPAGE
Lloh18:
	ldr	x8, [x8, _E_FAIL@GOTPAGEOFF]
	b	LBB0_4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_DD_OK,4,2                      ; @DD_OK
	.comm	_DDRAW_GDI_FLIP,4,2             ; @DDRAW_GDI_FLIP
	.comm	_WINED3D_TEXF_POINT,4,2         ; @WINED3D_TEXF_POINT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to get surface DC, hr %#x.\n"

l_.str.1:                               ; @.str.1
	.asciz	"Failed to get screen DC.\n"

	.comm	_E_FAIL,4,2                     ; @E_FAIL
	.comm	_SRCCOPY,4,2                    ; @SRCCOPY
l_.str.2:                               ; @.str.2
	.asciz	"Failed to blit to/from screen.\n"

.subsections_via_symbols
