	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amd_iommu_init_device          ## -- Begin function amd_iommu_init_device
	.p2align	4, 0x90
_amd_iommu_init_device:                 ## @amd_iommu_init_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	%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
	movl	%esi, %r13d
	movq	%rdi, %r15
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_might_sleep
	xorl	%eax, %eax
	callq	_amd_iommu_v2_supported
	testl	%eax, %eax
	je	LBB0_1
## %bb.2:
	testl	%r13d, %r13d
	jle	LBB0_4
## %bb.3:
	movq	_PASID_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	incl	%eax
	cmpl	%r13d, %eax
	jge	LBB0_6
LBB0_4:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_5:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_25
LBB0_1:
	movq	_ENODEV@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_25
LBB0_6:
	movq	%r15, %rdi
	callq	_device_id
	movl	%eax, %ebx
	movq	_GFP_KERNEL@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	movl	$64, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_7
## %bb.8:
	movq	%rax, %r12
	leaq	60(%rax), %rdi
	callq	_spin_lock_init
	leaq	56(%r12), %rdi
	callq	_init_waitqueue_head
	movq	%r15, 48(%r12)
	movl	%ebx, 40(%r12)
	movq	$0, 32(%r12)
	leal	-1(%r13), %eax
	cmpl	$512, %eax                      ## imm = 0x200
	jb	LBB0_12
## %bb.9:
	xorl	%eax, %eax
	movl	%r13d, %ecx
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	incq	%rax
	sarl	$9, %ecx
	leal	-1(%rcx), %edx
	cmpl	$511, %edx                      ## imm = 0x1FF
	ja	LBB0_10
## %bb.11:
	movq	%rax, 32(%r12)
LBB0_12:
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	leaq	28(%r12), %rdi
	movl	$1, %esi
	callq	_atomic_set
	movl	%r13d, (%r12)
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	movl	(%r14), %edi
	callq	_get_zeroed_page
	movq	%rax, 8(%r12)
	testq	%rax, %rax
	je	LBB0_20
## %bb.13:
	movq	_pci_bus_type@GOTPCREL(%rip), %rdi
	callq	_iommu_domain_alloc
	movq	%rax, 16(%r12)
	testq	%rax, %rax
	je	LBB0_19
## %bb.14:
	movq	%rax, %rdi
	callq	_amd_iommu_domain_direct_map
	movq	16(%r12), %rdi
	movl	%r13d, %esi
	callq	_amd_iommu_domain_enable_v2
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_18
## %bb.15:
	movq	%r15, %rdi
	callq	_iommu_group_get
	testq	%rax, %rax
	je	LBB0_16
## %bb.21:
	movq	%rax, %r15
	movq	16(%r12), %rdi
	movq	%rax, %rsi
	callq	_iommu_attach_group
	movl	%eax, %ebx
	movq	%r15, %rdi
	callq	_iommu_group_put
	testl	%ebx, %ebx
	jne	LBB0_18
## %bb.22:
	movq	_state_lock@GOTPCREL(%rip), %rdi
	callq	_spin_lock_irqsave
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	callq	___get_device_state
	testq	%rax, %rax
	je	LBB0_24
## %bb.23:
	movq	_state_lock@GOTPCREL(%rip), %rdi
	callq	_spin_unlock_irqrestore
	movq	_EBUSY@GOTPCREL(%rip), %rax
	jmp	LBB0_17
LBB0_7:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_5
LBB0_16:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_17:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_18:
	movq	16(%r12), %rdi
	callq	_iommu_domain_free
LBB0_19:
	movq	8(%r12), %rdi
	callq	_free_page
LBB0_20:
	movq	%r12, %rdi
	callq	_kfree
LBB0_25:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_24:
	addq	$24, %r12
	movq	_state_list@GOTPCREL(%rip), %rsi
	movq	%r12, %rdi
	callq	_list_add_tail
	movq	_state_lock@GOTPCREL(%rip), %rdi
	callq	_spin_unlock_irqrestore
	xorl	%ebx, %ebx
	jmp	LBB0_25
	.cfi_endproc
                                        ## -- End function
	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_PASID_MASK,4,2                 ## @PASID_MASK
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_pci_bus_type,4,2               ## @pci_bus_type
	.comm	_state_lock,4,2                 ## @state_lock
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_state_list,4,2                 ## @state_list
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amd_iommu_init_device          ; -- Begin function amd_iommu_init_device
	.p2align	2
_amd_iommu_init_device:                 ; @amd_iommu_init_device
	.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
	mov	x22, x1
	mov	x21, x0
	bl	_might_sleep
	bl	_amd_iommu_v2_supported
	cbz	w0, LBB0_4
