	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function alloc_new_range
_alloc_new_range:                       ## @alloc_new_range
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r15d
	movl	(%rsi), %ebx
	movq	_APERTURE_RANGE_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	sarl	%cl, %ebx
	movq	_APERTURE_MAX_RANGES@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ebx
	jge	LBB0_26
## %bb.1:
	movq	%rsi, %r12
	movl	%edx, %r13d
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	movl	$4, %edi
	movl	%r15d, %esi
	callq	_kzalloc
	movq	8(%r12), %rcx
	movslq	%ebx, %rbx
	movq	%rax, (%rcx,%rbx,8)
	movq	8(%r12), %rax
	cmpq	$0, (%rax,%rbx,8)
	je	LBB0_26
## %bb.2:
	movl	%r15d, %edi
	callq	_get_zeroed_page
	movq	8(%r12), %rcx
	movq	(%rcx,%rbx,8), %rdx
	movq	%rax, 8(%rdx)
	movq	(%rcx,%rbx,8), %rcx
	cmpq	$0, 8(%rcx)
	je	LBB0_25
## %bb.3:
	movl	(%r12), %eax
	movl	%eax, (%rcx)
	testl	%r13d, %r13d
	je	LBB0_10
## %bb.4:
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	movq	_APERTURE_RANGE_PAGES@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r14d
	cmpl	$512, %r14d                     ## imm = 0x200
	jl	LBB0_9
## %bb.5:
	movslq	%eax, %rbx
	shrq	$9, %r14
	leaq	16(%r12), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	_PM_MAP_4k@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	%rbx, %rsi
	leaq	-72(%rbp), %rcx
	movl	%r15d, %r8d
	callq	_alloc_pte
	testq	%rax, %rax
	je	LBB0_24
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	-72(%rbp), %rax
	movq	8(%r12), %rcx
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	movq	(%rcx,%rdx,8), %rcx
	movq	16(%rcx), %rcx
	movq	%rax, (%rcx,%r13,8)
	movq	_APERTURE_RANGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	leal	63(%rax), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	sarl	$6, %ecx
	movslq	%ecx, %rax
	addq	%rax, %rbx
	incq	%r13
	cmpq	%r13, %r14
	jne	LBB0_6
## %bb.8:
	movl	(%r12), %eax
LBB0_9:
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
LBB0_10:
	movslq	%eax, %rcx
	movq	_APERTURE_RANGE_SIZE@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	addq	%rcx, %rax
	movl	%eax, (%r12)
	movq	_MSI_ADDR_BASE_LO@GOTPCREL(%rip), %r14
	movq	(%r14), %rdi
	cmpq	%rcx, %rdi
	jbe	LBB0_13
## %bb.11:
	cmpq	%rax, %rdi
	jae	LBB0_13
## %bb.12:
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movl	$65536, %esi                    ## imm = 0x10000
	callq	_iommu_num_pages
	movq	(%r14), %rsi
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shrq	%cl, %rsi
	movq	%r12, %rdi
	movl	%eax, %edx
	callq	_dma_ops_reserve_addresses
LBB0_13:
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movq	(%rcx), %rdi
	testq	%rdi, %rdi
	je	LBB0_17
## %bb.14:
	movq	8(%r12), %rax
	movq	(%rax,%rbx,8), %rax
	movslq	(%rax), %rax
	cmpq	%rax, %rdi
	jb	LBB0_17
## %bb.15:
	movslq	(%r12), %rax
	cmpq	%rax, %rdi
	jae	LBB0_17
## %bb.16:
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movq	%rcx, %rdx
	movb	(%rax), %cl
	movq	%rdi, %r14
	shrq	%cl, %r14
	movl	8(%rdx), %esi
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	callq	_iommu_num_pages
	movq	%r12, %rdi
	movq	%r14, %rsi
	movl	%eax, %edx
	callq	_dma_ops_reserve_addresses
