	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function amd_execute_tuning_hs200
_amd_execute_tuning_hs200:              ## @amd_execute_tuning_hs200
	.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
	subq	$24, %rsp
	.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	_sdhci_priv
	movq	(%rax), %rax
	movq	(%rax), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	%r13, %rdi
	callq	_amd_tuning_reset
	xorl	%ebx, %ebx
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
	xorl	%r12d, %r12d
	xorl	%r14d, %r14d
	jmp	LBB0_1
	.p2align	4, 0x90
LBB0_3:                                 ##   in Loop: Header=BB0_1 Depth=1
	cmpl	%r12d, %r14d
	leal	1(%r14), %eax
	cmovgel	%eax, %r12d
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	cmovgel	%ebx, %ecx
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	movl	%eax, %r14d
LBB0_4:                                 ##   in Loop: Header=BB0_1 Depth=1
	incl	%ebx
	cmpl	$12, %ebx
	je	LBB0_5
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%ebx, %esi
	callq	_amd_config_tuning_phase
	movq	(%r13), %rdi
	movl	%r15d, %esi
	xorl	%edx, %edx
	callq	_mmc_send_tuning
	testq	%rax, %rax
	je	LBB0_3
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	_AMD_MSLEEP_DURATION@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_msleep
	movq	_SDHCI_RESET_DATA@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_SDHCI_RESET_CMD@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	movq	_SDHCI_SOFTWARE_RESET@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r13, %rdi
	callq	_sdhci_writeb
	xorl	%r14d, %r14d
	jmp	LBB0_4
LBB0_5:
	testl	%r12d, %r12d
	je	LBB0_6
## %bb.7:
	movl	%r12d, %eax
	shrl	$31, %eax
	addl	%r12d, %eax
	sarl	%eax
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	subl	%eax, %esi
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	callq	_amd_config_tuning_phase
	movq	%rbx, %rdi
	callq	_amd_enable_manual_tuning
	movq	(%r13), %rax
	movq	$0, (%rax)
	xorl	%eax, %eax
	jmp	LBB0_8
LBB0_6:
	leaq	L_.str(%rip), %rsi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_dev_err
	movq	_EIO@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_8:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AMD_MSLEEP_DURATION,4,2        ## @AMD_MSLEEP_DURATION
	.comm	_SDHCI_RESET_CMD,4,2            ## @SDHCI_RESET_CMD
	.comm	_SDHCI_RESET_DATA,4,2           ## @SDHCI_RESET_DATA
	.comm	_SDHCI_SOFTWARE_RESET,4,2       ## @SDHCI_SOFTWARE_RESET
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"no tuning point found\n"

	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_amd_execute_tuning_hs200
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function amd_execute_tuning_hs200
_amd_execute_tuning_hs200:              ; @amd_execute_tuning_hs200
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x21, x1
	mov	x19, x0
	bl	_sdhci_priv
	ldr	x8, [x0]
	ldr	x20, [x8]
	mov	x0, x19
	bl	_amd_tuning_reset
	mov	w22, #0
	mov	w23, #0
	mov	w24, #0
	mov	w25, #0
Lloh0:
	adrp	x26, _SDHCI_RESET_CMD@GOTPAGE
Lloh1:
	ldr	x26, [x26, _SDHCI_RESET_CMD@GOTPAGEOFF]
Lloh2:
	adrp	x27, _SDHCI_RESET_DATA@GOTPAGE
Lloh3:
	ldr	x27, [x27, _SDHCI_RESET_DATA@GOTPAGEOFF]
Lloh4:
	adrp	x28, _SDHCI_SOFTWARE_RESET@GOTPAGE
Lloh5:
	ldr	x28, [x28, _SDHCI_SOFTWARE_RESET@GOTPAGEOFF]
	b	LBB0_3
LBB0_1:                                 ;   in Loop: Header=BB0_3 Depth=1
	cmp	w25, w24
	csel	w23, w23, w22, lt
	csinc	w24, w24, w25, lt
	add	w25, w25, #1
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	w22, w22, #1
	cmp	w22, #12
	b.eq	LBB0_5
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	mov	x1, x22
	bl	_amd_config_tuning_phase
	ldr	x0, [x19]
	mov	x1, x21
	mov	x2, #0
	bl	_mmc_send_tuning
	cbz	x0, LBB0_1
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
Lloh6:
	adrp	x8, _AMD_MSLEEP_DURATION@GOTPAGE
Lloh7:
	ldr	x8, [x8, _AMD_MSLEEP_DURATION@GOTPAGEOFF]
Lloh8:
	ldr	w0, [x8]
	bl	_msleep
	ldr	w8, [x26]
	ldr	w9, [x27]
	orr	w1, w9, w8
	ldr	w2, [x28]
	mov	x0, x19
	bl	_sdhci_writeb
	mov	w25, #0
	b	LBB0_2
LBB0_5:
	cbz	w24, LBB0_7
; %bb.6:
	cmp	w24, #0
	cinc	w8, w24, lt
	sub	w1, w23, w8, asr #1
	mov	x0, x20
	bl	_amd_config_tuning_phase
	mov	x0, x20
	bl	_amd_enable_manual_tuning
	mov	w0, #0
	ldr	x8, [x19]
	str	xzr, [x8]
	b	LBB0_8
LBB0_7:
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	bl	_dev_err
Lloh11:
	adrp	x8, _EIO@GOTPAGE
Lloh12:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_8:
	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
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_AMD_MSLEEP_DURATION,4,2        ; @AMD_MSLEEP_DURATION
	.comm	_SDHCI_RESET_CMD,4,2            ; @SDHCI_RESET_CMD
	.comm	_SDHCI_RESET_DATA,4,2           ; @SDHCI_RESET_DATA
	.comm	_SDHCI_SOFTWARE_RESET,4,2       ; @SDHCI_SOFTWARE_RESET
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"no tuning point found\n"

	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_amd_execute_tuning_hs200
.subsections_via_symbols
