	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function add_bounce_page
_add_bounce_page:                       ## @add_bounce_page
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%r9d, -56(%rbp)                 ## 4-byte Spill
	movl	%r8d, %r12d
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	movl	%edx, -48(%rbp)                 ## 4-byte Spill
	movq	%rsi, %r15
	movq	%rdi, %rbx
	xorl	%edi, %edi
	cmpq	$0, 8(%rbx)
	setne	%dil
	leaq	L_.str(%rip), %rsi
	callq	_KASSERT
	testq	%r15, %r15
	setne	%al
	cmpq	_nobounce_dmamap@GOTPCREL(%rip), %r15
	setne	%cl
	andb	%al, %cl
	movzbl	%cl, %edi
	movq	%r15, %rsi
	callq	_KASSERT
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movq	8(%rbx), %r14
	movq	(%r15), %rax
	testq	%rax, %rax
	jne	LBB0_2
## %bb.1:
	leaq	L_.str.2(%rip), %rdi
	callq	_panic
	movq	(%r15), %rax
LBB0_2:
	movl	%r12d, -52(%rbp)                ## 4-byte Spill
	decq	%rax
	movq	%rax, (%r15)
	movq	8(%r15), %rax
	testq	%rax, %rax
	jne	LBB0_4
## %bb.3:
	leaq	L_.str.2(%rip), %rdi
	callq	_panic
	movq	8(%r15), %rax
LBB0_4:
	decq	%rax
	movq	%rax, 8(%r15)
	movq	_bounce_lock@GOTPCREL(%rip), %rdi
	callq	_mtx_lock
	leaq	8(%r14), %r12
	movq	%r12, %rdi
	callq	_STAILQ_FIRST
	movq	%rax, %r13
	testq	%rax, %rax
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	jne	LBB0_6
## %bb.5:
	leaq	L_.str.3(%rip), %rdi
	callq	_panic
LBB0_6:
	movq	_links@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_STAILQ_REMOVE_HEAD
	decl	4(%r14)
	incl	(%r14)
	movq	_bounce_lock@GOTPCREL(%rip), %rdi
	callq	_mtx_unlock
	movq	_BUS_DMA_KEEP_PG_OFFSET@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	testl	%eax, (%rcx)
	movl	-52(%rbp), %r12d                ## 4-byte Reload
	je	LBB0_8
## %bb.7:
	movq	_PAGE_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	andl	%ebx, %ecx
	orl	%ecx, (%r13)
	movl	(%rax), %eax
	andl	%ebx, %eax
	orl	%eax, 4(%r13)
	xorl	%edi, %edi
	testl	%r12d, %r12d
	sete	%dil
	leaq	L_.str.4(%rip), %rsi
	callq	_KASSERT
