	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function msdc_cmd_prepare_raw_cmd
_msdc_cmd_prepare_raw_cmd:              ## @msdc_cmd_prepare_raw_cmd
	.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	%rdx, %r13
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movl	(%rdx), %r12d
	callq	_msdc_cmd_find_resp
	movl	%eax, %r15d
	movl	%r12d, %ecx
	andl	$63, %ecx
	movl	%eax, (%r14)
	andl	$7, %r15d
	shll	$7, %r15d
	orl	%ecx, %r15d
	movq	_SD_IO_RW_DIRECT@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jne	LBB0_2
## %bb.1:
	cmpl	$-1, 4(%r13)
	je	LBB0_3
LBB0_2:
	movq	_MMC_STOP_TRANSMISSION@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	je	LBB0_3
## %bb.4:
	movq	_SD_SWITCH_VOLTAGE@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jne	LBB0_6
## %bb.5:
	orl	$1073741824, %r15d              ## imm = 0x40000000
	jmp	LBB0_15
LBB0_3:
	orl	$16384, %r15d                   ## imm = 0x4000
	jmp	LBB0_15
LBB0_6:
	movq	_SD_APP_SEND_SCR@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	je	LBB0_14
## %bb.7:
	movq	_SD_APP_SEND_NUM_WR_BLKS@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	je	LBB0_14
## %bb.8:
	movq	_SD_SWITCH@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jne	LBB0_10
## %bb.9:
	movq	%r13, %rdi
	callq	_mmc_cmd_type
	movq	_MMC_CMD_ADTC@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_14
LBB0_10:
	movq	_SD_APP_SD_STATUS@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jne	LBB0_12
## %bb.11:
	movq	%r13, %rdi
	callq	_mmc_cmd_type
	movq	_MMC_CMD_ADTC@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_14
LBB0_12:
	movq	_MMC_SEND_EXT_CSD@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jne	LBB0_15
## %bb.13:
	movq	%r13, %rdi
	callq	_mmc_cmd_type
	movq	_MMC_CMD_ADTC@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_15
LBB0_14:
	orl	$2048, %r15d                    ## imm = 0x800
LBB0_15:
	movq	8(%r13), %r13
	testq	%r13, %r13
	je	LBB0_25
## %bb.16:
	movl	%r12d, %edi
	callq	_mmc_op_multi
	testq	%rax, %rax
	je	LBB0_20
## %bb.17:
	movq	32(%r14), %rax
	movl	(%rax), %edi
	callq	_mmc_card_mmc
	testq	%rax, %rax
	je	LBB0_20
## %bb.18:
	movq	(%rbx), %rax
	testq	%rax, %rax
	je	LBB0_20
## %bb.19:
	movl	%r15d, %ecx
	orl	$536870912, %ecx                ## imm = 0x20000000
	cmpl	$65536, (%rax)                  ## imm = 0x10000
	cmovbl	%ecx, %r15d
LBB0_20:
	movl	(%r13), %eax
	shll	$16, %eax
	andl	$268369920, %eax                ## imm = 0xFFF0000
	orl	%r15d, %eax
	movq	_MMC_DATA_WRITE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	andl	4(%r13), %ecx
	movl	%eax, %r15d
	orl	$8192, %r15d                    ## imm = 0x2000
	testl	%ecx, %ecx
	cmovel	%eax, %r15d
	xorl	%ebx, %ebx
	cmpl	$2, 8(%r13)
	setge	%bl
	shll	$11, %ebx
	addl	$2048, %ebx                     ## imm = 0x800
	movq	_MSDC_CFG@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	24(%r14), %rdi
	movq	_MSDC_CFG_PIO@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_sdr_clr_bits
	movq	16(%r13), %rsi
	cmpq	%rsi, 8(%r14)
	jne	LBB0_21
## %bb.22:
	movq	24(%r13), %rdx
	cmpq	%rdx, 16(%r14)
	jne	LBB0_23
	jmp	LBB0_24
LBB0_21:
	movq	24(%r13), %rdx
LBB0_23:
	movq	%r14, %rdi
	callq	_msdc_set_timeout
LBB0_24:
	orl	%ebx, %r15d
	movl	8(%r13), %edi
	movq	_SDC_BLK_NUM@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	24(%r14), %rsi
	callq	_writel
