	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ivhd_identify
_ivhd_identify:                         ## @ivhd_identify
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	leaq	L_.str(%rip), %rdi
	callq	_acpi_disabled
	testq	%rax, %rax
	jne	LBB0_21
## %bb.1:
	movq	_ACPI_SIG_IVRS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	-56(%rbp), %rdx
	movl	$1, %esi
	callq	_AcpiGetTable
	movl	%eax, %edi
	callq	_ACPI_FAILURE
	testq	%rax, %rax
	je	LBB0_2
LBB0_21:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movq	-56(%rbp), %rax
	cmpq	$0, 8(%rax)
	je	LBB0_21
## %bb.3:
	movl	(%rax), %ebx
	movl	%ebx, %edi
	movl	$21, %esi
	movl	$15, %edx
	callq	_REG_BITS
	movl	%eax, %r15d
	movl	%ebx, %edi
	movl	$14, %esi
	movl	$8, %edx
	callq	_REG_BITS
	movl	%eax, %r12d
	movl	%ebx, %edi
	movl	$7, %esi
	movl	$5, %edx
	callq	_REG_BITS
	movl	%eax, %r13d
	movl	%ebx, %edi
	movl	$22, %esi
	movl	$22, %edx
	callq	_REG_BITS
	leaq	L_.str.1(%rip), %rdi
	leaq	L_.str.2(%rip), %r9
	movl	%r15d, %esi
	movl	%r12d, %edx
	movl	%r13d, %ecx
	movl	%eax, %r8d
	xorl	%eax, %eax
	callq	_printf
	movq	_ivhd_count_iter@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	xorl	%esi, %esi
	callq	_ivrs_hdr_iterate_tbl
	movq	_ivhd_count@GOTPCREL(%rip), %r12
	movl	(%r12), %edi
	testl	%edi, %edi
	je	LBB0_21
## %bb.4:
	jle	LBB0_13
## %bb.5:
	xorl	%ebx, %ebx
	movq	_ivhd_hdrs@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movl	%ebx, %edi
	callq	_ivhd_find_by_index
	movq	%rax, %r15
	movq	%rax, %rdi
	movq	%rbx, %rsi
	callq	_KASSERT
	movq	(%r13), %rax
	movq	%r15, (%rax,%rbx,8)
	incq	%rbx
	movslq	(%r12), %rdi
	cmpq	%rdi, %rbx
	jl	LBB0_6
## %bb.7:
	cmpl	$2, %edi
	jl	LBB0_13
## %bb.8:
	movl	%r14d, -44(%rbp)                ## 4-byte Spill
	movl	%edi, %ebx
	movl	$4294967294, %r15d              ## imm = 0xFFFFFFFE
	addq	%rbx, %r15
	decq	%rbx
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_9 Depth=1
	decq	%r15
	leaq	-1(%rbx), %rax
	incq	%rbx
	cmpq	$2, %rbx
	movq	%rax, %rbx
	jbe	LBB0_12
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r13), %rax
	movl	%r15d, %r12d
	movq	(%rax,%r12,8), %rdi
	movl	%ebx, %r14d
	movq	(%rax,%r14,8), %rsi
	callq	_ivhd_is_newer
	testq	%rax, %rax
	je	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=1
	movq	(%r13), %rax
	movq	(%rax,%r14,8), %rcx
	movq	%rcx, (%rax,%r12,8)
	movq	_ivhd_count@GOTPCREL(%rip), %rax
	decl	(%rax)
	jmp	LBB0_11
LBB0_12:
	movq	_ivhd_count@GOTPCREL(%rip), %r12
	movl	(%r12), %edi
	movl	-44(%rbp), %r14d                ## 4-byte Reload
LBB0_13:
	shll	$2, %edi
	movq	_M_DEVBUF@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_M_WAITOK@GOTPCREL(%rip), %rax
	movq	_M_ZERO@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_malloc
	movq	_ivhd_devs@GOTPCREL(%rip), %r13
	movq	%rax, (%r13)
	cmpl	$0, (%r12)
	jle	LBB0_14
## %bb.15:
	xorl	%ebx, %ebx
	leaq	L_.str(%rip), %r15
	jmp	LBB0_16
	.p2align	4, 0x90
LBB0_19:                                ##   in Loop: Header=BB0_16 Depth=1
	incq	%rbx
	movslq	(%r12), %rax
	cmpq	%rax, %rbx
	jge	LBB0_20
LBB0_16:                                ## =>This Inner Loop Header: Depth=1
	movq	_ivhd_hdrs@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%rax,%rbx,8), %rdi
	movq	%rbx, %rsi
	callq	_KASSERT
	movq	_ACPI_DEV_BASE_ORDER@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	$100, %rsi
	movl	%r14d, %edi
	movq	%r15, %rdx
	movl	%ebx, %ecx
	callq	_BUS_ADD_CHILD
	movq	(%r13), %rcx
	movq	%rax, (%rcx,%rbx,8)
	movq	(%r13), %rax
	cmpq	$0, (%rax,%rbx,8)
	jne	LBB0_19
