	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mmc_io_rw_direct_host
_mmc_io_rw_direct_host:                 ## @mmc_io_rw_direct_host
	.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	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	xorps	%xmm0, %xmm0
	movups	%xmm0, -40(%rbp)
	cmpl	$8, %edx
	jae	LBB0_1
## %bb.3:
	cmpl	$131072, %ecx                   ## imm = 0x20000
	jae	LBB0_1
## %bb.4:
	movq	%r9, %r14
	movq	%rdi, %r15
	movq	_SD_IO_RW_DIRECT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -32(%rbp)
	xorl	%eax, %eax
	testl	%esi, %esi
	setne	%al
	movl	%eax, %esi
	shll	$31, %esi
	shll	$28, %edx
	testq	%r9, %r9
	setne	%bl
	andb	%bl, %al
	movzbl	%al, %eax
	shll	$27, %eax
	shll	$9, %ecx
	orl	%edx, %ecx
	orl	%esi, %ecx
	orl	%r8d, %ecx
	orl	%eax, %ecx
	movl	%ecx, -48(%rbp)
	movq	_MMC_RSP_SPI_R5@GOTPCREL(%rip), %rax
	movq	_MMC_RSP_R5@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movq	_MMC_CMD_AC@GOTPCREL(%rip), %rax
	orl	(%rax), %ecx
	movl	%ecx, -44(%rbp)
	leaq	-48(%rbp), %rsi
	xorl	%edx, %edx
	callq	_mmc_wait_for_cmd
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_16
## %bb.5:
	movq	%r15, %rdi
	callq	_mmc_host_is_spi
	testq	%rax, %rax
	je	LBB0_6
LBB0_11:
	xorl	%ebx, %ebx
	testq	%r14, %r14
	je	LBB0_16
## %bb.12:
	movq	%r15, %rdi
	callq	_mmc_host_is_spi
	movq	-40(%rbp), %rcx
	movl	(%rcx), %ecx
	testq	%rax, %rax
	je	LBB0_14
## %bb.13:
	movzbl	%ch, %eax
	jmp	LBB0_15
LBB0_6:
	movq	-40(%rbp), %rax
	movl	(%rax), %eax
	movq	_R5_ERROR@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_8
## %bb.7:
	movq	_EIO@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_14:
	movzbl	%cl, %eax
LBB0_15:
	movl	%eax, (%r14)
	jmp	LBB0_16
