	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function panfrost_gem_open
_panfrost_gem_open:                     ## @panfrost_gem_open
	.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	%rsi, %rbx
	movq	(%rdi), %r13
	callq	_to_panfrost_bo
	movq	%rax, %r14
	movq	16(%rax), %r12
	testq	%r12, %r12
	je	LBB0_2
## %bb.1:
	movq	_PANFROST_BO_NOEXEC@GOTPCREL(%rip), %rax
	movq	(%rax), %r12
LBB0_2:
	movq	(%rbx), %r15
	je	LBB0_3
## %bb.4:
	movq	_SZ_2M@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	movq	%rax, %rdx
	shrq	%cl, %rdx
	xorl	%ebx, %ebx
	cmpq	%rax, %r13
	cmovaeq	%rdx, %rbx
	jmp	LBB0_5
LBB0_3:
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	movq	%r13, %rbx
	shrq	%cl, %rbx
LBB0_5:
	leaq	8(%r15), %rax
	movq	%rax, 8(%r14)
	movq	%r15, %rdi
	callq	_spin_lock
	leaq	4(%r15), %rdi
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shrq	%cl, %r13
	movq	%r14, %rsi
	movq	%r13, %rdx
	movq	%rbx, %rcx
	movq	%r12, %r8
	xorl	%r9d, %r9d
	callq	_drm_mm_insert_node_generic
	movl	%eax, %ebx
	movq	%r15, %rdi
	callq	_spin_unlock
	testl	%ebx, %ebx
	jne	LBB0_10
## %bb.6:
	cmpl	$0, 4(%r14)
	je	LBB0_8
## %bb.7:
	xorl	%ebx, %ebx
	jmp	LBB0_10
LBB0_8:
	movq	%r14, %rdi
	callq	_panfrost_mmu_map
	movl	$0, %ebx
	testl	%eax, %eax
	je	LBB0_10
## %bb.9:
	movl	%eax, %r12d
	movq	%r15, %rdi
	callq	_spin_lock
	movq	%r14, %rdi
	callq	_drm_mm_remove_node
	movq	%r15, %rdi
	callq	_spin_unlock
	movl	%r12d, %ebx
LBB0_10:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PANFROST_BO_NOEXEC,8,3         ## @PANFROST_BO_NOEXEC
	.comm	_PAGE_SHIFT,8,3                 ## @PAGE_SHIFT
	.comm	_SZ_2M,8,3                      ## @SZ_2M
	.no_dead_strip	_panfrost_gem_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function panfrost_gem_open
_panfrost_gem_open:                     ; @panfrost_gem_open
	.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	x20, x1
	ldr	x23, [x0]
	bl	_to_panfrost_bo
	mov	x19, x0
	ldr	x8, [x0, #16]
Lloh0:
	adrp	x9, _PANFROST_BO_NOEXEC@GOTPAGE
Lloh1:
	ldr	x9, [x9, _PANFROST_BO_NOEXEC@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, #0
	csel	x21, xzr, x9, eq
	ldr	x20, [x20]
Lloh3:
	adrp	x24, _PAGE_SHIFT@GOTPAGE
Lloh4:
	ldr	x24, [x24, _PAGE_SHIFT@GOTPAGEOFF]
	cbz	x8, LBB0_2
; %bb.1:
Lloh5:
	adrp	x8, _SZ_2M@GOTPAGE
Lloh6:
	ldr	x8, [x8, _SZ_2M@GOTPAGEOFF]
Lloh7:
	ldr	x8, [x8]
	ldr	x9, [x24]
	lsr	x9, x8, x9
	cmp	x23, x8
	csel	x22, xzr, x9, lo
	b	LBB0_3
LBB0_2:
	ldr	x8, [x24]
	lsr	x22, x23, x8
LBB0_3:
	add	x8, x20, #8
	str	x8, [x19, #8]
	mov	x0, x20
	bl	_spin_lock
	add	x0, x20, #4
	ldr	x8, [x24]
	lsr	x2, x23, x8
	mov	x1, x19
	mov	x3, x22
	mov	x4, x21
	mov	w5, #0
	bl	_drm_mm_insert_node_generic
	mov	x21, x0
	mov	x0, x20
	bl	_spin_unlock
	cbnz	w21, LBB0_8
; %bb.4:
	ldr	w8, [x19, #4]
	cbz	w8, LBB0_6
; %bb.5:
	mov	w21, #0
	b	LBB0_8
LBB0_6:
	mov	x0, x19
	bl	_panfrost_mmu_map
	mov	x21, x0
	cbz	w0, LBB0_8
; %bb.7:
	mov	x0, x20
	bl	_spin_lock
	mov	x0, x19
	bl	_drm_mm_remove_node
	mov	x0, x20
	bl	_spin_unlock
LBB0_8:
	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 AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_PANFROST_BO_NOEXEC,8,3         ; @PANFROST_BO_NOEXEC
	.comm	_PAGE_SHIFT,8,3                 ; @PAGE_SHIFT
	.comm	_SZ_2M,8,3                      ; @SZ_2M
	.no_dead_strip	_panfrost_gem_open
.subsections_via_symbols
