	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function texture_resource_sub_resource_unmap
_texture_resource_sub_resource_unmap:   ## @texture_resource_sub_resource_unmap
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %ebx
	movq	%rdi, %r12
	movq	8(%rdi), %r13
	leaq	L_.str(%rip), %rdi
	movq	%r12, %rsi
	movl	%ebx, %edx
	callq	_TRACE
	movq	%r12, %rdi
	callq	_texture_from_resource
	movq	%rax, %r14
	movq	%rax, %rdi
	movl	%ebx, %esi
	callq	_wined3d_texture_get_sub_resource
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r15
	cmpl	$0, 4(%rax)
	je	LBB0_3
## %bb.6:
	cmpq	$0, (%r13)
	je	LBB0_7
## %bb.8:
	movq	%r13, %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_context_acquire
	movq	%rax, %r13
	jmp	LBB0_9
LBB0_1:
	movq	_E_INVALIDARG@GOTPCREL(%rip), %rbx
	jmp	LBB0_18
LBB0_3:
	leaq	L_.str.1(%rip), %rdi
	callq	_WARN
	movq	_WINED3D_TEXTURE_DC_IN_USE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r14)
	jne	LBB0_4
## %bb.5:
	movq	_WINEDDERR_NOTLOCKED@GOTPCREL(%rip), %rbx
	jmp	LBB0_18
LBB0_7:
	xorl	%r13d, %r13d
LBB0_9:
	movl	24(%r14), %ecx
	leaq	-48(%rbp), %rdx
	movq	%r14, %rdi
	movl	%ebx, %esi
	movq	%rdx, %rbx
	callq	_wined3d_texture_get_memory
	movq	_GL_PIXEL_UNPACK_BUFFER@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r13, %rdi
	movq	%rbx, %rsi
	callq	_context_unmap_bo_address
	testq	%r13, %r13
	je	LBB0_11
## %bb.10:
	movq	%r13, %rdi
	callq	_context_release
LBB0_11:
	movq	16(%r14), %rdi
	testq	%rdi, %rdi
	je	LBB0_15
## %bb.12:
	cmpq	%r14, 8(%rdi)
	jne	LBB0_15
## %bb.13:
	movq	_WINED3D_LOCATION_DRAWABLE@GOTPCREL(%rip), %rax
	movq	_WINED3D_LOCATION_TEXTURE_RGB@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	testl	%ecx, (%r15)
	jne	LBB0_15
## %bb.14:
	movq	(%rdi), %rax
	callq	*(%rax)
LBB0_15:
	decl	4(%r15)
	decl	(%r12)
	movq	_WINED3D_OK@GOTPCREL(%rip), %rbx
	jne	LBB0_18
## %bb.16:
	cmpq	$0, 8(%r14)
	je	LBB0_18
## %bb.17:
	movq	%r14, %rdi
	callq	_wined3d_texture_update_map_binding
	jmp	LBB0_18
LBB0_4:
	movq	_WINED3D_OK@GOTPCREL(%rip), %rbx
LBB0_18:
	movl	(%rbx), %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"resource %p, sub_resource_idx %u.\n"

	.comm	_E_INVALIDARG,4,2               ## @E_INVALIDARG
