	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function surface_load_sysmem
_surface_load_sysmem:                   ## @surface_load_sysmem
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r14d
	movq	%rsi, %r12
	movq	%rdi, %r15
	callq	_surface_get_sub_resource_idx
	movl	%eax, %r13d
	movq	(%r12), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	(%r15), %rbx
	movq	16(%rbx), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rdi
	movl	%r13d, %esi
	movq	%r12, %rdx
	movl	%r14d, %ecx
	callq	_wined3d_texture_prepare_location
	movq	_WINED3D_LOCATION_TEXTURE_RGB@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_is_multisample_location
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	_WINED3D_LOCATION_RB_RESOLVED@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%rbx, %rdi
	movl	%r13d, %esi
	movq	%r12, %rdx
	callq	_wined3d_texture_load_location
	movq	_WINED3D_LOCATION_RB_RESOLVED@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movq	%r12, %rsi
	movl	%r14d, %ecx
LBB0_9:
	callq	_read_from_framebuffer
	movq	_TRUE@GOTPCREL(%rip), %rax
	jmp	LBB0_11
LBB0_2:
	movl	%r14d, -44(%rbp)                ## 4-byte Spill
	movl	%r13d, %edx
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	movl	(%r14,%rdx,4), %edi
	movq	_WINED3D_LOCATION_RB_MULTISAMPLE@GOTPCREL(%rip), %rax
	movq	_WINED3D_LOCATION_RB_RESOLVED@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	testl	%edi, %ecx
	je	LBB0_4
## %bb.3:
	movq	_WINED3D_LOCATION_TEXTURE_RGB@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%rbx, %rdi
	movl	%r13d, %esi
	movq	%rdx, %r13
	movq	%r12, %rdx
	callq	_wined3d_texture_load_location
	movl	(%r14,%r13,4), %edi
LBB0_4:
	movq	_WINED3D_LOCATION_TEXTURE_RGB@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_WINED3D_LOCATION_TEXTURE_SRGB@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	%eax, %ecx
	testl	%edi, %ecx
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	je	LBB0_6
## %bb.5:
	xorl	%edx, %edx
	testl	%edi, %eax
	sete	%dl
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_wined3d_texture_bind_and_dirtify
	movq	%r15, %rdi
	movq	%r14, %rsi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	callq	_surface_download_data
	incl	8(%rbx)
	movq	_TRUE@GOTPCREL(%rip), %rax
	jmp	LBB0_11
LBB0_6:
	movq	_WINED3DUSAGE_DEPTHSTENCIL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rbx)
	je	LBB0_7
LBB0_10:
	callq	_wined3d_debug_location
	leaq	L_.str(%rip), %rdi
	movq	%r15, %rsi
	movl	%eax, %edx
	callq	_FIXME
	movq	_FALSE@GOTPCREL(%rip), %rax
LBB0_11:
	movl	(%rax), %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movq	_WINED3D_LOCATION_DRAWABLE@GOTPCREL(%rip), %rax
	testl	%edi, (%rax)
	je	LBB0_10