LBB0_17:
	movq	8(%r12), %rax
	movq	(%rax,%rbx,8), %rax
	movslq	(%rax), %rbx
	cmpl	(%r12), %ebx
	jae	LBB0_23
## %bb.18:
	leaq	16(%r12), %r14
	movq	_PM_MAP_4k@GOTPCREL(%rip), %r15
	movq	_PAGE_SIZE@GOTPCREL(%rip), %r13
	jmp	LBB0_19
	.p2align	4, 0x90
LBB0_22:                                ##   in Loop: Header=BB0_19 Depth=1
	addq	(%r13), %rbx
	movslq	(%r12), %rax
	cmpq	%rax, %rbx
	jae	LBB0_23
LBB0_19:                                ## =>This Inner Loop Header: Depth=1
	movl	(%r15), %edx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_fetch_pte
	testq	%rax, %rax
	je	LBB0_22
## %bb.20:                              ##   in Loop: Header=BB0_19 Depth=1
	movl	(%rax), %edi
	callq	_IOMMU_PTE_PRESENT
	testl	%eax, %eax
	je	LBB0_22
## %bb.21:                              ##   in Loop: Header=BB0_19 Depth=1
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movzbl	(%rax), %ecx
	movq	%rbx, %rsi
	shrq	%cl, %rsi
	movq	%r12, %rdi
	movl	$1, %edx
	callq	_dma_ops_reserve_addresses
	jmp	LBB0_22
LBB0_23:
	addq	$16, %r12
	movq	%r12, %rdi
	callq	_update_domain
	xorl	%eax, %eax
	jmp	LBB0_27
LBB0_24:
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
LBB0_25:
	leaq	16(%r12), %rdi
	callq	_update_domain
	movq	8(%r12), %rax
	movq	(%rax,%rbx,8), %rax
	movq	8(%rax), %rdi
	callq	_free_page
	movq	8(%r12), %rax
	movq	(%rax,%rbx,8), %rdi
	callq	_kfree
	movq	8(%r12), %rax
	movq	$0, (%rax,%rbx,8)
LBB0_26:
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_27:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_APERTURE_RANGE_SHIFT,4,2       ## @APERTURE_RANGE_SHIFT
	.comm	_APERTURE_MAX_RANGES,4,2        ## @APERTURE_MAX_RANGES
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_APERTURE_RANGE_PAGES,4,2       ## @APERTURE_RANGE_PAGES
	.comm	_PM_MAP_4k,4,2                  ## @PM_MAP_4k
	.comm	_APERTURE_RANGE_SIZE,4,2        ## @APERTURE_RANGE_SIZE
	.comm	_MSI_ADDR_BASE_LO,8,3           ## @MSI_ADDR_BASE_LO
	.comm	_PAGE_SIZE,8,3                  ## @PAGE_SIZE
	.comm	_PAGE_SHIFT,8,3                 ## @PAGE_SHIFT
	.no_dead_strip	_alloc_new_range
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function alloc_new_range
_alloc_new_range:                       ; @alloc_new_range
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	ldr	w8, [x1]
Lloh0:
	adrp	x9, _APERTURE_RANGE_SHIFT@GOTPAGE
