	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vm_iommu_modify
_vm_iommu_modify:                       ## @vm_iommu_modify
	.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	%esi, -44(%rbp)                 ## 4-byte Spill
	movq	%rdi, %r14
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	xorl	%eax, %eax
	callq	_iommu_host_domain
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	_VM_MAX_MEMMAPS@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jle	LBB0_15
## %bb.1:
	xorl	%ecx, %ecx
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_14:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	incq	%rcx
	movq	_VM_MAX_MEMMAPS@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	cmpq	%rax, %rcx
	jge	LBB0_15
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_10 Depth 2
	movq	8(%r14), %r15
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	leaq	(%rcx,%rcx,2), %rbx
	leaq	(%r15,%rbx,8), %r13
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_sysmem_mapping
	testl	%eax, %eax
	je	LBB0_14
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movslq	(%r13), %rsi
	movq	_VM_MEMMAP_F_IOMMU@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_6
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	xorl	%edi, %edi
	testl	%esi, %eax
	sete	%dil
	callq	_KASSERT
	movl	(%r13), %eax
	movq	_VM_MEMMAP_F_WIRED@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_14
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	_VM_MEMMAP_F_IOMMU@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%eax, (%r13)
	cmpq	$0, 16(%r15,%rbx,8)
	jg	LBB0_9
	jmp	LBB0_14
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_2 Depth=1
	testl	%esi, %eax
	je	LBB0_14
## %bb.7:                               ##   in Loop: Header=BB0_2 Depth=1
	notl	%eax
	andl	%esi, %eax
	movl	%eax, (%r13)
	xorl	%edi, %edi
	movslq	%eax, %rsi
	movq	_VM_MEMMAP_F_WIRED@GOTPCREL(%rip), %rcx
	andl	(%rcx), %eax
	setne	%dil
	callq	_KASSERT
	cmpq	$0, 16(%r15,%rbx,8)
	jle	LBB0_14
