	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function alloc_iommu
_alloc_iommu:                           ## @alloc_iommu
	.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	%rdx, %r15
	movl	%esi, %r14d
	movq	%rdi, %r13
	movq	_iommu_bus_base@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	callq	_dma_get_seg_boundary
	andq	%rax, %rbx
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_ALIGN
	movq	%rax, %r12
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rbx
	movb	(%rbx), %cl
	shrq	%cl, %r12
	movq	%r13, %rdi
	callq	_dma_get_seg_boundary
	leaq	1(%rax), %rdi
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_ALIGN
	movq	%rax, %r13
	movb	(%rbx), %cl
	shrq	%cl, %r13
	movq	_iommu_bitmap_lock@GOTPCREL(%rip), %rdi
	callq	_spin_lock_irqsave
	movq	_iommu_gart_bitmap@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_iommu_pages@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	_next_bit@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movq	%r15, (%rsp)
	movl	%r14d, %ecx
	movq	%r12, %r8
	movq	%r13, %r9
	callq	_iommu_area_alloc
	movq	%rax, %rbx
	cmpq	$-1, %rax
	jne	LBB0_3
## %bb.1:
	movq	_need_flush@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
	movq	_iommu_gart_bitmap@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_iommu_pages@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%r15, (%rsp)
	xorl	%edx, %edx
	movl	%r14d, %ecx
	movq	%r12, %r8
	movq	%r13, %r9
	callq	_iommu_area_alloc
	movq	%rax, %rbx
	cmpq	$-1, %rax
	je	LBB0_2
LBB0_3:
	movslq	%r14d, %rax
	addq	%rbx, %rax
	movq	_next_bit@GOTPCREL(%rip), %rdx
	movq	%rax, (%rdx)
	movq	_iommu_pages@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jb	LBB0_5
## %bb.4:
	movq	%rdx, %rax
	movq	$0, (%rdx)
	movq	_need_flush@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
	jmp	LBB0_5
LBB0_2:
	movq	$-1, %rbx
LBB0_5:
	movq	_iommu_fullflush@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_7
## %bb.6:
	movq	_need_flush@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
LBB0_7:
	movq	_iommu_bitmap_lock@GOTPCREL(%rip), %rdi
	callq	_spin_unlock_irqrestore
	movq	%rbx, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_iommu_bus_base,8,3             ## @iommu_bus_base
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_PAGE_SHIFT,8,3                 ## @PAGE_SHIFT
	.comm	_iommu_bitmap_lock,4,2          ## @iommu_bitmap_lock
	.comm	_iommu_gart_bitmap,4,2          ## @iommu_gart_bitmap
	.comm	_iommu_pages,8,3                ## @iommu_pages
	.comm	_next_bit,8,3                   ## @next_bit
	.comm	_need_flush,4,2                 ## @need_flush
	.comm	_iommu_fullflush,8,3            ## @iommu_fullflush
	.no_dead_strip	_alloc_iommu
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function alloc_iommu
_alloc_iommu:                           ; @alloc_iommu
	.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	x20, x2
	mov	x19, x1
	mov	x22, x0
Lloh0:
	adrp	x8, _iommu_bus_base@GOTPAGE
Lloh1:
	ldr	x8, [x8, _iommu_bus_base@GOTPAGEOFF]
Lloh2:
	ldr	x21, [x8]
	bl	_dma_get_seg_boundary
	and	x0, x0, x21
Lloh3:
	adrp	x23, _PAGE_SIZE@GOTPAGE
Lloh4:
	ldr	x23, [x23, _PAGE_SIZE@GOTPAGEOFF]
	ldr	w1, [x23]
	bl	_ALIGN
Lloh5:
	adrp	x24, _PAGE_SHIFT@GOTPAGE
Lloh6:
	ldr	x24, [x24, _PAGE_SHIFT@GOTPAGEOFF]
	ldr	x8, [x24]
	lsr	x21, x0, x8
	mov	x0, x22
	bl	_dma_get_seg_boundary
	add	x0, x0, #1
	ldr	w1, [x23]
	bl	_ALIGN
	ldr	x8, [x24]
	lsr	x23, x0, x8
Lloh7:
	adrp	x0, _iommu_bitmap_lock@GOTPAGE
Lloh8:
	ldr	x0, [x0, _iommu_bitmap_lock@GOTPAGEOFF]
	bl	_spin_lock_irqsave
Lloh9:
	adrp	x27, _iommu_gart_bitmap@GOTPAGE
Lloh10:
	ldr	x27, [x27, _iommu_gart_bitmap@GOTPAGEOFF]
	ldr	w0, [x27]
Lloh11:
	adrp	x26, _iommu_pages@GOTPAGE
Lloh12:
	ldr	x26, [x26, _iommu_pages@GOTPAGEOFF]
	ldr	x1, [x26]
Lloh13:
	adrp	x25, _next_bit@GOTPAGE
Lloh14:
	ldr	x25, [x25, _next_bit@GOTPAGEOFF]
	ldr	x2, [x25]
	mov	x3, x19
	mov	x4, x21
	mov	x5, x23
	mov	x6, x20
	bl	_iommu_area_alloc
	mov	x22, x0
Lloh15:
	adrp	x24, _need_flush@GOTPAGE
Lloh16:
	ldr	x24, [x24, _need_flush@GOTPAGEOFF]
	cmn	x0, #1
	b.ne	LBB0_2
; %bb.1:
	mov	w8, #1
	str	w8, [x24]
	ldr	w0, [x27]
	ldr	x1, [x26]
	mov	x2, #0
	mov	x3, x19
	mov	x4, x21
	mov	x5, x23
	mov	x6, x20
	bl	_iommu_area_alloc
	mov	x22, x0
	cmn	x0, #1
	b.eq	LBB0_4
LBB0_2:
	add	x8, x22, w19, sxtw
	str	x8, [x25]
	ldr	x9, [x26]
	cmp	x8, x9
	b.lo	LBB0_4
; %bb.3:
	str	xzr, [x25]
	mov	w8, #1
	str	w8, [x24]
LBB0_4:
Lloh17:
	adrp	x8, _iommu_fullflush@GOTPAGE
Lloh18:
	ldr	x8, [x8, _iommu_fullflush@GOTPAGEOFF]
Lloh19:
	ldr	x8, [x8]
	cbz	x8, LBB0_6
; %bb.5:
	mov	w8, #1
	str	w8, [x24]
LBB0_6:
Lloh20:
	adrp	x0, _iommu_bitmap_lock@GOTPAGE
Lloh21:
	ldr	x0, [x0, _iommu_bitmap_lock@GOTPAGEOFF]
	bl	_spin_unlock_irqrestore
	mov	x0, x22
	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	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_iommu_bus_base,8,3             ; @iommu_bus_base
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_PAGE_SHIFT,8,3                 ; @PAGE_SHIFT
	.comm	_iommu_bitmap_lock,4,2          ; @iommu_bitmap_lock
	.comm	_iommu_gart_bitmap,4,2          ; @iommu_gart_bitmap
	.comm	_iommu_pages,8,3                ; @iommu_pages
	.comm	_next_bit,8,3                   ; @next_bit
	.comm	_need_flush,4,2                 ; @need_flush
	.comm	_iommu_fullflush,8,3            ; @iommu_fullflush
	.no_dead_strip	_alloc_iommu
.subsections_via_symbols
