	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function aml8726_mmc_finish_command
_aml8726_mmc_finish_command:            ## @aml8726_mmc_finish_command
	.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
	movl	%esi, %r14d
	movq	%rdi, %r15
	callq	_AML_MMC_LOCK_ASSERT
	movq	_AML_MMC_IRQ_STATUS_REG@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	_AML_MMC_IRQ_STATUS_CLEAR_IRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	callq	_CSR_WRITE_4
	movl	(%rbx), %esi
	movq	%r15, %rdi
	callq	_CSR_BARRIER
	leaq	16(%r15), %rdi
	callq	_callout_stop
	movq	8(%r15), %r12
	movq	$0, 8(%r15)
	movl	%r14d, (%r12)
	movq	16(%r12), %rax
	testq	%rax, %rax
	je	LBB0_7
## %bb.1:
	cmpq	$0, 8(%rax)
	je	LBB0_7
## %bb.2:
	movl	(%rax), %eax
	movq	_MMC_DATA_READ@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	_MMC_DATA_WRITE@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	%ecx, %edx
	testl	%eax, %edx
	je	LBB0_7
## %bb.3:
	movl	(%r15), %esi
	movl	4(%r15), %edi
	testl	%eax, %ecx
	jne	LBB0_4
## %bb.5:
	movq	_BUS_DMASYNC_POSTWRITE@GOTPCREL(%rip), %rax
	jmp	LBB0_6
LBB0_4:
	movq	_BUS_DMASYNC_POSTREAD@GOTPCREL(%rip), %rax
LBB0_6:
	movl	(%rax), %edx
	callq	_bus_dmamap_sync
	movl	(%r15), %esi
	movl	4(%r15), %edi
	callq	_bus_dmamap_unload
LBB0_7:
	movq	8(%r12), %rax
	movq	8(%rax), %rbx
	cmpq	%r12, %rbx
	je	LBB0_11
## %bb.8:
	testq	%rbx, %rbx
	je	LBB0_11
## %bb.9:
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_aml8726_mmc_start_command
	movq	_MMC_ERR_NONE@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_10
## %bb.13:
	movq	%r15, %rdi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_AML_MMC_UNLOCK                 ## TAILCALL
LBB0_10:
	movl	%eax, (%rbx)
LBB0_11:
	movq	%r15, %rdi
	callq	_AML_MMC_UNLOCK
	movq	8(%r12), %rdi
	testq	%rdi, %rdi
	je	LBB0_12
## %bb.14:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmpq	*(%rdi)                         ## TAILCALL
LBB0_12:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AML_MMC_IRQ_STATUS_REG,4,2     ## @AML_MMC_IRQ_STATUS_REG
	.comm	_AML_MMC_IRQ_STATUS_CLEAR_IRQ,4,2 ## @AML_MMC_IRQ_STATUS_CLEAR_IRQ
	.comm	_MMC_DATA_READ,4,2              ## @MMC_DATA_READ
	.comm	_MMC_DATA_WRITE,4,2             ## @MMC_DATA_WRITE
	.comm	_BUS_DMASYNC_POSTREAD,4,2       ## @BUS_DMASYNC_POSTREAD
	.comm	_BUS_DMASYNC_POSTWRITE,4,2      ## @BUS_DMASYNC_POSTWRITE
	.comm	_MMC_ERR_NONE,4,2               ## @MMC_ERR_NONE
	.no_dead_strip	_aml8726_mmc_finish_command
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function aml8726_mmc_finish_command
_aml8726_mmc_finish_command:            ; @aml8726_mmc_finish_command
	.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	x20, x1
	mov	x19, x0
	bl	_AML_MMC_LOCK_ASSERT
Lloh0:
	adrp	x21, _AML_MMC_IRQ_STATUS_REG@GOTPAGE
Lloh1:
	ldr	x21, [x21, _AML_MMC_IRQ_STATUS_REG@GOTPAGEOFF]
	ldr	w1, [x21]
