	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function init_iommu_perf_ctr
_init_iommu_perf_ctr:                   ## @init_iommu_perf_ctr
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	24(%rdi), %r14
	movl	$43981, -32(%rbp)               ## imm = 0xABCD
	movl	$0, -28(%rbp)
	movq	_FEATURE_PC@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_iommu_feature
	testl	%eax, %eax
	je	LBB0_6
## %bb.1:
	movq	_amd_iommu_pc_present@GOTPCREL(%rip), %r15
	movl	$1, (%r15)
	leaq	-32(%rbp), %r8
	movq	%rbx, %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	movl	$1, %r9d
	callq	_iommu_pc_get_set_reg
	testq	%rax, %rax
	jne	LBB0_4
## %bb.2:
	leaq	-28(%rbp), %r8
	movq	%rbx, %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	xorl	%r9d, %r9d
	callq	_iommu_pc_get_set_reg
	testq	%rax, %rax
	jne	LBB0_4
## %bb.3:
	movl	-32(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jne	LBB0_4
## %bb.5:
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdi
	callq	_pci_info
	movq	_MMIO_CNTR_CONF_OFFSET@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	16(%rbx), %rdi
	callq	_readl
                                        ## kill: def $eax killed $eax def $rax
	movl	%eax, %ecx
	shrl	$12, %ecx
	andl	$63, %ecx
	movq	%rcx, 8(%rbx)
	shrl	$7, %eax
	andl	$15, %eax
	movq	%rax, (%rbx)
	jmp	LBB0_6
LBB0_4:
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	callq	_pci_err
	movl	$0, (%r15)
LBB0_6:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_FEATURE_PC,4,2                 ## @FEATURE_PC
	.comm	_amd_iommu_pc_present,4,2       ## @amd_iommu_pc_present
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Unable to write to IOMMU perf counter.\n"

L_.str.1:                               ## @.str.1
	.asciz	"IOMMU performance counters supported\n"

	.comm	_MMIO_CNTR_CONF_OFFSET,8,3      ## @MMIO_CNTR_CONF_OFFSET
	.no_dead_strip	_init_iommu_perf_ctr
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function init_iommu_perf_ctr
_init_iommu_perf_ctr:                   ; @init_iommu_perf_ctr
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x19, x0
	ldr	x20, [x0, #24]
	mov	w8, #43981
	stp	wzr, w8, [sp, #8]
Lloh0:
	adrp	x8, _FEATURE_PC@GOTPAGE
Lloh1:
	ldr	x8, [x8, _FEATURE_PC@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_iommu_feature
	cbz	w0, LBB0_6
; %bb.1:
Lloh3:
	adrp	x21, _amd_iommu_pc_present@GOTPAGE
Lloh4:
	ldr	x21, [x21, _amd_iommu_pc_present@GOTPAGEOFF]
	mov	w8, #1
	str	w8, [x21]
	add	x4, sp, #12
	mov	x0, x19
	mov	w1, #0
	mov	w2, #0
	mov	w3, #0
	mov	w5, #1
	bl	_iommu_pc_get_set_reg
	cbnz	x0, LBB0_5
; %bb.2:
	add	x4, sp, #8
	mov	x0, x19
	mov	w1, #0
	mov	w2, #0
	mov	w3, #0
	mov	w5, #0
	bl	_iommu_pc_get_set_reg
	cbnz	x0, LBB0_5
; %bb.3:
	ldp	w9, w8, [sp, #8]
	cmp	w8, w9
	b.ne	LBB0_5
; %bb.4:
Lloh5:
	adrp	x1, l_.str.1@PAGE
Lloh6:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x20
	bl	_pci_info
	ldr	x8, [x19, #16]
Lloh7:
	adrp	x9, _MMIO_CNTR_CONF_OFFSET@GOTPAGE
Lloh8:
	ldr	x9, [x9, _MMIO_CNTR_CONF_OFFSET@GOTPAGEOFF]
Lloh9:
	ldr	x9, [x9]
	add	x0, x9, x8
	bl	_readl
	ubfx	w8, w0, #12, #6
	ubfx	w9, w0, #7, #4
	stp	x9, x8, [x19]
	b	LBB0_6
LBB0_5:
Lloh10:
	adrp	x1, l_.str@PAGE
Lloh11:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	bl	_pci_err
	str	wzr, [x21]
LBB0_6:
	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
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_FEATURE_PC,4,2                 ; @FEATURE_PC
	.comm	_amd_iommu_pc_present,4,2       ; @amd_iommu_pc_present
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Unable to write to IOMMU perf counter.\n"

l_.str.1:                               ; @.str.1
	.asciz	"IOMMU performance counters supported\n"

	.comm	_MMIO_CNTR_CONF_OFFSET,8,3      ; @MMIO_CNTR_CONF_OFFSET
	.no_dead_strip	_init_iommu_perf_ctr
.subsections_via_symbols
