	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function aml8726_sdxc_disengage_dma
_aml8726_sdxc_disengage_dma:            ## @aml8726_sdxc_disengage_dma
	.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
	movq	8(%rdi), %rax
	movq	(%rax), %rbx
	testq	%rbx, %rbx
	je	LBB0_12
## %bb.1:
	cmpq	$0, (%rbx)
	je	LBB0_12
## %bb.2:
	movq	%rdi, %r12
	movq	_AML_SDXC_PDMA_REG@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	callq	_CSR_READ_4
	movl	%eax, %r14d
	cmpl	$1, (%r12)
	jne	LBB0_5
## %bb.3:
	movq	_AML_SDXC_PDMA_DMA_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	notl	%eax
	andl	%eax, %r14d
	movl	(%r15), %esi
	movq	%r12, %rdi
	movl	%r14d, %edx
	jmp	LBB0_4
LBB0_12:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movq	_MMC_DATA_READ@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 8(%rbx)
	je	LBB0_11
## %bb.6:
	movq	_AML_SDXC_PDMA_RX_FLUSH_NOW@GOTPCREL(%rip), %rax
	orl	(%rax), %r14d
	movl	(%r15), %esi
	movq	%r12, %rdi
	movl	%r14d, %edx
	callq	_CSR_WRITE_4
	movl	(%r15), %esi
	movq	%r12, %rdi
	callq	_CSR_BARRIER
	movl	$100, %ebx
	movq	_AML_SDXC_STATUS_REG@GOTPCREL(%rip), %r13
	movq	_AML_SDXC_STATUS_RX_CNT_MASK@GOTPCREL(%rip), %r15
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r13), %esi
	movq	%r12, %rdi
	callq	_CSR_READ_4
	testl	%eax, (%r15)
	je	LBB0_10
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	movl	$1, %edi
	callq	_DELAY
	decl	%ebx
	jne	LBB0_7
## %bb.9:
	movl	4(%r12), %edi
	leaq	L_.str(%rip), %rsi
	callq	_device_printf
LBB0_10:
	movq	_AML_SDXC_PDMA_REG@GOTPCREL(%rip), %r15
LBB0_11:
	movq	_AML_SDXC_PDMA_DMA_EN@GOTPCREL(%rip), %rax
	movq	_AML_SDXC_PDMA_RX_FLUSH_MODE_SW@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	notl	%edx
	andl	%r14d, %edx
	movl	(%r15), %esi
	movq	%r12, %rdi
