	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function dw_mci_hi3798cv200_execute_tuning
_dw_mci_hi3798cv200_execute_tuning:     ## @dw_mci_hi3798cv200_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
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, -48(%rbp)                 ## 4-byte Spill
	movq	%rdi, -72(%rbp)                 ## 8-byte Spill
	movq	8(%rdi), %r15
	movq	8(%r15), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	leaq	_dw_mci_hi3798cv200_execute_tuning.degrees(%rip), %rbx
	movq	%rbx, %rdi
	callq	_ARRAY_SIZE
	testl	%eax, %eax
	jle	LBB0_17
## %bb.1:
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	movl	$-1, -44(%rbp)                  ## 4-byte Folded Spill
	xorl	%r13d, %r13d
	movq	%rbx, %r15
	xorl	%r12d, %r12d
	movl	$-1, %ebx
	movl	$-1, %r14d
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_2 Depth=1
	incq	%r13
	leaq	_dw_mci_hi3798cv200_execute_tuning.degrees(%rip), %rdi
	callq	_ARRAY_SIZE
	cltq
	addq	$4, %r15
	cmpq	%rax, %r13
	jge	LBB0_8
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edi
	movl	(%r15), %esi
	callq	_clk_set_phase
	movq	_RINTSTS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_ALL_INT_CLR@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_mci_writel
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edi
	movl	-48(%rbp), %esi                 ## 4-byte Reload
	xorl	%edx, %edx
	callq	_mmc_send_tuning
	movl	$1, %ecx
	testl	%eax, %eax
	je	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	%r12d, %ecx
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	movl	%ecx, %r12d
	testq	%r13, %r13
	je	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	leal	-1(%r13), %ecx
	testl	%eax, %eax
	cmovel	%ebx, %ecx
	movl	%r14d, %edx
	cmovel	%r13d, %edx
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	cmovel	%ecx, %ebx
	cmovnel	%edx, %r14d
LBB0_6:                                 ##   in Loop: Header=BB0_2 Depth=1
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	cmpl	$-1, %r14d
	je	LBB0_7
## %bb.9:                               ##   in Loop: Header=BB0_2 Depth=1
	cmpl	$-1, %ebx
	je	LBB0_7
	jmp	LBB0_10
LBB0_8:
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
LBB0_10:
	testl	%r12d, %r12d
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	je	LBB0_17
## %bb.11:
	xorl	%r12d, %r12d
	cmpl	$-1, %r14d
	cmovnel	%r14d, %r12d
	cmpl	$-1, %ebx
	jne	LBB0_13
## %bb.12:
	leaq	_dw_mci_hi3798cv200_execute_tuning.degrees(%rip), %rdi
	callq	_ARRAY_SIZE
	movl	%eax, %ebx
	decl	%ebx
LBB0_13:
	leal	(%rbx,%r12), %r14d
	cmpl	%r12d, %ebx
	jge	LBB0_16
## %bb.14:
	leaq	_dw_mci_hi3798cv200_execute_tuning.degrees(%rip), %rdi
	callq	_ARRAY_SIZE
	cmpl	%eax, %r14d
	movl	%ebx, %r14d
	jge	LBB0_16
## %bb.15:
	leaq	_dw_mci_hi3798cv200_execute_tuning.degrees(%rip), %rdi
	callq	_ARRAY_SIZE
                                        ## kill: def $eax killed $eax def $rax
	leal	(%r12,%rax), %r14d
	decl	%r14d
LBB0_16:
	movl	%r14d, %eax
	shrl	$31, %eax
	addl	%r14d, %eax
	sarl	%eax
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movl	(%rcx), %edi
	cltq
	leaq	_dw_mci_hi3798cv200_execute_tuning.degrees(%rip), %rcx
	movl	(%rcx,%rax,4), %r13d
	movl	%r13d, %esi
	callq	_clk_set_phase
	movl	(%r15), %edi
	leaq	L_.str(%rip), %rsi
	movl	%r12d, %edx
	movl	%ebx, %ecx
	movl	%r13d, %r8d
	callq	_dev_dbg
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	jmp	LBB0_18
LBB0_17:
	movl	(%r15), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_18:
	movq	_RINTSTS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_ALL_INT_CLR@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	callq	_mci_writel
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__const
	.p2align	4                               ## @dw_mci_hi3798cv200_execute_tuning.degrees
_dw_mci_hi3798cv200_execute_tuning.degrees:
	.long	0                               ## 0x0
	.long	45                              ## 0x2d
	.long	90                              ## 0x5a
	.long	135                             ## 0x87
	.long	180                             ## 0xb4
	.long	225                             ## 0xe1
	.long	270                             ## 0x10e
	.long	315                             ## 0x13b

	.comm	_RINTSTS,4,2                    ## @RINTSTS
	.comm	_ALL_INT_CLR,4,2                ## @ALL_INT_CLR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Tuning clk_sample[%d, %d], set[%d]\n"

