	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_etnaviv_gem_mapping_get        ## -- Begin function etnaviv_gem_mapping_get
	.p2align	4, 0x90
_etnaviv_gem_mapping_get:               ## @etnaviv_gem_mapping_get
	.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	%edx, %r13d
	movq	%rsi, %r12
	movq	%rdi, %r14
	callq	_to_etnaviv_bo
	movq	%rax, %r15
	movq	%rax, %rdi
	callq	_mutex_lock
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_etnaviv_gem_get_vram_mapping
	testq	%rax, %rax
	je	LBB0_4
## %bb.1:
	movq	%rax, %rbx
	movl	(%rax), %eax
	testl	%eax, %eax
	je	LBB0_2
## %bb.19:
	incl	%eax
	movl	%eax, (%rbx)
LBB0_15:
	movq	%r15, %rdi
	callq	_mutex_unlock
	jmp	LBB0_18
LBB0_2:
	movl	%r13d, -44(%rbp)                ## 4-byte Spill
	leaq	8(%r12), %r13
	movq	%r13, %rdi
	callq	_mutex_lock
	cmpq	%r12, 8(%rbx)
	je	LBB0_14
## %bb.3:
	movq	%r13, %rdi
	callq	_mutex_unlock
	movl	-44(%rbp), %r13d                ## 4-byte Reload
LBB0_4:
	movq	%r15, %rdi
	callq	_etnaviv_gem_get_pages
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_6
## %bb.5:
	movq	%rbx, %rdi
	callq	_PTR_ERR
	movl	%eax, %r13d
	xorl	%ebx, %ebx
	jmp	LBB0_17
LBB0_6:
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_etnaviv_gem_get_vram_mapping
	testq	%rax, %rax
	je	LBB0_7
## %bb.10:
	movq	%rax, %rbx
	movq	%rax, %rdi
	addq	$4, %rdi
	callq	_list_del
	jmp	LBB0_11
LBB0_14:
	incl	(%rbx)
	movq	%r13, %rdi
	callq	_mutex_unlock
	jmp	LBB0_15
LBB0_7:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$32, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_8
## %bb.9:
	movq	%rax, %rbx
	movq	%rax, %rdi
	addq	$24, %rdi
	callq	_INIT_LIST_HEAD
	movq	%r15, 16(%rbx)
LBB0_11:
	movq	%r12, %rdi
	callq	_etnaviv_iommu_context_get
	movq	%r12, 8(%rbx)
	movl	$1, (%rbx)
	movq	(%r12), %rax
	movl	(%rax), %edx
	movq	%r12, %rdi
	movq	%r15, %rsi
	movq	%rbx, %rcx
	movl	%r13d, %r8d
	callq	_etnaviv_iommu_map_gem
	movl	%eax, %r13d
	testl	%eax, %eax
	js	LBB0_12
## %bb.16:
	leaq	4(%rbx), %rdi
	movq	%r15, %rsi
	addq	$4, %rsi
	callq	_list_add_tail
	jmp	LBB0_17
LBB0_12:
	movq	%r12, %rdi
	callq	_etnaviv_iommu_context_put
	movq	%rbx, %rdi
	callq	_kfree
	movq	%r15, %rdi
	callq	_mutex_unlock
	jmp	LBB0_13
LBB0_8:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
LBB0_17:
	movq	%r15, %rdi
	callq	_mutex_unlock
	testl	%r13d, %r13d
	je	LBB0_18
LBB0_13:
	movl	%r13d, %edi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ERR_PTR                        ## TAILCALL
LBB0_18:
	movq	%r14, %rdi
	callq	_drm_gem_object_get
	movq	%rbx, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_etnaviv_gem_mapping_get        ; -- Begin function etnaviv_gem_mapping_get
	.p2align	2
_etnaviv_gem_mapping_get:               ; @etnaviv_gem_mapping_get
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x23, x2
	mov	x22, x1
	mov	x19, x0
	bl	_to_etnaviv_bo
	mov	x20, x0
	bl	_mutex_lock
	mov	x0, x20
	mov	x1, x22
	bl	_etnaviv_gem_get_vram_mapping
	cbz	x0, LBB0_6
; %bb.1:
	mov	x21, x0
	ldr	w8, [x0]
	cbz	w8, LBB0_4
; %bb.2:
	add	w8, w8, #1
	str	w8, [x21]
LBB0_3:
	mov	x0, x20
	bl	_mutex_unlock
	b	LBB0_19
LBB0_4:
	add	x24, x22, #8
	mov	x0, x24
	bl	_mutex_lock
	ldr	x8, [x21, #8]
	cmp	x8, x22
	b.eq	LBB0_10
; %bb.5:
	mov	x0, x24
	bl	_mutex_unlock
LBB0_6:
	mov	x0, x20
	bl	_etnaviv_gem_get_pages
	mov	x21, x0
	bl	_IS_ERR
	cbz	x0, LBB0_8
; %bb.7:
	mov	x0, x21
	bl	_PTR_ERR
	mov	x23, x0
	mov	x21, #0
	b	LBB0_17
LBB0_8:
	mov	x0, x20
	mov	x1, #0
	bl	_etnaviv_gem_get_vram_mapping
	cbz	x0, LBB0_11
; %bb.9:
	mov	x21, x0
	add	x0, x0, #4
	bl	_list_del
	b	LBB0_13
LBB0_10:
	ldr	w8, [x21]
	add	w8, w8, #1
	str	w8, [x21]
	mov	x0, x24
	bl	_mutex_unlock
	b	LBB0_3
LBB0_11:
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w0, #32
	bl	_kzalloc
	mov	x21, x0
	cbz	x0, LBB0_16
; %bb.12:
	add	x0, x21, #24
	bl	_INIT_LIST_HEAD
	str	x20, [x21, #16]
LBB0_13:
	mov	x0, x22
	bl	_etnaviv_iommu_context_get
	str	x22, [x21, #8]
	mov	w8, #1
	str	w8, [x21]
	ldr	x8, [x22]
	ldr	w2, [x8]
	mov	x0, x22
	mov	x1, x20
	mov	x3, x21
	mov	x4, x23
	bl	_etnaviv_iommu_map_gem
	mov	x23, x0
	tbnz	w0, #31, LBB0_15
; %bb.14:
	add	x0, x21, #4
	add	x1, x20, #4
	bl	_list_add_tail
	b	LBB0_17
LBB0_15:
	mov	x0, x22
	bl	_etnaviv_iommu_context_put
	mov	x0, x21
	bl	_kfree
	mov	x0, x20
	bl	_mutex_unlock
	b	LBB0_18
LBB0_16:
Lloh3:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_17:
	mov	x0, x20
	bl	_mutex_unlock
	cbz	w23, LBB0_19
LBB0_18:
	mov	x0, x23
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	b	_ERR_PTR
LBB0_19:
	mov	x0, x19
	bl	_drm_gem_object_get
	mov	x0, x21
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
.subsections_via_symbols
