	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_dmar_gas_map_region            ## -- Begin function dmar_gas_map_region
	.p2align	4, 0x90
_dmar_gas_map_region:                   ## @dmar_gas_map_region
	.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
	movq	%r8, -72(%rbp)                  ## 8-byte Spill
	movl	%ecx, %r12d
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	movq	%rsi, %r14
	movq	%rdi, %r15
	movslq	(%rsi), %rsi
	xorl	%edi, %edi
	testq	%rsi, %rsi
	sete	%dil
	callq	_KASSERT
	movq	_DMAR_GM_CANWAIT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	notl	%eax
	xorl	%edi, %edi
	testl	%r12d, %eax
	sete	%dil
	movslq	%r12d, %rbx
	movq	%rbx, %rsi
	callq	_KASSERT
	movq	8(%r14), %r13
	movq	%r15, %rdi
	callq	_DMAR_DOMAIN_LOCK
	movq	%r15, %rdi
	movq	%r14, %rsi
	movl	%ebx, %edx
	callq	_dmar_gas_alloc_region
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movl	%eax, %ebx
	movq	%r15, %rdi
	callq	_DMAR_DOMAIN_UNLOCK
	jmp	LBB0_16
LBB0_2:
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	orl	%eax, (%r14)
	movq	%r15, %rdi
	callq	_DMAR_DOMAIN_UNLOCK
	movq	8(%r14), %rax
	movq	16(%r14), %rcx
	xorl	%ebx, %ebx
	subq	%rax, %rcx
	je	LBB0_16
## %bb.3:
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	subq	%rax, %r13
	movq	%r13, %rdi
	callq	_OFF_TO_IDX
	movq	_DMAR_MAP_ENTRY_READ@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	andl	%edi, %ecx
	je	LBB0_5
## %bb.4:
	movq	_DMAR_PTE_R@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
LBB0_5:
	movq	_DMAR_MAP_ENTRY_WRITE@GOTPCREL(%rip), %rdx
	movl	(%rdx), %r8d
	andl	%edi, %r8d
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	movq	_DMAR_GM_CANWAIT@GOTPCREL(%rip), %r10
	je	LBB0_7
## %bb.6:
	movq	_DMAR_PTE_W@GOTPCREL(%rip), %rdx
	movl	(%rdx), %r8d
LBB0_7:
	movq	_DMAR_MAP_ENTRY_SNOOP@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	andl	%edi, %edx
	je	LBB0_9
## %bb.8:
	movq	_DMAR_PTE_SNP@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
LBB0_9:
	cltq
	orl	%ecx, %r8d
	movq	_DMAR_MAP_ENTRY_TM@GOTPCREL(%rip), %rcx
	andl	(%rcx), %edi
	je	LBB0_11
## %bb.10:
	movq	_DMAR_PTE_TM@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
LBB0_11:
	orl	%edi, %edx
	orl	%edx, %r8d
	leaq	(%rsi,%rax,4), %rcx
	andl	(%r10), %r12d
	je	LBB0_13
## %bb.12:
	movq	_DMAR_PGF_WAITOK@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
LBB0_13:
	movq	%r15, %rdi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movl	%r12d, %r9d
	callq	_domain_map_buf
	movl	%eax, %r15d
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r15d
	jne	LBB0_15
## %bb.14:
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_dmar_domain_unload_entry
	movl	%r15d, %ebx
	jmp	LBB0_16
LBB0_15:
	xorl	%edi, %edi
	testl	%r15d, %r15d
	sete	%dil
	movslq	%r15d, %rsi
	callq	_KASSERT
LBB0_16:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DMAR_GM_CANWAIT,4,2            ## @DMAR_GM_CANWAIT
	.comm	_DMAR_MAP_ENTRY_READ,4,2        ## @DMAR_MAP_ENTRY_READ
	.comm	_DMAR_PTE_R,4,2                 ## @DMAR_PTE_R
	.comm	_DMAR_MAP_ENTRY_WRITE,4,2       ## @DMAR_MAP_ENTRY_WRITE
	.comm	_DMAR_PTE_W,4,2                 ## @DMAR_PTE_W
	.comm	_DMAR_MAP_ENTRY_SNOOP,4,2       ## @DMAR_MAP_ENTRY_SNOOP
	.comm	_DMAR_PTE_SNP,4,2               ## @DMAR_PTE_SNP
	.comm	_DMAR_MAP_ENTRY_TM,4,2          ## @DMAR_MAP_ENTRY_TM
	.comm	_DMAR_PTE_TM,4,2                ## @DMAR_PTE_TM
	.comm	_DMAR_PGF_WAITOK,4,2            ## @DMAR_PGF_WAITOK
	.comm	_ENOMEM,4,2                     ## @ENOMEM
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_dmar_gas_map_region            ; -- Begin function dmar_gas_map_region
	.p2align	2
_dmar_gas_map_region:                   ; @dmar_gas_map_region
	.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	x23, x4
	mov	x21, x3
	mov	x22, x2
	mov	x19, x1
	mov	x20, x0
	ldrsw	x1, [x1]
	cmp	x1, #0
	cset	w0, eq
	bl	_KASSERT
Lloh0:
	adrp	x26, _DMAR_GM_CANWAIT@GOTPAGE
