	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mmc_card_sleepawake            ## -- Begin function mmc_card_sleepawake
	.p2align	4, 0x90
_mmc_card_sleepawake:                   ## @mmc_card_sleepawake
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r15d
	movq	%rdi, %rbx
	movq	8(%rdi), %r14
	testl	%esi, %esi
	je	LBB0_2
## %bb.1:
	movq	%rbx, %rdi
	callq	_mmc_deselect_cards
LBB0_2:
	leaq	-48(%rbp), %r12
	movq	%r12, %rdi
	xorl	%esi, %esi
	movl	$12, %edx
	callq	_memset
	movq	_MMC_SLEEP_AWAKE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -40(%rbp)
	movl	(%r14), %eax
	shll	$16, %eax
	leal	32768(%rax), %ecx
	testl	%r15d, %r15d
	cmovel	%eax, %ecx
	movl	%ecx, -48(%rbp)
	movq	_MMC_RSP_R1B@GOTPCREL(%rip), %rax
	movq	_MMC_CMD_AC@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movl	%ecx, -44(%rbp)
	movq	%rbx, %rdi
	movq	%r12, %rsi
	xorl	%edx, %edx
	callq	_mmc_wait_for_cmd
	testl	%eax, %eax
	jne	LBB0_7
## %bb.3:
	movq	_MMC_CAP_WAIT_WHILE_BUSY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rbx)
	jne	LBB0_5
## %bb.4:
	movl	4(%r14), %edi
	movl	$10000, %esi                    ## imm = 0x2710
	callq	_DIV_ROUND_UP
	movl	%eax, %edi
	callq	_mmc_delay
LBB0_5:
	xorl	%eax, %eax
	testl	%r15d, %r15d
	jne	LBB0_7
## %bb.6:
	movq	%r14, %rdi
	callq	_mmc_select_card
LBB0_7:
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MMC_SLEEP_AWAKE,4,2            ## @MMC_SLEEP_AWAKE
	.comm	_MMC_RSP_R1B,4,2                ## @MMC_RSP_R1B
	.comm	_MMC_CMD_AC,4,2                 ## @MMC_CMD_AC
	.comm	_MMC_CAP_WAIT_WHILE_BUSY,4,2    ## @MMC_CAP_WAIT_WHILE_BUSY
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mmc_card_sleepawake            ; -- Begin function mmc_card_sleepawake
	.p2align	2
_mmc_card_sleepawake:                   ; @mmc_card_sleepawake
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x20, x1
	mov	x21, x0
	ldr	x19, [x0, #8]
	cbz	w1, LBB0_2
; %bb.1:
	mov	x0, x21
	bl	_mmc_deselect_cards
LBB0_2:
	mov	x0, sp
	mov	w1, #0
	mov	w2, #12
	bl	_memset
Lloh0:
	adrp	x8, _MMC_SLEEP_AWAKE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MMC_SLEEP_AWAKE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	str	w8, [sp, #8]
	ldr	w8, [x19]
	lsl	w9, w8, #16
	mov	w10, #32768
	bfi	w10, w8, #16, #16
	cmp	w20, #0
	csel	w8, w9, w10, eq
Lloh3:
	adrp	x9, _MMC_RSP_R1B@GOTPAGE
Lloh4:
	ldr	x9, [x9, _MMC_RSP_R1B@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
Lloh6:
	adrp	x10, _MMC_CMD_AC@GOTPAGE
Lloh7:
	ldr	x10, [x10, _MMC_CMD_AC@GOTPAGEOFF]
Lloh8:
	ldr	w10, [x10]
	orr	w9, w10, w9
	stp	w8, w9, [sp]
	mov	x1, sp
	mov	x0, x21
	mov	w2, #0
	bl	_mmc_wait_for_cmd
	cbnz	w0, LBB0_8
; %bb.3:
	ldr	w8, [x21]
Lloh9:
	adrp	x9, _MMC_CAP_WAIT_WHILE_BUSY@GOTPAGE
Lloh10:
	ldr	x9, [x9, _MMC_CAP_WAIT_WHILE_BUSY@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_6
; %bb.4:
	cbz	w20, LBB0_7
LBB0_5:
	mov	w0, #0
	b	LBB0_8
LBB0_6:
	ldr	w0, [x19, #4]
	mov	w1, #10000
	bl	_DIV_ROUND_UP
	bl	_mmc_delay
	cbnz	w20, LBB0_5
LBB0_7:
	mov	x0, x19
	bl	_mmc_select_card
LBB0_8:
	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
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_MMC_SLEEP_AWAKE,4,2            ; @MMC_SLEEP_AWAKE
	.comm	_MMC_RSP_R1B,4,2                ; @MMC_RSP_R1B
	.comm	_MMC_CMD_AC,4,2                 ; @MMC_CMD_AC
	.comm	_MMC_CAP_WAIT_WHILE_BUSY,4,2    ; @MMC_CAP_WAIT_WHILE_BUSY
.subsections_via_symbols