LBB0_25:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SD_IO_RW_DIRECT,4,2            ## @SD_IO_RW_DIRECT
	.comm	_MMC_STOP_TRANSMISSION,4,2      ## @MMC_STOP_TRANSMISSION
	.comm	_SD_SWITCH_VOLTAGE,4,2          ## @SD_SWITCH_VOLTAGE
	.comm	_SD_APP_SEND_SCR,4,2            ## @SD_APP_SEND_SCR
	.comm	_SD_APP_SEND_NUM_WR_BLKS,4,2    ## @SD_APP_SEND_NUM_WR_BLKS
	.comm	_SD_SWITCH,4,2                  ## @SD_SWITCH
	.comm	_MMC_CMD_ADTC,8,3               ## @MMC_CMD_ADTC
	.comm	_SD_APP_SD_STATUS,4,2           ## @SD_APP_SD_STATUS
	.comm	_MMC_SEND_EXT_CSD,4,2           ## @MMC_SEND_EXT_CSD
	.comm	_MMC_DATA_WRITE,4,2             ## @MMC_DATA_WRITE
	.comm	_MSDC_CFG,8,3                   ## @MSDC_CFG
	.comm	_MSDC_CFG_PIO,4,2               ## @MSDC_CFG_PIO
	.comm	_SDC_BLK_NUM,8,3                ## @SDC_BLK_NUM
	.no_dead_strip	_msdc_cmd_prepare_raw_cmd
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function msdc_cmd_prepare_raw_cmd
_msdc_cmd_prepare_raw_cmd:              ; @msdc_cmd_prepare_raw_cmd
	.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
	mov	x23, x2
	mov	x21, x1
	mov	x19, x0
	ldr	w22, [x2]
	bl	_msdc_cmd_find_resp
	and	w20, w22, #0x3f
	bfi	w20, w0, #7, #3
	str	w0, [x19]
Lloh0:
	adrp	x8, _SD_IO_RW_DIRECT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SD_IO_RW_DIRECT@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w22, w8
	b.ne	LBB0_4
