	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function aml8726_sdxc_engage_dma
_aml8726_sdxc_engage_dma:               ## @aml8726_sdxc_engage_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	8(%rdi), %rax
	movq	(%rax), %rbx
	testq	%rbx, %rbx
	je	LBB0_10
## %bb.1:
	cmpq	$0, (%rbx)
	je	LBB0_10
## %bb.2:
	movq	%rdi, %r15
	movq	_AML_SDXC_PDMA_REG@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	callq	_CSR_READ_4
	movq	_AML_SDXC_PDMA_RX_FLUSH_MODE_SW@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, %edx
	notl	%edx
	andl	%eax, %edx
	movq	_AML_SDXC_PDMA_DMA_EN@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	cmpl	$1, (%r15)
	je	LBB0_5
## %bb.3:
	movq	_MMC_DATA_READ@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 8(%rbx)
	je	LBB0_6
## %bb.4:
	orl	%ecx, %edx
LBB0_5:
	movl	(%r14), %esi
	movq	%r15, %rdi
	callq	_CSR_WRITE_4
	movl	(%r14), %esi
	movq	%r15, %rdi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_CSR_BARRIER                    ## TAILCALL
LBB0_6:
	movq	_AML_SDXC_PDMA_TX_FILL@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	movl	(%r14), %esi
	movq	%r15, %rdi
	callq	_CSR_WRITE_4
	movl	(%r14), %esi
	movq	%r15, %rdi
	callq	_CSR_BARRIER
	movl	$100, %ebx
	movq	_AML_SDXC_STATUS_REG@GOTPCREL(%rip), %r14
	movq	_AML_SDXC_STATUS_TX_CNT_MASK@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r14), %esi
	movq	%r15, %rdi
	callq	_CSR_READ_4
	testl	%eax, (%r12)
	jne	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(%r15), %edi
	leaq	L_.str(%rip), %rsi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_device_printf                  ## TAILCALL
LBB0_10:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AML_SDXC_PDMA_REG,4,2          ## @AML_SDXC_PDMA_REG
	.comm	_AML_SDXC_PDMA_RX_FLUSH_MODE_SW,4,2 ## @AML_SDXC_PDMA_RX_FLUSH_MODE_SW
	.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_TX_FILL,4,2      ## @AML_SDXC_PDMA_TX_FILL
	.comm	_AML_SDXC_STATUS_REG,4,2        ## @AML_SDXC_STATUS_REG
	.comm	_AML_SDXC_STATUS_TX_CNT_MASK,4,2 ## @AML_SDXC_STATUS_TX_CNT_MASK
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"TX FIFO fill timeout\n"

	.no_dead_strip	_aml8726_sdxc_engage_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_engage_dma
_aml8726_sdxc_engage_dma:               ; @aml8726_sdxc_engage_dma
	.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
	ldr	x8, [x0, #8]
	ldr	x21, [x8]
	cbz	x21, LBB0_10
; %bb.1:
	ldr	x8, [x21]
	cbz	x8, LBB0_10
; %bb.2:
	mov	x19, x0
Lloh0:
	adrp	x20, _AML_SDXC_PDMA_REG@GOTPAGE
Lloh1:
	ldr	x20, [x20, _AML_SDXC_PDMA_REG@GOTPAGEOFF]
	ldr	w1, [x20]
	bl	_CSR_READ_4
Lloh2:
	adrp	x8, _AML_SDXC_PDMA_RX_FLUSH_MODE_SW@GOTPAGE
Lloh3:
	ldr	x8, [x8, _AML_SDXC_PDMA_RX_FLUSH_MODE_SW@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	bic	w9, w0, w8
Lloh5:
	adrp	x10, _AML_SDXC_PDMA_DMA_EN@GOTPAGE
Lloh6:
	ldr	x10, [x10, _AML_SDXC_PDMA_DMA_EN@GOTPAGEOFF]
Lloh7:
	ldr	w10, [x10]
	orr	w2, w9, w10
	ldr	w9, [x19]
	cmp	w9, #1
	b.eq	LBB0_5
; %bb.3:
	ldr	w9, [x21, #8]
Lloh8:
	adrp	x10, _MMC_DATA_READ@GOTPAGE
Lloh9:
	ldr	x10, [x10, _MMC_DATA_READ@GOTPAGEOFF]
Lloh10:
	ldr	w10, [x10]
	tst	w10, w9
	b.eq	LBB0_6
; %bb.4:
	orr	w2, w2, w8
LBB0_5:
	ldr	w1, [x20]
	mov	x0, x19
	bl	_CSR_WRITE_4
	ldr	w1, [x20]
	mov	x0, x19
	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	_CSR_BARRIER
LBB0_6:
Lloh11:
	adrp	x8, _AML_SDXC_PDMA_TX_FILL@GOTPAGE
Lloh12:
	ldr	x8, [x8, _AML_SDXC_PDMA_TX_FILL@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	orr	w2, w8, w2
	ldr	w1, [x20]
	mov	x0, x19
	bl	_CSR_WRITE_4
	ldr	w1, [x20]
	mov	x0, x19
	bl	_CSR_BARRIER
	mov	w20, #100
Lloh14:
	adrp	x21, _AML_SDXC_STATUS_REG@GOTPAGE
Lloh15:
	ldr	x21, [x21, _AML_SDXC_STATUS_REG@GOTPAGEOFF]
Lloh16:
	adrp	x22, _AML_SDXC_STATUS_TX_CNT_MASK@GOTPAGE
Lloh17:
	ldr	x22, [x22, _AML_SDXC_STATUS_TX_CNT_MASK@GOTPAGEOFF]
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x21]
	mov	x0, x19
	bl	_CSR_READ_4
	ldr	w8, [x22]
	tst	w8, w0
	b.ne	LBB0_10
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	mov	w0, #1
	bl	_DELAY
	subs	w20, w20, #1
	b.ne	LBB0_7
; %bb.9:
	ldr	w0, [x19, #4]
Lloh18:
	adrp	x1, l_.str@PAGE
Lloh19:
	add	x1, x1, l_.str@PAGEOFF
	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	_device_printf
LBB0_10:
	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
	ret
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_AML_SDXC_PDMA_REG,4,2          ; @AML_SDXC_PDMA_REG
	.comm	_AML_SDXC_PDMA_RX_FLUSH_MODE_SW,4,2 ; @AML_SDXC_PDMA_RX_FLUSH_MODE_SW
	.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_TX_FILL,4,2      ; @AML_SDXC_PDMA_TX_FILL
	.comm	_AML_SDXC_STATUS_REG,4,2        ; @AML_SDXC_STATUS_REG
	.comm	_AML_SDXC_STATUS_TX_CNT_MASK,4,2 ; @AML_SDXC_STATUS_TX_CNT_MASK
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"TX FIFO fill timeout\n"

	.no_dead_strip	_aml8726_sdxc_engage_dma
.subsections_via_symbols
