	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function dmar_domain_alloc
_dmar_domain_alloc:                     ## @dmar_domain_alloc
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r15d
	movq	%rdi, %r14
	movl	4(%rdi), %edi
	callq	_alloc_unr
	cmpl	$-1, %eax
	je	LBB0_9
## %bb.1:
	movl	%eax, %ebx
	movq	_M_DMAR_DOMAIN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_M_WAITOK@GOTPCREL(%rip), %rax
	movq	_M_ZERO@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	movl	$64, %edi
	callq	_malloc
	movq	%rax, %r12
	movl	%ebx, (%rax)
	leaq	56(%rax), %rdi
	callq	_LIST_INIT
	leaq	52(%r12), %rdi
	callq	_RB_INIT
	leaq	48(%r12), %rdi
	callq	_TAILQ_INIT
	leaq	44(%r12), %rdi
	movq	_dmar_domain_unload_task@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	xorl	%esi, %esi
	movq	%r12, %rcx
	callq	_TASK_INIT
	leaq	40(%r12), %rdi
	movq	_MTX_DEF@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	L_.str(%rip), %rsi
	xorl	%edx, %edx
	callq	_mtx_init
	movq	%r14, 32(%r12)
	testl	%r15d, %r15d
	je	LBB0_3
## %bb.2:
	movq	_Maxmem@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_ptoa
	movq	%rax, %rsi
	jmp	LBB0_4
LBB0_3:
	movq	_BUS_SPACE_MAXADDR@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
LBB0_4:
	xorl	%edx, %edx
	testl	%r15d, %r15d
	sete	%dl
	movq	%rsi, 8(%r12)
	movq	%r14, %rdi
	callq	_dmar_maxaddr2mgaw
	movq	%r12, %rdi
	movl	%eax, %esi
	callq	_domain_set_agaw
	testl	%eax, %eax
	je	LBB0_5
LBB0_8:
	movq	%r12, %rdi
	callq	_dmar_domain_destroy
LBB0_9:
	xorl	%r12d, %r12d
LBB0_13:
	movq	%r12, %rax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	testl	%r15d, %r15d
	je	LBB0_6
## %bb.10:
	movq	%r12, %rdi
	callq	_dmar_gas_init_domain
	movq	_DMAR_ECAP_PT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r14)
	jne	LBB0_12
## %bb.11:
	movq	8(%r12), %rsi
	movq	%r12, %rdi
	callq	_domain_get_idmap_pgtbl
	movl	%eax, 24(%r12)
LBB0_12:
	movq	_DMAR_DOMAIN_IDMAP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 20(%r12)
	jmp	LBB0_13
LBB0_6:
	movb	16(%r12), %cl
	decb	%cl
	movl	$1, %eax
	shlq	%cl, %rax
	movq	%rax, 8(%r12)
	movq	%r12, %rdi
	callq	_dmar_gas_init_domain
	movq	%r12, %rdi
	callq	_domain_alloc_pgtbl
	testl	%eax, %eax
	jne	LBB0_8
## %bb.7:
	movq	%r12, %rdi
	movl	$-18874368, %esi                ## imm = 0xFEE00000
	movl	$-17825792, %edx                ## imm = 0xFEF00000
	callq	_dmar_gas_reserve_region
	testl	%eax, %eax
	jne	LBB0_8
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.comm	_M_DMAR_DOMAIN,4,2              ## @M_DMAR_DOMAIN
	.comm	_M_WAITOK,4,2                   ## @M_WAITOK
	.comm	_M_ZERO,4,2                     ## @M_ZERO
	.comm	_dmar_domain_unload_task,4,2    ## @dmar_domain_unload_task
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"dmardom"

	.comm	_MTX_DEF,4,2                    ## @MTX_DEF
	.comm	_Maxmem,4,2                     ## @Maxmem
	.comm	_BUS_SPACE_MAXADDR,8,3          ## @BUS_SPACE_MAXADDR
	.comm	_DMAR_ECAP_PT,4,2               ## @DMAR_ECAP_PT
	.comm	_DMAR_DOMAIN_IDMAP,4,2          ## @DMAR_DOMAIN_IDMAP
	.no_dead_strip	_dmar_domain_alloc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function dmar_domain_alloc
