	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vc4_plane_allocate_lbm
_vc4_plane_allocate_lbm:                ## @vc4_plane_allocate_lbm
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	(%rdi), %rax
	movl	(%rax), %edi
	callq	_to_vc4_dev
	movq	%rax, %r14
	movq	%rbx, %rdi
	callq	_to_vc4_plane_state
	movq	%rax, %r15
	movq	%rbx, %rdi
	callq	_vc4_lbm_size
	xorl	%ebx, %ebx
	testq	%rax, %rax
	je	LBB0_7
## %bb.1:
	movq	%rax, %r12
	xorl	%edi, %edi
	cmpq	$0, (%r15)
	sete	%dil
	callq	_WARN_ON
	testq	%rax, %rax
	je	LBB0_3
## %bb.2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_7
LBB0_3:
	movq	%r15, %rbx
	addq	$8, %rbx
	cmpl	$0, 20(%r15)
	je	LBB0_4
## %bb.5:
	xorl	%edi, %edi
	cmpq	(%rbx), %r12
	setne	%dil
	callq	_WARN_ON_ONCE
	jmp	LBB0_6
LBB0_4:
	movq	(%r14), %rdi
	callq	_spin_lock_irqsave
	movq	(%r14), %rdi
	addq	$4, %rdi
	movq	%rbx, %rsi
	movq	%r12, %rdx
	movl	$32, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	_drm_mm_insert_node_generic
	movl	%eax, %ebx
	movq	(%r14), %rdi
	callq	_spin_unlock_irqrestore
	testl	%ebx, %ebx
	jne	LBB0_7
LBB0_6:
	movl	16(%r15), %eax
	movq	24(%r15), %rcx
	movq	(%r15), %rdx
	movl	%eax, (%rcx,%rdx,4)
	xorl	%ebx, %ebx
LBB0_7:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_vc4_plane_allocate_lbm
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vc4_plane_allocate_lbm
_vc4_plane_allocate_lbm:                ; @vc4_plane_allocate_lbm
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x21, x0
	ldr	x8, [x0]
	ldr	w0, [x8]
	bl	_to_vc4_dev
	mov	x20, x0
	mov	x0, x21
	bl	_to_vc4_plane_state
	mov	x19, x0
	mov	x0, x21
	bl	_vc4_lbm_size
	mov	x21, x0
	cbz	x0, LBB0_7
; %bb.1:
	ldr	x8, [x19]
	cmp	x8, #0
	cset	w0, eq
	bl	_WARN_ON
	cbz	x0, LBB0_3
; %bb.2:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_7
LBB0_3:
	add	x22, x19, #8
	ldr	w8, [x19, #20]
	cbz	w8, LBB0_5
; %bb.4:
	ldr	x8, [x22]
	cmp	x21, x8
	cset	w0, ne
	bl	_WARN_ON_ONCE
	b	LBB0_6
LBB0_5:
	ldr	x0, [x20]
	bl	_spin_lock_irqsave
	ldr	x8, [x20]
	add	x0, x8, #4
	mov	x1, x22
	mov	x2, x21
	mov	w3, #32
	mov	w4, #0
	mov	w5, #0
	bl	_drm_mm_insert_node_generic
	mov	x21, x0
	ldr	x0, [x20]
	bl	_spin_unlock_irqrestore
	cbnz	w21, LBB0_7
LBB0_6:
	mov	w21, #0
	ldr	w8, [x19, #16]
	ldr	x9, [x19, #24]
	ldr	x10, [x19]
	str	w8, [x9, x10, lsl #2]
LBB0_7:
	mov	x0, x21
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_vc4_plane_allocate_lbm
.subsections_via_symbols