L_.str.1:                               ## @.str.1
	.asciz	"No valid clk_sample shift! use default\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_dw_mci_hi3798cv200_execute_tuning
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function dw_mci_hi3798cv200_execute_tuning
_dw_mci_hi3798cv200_execute_tuning:     ; @dw_mci_hi3798cv200_execute_tuning
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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	x23, x1
	mov	x24, x0
	ldr	x19, [x0, #8]
	ldr	x8, [x19, #8]
	str	x8, [sp, #8]                    ; 8-byte Folded Spill
Lloh0:
	adrp	x27, _dw_mci_hi3798cv200_execute_tuning.degrees@PAGE
Lloh1:
	add	x27, x27, _dw_mci_hi3798cv200_execute_tuning.degrees@PAGEOFF
	mov	x0, x27
	bl	_ARRAY_SIZE
	cmp	w0, #1
	b.lt	LBB0_13
; %bb.1:
	mov	x26, #0
	mov	w28, #0
	mov	w20, #-1
	mov	w22, #-1
	mov	w25, #-1
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x26, x26, #1
	mov	x0, x27
	bl	_ARRAY_SIZE
	cmp	x26, w0, sxtw
	b.ge	LBB0_12
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	mov	x21, x20
	ldr	x9, [sp, #8]                    ; 8-byte Folded Reload
	ldr	w0, [x9]
	ldr	w1, [x27, x26, lsl #2]
	bl	_clk_set_phase
Lloh2:
	adrp	x8, _RINTSTS@GOTPAGE
Lloh3:
	ldr	x8, [x8, _RINTSTS@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
Lloh5:
	adrp	x8, _ALL_INT_CLR@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ALL_INT_CLR@GOTPAGEOFF]
Lloh7:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_mci_writel
	ldr	w0, [x24]
	mov	x1, x23
	mov	x2, #0
	bl	_mmc_send_tuning
	mov	x20, x0
	cmp	w0, #0
	csinc	w28, w28, wzr, ne
	cset	w8, eq
	cmp	w21, #0
	cset	w9, ne
	orr	w10, w9, w8
	sub	w11, w26, #1
	cmp	w10, #0
	csel	w10, w22, w11, ne
	tst	w9, w8
	csel	w8, w26, w25, ne
	cmp	x26, #0
	csel	w25, w25, w8, eq
	csel	w22, w22, w10, eq
	cmn	w25, #1
	b.eq	LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	cmn	w22, #1
	b.eq	LBB0_2
; %bb.5:
	cbz	w28, LBB0_13
LBB0_6:
	cmn	w25, #1
	csel	w23, wzr, w25, eq
	cmn	w22, #1
	b.ne	LBB0_8
; %bb.7:
Lloh8:
	adrp	x0, _dw_mci_hi3798cv200_execute_tuning.degrees@PAGE
Lloh9:
	add	x0, x0, _dw_mci_hi3798cv200_execute_tuning.degrees@PAGEOFF
	bl	_ARRAY_SIZE
	sub	w22, w0, #1
LBB0_8:
	add	w24, w22, w23
	cmp	w22, w23
	b.ge	LBB0_11
; %bb.9:
Lloh10:
	adrp	x0, _dw_mci_hi3798cv200_execute_tuning.degrees@PAGE
Lloh11:
	add	x0, x0, _dw_mci_hi3798cv200_execute_tuning.degrees@PAGEOFF
	bl	_ARRAY_SIZE
	cmp	w24, w0
	mov	x24, x22
	b.ge	LBB0_11
; %bb.10:
Lloh12:
	adrp	x0, _dw_mci_hi3798cv200_execute_tuning.degrees@PAGE
Lloh13:
	add	x0, x0, _dw_mci_hi3798cv200_execute_tuning.degrees@PAGEOFF
	bl	_ARRAY_SIZE
	add	w8, w23, w0
	sub	w24, w8, #1
LBB0_11:
	cmp	w24, #0
	cinc	w8, w24, lt
	asr	w8, w8, #1
	ldr	x9, [sp, #8]                    ; 8-byte Folded Reload
	ldr	w0, [x9]
	ldr	w21, [x27, w8, sxtw #2]
	mov	x1, x21
	bl	_clk_set_phase
	ldr	w0, [x19]
Lloh14:
	adrp	x1, l_.str@PAGE
Lloh15:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x23
	mov	x3, x22
	mov	x4, x21
	bl	_dev_dbg
	b	LBB0_14
LBB0_12:
	mov	w20, #0
	cbnz	w28, LBB0_6
LBB0_13:
	ldr	w0, [x19]
Lloh16:
	adrp	x1, l_.str.1@PAGE
Lloh17:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
Lloh18:
	adrp	x8, _EINVAL@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_14:
Lloh21:
	adrp	x8, _RINTSTS@GOTPAGE
Lloh22:
	ldr	x8, [x8, _RINTSTS@GOTPAGEOFF]
Lloh23:
	ldr	w1, [x8]
Lloh24:
	adrp	x8, _ALL_INT_CLR@GOTPAGE
Lloh25:
	ldr	x8, [x8, _ALL_INT_CLR@GOTPAGEOFF]
Lloh26:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_mci_writel
	mov	x0, x20
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__const
	.p2align	2                               ; @dw_mci_hi3798cv200_execute_tuning.degrees
_dw_mci_hi3798cv200_execute_tuning.degrees:
	.long	0                               ; 0x0
	.long	45                              ; 0x2d
	.long	90                              ; 0x5a
	.long	135                             ; 0x87
	.long	180                             ; 0xb4
	.long	225                             ; 0xe1
	.long	270                             ; 0x10e
	.long	315                             ; 0x13b

	.comm	_RINTSTS,4,2                    ; @RINTSTS
	.comm	_ALL_INT_CLR,4,2                ; @ALL_INT_CLR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Tuning clk_sample[%d, %d], set[%d]\n"

l_.str.1:                               ; @.str.1
	.asciz	"No valid clk_sample shift! use default\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_dw_mci_hi3798cv200_execute_tuning
.subsections_via_symbols