LBB0_8:
	movl	-48(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, 24(%r13)
	movl	%ebx, %edi
	callq	_PHYS_TO_VM_PAGE
	movq	16(%r13), %rcx
	movq	%rax, (%rcx)
	movq	_PAGE_MASK@GOTPCREL(%rip), %r14
	xorl	%edi, %edi
	movl	(%r14), %eax
	andl	%r12d, %eax
	sete	%dil
	leaq	L_.str.5(%rip), %rsi
	callq	_KASSERT
	movl	%r12d, %edi
	callq	_PHYS_TO_VM_PAGE
	movq	16(%r13), %rcx
	movq	%rax, 8(%rcx)
	andl	(%r14), %ebx
	movl	%ebx, 8(%r13)
	movl	-56(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, 12(%r13)
	addq	$16, %r15
	movq	_links@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movq	%r13, %rsi
	callq	_STAILQ_INSERT_TAIL
	movl	4(%r13), %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"no bounce zone in dma tag"

	.comm	_nobounce_dmamap,24,3           ## @nobounce_dmamap
L_.str.2:                               ## @.str.2
	.asciz	"add_bounce_page: map doesn't need any pages"

	.comm	_bounce_lock,4,2                ## @bounce_lock
L_.str.3:                               ## @.str.3
	.asciz	"add_bounce_page: free page list is empty"

	.comm	_links,4,2                      ## @links
	.comm	_BUS_DMA_KEEP_PG_OFFSET,4,2     ## @BUS_DMA_KEEP_PG_OFFSET
	.comm	_PAGE_MASK,4,2                  ## @PAGE_MASK
L_.str.4:                               ## @.str.4
	.asciz	"Trying to bounce multiple pages with BUS_DMA_KEEP_PG_OFFSET"

L_.str.5:                               ## @.str.5
	.asciz	"Second page is not aligned"

	.no_dead_strip	_add_bounce_page
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function add_bounce_page
lCPI0_0:
	.long	1                               ; 0x1
	.long	4294967295                      ; 0xffffffff
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	2
_add_bounce_page:                       ; @add_bounce_page
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x5
	mov	x22, x4
	mov	x21, x3
	mov	x23, x2
	mov	x20, x1
	mov	x24, x0
	ldr	x8, [x0, #8]
	cmp	x8, #0
	cset	w0, ne
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_KASSERT
	cmp	x20, #0
Lloh2:
	adrp	x8, _nobounce_dmamap@GOTPAGE
Lloh3:
	ldr	x8, [x8, _nobounce_dmamap@GOTPAGEOFF]
	ccmp	x20, x8, #4, ne
	cset	w0, ne
	mov	x1, x20
	bl	_KASSERT
	ldr	x28, [x24, #8]
	ldr	x8, [x20]
	cbnz	x8, LBB0_2
; %bb.1:
Lloh4:
	adrp	x0, l_.str.2@PAGE
Lloh5:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_panic
	ldr	x8, [x20]
LBB0_2:
	sub	x8, x8, #1
	str	x8, [x20]
	ldr	x8, [x20, #8]
	cbnz	x8, LBB0_4
; %bb.3:
Lloh6:
	adrp	x0, l_.str.2@PAGE
Lloh7:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_panic
	ldr	x8, [x20, #8]
LBB0_4:
	sub	x8, x8, #1
	str	x8, [x20, #8]
Lloh8:
	adrp	x0, _bounce_lock@GOTPAGE
Lloh9:
	ldr	x0, [x0, _bounce_lock@GOTPAGEOFF]
	bl	_mtx_lock
	add	x26, x28, #8
	mov	x0, x26
	bl	_STAILQ_FIRST
	mov	x25, x0
	cbnz	x0, LBB0_6
; %bb.5:
Lloh10:
	adrp	x0, l_.str.3@PAGE
Lloh11:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_panic
LBB0_6:
Lloh12:
	adrp	x27, _links@GOTPAGE
Lloh13:
	ldr	x27, [x27, _links@GOTPAGEOFF]
	ldr	w1, [x27]
	mov	x0, x26
	bl	_STAILQ_REMOVE_HEAD
	ldr	d0, [x28]
Lloh14:
	adrp	x8, lCPI0_0@PAGE
Lloh15:
	ldr	d1, [x8, lCPI0_0@PAGEOFF]
	add.2s	v0, v0, v1
	str	d0, [x28]
Lloh16:
	adrp	x0, _bounce_lock@GOTPAGE
Lloh17:
	ldr	x0, [x0, _bounce_lock@GOTPAGEOFF]
	bl	_mtx_unlock
	ldr	w8, [x24]
Lloh18:
	adrp	x9, _BUS_DMA_KEEP_PG_OFFSET@GOTPAGE
Lloh19:
	ldr	x9, [x9, _BUS_DMA_KEEP_PG_OFFSET@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
Lloh21:
	adrp	x24, _PAGE_MASK@GOTPAGE
Lloh22:
	ldr	x24, [x24, _PAGE_MASK@GOTPAGEOFF]
	tst	w9, w8
	b.eq	LBB0_8
; %bb.7:
	ldr	w8, [x24]
	and	w8, w8, w21
	ldp	w9, w10, [x25]
	orr	w8, w9, w8
	str	w8, [x25]
	ldr	w8, [x24]
	and	w8, w8, w21
	orr	w8, w10, w8
	str	w8, [x25, #4]
	cmp	w22, #0
	cset	w0, eq
Lloh23:
	adrp	x1, l_.str.4@PAGE
Lloh24:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_KASSERT
LBB0_8:
	str	w23, [x25, #24]
	mov	x0, x21
	bl	_PHYS_TO_VM_PAGE
	ldr	x8, [x25, #16]
	str	x0, [x8]
	ldr	w8, [x24]
	tst	w8, w22
	cset	w0, eq
Lloh25:
	adrp	x1, l_.str.5@PAGE
Lloh26:
	add	x1, x1, l_.str.5@PAGEOFF
	bl	_KASSERT
	mov	x0, x22
	bl	_PHYS_TO_VM_PAGE
	ldr	x8, [x25, #16]
	str	x0, [x8, #8]
	ldr	w8, [x24]
	and	w8, w8, w21
	stp	w8, w19, [x25, #8]
	add	x0, x20, #16
	ldr	w2, [x27]
	mov	x1, x25
	bl	_STAILQ_INSERT_TAIL
	ldr	w0, [x25, #4]
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdr	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpAdd	Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"no bounce zone in dma tag"

	.comm	_nobounce_dmamap,24,3           ; @nobounce_dmamap
l_.str.2:                               ; @.str.2
	.asciz	"add_bounce_page: map doesn't need any pages"

	.comm	_bounce_lock,4,2                ; @bounce_lock
l_.str.3:                               ; @.str.3
	.asciz	"add_bounce_page: free page list is empty"

	.comm	_links,4,2                      ; @links
	.comm	_BUS_DMA_KEEP_PG_OFFSET,4,2     ; @BUS_DMA_KEEP_PG_OFFSET
	.comm	_PAGE_MASK,4,2                  ; @PAGE_MASK
l_.str.4:                               ; @.str.4
	.asciz	"Trying to bounce multiple pages with BUS_DMA_KEEP_PG_OFFSET"

l_.str.5:                               ; @.str.5
	.asciz	"Second page is not aligned"

	.no_dead_strip	_add_bounce_page
.subsections_via_symbols