LBB0_4:
	callq	_CSR_WRITE_4
	movl	(%r15), %esi
	movq	%r12, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_CSR_BARRIER                    ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_AML_SDXC_PDMA_REG,4,2          ## @AML_SDXC_PDMA_REG
	.comm	_AML_SDXC_PDMA_DMA_EN,4,2       ## @AML_SDXC_PDMA_DMA_EN
	.comm	_MMC_DATA_READ,4,2              ## @MMC_DATA_READ
	.comm	_AML_SDXC_PDMA_RX_FLUSH_NOW,4,2 ## @AML_SDXC_PDMA_RX_FLUSH_NOW
	.comm	_AML_SDXC_STATUS_REG,4,2        ## @AML_SDXC_STATUS_REG
	.comm	_AML_SDXC_STATUS_RX_CNT_MASK,4,2 ## @AML_SDXC_STATUS_RX_CNT_MASK
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"RX FIFO drain timeout\n"

	.comm	_AML_SDXC_PDMA_RX_FLUSH_MODE_SW,4,2 ## @AML_SDXC_PDMA_RX_FLUSH_MODE_SW
	.no_dead_strip	_aml8726_sdxc_disengage_dma
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function aml8726_sdxc_disengage_dma
_aml8726_sdxc_disengage_dma:            ; @aml8726_sdxc_disengage_dma
	.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
	ldr	x8, [x0, #8]
	ldr	x22, [x8]
	cbz	x22, LBB0_4
; %bb.1:
	ldr	x8, [x22]
	cbz	x8, LBB0_4
; %bb.2:
	mov	x19, x0
Lloh0:
	adrp	x21, _AML_SDXC_PDMA_REG@GOTPAGE
Lloh1:
	ldr	x21, [x21, _AML_SDXC_PDMA_REG@GOTPAGEOFF]
	ldr	w1, [x21]
	bl	_CSR_READ_4
	mov	x20, x0
	ldr	w8, [x19]
	cmp	w8, #1
	b.ne	LBB0_5
; %bb.3:
Lloh2:
	adrp	x8, _AML_SDXC_PDMA_DMA_EN@GOTPAGE
Lloh3:
	ldr	x8, [x8, _AML_SDXC_PDMA_DMA_EN@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	b	LBB0_11
LBB0_4:
	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_5:
	ldr	w8, [x22, #8]
Lloh5:
	adrp	x9, _MMC_DATA_READ@GOTPAGE
Lloh6:
	ldr	x9, [x9, _MMC_DATA_READ@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_10
; %bb.6:
Lloh8:
	adrp	x8, _AML_SDXC_PDMA_RX_FLUSH_NOW@GOTPAGE
Lloh9:
	ldr	x8, [x8, _AML_SDXC_PDMA_RX_FLUSH_NOW@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	orr	w20, w8, w20
	ldr	w1, [x21]
	mov	x0, x19
	mov	x2, x20
	bl	_CSR_WRITE_4
	ldr	w1, [x21]
	mov	x0, x19
	bl	_CSR_BARRIER
	mov	w22, #100
Lloh11:
	adrp	x23, _AML_SDXC_STATUS_REG@GOTPAGE
Lloh12:
	ldr	x23, [x23, _AML_SDXC_STATUS_REG@GOTPAGEOFF]
Lloh13:
	adrp	x24, _AML_SDXC_STATUS_RX_CNT_MASK@GOTPAGE
Lloh14:
	ldr	x24, [x24, _AML_SDXC_STATUS_RX_CNT_MASK@GOTPAGEOFF]
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x23]
	mov	x0, x19
	bl	_CSR_READ_4
	ldr	w8, [x24]
	tst	w8, w0
	b.eq	LBB0_10
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	mov	w0, #1
	bl	_DELAY
	subs	w22, w22, #1
	b.ne	LBB0_7
; %bb.9:
	ldr	w0, [x19, #4]
Lloh15:
	adrp	x1, l_.str@PAGE
Lloh16:
	add	x1, x1, l_.str@PAGEOFF
	bl	_device_printf
LBB0_10:
Lloh17:
	adrp	x8, _AML_SDXC_PDMA_DMA_EN@GOTPAGE
Lloh18:
	ldr	x8, [x8, _AML_SDXC_PDMA_DMA_EN@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
Lloh20:
	adrp	x9, _AML_SDXC_PDMA_RX_FLUSH_MODE_SW@GOTPAGE
Lloh21:
	ldr	x9, [x9, _AML_SDXC_PDMA_RX_FLUSH_MODE_SW@GOTPAGEOFF]
Lloh22:
	ldr	w9, [x9]
	orr	w8, w9, w8
LBB0_11:
	bic	w2, w20, w8
	ldr	w1, [x21]
	mov	x0, x19
	bl	_CSR_WRITE_4
	ldr	w1, [x21]
	mov	x0, x19
	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
	b	_CSR_BARRIER
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_AML_SDXC_PDMA_REG,4,2          ; @AML_SDXC_PDMA_REG
	.comm	_AML_SDXC_PDMA_DMA_EN,4,2       ; @AML_SDXC_PDMA_DMA_EN
	.comm	_MMC_DATA_READ,4,2              ; @MMC_DATA_READ
	.comm	_AML_SDXC_PDMA_RX_FLUSH_NOW,4,2 ; @AML_SDXC_PDMA_RX_FLUSH_NOW
	.comm	_AML_SDXC_STATUS_REG,4,2        ; @AML_SDXC_STATUS_REG
	.comm	_AML_SDXC_STATUS_RX_CNT_MASK,4,2 ; @AML_SDXC_STATUS_RX_CNT_MASK
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"RX FIFO drain timeout\n"

	.comm	_AML_SDXC_PDMA_RX_FLUSH_MODE_SW,4,2 ; @AML_SDXC_PDMA_RX_FLUSH_MODE_SW
	.no_dead_strip	_aml8726_sdxc_disengage_dma
.subsections_via_symbols