Lloh1:
	ldr	x9, [x9, _APERTURE_RANGE_SHIFT@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	asr	w20, w8, w9
Lloh3:
	adrp	x8, _APERTURE_MAX_RANGES@GOTPAGE
Lloh4:
	ldr	x8, [x8, _APERTURE_MAX_RANGES@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w20, w8
	b.ge	LBB0_23
; %bb.1:
	mov	x21, x3
	mov	x22, x2
	mov	x19, x1
	mov	x23, x0
	mov	w0, #4
	mov	x1, x3
	bl	_kzalloc
	ldr	x8, [x19, #8]
	sbfiz	x9, x20, #3, #32
	str	x0, [x8, x9]
	ldr	x8, [x19, #8]
	ldr	x8, [x8, x9]
	cbz	x8, LBB0_23
; %bb.2:
	sxtw	x24, w20
	mov	x0, x21
	bl	_get_zeroed_page
	ldr	x8, [x19, #8]
	lsl	x25, x24, #3
	ldr	x9, [x8, x25]
	str	x0, [x9, #8]
	ldr	x9, [x8, x25]
	ldr	x8, [x9, #8]
	cbz	x8, LBB0_22
; %bb.3:
	ldr	w8, [x19]
	str	w8, [x9]
Lloh6:
	adrp	x26, _APERTURE_RANGE_SIZE@GOTPAGE
Lloh7:
	ldr	x26, [x26, _APERTURE_RANGE_SIZE@GOTPAGEOFF]
	cbz	w22, LBB0_9
; %bb.4:
Lloh8:
	adrp	x9, _APERTURE_RANGE_PAGES@GOTPAGE
Lloh9:
	ldr	x9, [x9, _APERTURE_RANGE_PAGES@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	cmp	w9, #512
	b.lt	LBB0_9
; %bb.5:
	str	x23, [sp]                       ; 8-byte Folded Spill
	mov	x27, #0
                                        ; kill: def $w8 killed $w8 killed $x8 def $x8
	sxtw	x22, w8
	lsr	x8, x9, #6
	and	x28, x8, #0x3fffff8
	add	x23, x19, #16
Lloh11:
	adrp	x20, _PM_MAP_4k@GOTPAGE
Lloh12:
	ldr	x20, [x20, _PM_MAP_4k@GOTPAGEOFF]
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w2, [x20]
	add	x3, sp, #8
	mov	x0, x23
	mov	x1, x22
	mov	x4, x21
	bl	_alloc_pte
	cbz	x0, LBB0_22
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [x19, #8]
	ldr	x8, [x8, x24, lsl #3]
	ldr	x9, [sp, #8]
	ldr	x8, [x8, #16]
	str	x9, [x8, x27]
	ldr	w8, [x26]
	add	w9, w8, #63
	cmp	w8, #0
	csel	w8, w9, w8, lt
	asr	w8, w8, #6
	add	x22, x22, w8, sxtw
	add	x27, x27, #8
	cmp	x28, x27
	b.ne	LBB0_6
; %bb.8:
	ldr	w8, [x19]
	ldr	x23, [sp]                       ; 8-byte Folded Reload
LBB0_9:
	sxtw	x8, w8
	ldrsw	x9, [x26]
	add	x9, x9, x8
	str	w9, [x19]
Lloh13:
	adrp	x20, _MSI_ADDR_BASE_LO@GOTPAGE
Lloh14:
	ldr	x20, [x20, _MSI_ADDR_BASE_LO@GOTPAGEOFF]
	ldr	x0, [x20]
	cmp	x0, x8
	ccmp	x0, x9, #2, hi
	b.hs	LBB0_11
; %bb.10:
Lloh15:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh16:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh17:
	ldr	x2, [x8]
	mov	w1, #65536
	bl	_iommu_num_pages
	mov	x2, x0
	ldr	x8, [x20]
Lloh18:
	adrp	x9, _PAGE_SHIFT@GOTPAGE
Lloh19:
	ldr	x9, [x9, _PAGE_SHIFT@GOTPAGEOFF]
Lloh20:
	ldr	x9, [x9]
	lsr	x1, x8, x9
	mov	x0, x19
	bl	_dma_ops_reserve_addresses
LBB0_11:
	ldr	x0, [x23]
	cbz	x0, LBB0_15
; %bb.12:
	ldr	x8, [x19, #8]
	ldr	x8, [x8, x24, lsl #3]
	ldrsw	x8, [x8]
	cmp	x0, x8
	b.lo	LBB0_15
; %bb.13:
	ldrsw	x8, [x19]
	cmp	x0, x8
	b.hs	LBB0_15
; %bb.14:
Lloh21:
	adrp	x8, _PAGE_SHIFT@GOTPAGE
Lloh22:
	ldr	x8, [x8, _PAGE_SHIFT@GOTPAGEOFF]
Lloh23:
	ldr	x8, [x8]
	lsr	x21, x0, x8
	ldr	w1, [x23, #8]
Lloh24:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh25:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh26:
	ldr	x2, [x8]
	bl	_iommu_num_pages
	mov	x2, x0
	mov	x0, x19
	mov	x1, x21
	bl	_dma_ops_reserve_addresses
LBB0_15:
	ldr	x8, [x19, #8]
	ldr	x8, [x8, x24, lsl #3]
	ldrsw	x20, [x8]
	ldr	w8, [x19]
	cmp	w20, w8
	b.hs	LBB0_21
; %bb.16:
	add	x21, x19, #16
Lloh27:
	adrp	x22, _PM_MAP_4k@GOTPAGE
Lloh28:
	ldr	x22, [x22, _PM_MAP_4k@GOTPAGEOFF]
Lloh29:
	adrp	x23, _PAGE_SIZE@GOTPAGE
Lloh30:
	ldr	x23, [x23, _PAGE_SIZE@GOTPAGEOFF]
Lloh31:
	adrp	x24, _PAGE_SHIFT@GOTPAGE
Lloh32:
	ldr	x24, [x24, _PAGE_SHIFT@GOTPAGEOFF]
	b	LBB0_18
LBB0_17:                                ;   in Loop: Header=BB0_18 Depth=1
	ldr	x8, [x23]
	ldrsw	x9, [x19]
	add	x20, x8, x20
	cmp	x20, x9
	b.hs	LBB0_21
LBB0_18:                                ; =>This Inner Loop Header: Depth=1
	ldr	w2, [x22]
	mov	x0, x21
	mov	x1, x20
	bl	_fetch_pte
	cbz	x0, LBB0_17
; %bb.19:                               ;   in Loop: Header=BB0_18 Depth=1
	ldr	w0, [x0]
	bl	_IOMMU_PTE_PRESENT
	cbz	w0, LBB0_17
; %bb.20:                               ;   in Loop: Header=BB0_18 Depth=1
	ldr	x8, [x24]
	lsr	x1, x20, x8
	mov	x0, x19
	mov	w2, #1
	bl	_dma_ops_reserve_addresses
	b	LBB0_17
LBB0_21:
	add	x0, x19, #16
	bl	_update_domain
	mov	w0, #0
	b	LBB0_24
LBB0_22:
	add	x0, x19, #16
	bl	_update_domain
	ldr	x8, [x19, #8]
	ldr	x8, [x8, x25]
	ldr	x0, [x8, #8]
	bl	_free_page
	ldr	x8, [x19, #8]
	ldr	x0, [x8, x25]
	bl	_kfree
	ldr	x8, [x19, #8]
	str	xzr, [x8, x25]
LBB0_23:
Lloh33:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh34:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh35:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_24:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.cfi_endproc
                                        ; -- End function
	.comm	_APERTURE_RANGE_SHIFT,4,2       ; @APERTURE_RANGE_SHIFT
	.comm	_APERTURE_MAX_RANGES,4,2        ; @APERTURE_MAX_RANGES
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_APERTURE_RANGE_PAGES,4,2       ; @APERTURE_RANGE_PAGES
	.comm	_PM_MAP_4k,4,2                  ; @PM_MAP_4k
	.comm	_APERTURE_RANGE_SIZE,4,2        ; @APERTURE_RANGE_SIZE
	.comm	_MSI_ADDR_BASE_LO,8,3           ; @MSI_ADDR_BASE_LO
	.comm	_PAGE_SIZE,8,3                  ; @PAGE_SIZE
	.comm	_PAGE_SHIFT,8,3                 ; @PAGE_SHIFT
	.no_dead_strip	_alloc_new_range
.subsections_via_symbols