; %bb.1:
	subs	w23, w22, #1
	b.lt	LBB0_3
; %bb.2:
Lloh0:
	adrp	x8, _PASID_MASK@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PASID_MASK@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	add	w8, w8, #1
	cmp	w8, w22
	b.ge	LBB0_7
LBB0_3:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_5
LBB0_4:
Lloh5:
	adrp	x8, _ENODEV@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
LBB0_5:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_6:
	mov	x0, x23
	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_7:
	mov	x0, x21
	bl	_device_id
	mov	x20, x0
Lloh7:
	adrp	x24, _GFP_KERNEL@GOTPAGE
Lloh8:
	ldr	x24, [x24, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w1, [x24]
	mov	w0, #64
	bl	_kzalloc
	cbz	x0, LBB0_19
; %bb.8:
	mov	x19, x0
	add	x0, x0, #60
	bl	_spin_lock_init
	add	x0, x19, #56
	bl	_init_waitqueue_head
	str	x21, [x19, #48]
	str	w20, [x19, #40]
	str	xzr, [x19, #32]
	cmp	w23, #512
	b.lo	LBB0_12
; %bb.9:
	mov	x8, #0
	mov	x9, x22
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	add	x8, x8, #1
	asr	w9, w9, #9
	sub	w10, w9, #1
	cmp	w10, #511
	b.hi	LBB0_10
; %bb.11:
	str	x8, [x19, #32]
LBB0_12:
	add	x0, x19, #28
	mov	w1, #1
	bl	_atomic_set
	str	w22, [x19]
Lloh9:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w23, w8
	ldr	w0, [x24]
	bl	_get_zeroed_page
	str	x0, [x19, #8]
	cbz	x0, LBB0_24
; %bb.13:
Lloh12:
	adrp	x0, _pci_bus_type@GOTPAGE
Lloh13:
	ldr	x0, [x0, _pci_bus_type@GOTPAGEOFF]
	bl	_iommu_domain_alloc
	str	x0, [x19, #16]
	cbz	x0, LBB0_23
; %bb.14:
	bl	_amd_iommu_domain_direct_map
	ldr	x0, [x19, #16]
	mov	x1, x22
	bl	_amd_iommu_domain_enable_v2
	mov	x23, x0
	cbnz	w0, LBB0_22
; %bb.15:
	mov	x0, x21
	bl	_iommu_group_get
	cbz	x0, LBB0_20
; %bb.16:
	mov	x21, x0
	ldr	x0, [x19, #16]
	mov	x1, x21
	bl	_iommu_attach_group
	mov	x23, x0
	mov	x0, x21
	bl	_iommu_group_put
	cbnz	w23, LBB0_22
; %bb.17:
Lloh14:
	adrp	x0, _state_lock@GOTPAGE
Lloh15:
	ldr	x0, [x0, _state_lock@GOTPAGEOFF]
	bl	_spin_lock_irqsave
	mov	x0, x20
	bl	___get_device_state
	cbz	x0, LBB0_25
; %bb.18:
Lloh16:
	adrp	x0, _state_lock@GOTPAGE
Lloh17:
	ldr	x0, [x0, _state_lock@GOTPAGEOFF]
	bl	_spin_unlock_irqrestore
Lloh18:
	adrp	x8, _EBUSY@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
	b	LBB0_21
LBB0_19:
Lloh20:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh21:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_5
LBB0_20:
Lloh22:
	adrp	x8, _EINVAL@GOTPAGE
Lloh23:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_21:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_22:
	ldr	x0, [x19, #16]
	bl	_iommu_domain_free
LBB0_23:
	ldr	x0, [x19, #8]
	bl	_free_page
LBB0_24:
	mov	x0, x19
	bl	_kfree
	b	LBB0_6
LBB0_25:
	add	x0, x19, #24
Lloh24:
	adrp	x1, _state_list@GOTPAGE
Lloh25:
	ldr	x1, [x1, _state_list@GOTPAGEOFF]
	bl	_list_add_tail
Lloh26:
	adrp	x0, _state_lock@GOTPAGE
Lloh27:
	ldr	x0, [x0, _state_lock@GOTPAGEOFF]
	bl	_spin_unlock_irqrestore
	mov	w23, #0
	b	LBB0_6
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_PASID_MASK,4,2                 ; @PASID_MASK
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_pci_bus_type,4,2               ; @pci_bus_type
	.comm	_state_lock,4,2                 ; @state_lock
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_state_list,4,2                 ; @state_list
.subsections_via_symbols