## %bb.8:
	movl	4(%rbx), %edx
	movq	%r15, %rdi
	movq	%r12, %rsi
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.comm	_WINED3D_LOCATION_TEXTURE_RGB,4,2 ## @WINED3D_LOCATION_TEXTURE_RGB
	.comm	_WINED3D_LOCATION_RB_RESOLVED,4,2 ## @WINED3D_LOCATION_RB_RESOLVED
	.comm	_TRUE,4,2                       ## @TRUE
	.comm	_WINED3D_LOCATION_RB_MULTISAMPLE,4,2 ## @WINED3D_LOCATION_RB_MULTISAMPLE
	.comm	_WINED3D_LOCATION_TEXTURE_SRGB,4,2 ## @WINED3D_LOCATION_TEXTURE_SRGB
	.comm	_WINED3DUSAGE_DEPTHSTENCIL,4,2  ## @WINED3DUSAGE_DEPTHSTENCIL
	.comm	_WINED3D_LOCATION_DRAWABLE,4,2  ## @WINED3D_LOCATION_DRAWABLE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Can't load surface %p with location flags %s into sysmem.\n"

	.comm	_FALSE,4,2                      ## @FALSE
	.no_dead_strip	_surface_load_sysmem
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function surface_load_sysmem
_surface_load_sysmem:                   ; @surface_load_sysmem
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x2
	mov	x21, x1
	mov	x20, x0
	bl	_surface_get_sub_resource_idx
	mov	x24, x0
	ldr	x23, [x21]
	ldr	x22, [x20]
	ldr	x26, [x22, #16]
	mov	x0, x22
	mov	x1, x24
	mov	x2, x21
	mov	x3, x19
	bl	_wined3d_texture_prepare_location
Lloh0:
	adrp	x25, _WINED3D_LOCATION_TEXTURE_RGB@GOTPAGE
Lloh1:
	ldr	x25, [x25, _WINED3D_LOCATION_TEXTURE_RGB@GOTPAGEOFF]
	ldr	w1, [x25]
	mov	x0, x22
	bl	_is_multisample_location
	cbz	x0, LBB0_3
; %bb.1:
Lloh2:
	adrp	x23, _WINED3D_LOCATION_RB_RESOLVED@GOTPAGE
Lloh3:
	ldr	x23, [x23, _WINED3D_LOCATION_RB_RESOLVED@GOTPAGEOFF]
	ldr	w3, [x23]
	mov	x0, x22
	mov	x1, x24
	mov	x2, x21
	bl	_wined3d_texture_load_location
	ldr	w2, [x23]
LBB0_2:
	mov	x0, x20
	mov	x1, x21
	mov	x3, x19
	bl	_read_from_framebuffer
	b	LBB0_7
LBB0_3:
	ldr	w0, [x26, w24, uxtw #2]
Lloh4:
	adrp	x8, _WINED3D_LOCATION_RB_MULTISAMPLE@GOTPAGE
Lloh5:
	ldr	x8, [x8, _WINED3D_LOCATION_RB_MULTISAMPLE@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
Lloh7:
	adrp	x9, _WINED3D_LOCATION_RB_RESOLVED@GOTPAGE
Lloh8:
	ldr	x9, [x9, _WINED3D_LOCATION_RB_RESOLVED@GOTPAGEOFF]
Lloh9:
	ldr	w9, [x9]
	orr	w8, w9, w8
	tst	w8, w0
	b.eq	LBB0_5
; %bb.4:
	mov	w27, w24
	ldr	w3, [x25]
	mov	x0, x22
	mov	x1, x24
	mov	x2, x21
	bl	_wined3d_texture_load_location
	ldr	w0, [x26, x27, lsl #2]
LBB0_5:
	ldr	w8, [x25]
Lloh10:
	adrp	x9, _WINED3D_LOCATION_TEXTURE_SRGB@GOTPAGE
Lloh11:
	ldr	x9, [x9, _WINED3D_LOCATION_TEXTURE_SRGB@GOTPAGEOFF]
Lloh12:
	ldr	w9, [x9]
	orr	w9, w9, w8
	tst	w9, w0
	b.eq	LBB0_9
; %bb.6:
	tst	w8, w0
	cset	w2, eq
	mov	x0, x22
	mov	x1, x21
	bl	_wined3d_texture_bind_and_dirtify
	mov	x0, x20
	mov	x1, x23
	mov	x2, x19
	bl	_surface_download_data
	ldr	w8, [x22, #8]
	add	w8, w8, #1
	str	w8, [x22, #8]
LBB0_7:
Lloh13:
	adrp	x8, _TRUE@GOTPAGE
Lloh14:
	ldr	x8, [x8, _TRUE@GOTPAGEOFF]
LBB0_8:
	ldr	w0, [x8]
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_9:
	ldr	w8, [x22]
Lloh15:
	adrp	x9, _WINED3DUSAGE_DEPTHSTENCIL@GOTPAGE
Lloh16:
	ldr	x9, [x9, _WINED3DUSAGE_DEPTHSTENCIL@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_11
LBB0_10:
	bl	_wined3d_debug_location
	mov	x2, x0
Lloh18:
	adrp	x0, l_.str@PAGE
Lloh19:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x20
	bl	_FIXME
Lloh20:
	adrp	x8, _FALSE@GOTPAGE
Lloh21:
	ldr	x8, [x8, _FALSE@GOTPAGEOFF]
	b	LBB0_8
LBB0_11:
Lloh22:
	adrp	x8, _WINED3D_LOCATION_DRAWABLE@GOTPAGE
Lloh23:
	ldr	x8, [x8, _WINED3D_LOCATION_DRAWABLE@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	tst	w8, w0
	b.eq	LBB0_10
; %bb.12:
	ldr	w2, [x22, #4]
	b	LBB0_2
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_WINED3D_LOCATION_TEXTURE_RGB,4,2 ; @WINED3D_LOCATION_TEXTURE_RGB
	.comm	_WINED3D_LOCATION_RB_RESOLVED,4,2 ; @WINED3D_LOCATION_RB_RESOLVED
	.comm	_TRUE,4,2                       ; @TRUE
	.comm	_WINED3D_LOCATION_RB_MULTISAMPLE,4,2 ; @WINED3D_LOCATION_RB_MULTISAMPLE
	.comm	_WINED3D_LOCATION_TEXTURE_SRGB,4,2 ; @WINED3D_LOCATION_TEXTURE_SRGB
	.comm	_WINED3DUSAGE_DEPTHSTENCIL,4,2  ; @WINED3DUSAGE_DEPTHSTENCIL
	.comm	_WINED3D_LOCATION_DRAWABLE,4,2  ; @WINED3D_LOCATION_DRAWABLE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Can't load surface %p with location flags %s into sysmem.\n"

	.comm	_FALSE,4,2                      ; @FALSE
	.no_dead_strip	_surface_load_sysmem
.subsections_via_symbols