LBB0_8:
	movq	_R5_FUNCTION_NUMBER@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_9
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_16:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	movq	_R5_OUT_OF_RANGE@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_11
## %bb.10:
	movq	_ERANGE@GOTPCREL(%rip), %rax
	jmp	LBB0_2
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_SD_IO_RW_DIRECT,4,2            ## @SD_IO_RW_DIRECT
	.comm	_MMC_RSP_SPI_R5,4,2             ## @MMC_RSP_SPI_R5
	.comm	_MMC_RSP_R5,4,2                 ## @MMC_RSP_R5
	.comm	_MMC_CMD_AC,4,2                 ## @MMC_CMD_AC
	.comm	_R5_ERROR,4,2                   ## @R5_ERROR
	.comm	_EIO,4,2                        ## @EIO
	.comm	_R5_FUNCTION_NUMBER,4,2         ## @R5_FUNCTION_NUMBER
	.comm	_R5_OUT_OF_RANGE,4,2            ## @R5_OUT_OF_RANGE
	.comm	_ERANGE,4,2                     ## @ERANGE
	.no_dead_strip	_mmc_io_rw_direct_host
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mmc_io_rw_direct_host
_mmc_io_rw_direct_host:                 ; @mmc_io_rw_direct_host
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	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
	stp	xzr, xzr, [sp, #16]
	cmp	w2, #8
	b.hs	LBB0_13
; %bb.1:
	cmp	w3, #32, lsl #12                ; =131072
	b.hs	LBB0_13
; %bb.2:
	mov	x19, x5
	mov	x20, x0
Lloh0:
	adrp	x8, _SD_IO_RW_DIRECT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SD_IO_RW_DIRECT@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	str	w8, [sp, #24]
	cmp	w1, #0
	cset	w8, ne
	lsl	w9, w8, #31
	orr	w9, w9, w2, lsl #28
	cmp	x5, #0
	cset	w10, ne
	tst	w8, w10
	mov	w8, #134217728
	csel	w8, w8, wzr, ne
	orr	w9, w9, w3, lsl #9
	orr	w9, w9, w4
Lloh3:
	adrp	x10, _MMC_RSP_SPI_R5@GOTPAGE
Lloh4:
	ldr	x10, [x10, _MMC_RSP_SPI_R5@GOTPAGEOFF]
	orr	w8, w9, w8
Lloh5:
	ldr	w9, [x10]
Lloh6:
	adrp	x10, _MMC_RSP_R5@GOTPAGE
Lloh7:
	ldr	x10, [x10, _MMC_RSP_R5@GOTPAGEOFF]
Lloh8:
	ldr	w10, [x10]
	orr	w9, w10, w9
Lloh9:
	adrp	x10, _MMC_CMD_AC@GOTPAGE
Lloh10:
	ldr	x10, [x10, _MMC_CMD_AC@GOTPAGEOFF]
Lloh11:
	ldr	w10, [x10]
	orr	w9, w9, w10
	stp	w8, w9, [sp, #8]
	add	x1, sp, #8
	mov	w2, #0
	bl	_mmc_wait_for_cmd
	cbnz	w0, LBB0_15
; %bb.3:
	mov	x0, x20
	bl	_mmc_host_is_spi
	cbz	x0, LBB0_7
LBB0_4:
	cbz	x19, LBB0_9
; %bb.5:
	mov	x0, x20
	bl	_mmc_host_is_spi
	ldr	x8, [sp, #16]
	ldr	w8, [x8]
	cbz	x0, LBB0_10
; %bb.6:
	mov	w0, #0
	ubfx	w8, w8, #8, #8
	b	LBB0_11
LBB0_7:
	ldr	x8, [sp, #16]
	ldr	w8, [x8]
Lloh12:
	adrp	x9, _R5_ERROR@GOTPAGE
Lloh13:
	ldr	x9, [x9, _R5_ERROR@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_12
; %bb.8:
Lloh15:
	adrp	x8, _EIO@GOTPAGE
Lloh16:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_14
LBB0_9:
	mov	w0, #0
	b	LBB0_15
LBB0_10:
	and	w8, w8, #0xff
LBB0_11:
	str	w8, [x19]
	b	LBB0_15
LBB0_12:
Lloh17:
	adrp	x9, _R5_FUNCTION_NUMBER@GOTPAGE
Lloh18:
	ldr	x9, [x9, _R5_FUNCTION_NUMBER@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_16
LBB0_13:
Lloh20:
	adrp	x8, _EINVAL@GOTPAGE
Lloh21:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_14:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_15:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
LBB0_16:
Lloh22:
	adrp	x9, _R5_OUT_OF_RANGE@GOTPAGE
Lloh23:
	ldr	x9, [x9, _R5_OUT_OF_RANGE@GOTPAGEOFF]
Lloh24:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_4
; %bb.17:
Lloh25:
	adrp	x8, _ERANGE@GOTPAGE
Lloh26:
	ldr	x8, [x8, _ERANGE@GOTPAGEOFF]
	b	LBB0_14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_SD_IO_RW_DIRECT,4,2            ; @SD_IO_RW_DIRECT
	.comm	_MMC_RSP_SPI_R5,4,2             ; @MMC_RSP_SPI_R5
	.comm	_MMC_RSP_R5,4,2                 ; @MMC_RSP_R5
	.comm	_MMC_CMD_AC,4,2                 ; @MMC_CMD_AC
	.comm	_R5_ERROR,4,2                   ; @R5_ERROR
	.comm	_EIO,4,2                        ; @EIO
	.comm	_R5_FUNCTION_NUMBER,4,2         ; @R5_FUNCTION_NUMBER
	.comm	_R5_OUT_OF_RANGE,4,2            ; @R5_OUT_OF_RANGE
	.comm	_ERANGE,4,2                     ; @ERANGE
	.no_dead_strip	_mmc_io_rw_direct_host
.subsections_via_symbols
