	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_dmar_init_irt                  ## -- Begin function dmar_init_irt
	.p2align	4, 0x90
_dmar_init_irt:                         ## @dmar_init_irt
	.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	_DMAR_ECAP_IR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	xorl	%r14d, %r14d
	testl	%eax, (%rdi)
	je	LBB0_11
## %bb.1:
	movq	%rdi, %rbx
	leaq	4(%rdi), %r15
	movl	$1, 4(%rdi)
	leaq	L_.str(%rip), %rdi
	movq	%r15, %rsi
	callq	_TUNABLE_INT_FETCH
	cmpl	$0, 4(%rbx)
	je	LBB0_11
## %bb.2:
	cmpl	$0, 32(%rbx)
	je	LBB0_3
## %bb.5:
	movq	_num_io_irqs@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_clp2
	movl	%eax, %r15d
	movl	%eax, 8(%rbx)
	shll	$2, %r15d
	movq	_M_ZERO@GOTPCREL(%rip), %rax
	movq	_M_WAITOK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r12d
	orl	(%rax), %r12d
	movq	_dmar_high@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movq	%rbx, %rdi
	callq	_DMAR_IS_COHERENT
	testq	%rax, %rax
	jne	LBB0_6
## %bb.7:
	movq	_VM_MEMATTR_UNCACHEABLE@GOTPCREL(%rip), %rax
	jmp	LBB0_8
LBB0_3:
	movl	$0, (%r15)
	movq	_bootverbose@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_11
## %bb.4:
	movl	28(%rbx), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_device_printf
	jmp	LBB0_11
LBB0_6:
	movq	_VM_MEMATTR_DEFAULT@GOTPCREL(%rip), %rax
LBB0_8:
	movl	%r14d, %ecx
	movl	(%rax), %eax
	movl	%eax, (%rsp)
	xorl	%r14d, %r14d
	movl	%r15d, %edi
	movl	%r12d, %esi
	xorl	%edx, %edx
	movl	%r13d, %r8d
	xorl	%r9d, %r9d
	callq	_kmem_alloc_contig
	movq	%rax, 16(%rbx)
	testq	%rax, %rax
	je	LBB0_9
## %bb.10:
	movl	%eax, %edi
	callq	_pmap_kextract
	movl	%eax, 24(%rbx)
	movl	8(%rbx), %edx
	movq	_M_FIRSTFIT@GOTPCREL(%rip), %rax
	movq	_M_NOWAIT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r9d
	orl	(%rax), %r9d
	leaq	L_.str.2(%rip), %rdi
	xorl	%esi, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	callq	_vmem_create
	movl	%eax, 12(%rbx)
	movq	%rbx, %rdi
	callq	_DMAR_LOCK
	movq	%rbx, %rdi
	callq	_dmar_load_irt_ptr
	movq	%rbx, %rdi
	callq	_dmar_qi_invalidate_iec_glob
	movq	%rbx, %rdi
	callq	_DMAR_UNLOCK
	xorl	%eax, %eax
	callq	_intr_reprogram
	movq	%rbx, %rdi
	callq	_DMAR_LOCK
	movq	%rbx, %rdi
	callq	_dmar_enable_ir
	movq	%rbx, %rdi
	callq	_DMAR_UNLOCK
	jmp	LBB0_11
LBB0_9:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
LBB0_11:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DMAR_ECAP_IR,4,2               ## @DMAR_ECAP_IR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"hw.dmar.ir"

	.comm	_bootverbose,8,3                ## @bootverbose
L_.str.1:                               ## @.str.1
	.asciz	"QI disabled, disabling interrupt remapping\n"

	.comm	_num_io_irqs,4,2                ## @num_io_irqs
	.comm	_M_ZERO,4,2                     ## @M_ZERO
	.comm	_M_WAITOK,4,2                   ## @M_WAITOK
	.comm	_dmar_high,4,2                  ## @dmar_high
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_VM_MEMATTR_DEFAULT,4,2         ## @VM_MEMATTR_DEFAULT
	.comm	_VM_MEMATTR_UNCACHEABLE,4,2     ## @VM_MEMATTR_UNCACHEABLE
	.comm	_ENOMEM,4,2                     ## @ENOMEM
L_.str.2:                               ## @.str.2
	.asciz	"dmarirt"

	.comm	_M_FIRSTFIT,4,2                 ## @M_FIRSTFIT
	.comm	_M_NOWAIT,4,2                   ## @M_NOWAIT
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_dmar_init_irt                  ; -- Begin function dmar_init_irt
	.p2align	2
_dmar_init_irt:                         ; @dmar_init_irt
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	ldr	w8, [x0]
Lloh0:
	adrp	x9, _DMAR_ECAP_IR@GOTPAGE
