	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amd_iommu_free_device          ## -- Begin function amd_iommu_free_device
	.p2align	4, 0x90
_amd_iommu_free_device:                 ## @amd_iommu_free_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	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %rbx
	xorl	%eax, %eax
	callq	_amd_iommu_v2_supported
	testl	%eax, %eax
	je	LBB0_3
## %bb.1:
	movq	%rbx, %rdi
	callq	_device_id
	movl	%eax, %ebx
	movq	_state_lock@GOTPCREL(%rip), %rdi
	callq	_spin_lock_irqsave
	movl	%ebx, %edi
	callq	___get_device_state
	testq	%rax, %rax
	je	LBB0_4
## %bb.2:
	movq	%rax, %rbx
	movq	%rax, %rdi
	addq	$8, %rdi
	callq	_list_del
	movq	_state_lock@GOTPCREL(%rip), %rdi
	callq	_spin_unlock_irqrestore
	movq	%rbx, %rdi
	callq	_free_pasid_states
	movq	%rbx, %rdi
	callq	_put_device_state
	movl	4(%rbx), %r14d
	movq	%rbx, %rdi
	callq	_atomic_read
	xorl	%esi, %esi
	testl	%eax, %eax
	sete	%sil
	movl	%r14d, %edi
	callq	_wait_event
	movq	%rbx, %rdi
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_free_device_state              ## TAILCALL
LBB0_3:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_4:
	movq	_state_lock@GOTPCREL(%rip), %rdi
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_spin_unlock_irqrestore         ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_state_lock,4,2                 ## @state_lock
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amd_iommu_free_device          ; -- Begin function amd_iommu_free_device
	.p2align	2
_amd_iommu_free_device:                 ; @amd_iommu_free_device
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	bl	_amd_iommu_v2_supported
	cbz	w0, LBB0_3
; %bb.1:
	mov	x0, x19
	bl	_device_id
	mov	x19, x0
Lloh0:
	adrp	x0, _state_lock@GOTPAGE
Lloh1:
	ldr	x0, [x0, _state_lock@GOTPAGEOFF]
	bl	_spin_lock_irqsave
	mov	x0, x19
	bl	___get_device_state
	cbz	x0, LBB0_4
; %bb.2:
	mov	x19, x0
	add	x0, x0, #8
	bl	_list_del
Lloh2:
	adrp	x0, _state_lock@GOTPAGE
Lloh3:
	ldr	x0, [x0, _state_lock@GOTPAGEOFF]
	bl	_spin_unlock_irqrestore
	mov	x0, x19
	bl	_free_pasid_states
	mov	x0, x19
	bl	_put_device_state
	ldr	w20, [x19, #4]
	mov	x0, x19
	bl	_atomic_read
	cmp	w0, #0
	cset	w1, eq
	mov	x0, x20
	bl	_wait_event
	mov	x0, x19
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_free_device_state
LBB0_3:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_4:
Lloh4:
	adrp	x0, _state_lock@GOTPAGE
Lloh5:
	ldr	x0, [x0, _state_lock@GOTPAGEOFF]
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_spin_unlock_irqrestore
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_state_lock,4,2                 ; @state_lock
.subsections_via_symbols