Lloh2:
	adrp	x8, _AML_MMC_IRQ_STATUS_CLEAR_IRQ@GOTPAGE
Lloh3:
	ldr	x8, [x8, _AML_MMC_IRQ_STATUS_CLEAR_IRQ@GOTPAGEOFF]
Lloh4:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_CSR_WRITE_4
	ldr	w1, [x21]
	mov	x0, x19
	bl	_CSR_BARRIER
	add	x0, x19, #16
	bl	_callout_stop
	ldr	x21, [x19, #8]
	str	xzr, [x19, #8]
	str	w20, [x21]
	ldr	x8, [x21, #16]
	cbz	x8, LBB0_4
; %bb.1:
	ldr	x9, [x8, #8]
	cbz	x9, LBB0_4
; %bb.2:
	ldr	w8, [x8]
Lloh5:
	adrp	x9, _MMC_DATA_READ@GOTPAGE
Lloh6:
	ldr	x9, [x9, _MMC_DATA_READ@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
Lloh8:
	adrp	x10, _MMC_DATA_WRITE@GOTPAGE
Lloh9:
	ldr	x10, [x10, _MMC_DATA_WRITE@GOTPAGEOFF]
Lloh10:
	ldr	w10, [x10]
	orr	w10, w10, w9
	tst	w10, w8
	b.eq	LBB0_4
; %bb.3:
Lloh11:
	adrp	x10, _BUS_DMASYNC_POSTWRITE@GOTPAGE
Lloh12:
	ldr	x10, [x10, _BUS_DMASYNC_POSTWRITE@GOTPAGEOFF]
	ldp	w1, w0, [x19]
Lloh13:
	adrp	x11, _BUS_DMASYNC_POSTREAD@GOTPAGE
Lloh14:
	ldr	x11, [x11, _BUS_DMASYNC_POSTREAD@GOTPAGEOFF]
	tst	w9, w8
	csel	x8, x10, x11, eq
	ldr	w2, [x8]
	bl	_bus_dmamap_sync
	ldp	w1, w0, [x19]
	bl	_bus_dmamap_unload
LBB0_4:
	ldr	x8, [x21, #8]
	ldr	x20, [x8, #8]
	cmp	x20, x21
	ccmp	x20, #0, #4, ne
	b.eq	LBB0_8
; %bb.5:
	mov	x0, x19
	mov	x1, x20
	bl	_aml8726_mmc_start_command
Lloh15:
	adrp	x8, _MMC_ERR_NONE@GOTPAGE
Lloh16:
	ldr	x8, [x8, _MMC_ERR_NONE@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	cmp	w0, w8
	b.ne	LBB0_7
; %bb.6:
	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	_AML_MMC_UNLOCK
LBB0_7:
	str	w0, [x20]
LBB0_8:
	mov	x0, x19
	bl	_AML_MMC_UNLOCK
	ldr	x0, [x21, #8]
	cbz	x0, LBB0_10
; %bb.9:
	ldr	x1, [x0]
	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
	br	x1
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	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_AML_MMC_IRQ_STATUS_REG,4,2     ; @AML_MMC_IRQ_STATUS_REG
	.comm	_AML_MMC_IRQ_STATUS_CLEAR_IRQ,4,2 ; @AML_MMC_IRQ_STATUS_CLEAR_IRQ
	.comm	_MMC_DATA_READ,4,2              ; @MMC_DATA_READ
	.comm	_MMC_DATA_WRITE,4,2             ; @MMC_DATA_WRITE
	.comm	_BUS_DMASYNC_POSTREAD,4,2       ; @BUS_DMASYNC_POSTREAD
	.comm	_BUS_DMASYNC_POSTWRITE,4,2      ; @BUS_DMASYNC_POSTWRITE
	.comm	_MMC_ERR_NONE,4,2               ; @MMC_ERR_NONE
	.no_dead_strip	_aml8726_mmc_finish_command
.subsections_via_symbols
