	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function detach_device
_detach_device:                         ## @detach_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, %r15
	callq	_get_dev_data
	movq	%rax, %rbx
	movq	16(%rax), %r12
	leaq	4(%r12), %r14
	movq	%r14, %rdi
	callq	_spin_lock_irqsave
	movq	%rbx, %rdi
	callq	_spin_lock
	xorl	%edi, %edi
	cmpq	$0, 16(%rbx)
	sete	%dil
	callq	_WARN_ON
	testq	%rax, %rax
	jne	LBB0_8
## %bb.1:
	movq	%rbx, %rdi
	callq	_do_detach
	movq	%r15, %rdi
	callq	_dev_is_pci
	testl	%eax, %eax
	je	LBB0_8
## %bb.2:
	movq	_PD_IOMMUV2_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r12)
	je	LBB0_5
## %bb.3:
	cmpq	$0, 8(%rbx)
	je	LBB0_5
## %bb.4:
	movq	%r15, %rdi
	callq	_to_pci_dev
	movl	%eax, %edi
	callq	_pdev_iommuv2_disable
	jmp	LBB0_7
LBB0_5:
	cmpl	$0, 4(%rbx)
	je	LBB0_7
## %bb.6:
	movq	%r15, %rdi
	callq	_to_pci_dev
	movl	%eax, %edi
	callq	_pci_disable_ats
LBB0_7:
	movl	$0, 4(%rbx)
LBB0_8:
	movq	%rbx, %rdi
	callq	_spin_unlock
	movq	%r14, %rdi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_spin_unlock_irqrestore         ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_PD_IOMMUV2_MASK,4,2            ## @PD_IOMMUV2_MASK
	.no_dead_strip	_detach_device
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function detach_device
_detach_device:                         ; @detach_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	x21, x0
	bl	_get_dev_data
	mov	x19, x0
	ldr	x22, [x0, #16]
	add	x20, x22, #4
	mov	x0, x20
	bl	_spin_lock_irqsave
	mov	x0, x19
	bl	_spin_lock
	ldr	x8, [x19, #16]
	cmp	x8, #0
	cset	w0, eq
	bl	_WARN_ON
	cbnz	x0, LBB0_8
; %bb.1:
	mov	x0, x19
	bl	_do_detach
	mov	x0, x21
	bl	_dev_is_pci
	cbz	w0, LBB0_8
; %bb.2:
	ldr	w8, [x22]
Lloh0:
	adrp	x9, _PD_IOMMUV2_MASK@GOTPAGE
Lloh1:
	ldr	x9, [x9, _PD_IOMMUV2_MASK@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_5
; %bb.3:
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_5
; %bb.4:
	mov	x0, x21
	bl	_to_pci_dev
	bl	_pdev_iommuv2_disable
	b	LBB0_7
LBB0_5:
	ldr	w8, [x19, #4]
	cbz	w8, LBB0_7
; %bb.6:
	mov	x0, x21
	bl	_to_pci_dev
	bl	_pci_disable_ats
LBB0_7:
	str	wzr, [x19, #4]
LBB0_8:
	mov	x0, x19
	bl	_spin_unlock
	mov	x0, x20
	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
	b	_spin_unlock_irqrestore
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_PD_IOMMUV2_MASK,4,2            ; @PD_IOMMUV2_MASK
	.no_dead_strip	_detach_device
.subsections_via_symbols