## %bb.17:                              ##   in Loop: Header=BB0_16 Depth=1
	movl	%r14d, %edi
	movq	%r15, %rsi
	movl	%ebx, %edx
	callq	_device_find_child
	movq	(%r13), %rcx
	movq	%rax, (%rcx,%rbx,8)
	movq	(%r13), %rax
	cmpq	$0, (%rax,%rbx,8)
	jne	LBB0_19
## %bb.18:
	leaq	L_.str.4(%rip), %rdi
	movl	%ebx, %esi
	xorl	%eax, %eax
	callq	_printf
	jmp	LBB0_20
LBB0_14:
	xorl	%ebx, %ebx
LBB0_20:
	movl	%ebx, (%r12)
	jmp	LBB0_21
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ivhd"

	.comm	_ACPI_SIG_IVRS,4,2              ## @ACPI_SIG_IVRS
L_.str.1:                               ## @.str.1
	.asciz	"AMD-Vi: IVRS Info VAsize = %d PAsize = %d GVAsize = %d flags:%b\n"

L_.str.2:                               ## @.str.2
	.asciz	"\020\001EFRSup"

	.comm	_ivhd_count_iter,4,2            ## @ivhd_count_iter
	.comm	_ivhd_count,4,2                 ## @ivhd_count
	.comm	_ivhd_hdrs,8,3                  ## @ivhd_hdrs
	.comm	_M_DEVBUF,4,2                   ## @M_DEVBUF
	.comm	_M_WAITOK,4,2                   ## @M_WAITOK
	.comm	_M_ZERO,4,2                     ## @M_ZERO
	.comm	_ivhd_devs,8,3                  ## @ivhd_devs
	.comm	_ACPI_DEV_BASE_ORDER,8,3        ## @ACPI_DEV_BASE_ORDER
L_.str.4:                               ## @.str.4
	.asciz	"AMD-Vi: cant find ivhd%d\n"

	.no_dead_strip	_ivhd_identify
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ivhd_identify
_ivhd_identify:                         ; @ivhd_identify
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	mov	x19, x1
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_acpi_disabled
	cbnz	x0, LBB0_2
; %bb.1:
Lloh2:
	adrp	x8, _ACPI_SIG_IVRS@GOTPAGE
Lloh3:
	ldr	x8, [x8, _ACPI_SIG_IVRS@GOTPAGEOFF]
Lloh4:
	ldr	w0, [x8]
	add	x2, sp, #40
	mov	w1, #1
	bl	_AcpiGetTable
	bl	_ACPI_FAILURE
	cbz	x0, LBB0_3
