	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function emac_detach
_emac_detach:                           ## @emac_detach
	.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
	movl	%edi, %r14d
	callq	_device_get_softc
	movq	%rax, %rbx
	movq	_IFF_DRV_RUNNING@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	notl	%eax
	movq	8(%rbx), %rcx
	andl	%eax, (%rcx)
	movl	%r14d, %edi
	callq	_device_is_attached
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	8(%rbx), %rdi
	callq	_ether_ifdetach
	movq	%rbx, %rdi
	callq	_EMAC_LOCK
	movq	%rbx, %rdi
	callq	_emac_stop_locked
	movq	%rbx, %rdi
	callq	_EMAC_UNLOCK
	movq	%rbx, %rdi
	addq	$64, %rdi
	callq	_callout_drain
LBB0_2:
	movq	56(%rbx), %rdx
	testq	%rdx, %rdx
	je	LBB0_4
## %bb.3:
	movl	40(%rbx), %edi
	movq	16(%rbx), %rsi
	callq	_bus_teardown_intr
LBB0_4:
	movq	48(%rbx), %rsi
	testq	%rsi, %rsi
	je	LBB0_6
## %bb.5:
	movl	40(%rbx), %edi
	callq	_device_delete_child
	movl	40(%rbx), %edi
	callq	_bus_generic_detach
LBB0_6:
	movq	32(%rbx), %rdi
	testq	%rdi, %rdi
	je	LBB0_8
## %bb.7:
	callq	_clk_disable
LBB0_8:
	movq	24(%rbx), %rcx
	testq	%rcx, %rcx
	je	LBB0_10
## %bb.9:
	movq	_SYS_RES_MEMORY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r14d, %edi
	xorl	%edx, %edx
	callq	_bus_release_resource
LBB0_10:
	movq	16(%rbx), %rcx
	testq	%rcx, %rcx
	je	LBB0_12
## %bb.11:
	movq	_SYS_RES_IRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r14d, %edi
	xorl	%edx, %edx
	callq	_bus_release_resource
LBB0_12:
	movq	8(%rbx), %rdi
	testq	%rdi, %rdi
	je	LBB0_14
## %bb.13:
	callq	_if_free
LBB0_14:
	movq	%rbx, %rdi
	callq	_mtx_initialized
	testq	%rax, %rax
	je	LBB0_16
## %bb.15:
	movq	%rbx, %rdi
	callq	_mtx_destroy
LBB0_16:
	xorl	%eax, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_IFF_DRV_RUNNING,4,2            ## @IFF_DRV_RUNNING
	.comm	_SYS_RES_MEMORY,4,2             ## @SYS_RES_MEMORY
	.comm	_SYS_RES_IRQ,4,2                ## @SYS_RES_IRQ
	.no_dead_strip	_emac_detach
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function emac_detach
_emac_detach:                           ; @emac_detach
	.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	x20, x0
	bl	_device_get_softc
	mov	x19, x0
Lloh0:
	adrp	x8, _IFF_DRV_RUNNING@GOTPAGE
Lloh1:
	ldr	x8, [x8, _IFF_DRV_RUNNING@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	ldr	x9, [x0, #8]
	ldr	w10, [x9]
	bic	w8, w10, w8
	str	w8, [x9]
	mov	x0, x20
	bl	_device_is_attached
	cbz	x0, LBB0_2
; %bb.1:
	ldr	x0, [x19, #8]
	bl	_ether_ifdetach
	mov	x0, x19
	bl	_EMAC_LOCK
	mov	x0, x19
	bl	_emac_stop_locked
	mov	x0, x19
	bl	_EMAC_UNLOCK
	add	x0, x19, #64
	bl	_callout_drain
LBB0_2:
	ldr	x2, [x19, #56]
	cbz	x2, LBB0_4
; %bb.3:
	ldr	w0, [x19, #40]
	ldr	x1, [x19, #16]
	bl	_bus_teardown_intr
LBB0_4:
	ldr	x1, [x19, #48]
	cbz	x1, LBB0_6
; %bb.5:
	ldr	w0, [x19, #40]
	bl	_device_delete_child
	ldr	w0, [x19, #40]
	bl	_bus_generic_detach
LBB0_6:
	ldr	x0, [x19, #32]
	cbz	x0, LBB0_8
; %bb.7:
	bl	_clk_disable
LBB0_8:
	ldr	x3, [x19, #24]
	cbz	x3, LBB0_10
; %bb.9:
Lloh3:
	adrp	x8, _SYS_RES_MEMORY@GOTPAGE
Lloh4:
	ldr	x8, [x8, _SYS_RES_MEMORY@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #0
	bl	_bus_release_resource
LBB0_10:
	ldr	x3, [x19, #16]
	cbz	x3, LBB0_12
; %bb.11:
Lloh6:
	adrp	x8, _SYS_RES_IRQ@GOTPAGE
Lloh7:
	ldr	x8, [x8, _SYS_RES_IRQ@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #0
	bl	_bus_release_resource
LBB0_12:
	ldr	x0, [x19, #8]
	cbz	x0, LBB0_14
; %bb.13:
	bl	_if_free
LBB0_14:
	mov	x0, x19
	bl	_mtx_initialized
	cbz	x0, LBB0_16
; %bb.15:
	mov	x0, x19
	bl	_mtx_destroy
LBB0_16:
	mov	w0, #0
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_IFF_DRV_RUNNING,4,2            ; @IFF_DRV_RUNNING
	.comm	_SYS_RES_MEMORY,4,2             ; @SYS_RES_MEMORY
	.comm	_SYS_RES_IRQ,4,2                ; @SYS_RES_IRQ
	.no_dead_strip	_emac_detach
.subsections_via_symbols
