	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function v3d_bo_create_finish
_v3d_bo_create_finish:                  ## @v3d_bo_create_finish
	.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
	movq	%rdi, %r12
	movl	4(%rdi), %edi
	callq	_to_v3d_dev
	movq	%rax, %r14
	movq	%r12, %rdi
	callq	_to_v3d_bo
	movq	%rax, %r15
	leaq	4(%rax), %rdi
	callq	_drm_gem_shmem_get_pages_sgt
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_1
## %bb.4:
	movq	%rbx, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_PTR_ERR                        ## TAILCALL
LBB0_1:
	leaq	12(%r14), %rbx
	movq	%rbx, %rdi
	callq	_spin_lock
	leaq	16(%r14), %rdi
	movl	(%r12), %edx
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	sarl	%cl, %edx
	movq	_GMP_GRANULARITY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	sarl	%cl, %eax
	movq	%r15, %rsi
	movl	%eax, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	_drm_mm_insert_node_generic
	movl	%eax, %r13d
	movq	%rbx, %rdi
	callq	_spin_unlock
	testl	%r13d, %r13d
	jne	LBB0_3
## %bb.2:
	movq	%r14, %rdi
	callq	_mutex_lock
	incl	8(%r14)
	movl	(%r12), %eax
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	sarl	%cl, %eax
	addl	%eax, 4(%r14)
	movq	%r14, %rdi
	callq	_mutex_unlock
	movq	%r15, %rdi
	callq	_v3d_mmu_insert_ptes
	xorl	%r13d, %r13d
LBB0_3:
	movl	%r13d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SHIFT,4,2                 ## @PAGE_SHIFT
	.comm	_GMP_GRANULARITY,4,2            ## @GMP_GRANULARITY
	.no_dead_strip	_v3d_bo_create_finish
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function v3d_bo_create_finish
_v3d_bo_create_finish:                  ; @v3d_bo_create_finish
	.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	x21, x0
	ldr	w0, [x0, #4]
	bl	_to_v3d_dev
	mov	x19, x0
	mov	x0, x21
	bl	_to_v3d_bo
	mov	x20, x0
	add	x0, x0, #4
	bl	_drm_gem_shmem_get_pages_sgt
	mov	x22, x0
	bl	_IS_ERR
	cbz	x0, LBB0_2
; %bb.1:
	mov	x0, x22
	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	_PTR_ERR
LBB0_2:
	add	x23, x19, #12
	mov	x0, x23
	bl	_spin_lock
	add	x0, x19, #16
	ldr	w8, [x21]
Lloh0:
	adrp	x24, _PAGE_SHIFT@GOTPAGE
Lloh1:
	ldr	x24, [x24, _PAGE_SHIFT@GOTPAGEOFF]
	ldr	w9, [x24]
	asr	w2, w8, w9
Lloh2:
	adrp	x8, _GMP_GRANULARITY@GOTPAGE
Lloh3:
	ldr	x8, [x8, _GMP_GRANULARITY@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	asr	w3, w8, w9
	mov	x1, x20
	mov	w4, #0
	mov	w5, #0
	bl	_drm_mm_insert_node_generic
	mov	x22, x0
	mov	x0, x23
	bl	_spin_unlock
	cbnz	w22, LBB0_4
; %bb.3:
	mov	x0, x19
	bl	_mutex_lock
	ldr	w8, [x21]
	ldr	w9, [x24]
	asr	w8, w8, w9
	ldur	d0, [x19, #4]
	movi.2s	v1, #1
	mov.s	v1[0], w8
	add.2s	v0, v0, v1
	stur	d0, [x19, #4]
	mov	x0, x19
	bl	_mutex_unlock
	mov	x0, x20
	bl	_v3d_mmu_insert_ptes
LBB0_4:
	mov	x0, x22
	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	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SHIFT,4,2                 ; @PAGE_SHIFT
	.comm	_GMP_GRANULARITY,4,2            ; @GMP_GRANULARITY
	.no_dead_strip	_v3d_bo_create_finish
.subsections_via_symbols