Lloh1:
	ldr	x26, [x26, _DMAR_GM_CANWAIT@GOTPAGEOFF]
	ldr	w8, [x26]
	bics	wzr, w21, w8
	cset	w0, eq
	sxtw	x1, w21
	bl	_KASSERT
	ldr	x27, [x19, #8]
	mov	x0, x20
	bl	_DMAR_DOMAIN_LOCK
	mov	x0, x20
	mov	x1, x19
	mov	x2, x21
	bl	_dmar_gas_alloc_region
	cbz	w0, LBB0_2
; %bb.1:
	mov	x24, x0
	mov	x0, x20
	bl	_DMAR_DOMAIN_UNLOCK
	b	LBB0_7
LBB0_2:
	ldr	w8, [x19]
	orr	w8, w8, w22
	str	w8, [x19]
	mov	x0, x20
	bl	_DMAR_DOMAIN_UNLOCK
	ldp	x24, x8, [x19, #8]
	subs	x25, x8, x24
	b.eq	LBB0_6
; %bb.3:
	sub	x0, x27, x24
	bl	_OFF_TO_IDX
	add	x3, x23, w0, sxtw #2
Lloh2:
	adrp	x8, _DMAR_MAP_ENTRY_READ@GOTPAGE
Lloh3:
	ldr	x8, [x8, _DMAR_MAP_ENTRY_READ@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
Lloh5:
	adrp	x9, _DMAR_PTE_R@GOTPAGE
Lloh6:
	ldr	x9, [x9, _DMAR_PTE_R@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	tst	w8, w22
	csel	w8, wzr, w9, eq
Lloh8:
	adrp	x9, _DMAR_MAP_ENTRY_WRITE@GOTPAGE
Lloh9:
	ldr	x9, [x9, _DMAR_MAP_ENTRY_WRITE@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
Lloh11:
	adrp	x10, _DMAR_PTE_W@GOTPAGE
Lloh12:
	ldr	x10, [x10, _DMAR_PTE_W@GOTPAGEOFF]
Lloh13:
	ldr	w10, [x10]
	tst	w9, w22
	csel	w9, wzr, w10, eq
	orr	w8, w9, w8
Lloh14:
	adrp	x9, _DMAR_MAP_ENTRY_SNOOP@GOTPAGE
Lloh15:
	ldr	x9, [x9, _DMAR_MAP_ENTRY_SNOOP@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
Lloh17:
	adrp	x10, _DMAR_PTE_SNP@GOTPAGE
Lloh18:
	ldr	x10, [x10, _DMAR_PTE_SNP@GOTPAGEOFF]
Lloh19:
	ldr	w10, [x10]
	tst	w9, w22
	csel	w9, wzr, w10, eq
	orr	w8, w8, w9
Lloh20:
	adrp	x9, _DMAR_MAP_ENTRY_TM@GOTPAGE
Lloh21:
	ldr	x9, [x9, _DMAR_MAP_ENTRY_TM@GOTPAGEOFF]
Lloh22:
	ldr	w9, [x9]
Lloh23:
	adrp	x10, _DMAR_PTE_TM@GOTPAGE
Lloh24:
	ldr	x10, [x10, _DMAR_PTE_TM@GOTPAGEOFF]
Lloh25:
	ldr	w10, [x10]
	tst	w9, w22
	csel	w9, wzr, w10, eq
	orr	w4, w8, w9
	ldr	w8, [x26]
Lloh26:
	adrp	x9, _DMAR_PGF_WAITOK@GOTPAGE
Lloh27:
	ldr	x9, [x9, _DMAR_PGF_WAITOK@GOTPAGEOFF]
Lloh28:
	ldr	w9, [x9]
	tst	w8, w21
	csel	w5, wzr, w9, eq
	mov	x0, x20
	mov	x1, x24
	mov	x2, x25
	bl	_domain_map_buf
	mov	x24, x0
Lloh29:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh30:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh31:
	ldr	w8, [x8]
	cmp	w0, w8
	b.ne	LBB0_5
; %bb.4:
	mov	x0, x19
	mov	w1, #0
	bl	_dmar_domain_unload_entry
	b	LBB0_7
LBB0_5:
	cmp	w24, #0
	cset	w0, eq
	sxtw	x1, w24
	bl	_KASSERT
LBB0_6:
	mov	w24, #0
LBB0_7:
	mov	x0, x24
	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	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.comm	_DMAR_GM_CANWAIT,4,2            ; @DMAR_GM_CANWAIT
	.comm	_DMAR_MAP_ENTRY_READ,4,2        ; @DMAR_MAP_ENTRY_READ
	.comm	_DMAR_PTE_R,4,2                 ; @DMAR_PTE_R
	.comm	_DMAR_MAP_ENTRY_WRITE,4,2       ; @DMAR_MAP_ENTRY_WRITE
	.comm	_DMAR_PTE_W,4,2                 ; @DMAR_PTE_W
	.comm	_DMAR_MAP_ENTRY_SNOOP,4,2       ; @DMAR_MAP_ENTRY_SNOOP
	.comm	_DMAR_PTE_SNP,4,2               ; @DMAR_PTE_SNP
	.comm	_DMAR_MAP_ENTRY_TM,4,2          ; @DMAR_MAP_ENTRY_TM
	.comm	_DMAR_PTE_TM,4,2                ; @DMAR_PTE_TM
	.comm	_DMAR_PGF_WAITOK,4,2            ; @DMAR_PGF_WAITOK
	.comm	_ENOMEM,4,2                     ; @ENOMEM
.subsections_via_symbols