L_.str.1:                               ## @.str.1
	.asciz	"Trying to unmap unmapped sub-resource.\n"

	.comm	_WINED3D_TEXTURE_DC_IN_USE,4,2  ## @WINED3D_TEXTURE_DC_IN_USE
	.comm	_WINED3D_OK,4,2                 ## @WINED3D_OK
	.comm	_WINEDDERR_NOTLOCKED,4,2        ## @WINEDDERR_NOTLOCKED
	.comm	_GL_PIXEL_UNPACK_BUFFER,4,2     ## @GL_PIXEL_UNPACK_BUFFER
	.comm	_WINED3D_LOCATION_DRAWABLE,4,2  ## @WINED3D_LOCATION_DRAWABLE
	.comm	_WINED3D_LOCATION_TEXTURE_RGB,4,2 ## @WINED3D_LOCATION_TEXTURE_RGB
	.no_dead_strip	_texture_resource_sub_resource_unmap
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function texture_resource_sub_resource_unmap
_texture_resource_sub_resource_unmap:   ; @texture_resource_sub_resource_unmap
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x22, x1
	mov	x20, x0
	ldr	x23, [x0, #8]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x20
	mov	x2, x22
	bl	_TRACE
	mov	x0, x20
	bl	_texture_from_resource
	mov	x19, x0
	mov	x1, x22
	bl	_wined3d_texture_get_sub_resource
	cbz	x0, LBB0_4
; %bb.1:
	mov	x21, x0
	ldr	w8, [x0, #4]
	cbz	w8, LBB0_5
; %bb.2:
	ldr	x8, [x23]
	cbz	x8, LBB0_6
; %bb.3:
	mov	x0, x23
	mov	x1, #0
	mov	w2, #0
	bl	_context_acquire
	mov	x23, x0
	b	LBB0_7
LBB0_4:
Lloh2:
	adrp	x8, _E_INVALIDARG@GOTPAGE
Lloh3:
	ldr	x8, [x8, _E_INVALIDARG@GOTPAGEOFF]
	b	LBB0_17
LBB0_5:
Lloh4:
	adrp	x0, l_.str.1@PAGE
Lloh5:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_WARN
	ldr	w8, [x19]
Lloh6:
	adrp	x9, _WINED3D_TEXTURE_DC_IN_USE@GOTPAGE
Lloh7:
	ldr	x9, [x9, _WINED3D_TEXTURE_DC_IN_USE@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
Lloh9:
	adrp	x10, _WINED3D_OK@GOTPAGE
Lloh10:
	ldr	x10, [x10, _WINED3D_OK@GOTPAGEOFF]
Lloh11:
	adrp	x11, _WINEDDERR_NOTLOCKED@GOTPAGE
Lloh12:
	ldr	x11, [x11, _WINEDDERR_NOTLOCKED@GOTPAGEOFF]
	tst	w9, w8
	csel	x8, x11, x10, eq
	b	LBB0_17
LBB0_6:
	mov	x23, #0
LBB0_7:
	ldr	w3, [x19, #24]
	add	x2, sp, #8
	mov	x0, x19
	mov	x1, x22
	bl	_wined3d_texture_get_memory
Lloh13:
	adrp	x8, _GL_PIXEL_UNPACK_BUFFER@GOTPAGE
Lloh14:
	ldr	x8, [x8, _GL_PIXEL_UNPACK_BUFFER@GOTPAGEOFF]
Lloh15:
	ldr	w2, [x8]
	add	x1, sp, #8
	mov	x0, x23
	bl	_context_unmap_bo_address
	cbz	x23, LBB0_9
; %bb.8:
	mov	x0, x23
	bl	_context_release
LBB0_9:
	ldr	x0, [x19, #16]
	cbz	x0, LBB0_13
; %bb.10:
	ldr	x8, [x0, #8]
	cmp	x8, x19
	b.ne	LBB0_13
; %bb.11:
	ldr	w8, [x21]
Lloh16:
	adrp	x9, _WINED3D_LOCATION_DRAWABLE@GOTPAGE
Lloh17:
	ldr	x9, [x9, _WINED3D_LOCATION_DRAWABLE@GOTPAGEOFF]
Lloh18:
	ldr	w9, [x9]
Lloh19:
	adrp	x10, _WINED3D_LOCATION_TEXTURE_RGB@GOTPAGE
Lloh20:
	ldr	x10, [x10, _WINED3D_LOCATION_TEXTURE_RGB@GOTPAGEOFF]
Lloh21:
	ldr	w10, [x10]
	orr	w9, w10, w9
	tst	w9, w8
	b.ne	LBB0_13
; %bb.12:
	ldr	x8, [x0]
	ldr	x8, [x8]
	blr	x8
LBB0_13:
	ldr	w8, [x21, #4]
	sub	w8, w8, #1
	str	w8, [x21, #4]
	ldr	w8, [x20]
	subs	w8, w8, #1
	str	w8, [x20]
	b.ne	LBB0_16
; %bb.14:
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_16
; %bb.15:
	mov	x0, x19
	bl	_wined3d_texture_update_map_binding
LBB0_16:
Lloh22:
	adrp	x8, _WINED3D_OK@GOTPAGE
Lloh23:
	ldr	x8, [x8, _WINED3D_OK@GOTPAGEOFF]
LBB0_17:
	ldr	w0, [x8]
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"resource %p, sub_resource_idx %u.\n"

	.comm	_E_INVALIDARG,4,2               ; @E_INVALIDARG
l_.str.1:                               ; @.str.1
	.asciz	"Trying to unmap unmapped sub-resource.\n"

	.comm	_WINED3D_TEXTURE_DC_IN_USE,4,2  ; @WINED3D_TEXTURE_DC_IN_USE
	.comm	_WINED3D_OK,4,2                 ; @WINED3D_OK
	.comm	_WINEDDERR_NOTLOCKED,4,2        ; @WINEDDERR_NOTLOCKED
	.comm	_GL_PIXEL_UNPACK_BUFFER,4,2     ; @GL_PIXEL_UNPACK_BUFFER
	.comm	_WINED3D_LOCATION_DRAWABLE,4,2  ; @WINED3D_LOCATION_DRAWABLE
	.comm	_WINED3D_LOCATION_TEXTURE_RGB,4,2 ; @WINED3D_LOCATION_TEXTURE_RGB
	.no_dead_strip	_texture_resource_sub_resource_unmap
.subsections_via_symbols