Lloh1:
	ldr	x9, [x9, _DMAR_ECAP_IR@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_7
; %bb.1:
	mov	x19, x0
	mov	w8, #1
	mov	x20, x0
	str	w8, [x20, #4]!
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x20
	bl	_TUNABLE_INT_FETCH
	ldr	w8, [x20]
	cbz	w8, LBB0_7
; %bb.2:
	ldr	w8, [x19, #32]
	cbz	w8, LBB0_5
; %bb.3:
Lloh5:
	adrp	x8, _num_io_irqs@GOTPAGE
Lloh6:
	ldr	x8, [x8, _num_io_irqs@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
	bl	_clp2
	str	w0, [x19, #8]
Lloh8:
	adrp	x8, _M_ZERO@GOTPAGE
Lloh9:
	ldr	x8, [x8, _M_ZERO@GOTPAGEOFF]
	lsl	w20, w0, #2
Lloh10:
	ldr	w8, [x8]
Lloh11:
	adrp	x9, _M_WAITOK@GOTPAGE
Lloh12:
	ldr	x9, [x9, _M_WAITOK@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	orr	w21, w9, w8
Lloh14:
	adrp	x8, _dmar_high@GOTPAGE
Lloh15:
	ldr	x8, [x8, _dmar_high@GOTPAGEOFF]
Lloh16:
	ldr	w22, [x8]
Lloh17:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh18:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh19:
	ldr	w23, [x8]
	mov	x0, x19
	bl	_DMAR_IS_COHERENT
Lloh20:
	adrp	x8, _VM_MEMATTR_DEFAULT@GOTPAGE
Lloh21:
	ldr	x8, [x8, _VM_MEMATTR_DEFAULT@GOTPAGEOFF]
Lloh22:
	adrp	x9, _VM_MEMATTR_UNCACHEABLE@GOTPAGE
Lloh23:
	ldr	x9, [x9, _VM_MEMATTR_UNCACHEABLE@GOTPAGEOFF]
	cmp	x0, #0
	csel	x8, x9, x8, eq
	ldr	w6, [x8]
	mov	x0, x20
	mov	x1, x21
	mov	w2, #0
	mov	x3, x22
	mov	x4, x23
	mov	w5, #0
	bl	_kmem_alloc_contig
	str	x0, [x19, #16]
	cbz	x0, LBB0_9
; %bb.4:
                                        ; kill: def $w0 killed $w0 killed $x0
	bl	_pmap_kextract
	str	w0, [x19, #24]
Lloh24:
	adrp	x8, _M_FIRSTFIT@GOTPAGE
Lloh25:
	ldr	x8, [x8, _M_FIRSTFIT@GOTPAGEOFF]
	ldr	w2, [x19, #8]
Lloh26:
	ldr	w8, [x8]
Lloh27:
	adrp	x9, _M_NOWAIT@GOTPAGE
Lloh28:
	ldr	x9, [x9, _M_NOWAIT@GOTPAGEOFF]
Lloh29:
	ldr	w9, [x9]
	orr	w5, w9, w8
Lloh30:
	adrp	x0, l_.str.2@PAGE
Lloh31:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	w1, #0
	mov	w3, #1
	mov	w4, #0
	bl	_vmem_create
	str	w0, [x19, #12]
	mov	x0, x19
	bl	_DMAR_LOCK
	mov	x0, x19
	bl	_dmar_load_irt_ptr
	mov	x0, x19
	bl	_dmar_qi_invalidate_iec_glob
	mov	x0, x19
	bl	_DMAR_UNLOCK
	bl	_intr_reprogram
	mov	x0, x19
	bl	_DMAR_LOCK
	mov	x0, x19
	bl	_dmar_enable_ir
	mov	x0, x19
	bl	_DMAR_UNLOCK
	b	LBB0_7
LBB0_5:
	str	wzr, [x20]
Lloh32:
	adrp	x8, _bootverbose@GOTPAGE
Lloh33:
	ldr	x8, [x8, _bootverbose@GOTPAGEOFF]
Lloh34:
	ldr	x8, [x8]
	cbz	x8, LBB0_7
; %bb.6:
	ldr	w0, [x19, #28]
Lloh35:
	adrp	x1, l_.str.1@PAGE
Lloh36:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_device_printf
LBB0_7:
	mov	w0, #0
LBB0_8:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_9:
Lloh37:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh38:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh39:
	ldr	w0, [x8]
	b	LBB0_8
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh20, Lloh21
	.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 AdrpAdd	Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpAdd	Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.cfi_endproc
                                        ; -- End function
	.comm	_DMAR_ECAP_IR,4,2               ; @DMAR_ECAP_IR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"hw.dmar.ir"

	.comm	_bootverbose,8,3                ; @bootverbose
l_.str.1:                               ; @.str.1
	.asciz	"QI disabled, disabling interrupt remapping\n"

	.comm	_num_io_irqs,4,2                ; @num_io_irqs
	.comm	_M_ZERO,4,2                     ; @M_ZERO
	.comm	_M_WAITOK,4,2                   ; @M_WAITOK
	.comm	_dmar_high,4,2                  ; @dmar_high
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_VM_MEMATTR_DEFAULT,4,2         ; @VM_MEMATTR_DEFAULT
	.comm	_VM_MEMATTR_UNCACHEABLE,4,2     ; @VM_MEMATTR_UNCACHEABLE
	.comm	_ENOMEM,4,2                     ; @ENOMEM
l_.str.2:                               ; @.str.2
	.asciz	"dmarirt"

	.comm	_M_FIRSTFIT,4,2                 ; @M_FIRSTFIT
	.comm	_M_NOWAIT,4,2                   ; @M_NOWAIT
.subsections_via_symbols
