	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mmc_davinci_prepare_data
_mmc_davinci_prepare_data:              ## @mmc_davinci_prepare_data
	.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	%rdi, %rbx
	movq	_rw_threshold@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_MMCFIFOCTL_FIFOLEV@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r15d
	movq	(%rsi), %r14
	movq	(%rdi), %rcx
	movq	_MMC_CTLR_VERSION_2@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	movq	%r14, 16(%rdi)
	testq	%r14, %r14
	je	LBB0_5
## %bb.1:
	xorl	%esi, %esi
	cmpl	$64, %eax
	movl	$0, %edi
	cmovel	%r15d, %edi
	cmpl	$32, %eax
	cmovnel	%esi, %r15d
	cmpq	%rdx, %rcx
	cmovel	%edi, %r15d
	movl	60(%rbx), %edi
	callq	_mmc_dev
	movq	_MMC_DATA_WRITE@GOTPCREL(%rip), %r13
	movl	(%r13), %ecx
	andl	(%r14), %ecx
	leaq	L_.str.2(%rip), %rcx
	leaq	L_.str.1(%rip), %rdx
	cmoveq	%rcx, %rdx
	movl	4(%r14), %ecx
	movl	8(%r14), %r8d
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edi
	xorl	%eax, %eax
	callq	_dev_dbg
	movl	60(%rbx), %edi
	callq	_mmc_dev
	movl	12(%r14), %edx
	movl	16(%r14), %ecx
	leaq	L_.str.3(%rip), %rsi
	movl	%eax, %edi
	xorl	%eax, %eax
	callq	_dev_dbg
	movl	16(%r14), %eax
	cltd
	idivl	8(%rbx)
	addl	12(%r14), %eax
	cmpl	$65535, %eax                    ## imm = 0xFFFF
	movl	$65535, %edi                    ## imm = 0xFFFF
	cmovll	%eax, %edi
	movq	_DAVINCI_MMCTOD@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	48(%rbx), %rsi
	callq	_writel
	movl	4(%r14), %edi
	movq	_DAVINCI_MMCNBLK@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	48(%rbx), %rsi
	callq	_writel
	movl	8(%r14), %edi
	movq	_DAVINCI_MMCBLEN@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	48(%rbx), %rsi
	callq	_writel
	movl	(%r13), %eax
	andl	(%r14), %eax
	movq	_MMCFIFOCTL_FIFODIR_WR@GOTPCREL(%rip), %r13
	cmoveq	_MMCFIFOCTL_FIFODIR_RD@GOTPCREL(%rip), %r13
	movq	_DAVINCI_MMC_DATADIR_WRITE@GOTPCREL(%rip), %rax
	cmoveq	_DAVINCI_MMC_DATADIR_READ@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 56(%rbx)
	movl	(%r13), %edi
	orl	%r15d, %edi
	movq	_MMCFIFOCTL_FIFORST@GOTPCREL(%rip), %rax
	orl	(%rax), %edi
	movq	_DAVINCI_MMCFIFOCTL@GOTPCREL(%rip), %r12
	movq	(%r12), %rsi
	addq	48(%rbx), %rsi
	callq	_writel
	orl	(%r13), %r15d
	movq	(%r12), %rsi
	addq	48(%rbx), %rsi
	movl	%r15d, %edi
	callq	_writel
	movq	$0, 40(%rbx)
	movl	8(%r14), %eax
	imull	4(%r14), %eax
	movl	%eax, 12(%rbx)
	cmpq	$0, 32(%rbx)
	je	LBB0_4
## %bb.2:
	movq	_rw_threshold@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	decl	%ecx
	testl	%eax, %ecx
	jne	LBB0_4
## %bb.3:
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_mmc_davinci_start_dma_transfer
	testq	%rax, %rax
	je	LBB0_6
LBB0_4:
	movl	24(%r14), %eax
	movl	%eax, 28(%rbx)
	movq	16(%rbx), %rax
	movl	20(%rax), %eax
	movl	%eax, 24(%rbx)
	movq	%rbx, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_mmc_davinci_sg_to_buf          ## TAILCALL
