	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function aml8726_sdxc_detach
_aml8726_sdxc_detach:                   ## @aml8726_sdxc_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	%r15
	pushq	%r14
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, %r14d
	callq	_device_get_softc
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_AML_SDXC_LOCK
	cmpq	$0, 24(%rbx)
	je	LBB0_2
## %bb.1:
	movq	%rbx, %rdi
	callq	_AML_SDXC_UNLOCK
	movq	_EBUSY@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	jmp	LBB0_3
LBB0_2:
	movq	%rbx, %rdi
	callq	_aml8726_sdxc_power_off
	movq	%rbx, %rdi
	callq	_aml8726_sdxc_soft_reset
	movq	_AML_SDXC_IRQ_ENABLE_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%r15d, %r15d
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_CSR_WRITE_4
	movq	%rbx, %rdi
	callq	_AML_SDXC_UNLOCK
	movl	%r14d, %edi
	callq	_bus_generic_detach
	movq	(%rbx), %rax
	movl	4(%rax), %esi
	movl	16(%rbx), %edx
	movl	%r14d, %edi
	callq	_bus_teardown_intr
	movl	8(%rbx), %edi
	movl	12(%rbx), %esi
	callq	_bus_dmamap_destroy
	movl	8(%rbx), %edi
	callq	_bus_dma_tag_destroy
	movq	%rbx, %rdi
	callq	_AML_SDXC_LOCK_DESTROY
	movq	_aml8726_sdxc_spec@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	(%rbx), %rdx
	movl	%r14d, %edi
	callq	_bus_release_resources
LBB0_3:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_AML_SDXC_IRQ_ENABLE_REG,4,2    ## @AML_SDXC_IRQ_ENABLE_REG
	.comm	_aml8726_sdxc_spec,4,2          ## @aml8726_sdxc_spec
	.no_dead_strip	_aml8726_sdxc_detach
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function aml8726_sdxc_detach
_aml8726_sdxc_detach:                   ; @aml8726_sdxc_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	x19, x0
	bl	_device_get_softc
	mov	x20, x0
	bl	_AML_SDXC_LOCK
	ldr	x8, [x20, #24]
	cbz	x8, LBB0_2
; %bb.1:
	mov	x0, x20
	bl	_AML_SDXC_UNLOCK
Lloh0:
	adrp	x8, _EBUSY@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	b	LBB0_3
LBB0_2:
	mov	x0, x20
	bl	_aml8726_sdxc_power_off
	mov	x0, x20
	bl	_aml8726_sdxc_soft_reset
Lloh3:
	adrp	x8, _AML_SDXC_IRQ_ENABLE_REG@GOTPAGE
Lloh4:
	ldr	x8, [x8, _AML_SDXC_IRQ_ENABLE_REG@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #0
	bl	_CSR_WRITE_4
	mov	x0, x20
	bl	_AML_SDXC_UNLOCK
	mov	x0, x19
	bl	_bus_generic_detach
	ldr	x8, [x20]
	ldr	w1, [x8, #4]
	ldr	w2, [x20, #16]
	mov	x0, x19
	bl	_bus_teardown_intr
	ldp	w0, w1, [x20, #8]
	bl	_bus_dmamap_destroy
	ldr	w0, [x20, #8]
	bl	_bus_dma_tag_destroy
	mov	x0, x20
	bl	_AML_SDXC_LOCK_DESTROY
Lloh6:
	adrp	x8, _aml8726_sdxc_spec@GOTPAGE
Lloh7:
	ldr	x8, [x8, _aml8726_sdxc_spec@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	ldr	x2, [x20]
	mov	x0, x19
	bl	_bus_release_resources
	mov	w0, #0
LBB0_3:
	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	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_AML_SDXC_IRQ_ENABLE_REG,4,2    ; @AML_SDXC_IRQ_ENABLE_REG
	.comm	_aml8726_sdxc_spec,4,2          ; @aml8726_sdxc_spec
	.no_dead_strip	_aml8726_sdxc_detach
.subsections_via_symbols
