	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function amd_iommu_add_device
_amd_iommu_add_device:                  ## @amd_iommu_add_device
	.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	%rdi, %rbx
	callq	_check_device
	xorl	%r14d, %r14d
	testl	%eax, %eax
	je	LBB0_14
## %bb.1:
	movq	%rbx, %rdi
	callq	_get_dev_data
	testq	%rax, %rax
	jne	LBB0_14
## %bb.2:
	movq	%rbx, %rdi
	callq	_get_device_id
	testl	%eax, %eax
	js	LBB0_3
## %bb.4:
	movq	_amd_iommu_rlookup_table@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	%eax, %eax
	movq	(%rcx,%rax,8), %r15
	movq	%rbx, %rdi
	callq	_iommu_init_device
	testl	%eax, %eax
	je	LBB0_8
## %bb.5:
	movq	_ENOTSUPP@GOTPCREL(%rip), %rcx
	addl	(%rcx), %eax
	je	LBB0_7
## %bb.6:
	leaq	L_.str(%rip), %rsi
	movq	%rbx, %rdi
	callq	_dev_err
LBB0_7:
	movq	%rbx, %rdi
	callq	_iommu_ignore_device
	movq	$0, (%rbx)
	jmp	LBB0_13
LBB0_3:
	movl	%eax, %r14d
	jmp	LBB0_14
LBB0_8:
	movq	%rbx, %rdi
	callq	_init_iommu_group
	movq	%rbx, %rdi
	callq	_get_dev_data
	movq	%rax, %r12
	xorl	%edi, %edi
	testq	%rax, %rax
	sete	%dil
	callq	_BUG_ON
	cmpq	$0, 8(%r12)
	je	LBB0_10
## %bb.9:
	movq	%rbx, %rdi
	callq	_iommu_request_dm_for_dev
LBB0_10:
	movq	%rbx, %rdi
	callq	_iommu_get_domain_for_dev
	movq	(%rax), %rax
	movq	_IOMMU_DOMAIN_IDENTITY@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_12
## %bb.11:
	movl	$1, (%r12)
	jmp	LBB0_13
LBB0_12:
	movq	_amd_iommu_dma_ops@GOTPCREL(%rip), %rax
	movq	%rax, (%rbx)
LBB0_13:
	movq	%r15, %rdi
	callq	_iommu_completion_wait
LBB0_14:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_amd_iommu_rlookup_table,8,3    ## @amd_iommu_rlookup_table
	.comm	_ENOTSUPP,4,2                   ## @ENOTSUPP
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to initialize - trying to proceed anyway\n"

	.comm	_IOMMU_DOMAIN_IDENTITY,8,3      ## @IOMMU_DOMAIN_IDENTITY
	.comm	_amd_iommu_dma_ops,4,2          ## @amd_iommu_dma_ops
	.no_dead_strip	_amd_iommu_add_device
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function amd_iommu_add_device
_amd_iommu_add_device:                  ; @amd_iommu_add_device
	.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	x19, x0
	bl	_check_device
	cbz	w0, LBB0_14
; %bb.1:
	mov	x0, x19
	bl	_get_dev_data
	cbnz	x0, LBB0_13
; %bb.2:
	mov	x0, x19
	bl	_get_device_id
	tbnz	w0, #31, LBB0_14
; %bb.3:
Lloh0:
	adrp	x8, _amd_iommu_rlookup_table@GOTPAGE
Lloh1:
	ldr	x8, [x8, _amd_iommu_rlookup_table@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	ldr	x20, [x8, w0, uxtw #3]
	mov	x0, x19
	bl	_iommu_init_device
	cbz	w0, LBB0_7
; %bb.4:
Lloh3:
	adrp	x8, _ENOTSUPP@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ENOTSUPP@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmn	w0, w8
	b.eq	LBB0_6
; %bb.5:
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_dev_err
LBB0_6:
	mov	x0, x19
	bl	_iommu_ignore_device
	str	xzr, [x19]
	b	LBB0_12
LBB0_7:
	mov	x0, x19
	bl	_init_iommu_group
	mov	x0, x19
	bl	_get_dev_data
	mov	x21, x0
	cmp	x0, #0
	cset	w0, eq
	bl	_BUG_ON
	ldr	x8, [x21, #8]
	cbz	x8, LBB0_9
; %bb.8:
	mov	x0, x19
	bl	_iommu_request_dm_for_dev
LBB0_9:
	mov	x0, x19
	bl	_iommu_get_domain_for_dev
	ldr	x8, [x0]
Lloh8:
	adrp	x9, _IOMMU_DOMAIN_IDENTITY@GOTPAGE
Lloh9:
	ldr	x9, [x9, _IOMMU_DOMAIN_IDENTITY@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_11
; %bb.10:
	mov	w8, #1
	str	w8, [x21]
	b	LBB0_12
LBB0_11:
Lloh11:
	adrp	x8, _amd_iommu_dma_ops@GOTPAGE
Lloh12:
	ldr	x8, [x8, _amd_iommu_dma_ops@GOTPAGEOFF]
	str	x8, [x19]
LBB0_12:
	mov	x0, x20
	bl	_iommu_completion_wait
LBB0_13:
	mov	w0, #0
LBB0_14:
	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 AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_amd_iommu_rlookup_table,8,3    ; @amd_iommu_rlookup_table
	.comm	_ENOTSUPP,4,2                   ; @ENOTSUPP
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to initialize - trying to proceed anyway\n"

	.comm	_IOMMU_DOMAIN_IDENTITY,8,3      ; @IOMMU_DOMAIN_IDENTITY
	.comm	_amd_iommu_dma_ops,4,2          ; @amd_iommu_dma_ops
	.no_dead_strip	_amd_iommu_add_device
.subsections_via_symbols