LBB0_9:                                 ##   in Loop: Header=BB0_2 Depth=1
	leaq	(%r15,%rbx,8), %r12
	addq	$8, %r12
	movq	(%r12), %r13
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	jmp	LBB0_10
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_10 Depth=2
	movq	%r13, %rsi
	movl	-48(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, %edx
	callq	_iommu_remove_mapping
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movq	%r15, %rsi
	movq	%r15, %rdx
	movl	%ebx, %ecx
	callq	_iommu_create_mapping
LBB0_13:                                ##   in Loop: Header=BB0_10 Depth=2
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movslq	(%rax), %rcx
	addq	%rcx, %r13
	movq	8(%r12), %rax
	addq	(%r12), %rax
	cmpq	%rax, %r13
	jge	LBB0_14
LBB0_10:                                ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	_VM_PROT_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	%r14, %rdi
	movl	$-1, %esi
	movq	%r13, %rdx
                                        ## kill: def $ecx killed $ecx killed $rcx
	leaq	-72(%rbp), %r9
	callq	_vm_gpa_hold
	movq	%rax, %r15
	xorl	%ebx, %ebx
	testq	%rax, %rax
	setne	%bl
	movq	%r14, %rdi
	callq	_vm_name
	movl	%ebx, %edi
	movq	%r13, %rsi
	callq	_KASSERT
	movq	-72(%rbp), %rdi
	callq	_vm_gpa_release
	movq	%r15, %rdi
	callq	_DMAP_TO_PHYS
	movq	%rax, %r15
	movq	(%r14), %rdi
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=2
	movq	%r13, %rsi
	movq	%r15, %rdx
	movl	-48(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, %ecx
	callq	_iommu_create_mapping
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movq	%r15, %rsi
	movl	%ebx, %edx
	callq	_iommu_remove_mapping
	jmp	LBB0_13
LBB0_15:
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_17
## %bb.16:
	movq	(%r14), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
LBB0_17:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_iommu_invalidate_tlb
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_VM_MAX_MEMMAPS,4,2             ## @VM_MAX_MEMMAPS
	.comm	_VM_MEMMAP_F_IOMMU,4,2          ## @VM_MEMMAP_F_IOMMU
	.comm	_VM_MEMMAP_F_WIRED,4,2          ## @VM_MEMMAP_F_WIRED
	.comm	_VM_PROT_WRITE,4,2              ## @VM_PROT_WRITE
	.no_dead_strip	_vm_iommu_modify
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vm_iommu_modify
_vm_iommu_modify:                       ; @vm_iommu_modify
	.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
	mov	x21, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	w22, [x8]
	bl	_iommu_host_domain
	mov	x20, x0
Lloh3:
	adrp	x8, _VM_MAX_MEMMAPS@GOTPAGE
Lloh4:
	ldr	x8, [x8, _VM_MAX_MEMMAPS@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w8, #1
	b.lt	LBB0_15
; %bb.1:
	mov	x28, #0
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x28, x28, #1
Lloh6:
	adrp	x8, _VM_MAX_MEMMAPS@GOTPAGE
Lloh7:
	ldr	x8, [x8, _VM_MAX_MEMMAPS@GOTPAGEOFF]
Lloh8:
	ldrsw	x8, [x8]
	cmp	x28, x8
	b.ge	LBB0_15
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_13 Depth 2
	ldr	x24, [x19, #8]
	mov	w8, #24
	madd	x23, x28, x8, x24
	mov	x0, x19
	mov	x1, x23
	bl	_sysmem_mapping
	cbz	w0, LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldrsw	x1, [x23]
Lloh9:
	adrp	x8, _VM_MEMMAP_F_IOMMU@GOTPAGE
Lloh10:
	ldr	x8, [x8, _VM_MEMMAP_F_IOMMU@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	and	w9, w8, w1
	cbz	w21, LBB0_7
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	cmp	w9, #0
	cset	w0, eq
	bl	_KASSERT
	ldr	w8, [x23]
Lloh12:
	adrp	x9, _VM_MEMMAP_F_WIRED@GOTPAGE
Lloh13:
	ldr	x9, [x9, _VM_MEMMAP_F_WIRED@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_2
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
Lloh15:
	adrp	x9, _VM_MEMMAP_F_IOMMU@GOTPAGE
Lloh16:
	ldr	x9, [x9, _VM_MEMMAP_F_IOMMU@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	orr	w8, w9, w8
	str	w8, [x23]
	b	LBB0_9
LBB0_7:                                 ;   in Loop: Header=BB0_3 Depth=1
	cbz	w9, LBB0_2
; %bb.8:                                ;   in Loop: Header=BB0_3 Depth=1
	bic	w8, w1, w8
	str	w8, [x23]
Lloh18:
	adrp	x9, _VM_MEMMAP_F_WIRED@GOTPAGE
Lloh19:
	ldr	x9, [x9, _VM_MEMMAP_F_WIRED@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	tst	w9, w8
	cset	w0, ne
	sxtw	x1, w8
	bl	_KASSERT
LBB0_9:                                 ;   in Loop: Header=BB0_3 Depth=1
	mov	w8, #24
	madd	x26, x28, x8, x24
	ldr	x8, [x26, #16]!
	cmp	x8, #1
	b.lt	LBB0_2
; %bb.10:                               ;   in Loop: Header=BB0_3 Depth=1
	sub	x27, x26, #8
	ldr	x23, [x27]
Lloh21:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh22:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh23:
	ldr	w3, [x8]
	b	LBB0_13
LBB0_11:                                ;   in Loop: Header=BB0_13 Depth=2
	mov	x2, x22
	bl	_iommu_remove_mapping
	mov	x0, x20
	mov	x1, x24
	mov	x2, x24
	mov	x3, x22
	bl	_iommu_create_mapping
LBB0_12:                                ;   in Loop: Header=BB0_13 Depth=2
Lloh24:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh25:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh26:
	ldrsw	x3, [x8]
	add	x23, x23, x3
	ldr	x8, [x27]
	ldr	x9, [x26]
	add	x8, x9, x8
	cmp	x23, x8
	b.ge	LBB0_2
LBB0_13:                                ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
Lloh27:
	adrp	x8, _VM_PROT_WRITE@GOTPAGE
Lloh28:
	ldr	x8, [x8, _VM_PROT_WRITE@GOTPAGEOFF]
Lloh29:
	ldr	w4, [x8]
	add	x5, sp, #8
	mov	x0, x19
	mov	w1, #-1
	mov	x2, x23
                                        ; kill: def $w3 killed $w3 killed $x3
	bl	_vm_gpa_hold
	mov	x24, x0
	cmp	x0, #0
	cset	w25, ne
	mov	x0, x19
	bl	_vm_name
	mov	x0, x25
	mov	x1, x23
	bl	_KASSERT
	ldr	x0, [sp, #8]
	bl	_vm_gpa_release
	mov	x0, x24
	bl	_DMAP_TO_PHYS
	mov	x24, x0
	ldr	x0, [x19]
	mov	x1, x23
	cbz	w21, LBB0_11
; %bb.14:                               ;   in Loop: Header=BB0_13 Depth=2
	mov	x2, x24
	mov	x3, x22
	bl	_iommu_create_mapping
	mov	x0, x20
	mov	x1, x24
	mov	x2, x22
	bl	_iommu_remove_mapping
	b	LBB0_12
LBB0_15:
	cbnz	w21, LBB0_17
; %bb.16:
	ldr	x20, [x19]
LBB0_17:
	mov	x0, x20
	bl	_iommu_invalidate_tlb
	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 AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_VM_MAX_MEMMAPS,4,2             ; @VM_MAX_MEMMAPS
	.comm	_VM_MEMMAP_F_IOMMU,4,2          ; @VM_MEMMAP_F_IOMMU
	.comm	_VM_MEMMAP_F_WIRED,4,2          ; @VM_MEMMAP_F_WIRED
	.comm	_VM_PROT_WRITE,4,2              ; @VM_PROT_WRITE
	.no_dead_strip	_vm_iommu_modify
.subsections_via_symbols
