	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_kfd_iommu_add_perf_counters    ## -- Begin function kfd_iommu_add_perf_counters
	.p2align	4, 0x90
_kfd_iommu_add_perf_counters:           ## @kfd_iommu_add_perf_counters
	.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
	movq	_HSA_CAP_ATS_PRESENT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 4(%rdi)
	je	LBB0_1
## %bb.2:
	movq	%rdi, %r14
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_amd_iommu_pc_supported
	testl	%eax, %eax
	je	LBB0_6
## %bb.3:
	callq	_kfd_alloc_struct
	testq	%rax, %rax
	je	LBB0_4
## %bb.5:
	movq	%rax, %r15
	movl	8(%rax), %edi
	leaq	L_.str(%rip), %rsi
	callq	_strcpy
	xorl	%ebx, %ebx
	xorl	%edi, %edi
	callq	_amd_iommu_pc_get_max_banks
	movl	%eax, %r12d
	xorl	%edi, %edi
	callq	_amd_iommu_pc_get_max_counters
	imull	%r12d, %eax
	movl	%eax, (%r15)
	addq	$4, %r15
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_list_add_tail
	jmp	LBB0_6
LBB0_1:
	xorl	%ebx, %ebx
	jmp	LBB0_6
LBB0_4:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_6:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_HSA_CAP_ATS_PRESENT,4,2        ## @HSA_CAP_ATS_PRESENT
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"iommu"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_kfd_iommu_add_perf_counters    ; -- Begin function kfd_iommu_add_perf_counters
	.p2align	2
_kfd_iommu_add_perf_counters:           ; @kfd_iommu_add_perf_counters
	.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
	ldr	w8, [x0, #4]
Lloh0:
	adrp	x9, _HSA_CAP_ATS_PRESENT@GOTPAGE
Lloh1:
	ldr	x9, [x9, _HSA_CAP_ATS_PRESENT@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_4
; %bb.1:
	mov	x19, x0
	bl	_amd_iommu_pc_supported
	cbz	w0, LBB0_6
; %bb.2:
	bl	_kfd_alloc_struct
	cbz	x0, LBB0_5
; %bb.3:
	mov	x20, x0
	ldr	w0, [x0, #8]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	bl	_strcpy
	mov	w0, #0
	bl	_amd_iommu_pc_get_max_banks
	mov	x21, x0
	mov	w0, #0
	bl	_amd_iommu_pc_get_max_counters
	mul	w8, w0, w21
	str	w8, [x20]
	add	x0, x20, #4
	mov	x1, x19
	bl	_list_add_tail
LBB0_4:
	mov	w0, #0
	b	LBB0_6
LBB0_5:
Lloh5:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_6:
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_HSA_CAP_ATS_PRESENT,4,2        ; @HSA_CAP_ATS_PRESENT
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"iommu"

.subsections_via_symbols