; %bb.1:
	ldr	w8, [x23, #4]
Lloh3:
	adrp	x9, _MMC_STOP_TRANSMISSION@GOTPAGE
Lloh4:
	ldr	x9, [x9, _MMC_STOP_TRANSMISSION@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	cmn	w8, #1
	ccmp	w22, w9, #4, ne
	b.eq	LBB0_5
LBB0_2:
Lloh6:
	adrp	x8, _SD_SWITCH_VOLTAGE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _SD_SWITCH_VOLTAGE@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	cmp	w22, w8
	b.ne	LBB0_6
; %bb.3:
	orr	w20, w20, #0x40000000
	b	LBB0_14
LBB0_4:
Lloh9:
	adrp	x8, _MMC_STOP_TRANSMISSION@GOTPAGE
Lloh10:
	ldr	x8, [x8, _MMC_STOP_TRANSMISSION@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	cmp	w22, w8
	b.ne	LBB0_2
LBB0_5:
	orr	w20, w20, #0x4000
	b	LBB0_14
LBB0_6:
Lloh12:
	adrp	x8, _SD_APP_SEND_SCR@GOTPAGE
Lloh13:
	ldr	x8, [x8, _SD_APP_SEND_SCR@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
Lloh15:
	adrp	x9, _SD_APP_SEND_NUM_WR_BLKS@GOTPAGE
Lloh16:
	ldr	x9, [x9, _SD_APP_SEND_NUM_WR_BLKS@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	cmp	w22, w8
	ccmp	w22, w9, #4, ne
	b.eq	LBB0_13
; %bb.7:
Lloh18:
	adrp	x8, _SD_SWITCH@GOTPAGE
Lloh19:
	ldr	x8, [x8, _SD_SWITCH@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	cmp	w22, w8
	b.ne	LBB0_9
; %bb.8:
	mov	x0, x23
	bl	_mmc_cmd_type
Lloh21:
	adrp	x8, _MMC_CMD_ADTC@GOTPAGE
Lloh22:
	ldr	x8, [x8, _MMC_CMD_ADTC@GOTPAGEOFF]
Lloh23:
	ldr	x8, [x8]
	cmp	x0, x8
	b.eq	LBB0_13
LBB0_9:
Lloh24:
	adrp	x8, _SD_APP_SD_STATUS@GOTPAGE
Lloh25:
	ldr	x8, [x8, _SD_APP_SD_STATUS@GOTPAGEOFF]
Lloh26:
	ldr	w8, [x8]
	cmp	w22, w8
	b.ne	LBB0_11
; %bb.10:
	mov	x0, x23
	bl	_mmc_cmd_type
Lloh27:
	adrp	x8, _MMC_CMD_ADTC@GOTPAGE
Lloh28:
	ldr	x8, [x8, _MMC_CMD_ADTC@GOTPAGEOFF]
Lloh29:
	ldr	x8, [x8]
	cmp	x0, x8
	b.eq	LBB0_13
LBB0_11:
Lloh30:
	adrp	x8, _MMC_SEND_EXT_CSD@GOTPAGE
Lloh31:
	ldr	x8, [x8, _MMC_SEND_EXT_CSD@GOTPAGEOFF]
Lloh32:
	ldr	w8, [x8]
	cmp	w22, w8
	b.ne	LBB0_14
; %bb.12:
	mov	x0, x23
	bl	_mmc_cmd_type
Lloh33:
	adrp	x8, _MMC_CMD_ADTC@GOTPAGE
Lloh34:
	ldr	x8, [x8, _MMC_CMD_ADTC@GOTPAGEOFF]
Lloh35:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_14
LBB0_13:
	orr	w20, w20, #0x800
LBB0_14:
	ldr	x23, [x23, #8]
	cbz	x23, LBB0_24
; %bb.15:
	mov	x0, x22
	bl	_mmc_op_multi
	cbz	x0, LBB0_19
; %bb.16:
	ldr	x8, [x19, #32]
	ldr	w0, [x8]
	bl	_mmc_card_mmc
	cbz	x0, LBB0_19
; %bb.17:
	ldr	x8, [x21]
	cbz	x8, LBB0_19
; %bb.18:
	ldr	w8, [x8]
	orr	w9, w20, #0x20000000
	cmp	w8, #16, lsl #12                ; =65536
	csel	w20, w9, w20, lo
LBB0_19:
	ldp	w8, w9, [x23]
	ubfiz	w8, w8, #16, #12
	orr	w8, w8, w20
Lloh36:
	adrp	x10, _MMC_DATA_WRITE@GOTPAGE
Lloh37:
	ldr	x10, [x10, _MMC_DATA_WRITE@GOTPAGEOFF]
Lloh38:
	ldr	w10, [x10]
	orr	w11, w8, #0x2000
	tst	w10, w9
	csel	w8, w8, w11, eq
	ldr	w9, [x23, #8]
	mov	w10, #2048
	mov	w11, #4096
	cmp	w9, #1
	csel	w9, w11, w10, gt
	orr	w20, w8, w9
Lloh39:
	adrp	x8, _MSDC_CFG@GOTPAGE
Lloh40:
	ldr	x8, [x8, _MSDC_CFG@GOTPAGEOFF]
	ldr	x9, [x19, #24]
Lloh41:
	ldr	x8, [x8]
	add	x0, x8, x9
Lloh42:
	adrp	x8, _MSDC_CFG_PIO@GOTPAGE
Lloh43:
	ldr	x8, [x8, _MSDC_CFG_PIO@GOTPAGEOFF]
Lloh44:
	ldr	w1, [x8]
	bl	_sdr_clr_bits
	ldr	x8, [x19, #8]
	ldr	x1, [x23, #16]
	cmp	x8, x1
	b.ne	LBB0_21
; %bb.20:
	ldr	x8, [x19, #16]
	ldr	x2, [x23, #24]
	cmp	x8, x2
	b.ne	LBB0_22
	b	LBB0_23
LBB0_21:
	ldr	x2, [x23, #24]
LBB0_22:
	mov	x0, x19
	bl	_msdc_set_timeout
LBB0_23:
	ldr	w0, [x23, #8]
	ldr	x8, [x19, #24]
Lloh45:
	adrp	x9, _SDC_BLK_NUM@GOTPAGE
Lloh46:
	ldr	x9, [x9, _SDC_BLK_NUM@GOTPAGEOFF]
Lloh47:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
LBB0_24:
	mov	x0, x20
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh44
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh45, Lloh46, Lloh47
	.cfi_endproc
                                        ; -- End function
	.comm	_SD_IO_RW_DIRECT,4,2            ; @SD_IO_RW_DIRECT
	.comm	_MMC_STOP_TRANSMISSION,4,2      ; @MMC_STOP_TRANSMISSION
	.comm	_SD_SWITCH_VOLTAGE,4,2          ; @SD_SWITCH_VOLTAGE
	.comm	_SD_APP_SEND_SCR,4,2            ; @SD_APP_SEND_SCR
	.comm	_SD_APP_SEND_NUM_WR_BLKS,4,2    ; @SD_APP_SEND_NUM_WR_BLKS
	.comm	_SD_SWITCH,4,2                  ; @SD_SWITCH
	.comm	_MMC_CMD_ADTC,8,3               ; @MMC_CMD_ADTC
	.comm	_SD_APP_SD_STATUS,4,2           ; @SD_APP_SD_STATUS
	.comm	_MMC_SEND_EXT_CSD,4,2           ; @MMC_SEND_EXT_CSD
	.comm	_MMC_DATA_WRITE,4,2             ; @MMC_DATA_WRITE
	.comm	_MSDC_CFG,8,3                   ; @MSDC_CFG
	.comm	_MSDC_CFG_PIO,4,2               ; @MSDC_CFG_PIO
	.comm	_SDC_BLK_NUM,8,3                ; @SDC_BLK_NUM
	.no_dead_strip	_msdc_cmd_prepare_raw_cmd
.subsections_via_symbols