LBB0_5:
	movq	_DAVINCI_MMC_DATADIR_NONE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 56(%rbx)
	movq	_DAVINCI_MMCBLEN@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	48(%rbx), %rsi
	xorl	%edi, %edi
	callq	_writel
	movq	_DAVINCI_MMCNBLK@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	48(%rbx), %rsi
	xorl	%edi, %edi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_writel                         ## TAILCALL
LBB0_6:
	movl	$0, 12(%rbx)
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_rw_threshold,4,2               ## @rw_threshold
	.comm	_MMCFIFOCTL_FIFOLEV,4,2         ## @MMCFIFOCTL_FIFOLEV
	.comm	_MMC_CTLR_VERSION_2,8,3         ## @MMC_CTLR_VERSION_2
	.comm	_DAVINCI_MMC_DATADIR_NONE,4,2   ## @DAVINCI_MMC_DATADIR_NONE
	.comm	_DAVINCI_MMCBLEN,8,3            ## @DAVINCI_MMCBLEN
	.comm	_DAVINCI_MMCNBLK,8,3            ## @DAVINCI_MMCNBLK
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s, %d blocks of %d bytes\n"

	.comm	_MMC_DATA_WRITE,4,2             ## @MMC_DATA_WRITE
L_.str.1:                               ## @.str.1
	.asciz	"write"

L_.str.2:                               ## @.str.2
	.asciz	"read"

L_.str.3:                               ## @.str.3
	.asciz	"  DTO %d cycles + %d ns\n"

	.comm	_DAVINCI_MMCTOD,8,3             ## @DAVINCI_MMCTOD
	.comm	_DAVINCI_MMC_DATADIR_WRITE,4,2  ## @DAVINCI_MMC_DATADIR_WRITE
	.comm	_MMCFIFOCTL_FIFODIR_WR,4,2      ## @MMCFIFOCTL_FIFODIR_WR
	.comm	_MMCFIFOCTL_FIFORST,4,2         ## @MMCFIFOCTL_FIFORST
	.comm	_DAVINCI_MMCFIFOCTL,8,3         ## @DAVINCI_MMCFIFOCTL
	.comm	_DAVINCI_MMC_DATADIR_READ,4,2   ## @DAVINCI_MMC_DATADIR_READ
	.comm	_MMCFIFOCTL_FIFODIR_RD,4,2      ## @MMCFIFOCTL_FIFODIR_RD
	.no_dead_strip	_mmc_davinci_prepare_data
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mmc_davinci_prepare_data
_mmc_davinci_prepare_data:              ; @mmc_davinci_prepare_data
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	mov	x19, x0
Lloh0:
	adrp	x21, _rw_threshold@GOTPAGE
Lloh1:
	ldr	x21, [x21, _rw_threshold@GOTPAGEOFF]
	ldr	w8, [x21]
Lloh2:
	adrp	x9, _MMCFIFOCTL_FIFOLEV@GOTPAGE