_dmar_domain_alloc:                     ; @dmar_domain_alloc
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x21, x1
	mov	x20, x0
	ldr	w0, [x0, #4]
	bl	_alloc_unr
	cmn	w0, #1
	b.eq	LBB0_6
; %bb.1:
	mov	x22, x0
Lloh0:
	adrp	x8, _M_DMAR_DOMAIN@GOTPAGE
Lloh1:
	ldr	x8, [x8, _M_DMAR_DOMAIN@GOTPAGEOFF]
Lloh2:
	adrp	x9, _M_WAITOK@GOTPAGE
Lloh3:
	ldr	x9, [x9, _M_WAITOK@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
Lloh5:
	ldr	w8, [x9]
Lloh6:
	adrp	x9, _M_ZERO@GOTPAGE
Lloh7:
	ldr	x9, [x9, _M_ZERO@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	orr	w2, w9, w8
	mov	w0, #64
	bl	_malloc
	mov	x19, x0
	str	w22, [x0], #56
	bl	_LIST_INIT
	add	x0, x19, #52
	bl	_RB_INIT
	add	x0, x19, #48
	bl	_TAILQ_INIT
	add	x0, x19, #44
Lloh9:
	adrp	x8, _dmar_domain_unload_task@GOTPAGE
Lloh10:
	ldr	x8, [x8, _dmar_domain_unload_task@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
	mov	w1, #0
	mov	x3, x19
	bl	_TASK_INIT
	add	x0, x19, #40
Lloh12:
	adrp	x8, _MTX_DEF@GOTPAGE
Lloh13:
	ldr	x8, [x8, _MTX_DEF@GOTPAGEOFF]
Lloh14:
	ldr	w3, [x8]
Lloh15:
	adrp	x1, l_.str@PAGE
Lloh16:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, #0
	bl	_mtx_init
	str	x20, [x19, #32]
	cbz	w21, LBB0_3
; %bb.2:
Lloh17:
	adrp	x8, _Maxmem@GOTPAGE
Lloh18:
	ldr	x8, [x8, _Maxmem@GOTPAGEOFF]
Lloh19:
	ldr	w0, [x8]
	bl	_ptoa
	mov	x1, x0
	b	LBB0_4
LBB0_3:
Lloh20:
	adrp	x8, _BUS_SPACE_MAXADDR@GOTPAGE
Lloh21:
	ldr	x8, [x8, _BUS_SPACE_MAXADDR@GOTPAGEOFF]
Lloh22:
	ldr	x1, [x8]
LBB0_4:
	cmp	w21, #0
	cset	w2, eq
	str	x1, [x19, #8]
	mov	x0, x20
	bl	_dmar_maxaddr2mgaw
	mov	x1, x0
	mov	x0, x19
	bl	_domain_set_agaw
	cbz	w0, LBB0_8
LBB0_5:
	mov	x0, x19
	bl	_dmar_domain_destroy
LBB0_6:
	mov	x19, #0
LBB0_7:
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_8:
	cbz	w21, LBB0_12
; %bb.9:
	mov	x0, x19
	bl	_dmar_gas_init_domain
	ldr	w8, [x20]
Lloh23:
	adrp	x9, _DMAR_ECAP_PT@GOTPAGE
Lloh24:
	ldr	x9, [x9, _DMAR_ECAP_PT@GOTPAGEOFF]
Lloh25:
	ldr	w9, [x9]
	tst	w9, w8
	b.ne	LBB0_11
; %bb.10:
	ldr	x1, [x19, #8]
	mov	x0, x19
	bl	_domain_get_idmap_pgtbl
	str	w0, [x19, #24]
LBB0_11:
Lloh26:
	adrp	x8, _DMAR_DOMAIN_IDMAP@GOTPAGE
Lloh27:
	ldr	x8, [x8, _DMAR_DOMAIN_IDMAP@GOTPAGEOFF]
Lloh28:
	ldr	w8, [x8]
	ldr	w9, [x19, #20]
	orr	w8, w9, w8
	str	w8, [x19, #20]
	b	LBB0_7
LBB0_12:
	ldr	w8, [x19, #16]
	sub	w8, w8, #1
	mov	w9, #1
	lsl	x8, x9, x8
	str	x8, [x19, #8]
	mov	x0, x19
	bl	_dmar_gas_init_domain
	mov	x0, x19
	bl	_domain_alloc_pgtbl
	cbnz	w0, LBB0_5
; %bb.13:
	mov	w8, #-18874368
	orr	w2, w8, #0x100000
	mov	x0, x19
	mov	w1, #-18874368
	bl	_dmar_gas_reserve_region
	cbnz	w0, LBB0_5
	b	LBB0_7
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh4
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_M_DMAR_DOMAIN,4,2              ; @M_DMAR_DOMAIN
	.comm	_M_WAITOK,4,2                   ; @M_WAITOK
	.comm	_M_ZERO,4,2                     ; @M_ZERO
	.comm	_dmar_domain_unload_task,4,2    ; @dmar_domain_unload_task
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"dmardom"

	.comm	_MTX_DEF,4,2                    ; @MTX_DEF
	.comm	_Maxmem,4,2                     ; @Maxmem
	.comm	_BUS_SPACE_MAXADDR,8,3          ; @BUS_SPACE_MAXADDR
	.comm	_DMAR_ECAP_PT,4,2               ; @DMAR_ECAP_PT
	.comm	_DMAR_DOMAIN_IDMAP,4,2          ; @DMAR_DOMAIN_IDMAP
	.no_dead_strip	_dmar_domain_alloc
.subsections_via_symbols