LBB0_2:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_3:
	ldr	x8, [sp, #40]
	ldr	x9, [x8, #8]
	cbz	x9, LBB0_2
; %bb.4:
	ldr	w20, [x8]
	mov	x0, x20
	mov	w1, #21
	mov	w2, #15
	bl	_REG_BITS
	mov	x21, x0
	mov	x0, x20
	mov	w1, #14
	mov	w2, #8
	bl	_REG_BITS
	mov	x22, x0
	mov	x0, x20
	mov	w1, #7
	mov	w2, #5
	bl	_REG_BITS
	mov	x23, x0
	mov	x0, x20
	mov	w1, #22
	mov	w2, #22
	bl	_REG_BITS
                                        ; kill: def $w0 killed $w0 def $x0
Lloh5:
	adrp	x8, l_.str.2@PAGE
Lloh6:
	add	x8, x8, l_.str.2@PAGEOFF
	stp	x0, x8, [sp, #16]
	stp	x22, x23, [sp]
Lloh7:
	adrp	x0, l_.str.1@PAGE
Lloh8:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x21
	bl	_printf
Lloh9:
	adrp	x8, _ivhd_count_iter@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ivhd_count_iter@GOTPAGEOFF]
Lloh11:
	ldr	w0, [x8]
	mov	x1, #0
	bl	_ivrs_hdr_iterate_tbl
Lloh12:
	adrp	x22, _ivhd_count@GOTPAGE
Lloh13:
	ldr	x22, [x22, _ivhd_count@GOTPAGEOFF]
	ldr	w8, [x22]
	cbz	w8, LBB0_2
; %bb.5:
Lloh14:
	adrp	x23, _ivhd_hdrs@GOTPAGE
Lloh15:
	ldr	x23, [x23, _ivhd_hdrs@GOTPAGEOFF]
	cmp	w8, #1
	b.lt	LBB0_14
; %bb.6:
	mov	x20, #0
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	bl	_ivhd_find_by_index
	mov	x21, x0
	mov	x1, x20
	bl	_KASSERT
	ldr	x8, [x23]
	str	x21, [x8, x20, lsl #3]
	add	x20, x20, #1
	ldrsw	x8, [x22]
	cmp	x20, x8
	b.lt	LBB0_7
; %bb.8:
	cmp	w8, #1
	b.le	LBB0_14
; %bb.9:
	and	x8, x8, #0xffffffff
	b	LBB0_11
LBB0_10:                                ;   in Loop: Header=BB0_11 Depth=1
	add	x9, x20, #1
	mov	x8, x20
	cmp	x9, #2
	b.ls	LBB0_13
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	sub	x20, x8, #1
	ldr	x9, [x23]
	sub	w21, w8, #2
	ldr	x0, [x9, w21, uxtw #3]
	ldr	x1, [x9, w20, uxtw #3]
	bl	_ivhd_is_newer
	cbz	x0, LBB0_10
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	and	x8, x20, #0xffffffff
	ldr	x9, [x23]
	ldr	x8, [x9, x8, lsl #3]
	str	x8, [x9, x21, lsl #3]
	ldr	w8, [x22]
	sub	w8, w8, #1
	str	w8, [x22]
	b	LBB0_10
LBB0_13:
	ldr	w8, [x22]
LBB0_14:
	lsl	w0, w8, #2
Lloh16:
	adrp	x8, _M_DEVBUF@GOTPAGE
Lloh17:
	ldr	x8, [x8, _M_DEVBUF@GOTPAGEOFF]
Lloh18:
	adrp	x9, _M_WAITOK@GOTPAGE
Lloh19:
	ldr	x9, [x9, _M_WAITOK@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
Lloh21:
	ldr	w8, [x9]
Lloh22:
	adrp	x9, _M_ZERO@GOTPAGE
Lloh23:
	ldr	x9, [x9, _M_ZERO@GOTPAGEOFF]
Lloh24:
	ldr	w9, [x9]
	orr	w2, w9, w8
	bl	_malloc
Lloh25:
	adrp	x24, _ivhd_devs@GOTPAGE
Lloh26:
	ldr	x24, [x24, _ivhd_devs@GOTPAGEOFF]
	str	x0, [x24]
	ldr	w8, [x22]
	cmp	w8, #1
	b.lt	LBB0_20
; %bb.15:
	mov	x20, #0
Lloh27:
	adrp	x25, _ACPI_DEV_BASE_ORDER@GOTPAGE
Lloh28:
	ldr	x25, [x25, _ACPI_DEV_BASE_ORDER@GOTPAGEOFF]
Lloh29:
	adrp	x21, l_.str@PAGE
Lloh30:
	add	x21, x21, l_.str@PAGEOFF
	b	LBB0_17
LBB0_16:                                ;   in Loop: Header=BB0_17 Depth=1
	add	x20, x20, #1
	ldrsw	x8, [x22]
	cmp	x20, x8
	b.ge	LBB0_21
LBB0_17:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x23]
	lsl	x26, x20, #3
	ldr	x0, [x8, x26]
	mov	x1, x20
	bl	_KASSERT
	ldr	x8, [x25]
	add	x1, x8, #100
	mov	x0, x19
	mov	x2, x21
	mov	x3, x20
	bl	_BUS_ADD_CHILD
	ldr	x8, [x24]
	str	x0, [x8, x26]
	ldr	x8, [x24]
	ldr	x8, [x8, x26]
	cbnz	x8, LBB0_16
; %bb.18:                               ;   in Loop: Header=BB0_17 Depth=1
	mov	x0, x19
	mov	x1, x21
	mov	x2, x20
	bl	_device_find_child
	ldr	x8, [x24]
	str	x0, [x8, x26]
	ldr	x8, [x24]
	ldr	x8, [x8, x26]
	cbnz	x8, LBB0_16
; %bb.19:
Lloh31:
	adrp	x0, l_.str.4@PAGE
Lloh32:
	add	x0, x0, l_.str.4@PAGEOFF
	mov	x1, x20
	bl	_printf
	b	LBB0_21
LBB0_20:
	mov	w20, #0
LBB0_21:
	str	w20, [x22]
	b	LBB0_2
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh20
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpAdd	Lloh31, Lloh32
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ivhd"

	.comm	_ACPI_SIG_IVRS,4,2              ; @ACPI_SIG_IVRS
l_.str.1:                               ; @.str.1
	.asciz	"AMD-Vi: IVRS Info VAsize = %d PAsize = %d GVAsize = %d flags:%b\n"

l_.str.2:                               ; @.str.2
	.asciz	"\020\001EFRSup"

	.comm	_ivhd_count_iter,4,2            ; @ivhd_count_iter
	.comm	_ivhd_count,4,2                 ; @ivhd_count
	.comm	_ivhd_hdrs,8,3                  ; @ivhd_hdrs
	.comm	_M_DEVBUF,4,2                   ; @M_DEVBUF
	.comm	_M_WAITOK,4,2                   ; @M_WAITOK
	.comm	_M_ZERO,4,2                     ; @M_ZERO
	.comm	_ivhd_devs,8,3                  ; @ivhd_devs
	.comm	_ACPI_DEV_BASE_ORDER,8,3        ; @ACPI_DEV_BASE_ORDER
l_.str.4:                               ; @.str.4
	.asciz	"AMD-Vi: cant find ivhd%d\n"

	.no_dead_strip	_ivhd_identify
.subsections_via_symbols
