	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function lanai_buf_allocate
_lanai_buf_allocate:                    ## @lanai_buf_allocate
	.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	%rcx, %r15
	movq	%rdx, %r12
	movq	%rdi, %r14
	cmpq	$131072, %rsi                   ## imm = 0x20000
	movl	$131072, %eax                   ## imm = 0x20000
	cmovbq	%rsi, %rax
	movq	_LANAI_PAGE_SIZE@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	%ecx, %edx
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movl	%edx, %ebx
	movslq	%edx, %rsi
	leal	(%rsi,%rsi), %edx
	cmpq	%rsi, %rax
	ja	LBB0_1
## %bb.2:
	cmpq	%r12, %rcx
	cmovaq	%rcx, %r12
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movl	%ebx, %esi
	movq	%r14, %rdx
	callq	_pci_alloc_consistent
	movq	%rax, 8(%r14)
	testq	%rax, %rax
	jne	LBB0_6
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	%ebx, %eax
	shrl	$31, %eax
	addl	%ebx, %eax
	sarl	%eax
	movslq	%eax, %rcx
	movl	%eax, %ebx
	cmpq	%rcx, %r12
	jbe	LBB0_3
## %bb.5:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movslq	(%r14), %rdx
	xorl	%edi, %edi
	testb	%dl, %dl
	sete	%dil
	leaq	L_.str(%rip), %rsi
	callq	_APRINTK
	movq	8(%r14), %rdi
	movq	%rdi, 24(%r14)
	movslq	%ebx, %rax
	addq	%rdi, %rax
	movq	%rax, 16(%r14)
	xorl	%esi, %esi
	movl	%ebx, %edx
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_memset                         ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_LANAI_PAGE_SIZE,8,3            ## @LANAI_PAGE_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"bad dmaaddr: 0x%lx\n"

	.no_dead_strip	_lanai_buf_allocate
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function lanai_buf_allocate
_lanai_buf_allocate:                    ; @lanai_buf_allocate
	.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, x3
	mov	x19, x0
	mov	w8, #131072
	cmp	x1, #32, lsl #12                ; =131072
	csel	x9, x1, x8, lo
Lloh0:
	adrp	x8, _LANAI_PAGE_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _LANAI_PAGE_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	mov	x10, x8
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	mov	x20, x10
	lsl	w10, w10, #1
	cmp	x9, w20, sxtw
	b.hi	LBB0_1
; %bb.2:
	cmp	x8, x2
	csel	x22, x8, x2, hi
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x21
	mov	x1, x20
	mov	x2, x19
	bl	_pci_alloc_consistent
	str	x0, [x19, #8]
	cbnz	x0, LBB0_6
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	cmp	w20, #0
	cinc	w8, w20, lt
	asr	w20, w8, #1
	cmp	x22, w20, sxtw
	b.ls	LBB0_3
; %bb.5:
	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
LBB0_6:
	ldrsw	x2, [x19]
	tst	w2, #0xff
	cset	w0, eq
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	bl	_APRINTK
	ldr	x0, [x19, #8]
	add	x8, x0, w20, sxtw
	stp	x8, x0, [x19, #16]
	mov	w1, #0
	mov	x2, x20
	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
	b	_memset
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.comm	_LANAI_PAGE_SIZE,8,3            ; @LANAI_PAGE_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"bad dmaaddr: 0x%lx\n"

	.no_dead_strip	_lanai_buf_allocate
.subsections_via_symbols
