	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sdmmc_execute_tuning
_sdmmc_execute_tuning:                  ## @sdmmc_execute_tuning
	.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
	movl	%esi, %r15d
	movq	%rdi, %r13
	callq	_mmc_priv
	cmpq	$0, 8(%rax)
	je	LBB0_2
## %bb.1:
	movq	_ENOMEDIUM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_16
LBB0_2:
	movq	%rax, %r12
	movq	(%rax), %r14
	movq	_RTSX_SD_CARD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_rtsx_pci_card_exclusive_check
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_16
## %bb.3:
	movq	%r14, %rdi
	callq	_mutex_lock
	movq	%r14, %rdi
	callq	_rtsx_pci_start_run
	movl	(%r13), %eax
	cmpl	$128, %eax
	je	LBB0_7
## %bb.4:
	cmpl	$130, %eax
	je	LBB0_8
## %bb.5:
	cmpl	$129, %eax
	jne	LBB0_11
## %bb.6:
	movq	%r14, %rdi
	callq	_SDR104_TX_PHASE
	jmp	LBB0_9
LBB0_7:
	movq	%r14, %rdi
	callq	_SDR50_TX_PHASE
	jmp	LBB0_9
LBB0_8:
	movq	%r14, %rdi
	callq	_DDR50_TX_PHASE
LBB0_9:
	movl	%eax, %esi
	movq	%r12, %rdi
	xorl	%edx, %edx
	callq	_sd_change_phase
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_15
## %bb.10:
	movl	(%r13), %eax
LBB0_11:
	leal	-128(%rax), %ecx
	cmpl	$2, %ecx
	jae	LBB0_12
## %bb.17:
	movq	%r12, %rdi
	movl	%r15d, %esi
	callq	_sd_tuning_rx
	jmp	LBB0_14
LBB0_12:
	xorl	%ebx, %ebx
	cmpl	$130, %eax
	jne	LBB0_15
## %bb.13:
	movq	%r14, %rdi
	callq	_DDR50_RX_PHASE
	movq	%r12, %rdi
	movl	%eax, %esi
	movl	$1, %edx
	callq	_sd_change_phase
LBB0_14:
	movl	%eax, %ebx
LBB0_15:
	movq	%r14, %rdi
	callq	_mutex_unlock
LBB0_16:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOMEDIUM,4,2                  ## @ENOMEDIUM
	.comm	_RTSX_SD_CARD,4,2               ## @RTSX_SD_CARD
	.no_dead_strip	_sdmmc_execute_tuning
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sdmmc_execute_tuning
_sdmmc_execute_tuning:                  ; @sdmmc_execute_tuning
	.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	x21, x1
	mov	x22, x0
	bl	_mmc_priv
	ldr	x8, [x0, #8]
	cbz	x8, LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _ENOMEDIUM@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ENOMEDIUM@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_18
LBB0_2:
	mov	x20, x0
	ldr	x19, [x0]
Lloh3:
	adrp	x8, _RTSX_SD_CARD@GOTPAGE
Lloh4:
	ldr	x8, [x8, _RTSX_SD_CARD@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_rtsx_pci_card_exclusive_check
	mov	x23, x0
	cbnz	w0, LBB0_18
; %bb.3:
	mov	x0, x19
	bl	_mutex_lock
	mov	x0, x19
	bl	_rtsx_pci_start_run
	ldr	w8, [x22]
	cmp	w8, #128
	b.eq	LBB0_7
; %bb.4:
	cmp	w8, #130
	b.eq	LBB0_8
; %bb.5:
	cmp	w8, #129
	b.ne	LBB0_11
; %bb.6:
	mov	x0, x19
	bl	_SDR104_TX_PHASE
	b	LBB0_9
LBB0_7:
	mov	x0, x19
	bl	_SDR50_TX_PHASE
	b	LBB0_9
LBB0_8:
	mov	x0, x19
	bl	_DDR50_TX_PHASE
LBB0_9:
	mov	x1, x0
	mov	x0, x20
	mov	w2, #0
	bl	_sd_change_phase
	mov	x23, x0
	cbnz	w0, LBB0_17
; %bb.10:
	ldr	w8, [x22]
LBB0_11:
	sub	w9, w8, #128
	cmp	w9, #2
	b.hs	LBB0_13
; %bb.12:
	mov	x0, x20
	mov	x1, x21
	bl	_sd_tuning_rx
	b	LBB0_15
LBB0_13:
	cmp	w8, #130
	b.ne	LBB0_16
; %bb.14:
	mov	x0, x19
	bl	_DDR50_RX_PHASE
	mov	x1, x0
	mov	x0, x20
	mov	w2, #1
	bl	_sd_change_phase
LBB0_15:
	mov	x23, x0
	b	LBB0_17
LBB0_16:
	mov	w23, #0
LBB0_17:
	mov	x0, x19
	bl	_mutex_unlock
LBB0_18:
	mov	x0, x23
	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
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOMEDIUM,4,2                  ; @ENOMEDIUM
	.comm	_RTSX_SD_CARD,4,2               ; @RTSX_SD_CARD
	.no_dead_strip	_sdmmc_execute_tuning
.subsections_via_symbols
