	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function allocate_bz_and_pages
_allocate_bz_and_pages:                 ## @allocate_bz_and_pages
	.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	_BUS_DMA_COULD_BOUNCE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	xorl	%eax, %eax
	testl	%ecx, (%rdi)
	je	LBB0_11
## %bb.1:
	movq	%rsi, %r14
	movq	%rdi, %rbx
	movq	8(%rdi), %r15
	testq	%r15, %r15
	je	LBB0_2
LBB0_4:
	movq	%r14, %rdi
	callq	_STAILQ_INIT
	movq	_MAX_BPAGES@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movq	_BUS_DMA_MIN_ALLOC_COMP@GOTPCREL(%rip), %r12
	movl	(%r12), %eax
	testl	%eax, (%rbx)
	je	LBB0_7
## %bb.5:
	cmpq	$0, (%r15)
	jle	LBB0_10
## %bb.6:
	cmpl	%r14d, 8(%r15)
	jge	LBB0_10
LBB0_7:
	movl	4(%rbx), %edi
	callq	_atop
	movl	%eax, %edi
	movl	$1, %esi
	callq	_MAX
	subl	8(%r15), %r14d
	movl	%r14d, %edi
	movl	%eax, %esi
	callq	_MIN
	movl	%eax, %edi
	movl	$1, %esi
	callq	_MAX
	movl	%eax, %r14d
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_alloc_bounce_pages
	cmpl	%r14d, %eax
	jge	LBB0_8
## %bb.12:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	jmp	LBB0_11
LBB0_2:
	movq	%rbx, %rdi
	callq	_alloc_bounce_zone
	testl	%eax, %eax
	jne	LBB0_11
## %bb.3:
	movq	8(%rbx), %r15
	jmp	LBB0_4
LBB0_8:
	movl	(%rbx), %eax
	movl	(%r12), %ecx
	testl	%eax, %ecx
	jne	LBB0_10
## %bb.9:
	orl	%eax, %ecx
	movl	%ecx, (%rbx)
LBB0_10:
	incq	(%r15)
	xorl	%eax, %eax
LBB0_11:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BUS_DMA_COULD_BOUNCE,4,2       ## @BUS_DMA_COULD_BOUNCE
	.comm	_MAX_BPAGES,4,2                 ## @MAX_BPAGES
	.comm	_BUS_DMA_MIN_ALLOC_COMP,4,2     ## @BUS_DMA_MIN_ALLOC_COMP
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_allocate_bz_and_pages
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function allocate_bz_and_pages
_allocate_bz_and_pages:                 ; @allocate_bz_and_pages
	.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
	ldr	w8, [x0]
Lloh0:
	adrp	x9, _BUS_DMA_COULD_BOUNCE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _BUS_DMA_COULD_BOUNCE@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_7
; %bb.1:
	mov	x20, x1
	mov	x19, x0
	ldr	x21, [x0, #8]
	cbz	x21, LBB0_8
LBB0_2:
	mov	x0, x20
	bl	_STAILQ_INIT
Lloh3:
	adrp	x8, _MAX_BPAGES@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MAX_BPAGES@GOTPAGEOFF]
Lloh5:
	ldr	w20, [x8]
	ldr	w8, [x19]
Lloh6:
	adrp	x22, _BUS_DMA_MIN_ALLOC_COMP@GOTPAGE
Lloh7:
	ldr	x22, [x22, _BUS_DMA_MIN_ALLOC_COMP@GOTPAGEOFF]
	ldr	w9, [x22]
	tst	w9, w8
	b.eq	LBB0_5
; %bb.3:
	ldr	x8, [x21]
	cmp	x8, #1
	b.lt	LBB0_12
; %bb.4:
	ldr	w8, [x21, #8]
	cmp	w8, w20
	b.ge	LBB0_12
LBB0_5:
	ldr	w0, [x19, #4]
	bl	_atop
	mov	w1, #1
	bl	_MAX
	mov	x1, x0
	ldr	w8, [x21, #8]
	sub	w0, w20, w8
	bl	_MIN
	mov	w1, #1
	bl	_MAX
	mov	x20, x0
	mov	x0, x19
	mov	x1, x20
	bl	_alloc_bounce_pages
	cmp	w0, w20
	b.ge	LBB0_10
; %bb.6:
Lloh8:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh10:
	ldr	w0, [x8]
	b	LBB0_13
LBB0_7:
	mov	w0, #0
	b	LBB0_13
LBB0_8:
	mov	x0, x19
	bl	_alloc_bounce_zone
	cbnz	w0, LBB0_13
; %bb.9:
	ldr	x21, [x19, #8]
	b	LBB0_2
LBB0_10:
	ldr	w8, [x19]
	ldr	w9, [x22]
	tst	w9, w8
	b.ne	LBB0_12
; %bb.11:
	orr	w8, w9, w8
	str	w8, [x19]
LBB0_12:
	mov	w0, #0
	ldr	x8, [x21]
	add	x8, x8, #1
	str	x8, [x21]
LBB0_13:
	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
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_BUS_DMA_COULD_BOUNCE,4,2       ; @BUS_DMA_COULD_BOUNCE
	.comm	_MAX_BPAGES,4,2                 ; @MAX_BPAGES
	.comm	_BUS_DMA_MIN_ALLOC_COMP,4,2     ; @BUS_DMA_MIN_ALLOC_COMP
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_allocate_bz_and_pages
.subsections_via_symbols