Lloh3:
	ldr	x9, [x9, _MMCFIFOCTL_FIFOLEV@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
	ldr	x20, [x1]
	ldr	x10, [x0]
Lloh5:
	adrp	x11, _MMC_CTLR_VERSION_2@GOTPAGE
Lloh6:
	ldr	x11, [x11, _MMC_CTLR_VERSION_2@GOTPAGEOFF]
Lloh7:
	ldr	x11, [x11]
	str	x20, [x0, #16]
	cbz	x20, LBB0_5
; %bb.1:
	cmp	w8, #64
	csel	w12, w9, wzr, eq
	cmp	w8, #32
	csel	w8, w9, wzr, eq
	cmp	x10, x11
	csel	w22, w12, w8, eq
	ldr	w0, [x19, #60]
	bl	_mmc_dev
Lloh8:
	adrp	x23, _MMC_DATA_WRITE@GOTPAGE
Lloh9:
	ldr	x23, [x23, _MMC_DATA_WRITE@GOTPAGEOFF]
Lloh10:
	adrp	x8, l_.str.1@PAGE
Lloh11:
	add	x8, x8, l_.str.1@PAGEOFF
Lloh12:
	adrp	x9, l_.str.2@PAGE
Lloh13:
	add	x9, x9, l_.str.2@PAGEOFF
	ldr	w10, [x23]
	ldp	w11, w12, [x20]
	tst	w10, w11
	csel	x8, x9, x8, eq
	ldr	w9, [x20, #8]
	stp	x12, x9, [sp, #8]
	str	x8, [sp]
Lloh14:
	adrp	x1, l_.str@PAGE
Lloh15:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
	ldr	w0, [x19, #60]
	bl	_mmc_dev
	ldp	w8, w9, [x20, #12]
	stp	x8, x9, [sp]
Lloh16:
	adrp	x1, l_.str.3@PAGE
Lloh17:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_dbg
	ldp	w8, w9, [x20, #12]
	ldr	w10, [x19, #8]
	sdiv	w9, w9, w10
	mov	w10, #65535
	add	w8, w9, w8
	cmp	w8, w10
	csel	w0, w8, w10, lt
	ldr	x8, [x19, #48]
Lloh18:
	adrp	x9, _DAVINCI_MMCTOD@GOTPAGE
Lloh19:
	ldr	x9, [x9, _DAVINCI_MMCTOD@GOTPAGEOFF]
Lloh20:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	ldr	w0, [x20, #4]
	ldr	x8, [x19, #48]
Lloh21:
	adrp	x9, _DAVINCI_MMCNBLK@GOTPAGE
Lloh22:
	ldr	x9, [x9, _DAVINCI_MMCNBLK@GOTPAGEOFF]
Lloh23:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	ldr	w0, [x20, #8]
	ldr	x8, [x19, #48]
Lloh24:
	adrp	x9, _DAVINCI_MMCBLEN@GOTPAGE
Lloh25:
	ldr	x9, [x9, _DAVINCI_MMCBLEN@GOTPAGEOFF]
Lloh26:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	ldr	w8, [x20]
	ldr	w9, [x23]
Lloh27:
	adrp	x10, _MMCFIFOCTL_FIFODIR_WR@GOTPAGE
Lloh28:
	ldr	x10, [x10, _MMCFIFOCTL_FIFODIR_WR@GOTPAGEOFF]
Lloh29:
	adrp	x11, _MMCFIFOCTL_FIFODIR_RD@GOTPAGE
Lloh30:
	ldr	x11, [x11, _MMCFIFOCTL_FIFODIR_RD@GOTPAGEOFF]
	tst	w9, w8
	csel	x23, x11, x10, eq
Lloh31:
	adrp	x8, _DAVINCI_MMC_DATADIR_READ@GOTPAGE
Lloh32:
	ldr	x8, [x8, _DAVINCI_MMC_DATADIR_READ@GOTPAGEOFF]
Lloh33:
	adrp	x9, _DAVINCI_MMC_DATADIR_WRITE@GOTPAGE
Lloh34:
	ldr	x9, [x9, _DAVINCI_MMC_DATADIR_WRITE@GOTPAGEOFF]
	csel	x8, x8, x9, eq
	ldr	w8, [x8]
	str	w8, [x19, #56]
	ldr	w8, [x23]
	orr	w8, w8, w22
Lloh35:
	adrp	x9, _MMCFIFOCTL_FIFORST@GOTPAGE
Lloh36:
	ldr	x9, [x9, _MMCFIFOCTL_FIFORST@GOTPAGEOFF]
Lloh37:
	ldr	w9, [x9]
	orr	w0, w8, w9
	ldr	x8, [x19, #48]
Lloh38:
	adrp	x24, _DAVINCI_MMCFIFOCTL@GOTPAGE
Lloh39:
	ldr	x24, [x24, _DAVINCI_MMCFIFOCTL@GOTPAGEOFF]
	ldr	x9, [x24]
	add	x1, x9, x8
	bl	_writel
	ldr	w8, [x23]
	orr	w0, w8, w22
	ldr	x8, [x19, #48]
	ldr	x9, [x24]
	add	x1, x9, x8
	bl	_writel
	str	xzr, [x19, #40]
	ldp	w8, w9, [x20, #4]
	mul	w8, w9, w8
	str	w8, [x19, #12]
	ldr	x9, [x19, #32]
	cbz	x9, LBB0_4
; %bb.2:
	ldr	w9, [x21]
	sub	w9, w9, #1
	tst	w9, w8
	b.ne	LBB0_4
; %bb.3:
	mov	x0, x19
	mov	x1, x20
	bl	_mmc_davinci_start_dma_transfer
	cbz	x0, LBB0_6
LBB0_4:
	ldr	w8, [x20, #24]
	ldr	x9, [x19, #16]
	ldr	w9, [x9, #20]
	stp	w9, w8, [x19, #24]
	mov	x0, x19
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #96
	b	_mmc_davinci_sg_to_buf
LBB0_5:
Lloh40:
	adrp	x8, _DAVINCI_MMC_DATADIR_NONE@GOTPAGE
Lloh41:
	ldr	x8, [x8, _DAVINCI_MMC_DATADIR_NONE@GOTPAGEOFF]
Lloh42:
	ldr	w8, [x8]
	str	w8, [x19, #56]
	ldr	x8, [x19, #48]
Lloh43:
	adrp	x9, _DAVINCI_MMCBLEN@GOTPAGE
Lloh44:
	ldr	x9, [x9, _DAVINCI_MMCBLEN@GOTPAGEOFF]
Lloh45:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	w0, #0
	bl	_writel
	ldr	x8, [x19, #48]
Lloh46:
	adrp	x9, _DAVINCI_MMCNBLK@GOTPAGE
Lloh47:
	ldr	x9, [x9, _DAVINCI_MMCNBLK@GOTPAGEOFF]
Lloh48:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	w0, #0
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #96
	b	_writel
LBB0_6:
	str	wzr, [x19, #12]
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh38, Lloh39
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGot	Lloh33, Lloh34
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh46, Lloh47, Lloh48
	.loh AdrpLdrGotLdr	Lloh43, Lloh44, Lloh45
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.cfi_endproc
                                        ; -- End function
	.comm	_rw_threshold,4,2               ; @rw_threshold
	.comm	_MMCFIFOCTL_FIFOLEV,4,2         ; @MMCFIFOCTL_FIFOLEV
	.comm	_MMC_CTLR_VERSION_2,8,3         ; @MMC_CTLR_VERSION_2
	.comm	_DAVINCI_MMC_DATADIR_NONE,4,2   ; @DAVINCI_MMC_DATADIR_NONE
	.comm	_DAVINCI_MMCBLEN,8,3            ; @DAVINCI_MMCBLEN
	.comm	_DAVINCI_MMCNBLK,8,3            ; @DAVINCI_MMCNBLK
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s, %d blocks of %d bytes\n"

	.comm	_MMC_DATA_WRITE,4,2             ; @MMC_DATA_WRITE
l_.str.1:                               ; @.str.1
	.asciz	"write"

l_.str.2:                               ; @.str.2
	.asciz	"read"

l_.str.3:                               ; @.str.3
	.asciz	"  DTO %d cycles + %d ns\n"

	.comm	_DAVINCI_MMCTOD,8,3             ; @DAVINCI_MMCTOD
	.comm	_DAVINCI_MMC_DATADIR_WRITE,4,2  ; @DAVINCI_MMC_DATADIR_WRITE
	.comm	_MMCFIFOCTL_FIFODIR_WR,4,2      ; @MMCFIFOCTL_FIFODIR_WR
	.comm	_MMCFIFOCTL_FIFORST,4,2         ; @MMCFIFOCTL_FIFORST
	.comm	_DAVINCI_MMCFIFOCTL,8,3         ; @DAVINCI_MMCFIFOCTL
	.comm	_DAVINCI_MMC_DATADIR_READ,4,2   ; @DAVINCI_MMC_DATADIR_READ
	.comm	_MMCFIFOCTL_FIFODIR_RD,4,2      ; @MMCFIFOCTL_FIFODIR_RD
	.no_dead_strip	_mmc_davinci_prepare_data
.subsections_via_symbols
