	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sdhci_s3c_set_clock
_sdhci_s3c_set_clock:                   ## @sdhci_s3c_set_clock
	.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, %r14d
	movq	%rdi, %rbx
	callq	_to_s3c
	testl	%r14d, %r14d
	je	LBB0_9
## %bb.1:
	movq	%rax, %r15
	movl	%r14d, %r12d
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movq	_UINT_MAX@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	_MAX_BUS_CLK@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	movl	%r14d, -44(%rbp)                ## 4-byte Spill
	jle	LBB0_2
## %bb.3:
	xorl	%r13d, %r13d
	xorl	%r14d, %r14d
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movl	%r14d, %esi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	movq	%rax, %r12
	callq	_sdhci_s3c_consider_clock
	cmpl	%ebx, %eax
	cmovbl	%r14d, %r13d
	cmovbl	%eax, %ebx
	movq	%r12, %rax
	incl	%r14d
	cmpl	(%r12), %r14d
	jl	LBB0_4
	jmp	LBB0_5
LBB0_2:
	xorl	%r13d, %r13d
LBB0_5:
	movq	8(%r15), %rdi
	leaq	L_.str(%rip), %rsi
	movl	%r13d, %edx
	movl	-44(%rbp), %r12d                ## 4-byte Reload
	movl	%r12d, %ecx
	movl	%ebx, %r8d
	callq	_dev_dbg
	cmpl	%r13d, (%r15)
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	je	LBB0_7
## %bb.6:
	movq	24(%r15), %rax
	movslq	%r13d, %rcx
	movq	(%rax,%rcx,8), %r14
	movq	_SDHCI_CLOCK_CONTROL@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%rbx), %rsi
	xorl	%edi, %edi
	callq	_writew
	movl	%r13d, (%r15)
	movq	%r14, %rdi
	callq	_clk_get_rate
	movl	%eax, 12(%rbx)
	movq	%rbx, %rdi
	callq	_sdhci_s3c_get_timeout_clk
	movl	%eax, 8(%rbx)
	movq	_S3C_SDHCI_CONTROL2@GOTPCREL(%rip), %r14
	movq	(%r14), %rdi
	addq	(%rbx), %rdi
	callq	_readl
	movq	_S3C_SDHCI_CTRL2_SELBASECLK_MASK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	notl	%edx
	andl	%eax, %edx
	movq	_S3C_SDHCI_CTRL2_SELBASECLK_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shll	%cl, %r13d
	orl	%edx, %r13d
	movq	(%r14), %rsi
	addq	(%rbx), %rsi
	movl	%r13d, %edi
	callq	_writel
LBB0_7:
	movl	%r12d, -48(%rbp)
	movq	16(%r15), %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	je	LBB0_9
## %bb.8:
	movq	8(%r15), %rdi
	movq	(%rbx), %rsi
	leaq	-48(%rbp), %rdx
	xorl	%ecx, %ecx
	callq	*%rax
LBB0_9:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_UINT_MAX,4,2                   ## @UINT_MAX
	.comm	_MAX_BUS_CLK,4,2                ## @MAX_BUS_CLK
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"selected source %d, clock %d, delta %d\n"

	.comm	_SDHCI_CLOCK_CONTROL,8,3        ## @SDHCI_CLOCK_CONTROL
	.comm	_S3C_SDHCI_CONTROL2,8,3         ## @S3C_SDHCI_CONTROL2
	.comm	_S3C_SDHCI_CTRL2_SELBASECLK_MASK,4,2 ## @S3C_SDHCI_CTRL2_SELBASECLK_MASK
	.comm	_S3C_SDHCI_CTRL2_SELBASECLK_SHIFT,4,2 ## @S3C_SDHCI_CTRL2_SELBASECLK_SHIFT
	.no_dead_strip	_sdhci_s3c_set_clock
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sdhci_s3c_set_clock
_sdhci_s3c_set_clock:                   ; @sdhci_s3c_set_clock
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.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
	mov	x21, x1
	mov	x19, x0
	bl	_to_s3c
	cbz	w21, LBB0_9
; %bb.1:
	mov	x20, x0
Lloh0:
	adrp	x8, _UINT_MAX@GOTPAGE
Lloh1:
	ldr	x8, [x8, _UINT_MAX@GOTPAGEOFF]
Lloh2:
	ldr	w23, [x8]
Lloh3:
	adrp	x25, _MAX_BUS_CLK@GOTPAGE
Lloh4:
	ldr	x25, [x25, _MAX_BUS_CLK@GOTPAGEOFF]
	ldr	w8, [x25]
	cmp	w8, #1
	b.lt	LBB0_4
; %bb.2:
	mov	w22, #0
	mov	w24, #0
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	mov	x1, x24
	mov	x2, x21
	bl	_sdhci_s3c_consider_clock
	cmp	w0, w23
	csel	w22, w24, w22, lo
	csel	w23, w0, w23, lo
	add	w24, w24, #1
	ldr	w8, [x25]
	cmp	w24, w8
	b.lt	LBB0_3
	b	LBB0_5
LBB0_4:
	mov	w22, #0
LBB0_5:
	ldr	x0, [x20, #8]
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x22
	mov	x3, x21
	mov	x4, x23
	bl	_dev_dbg
	ldr	w8, [x20]
	cmp	w8, w22
	b.eq	LBB0_7
; %bb.6:
	ldr	x8, [x20, #24]
	ldr	x23, [x8, w22, sxtw #3]
	ldr	x8, [x19]
Lloh7:
	adrp	x9, _SDHCI_CLOCK_CONTROL@GOTPAGE
Lloh8:
	ldr	x9, [x9, _SDHCI_CLOCK_CONTROL@GOTPAGEOFF]
Lloh9:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	w0, #0
	bl	_writew
	str	w22, [x20]
	mov	x0, x23
	bl	_clk_get_rate
	str	w0, [x19, #12]
	mov	x0, x19
	bl	_sdhci_s3c_get_timeout_clk
	str	w0, [x19, #8]
	ldr	x8, [x19]
Lloh10:
	adrp	x23, _S3C_SDHCI_CONTROL2@GOTPAGE
Lloh11:
	ldr	x23, [x23, _S3C_SDHCI_CONTROL2@GOTPAGEOFF]
	ldr	x9, [x23]
	add	x0, x9, x8
	bl	_readl
Lloh12:
	adrp	x8, _S3C_SDHCI_CTRL2_SELBASECLK_MASK@GOTPAGE
Lloh13:
	ldr	x8, [x8, _S3C_SDHCI_CTRL2_SELBASECLK_MASK@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	bic	w8, w0, w8
Lloh15:
	adrp	x9, _S3C_SDHCI_CTRL2_SELBASECLK_SHIFT@GOTPAGE
Lloh16:
	ldr	x9, [x9, _S3C_SDHCI_CTRL2_SELBASECLK_SHIFT@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	lsl	w9, w22, w9
	orr	w0, w9, w8
	ldr	x8, [x19]
	ldr	x9, [x23]
	add	x1, x9, x8
	bl	_writel
LBB0_7:
	str	w21, [sp, #8]
	ldr	x8, [x20, #16]
	ldr	x8, [x8]
	cbz	x8, LBB0_9
; %bb.8:
	ldr	x0, [x20, #8]
	ldr	x1, [x19]
	add	x2, sp, #8
	mov	x3, #0
	blr	x8
LBB0_9:
	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
	add	sp, sp, #96
	ret
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_UINT_MAX,4,2                   ; @UINT_MAX
	.comm	_MAX_BUS_CLK,4,2                ; @MAX_BUS_CLK
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"selected source %d, clock %d, delta %d\n"

	.comm	_SDHCI_CLOCK_CONTROL,8,3        ; @SDHCI_CLOCK_CONTROL
	.comm	_S3C_SDHCI_CONTROL2,8,3         ; @S3C_SDHCI_CONTROL2
	.comm	_S3C_SDHCI_CTRL2_SELBASECLK_MASK,4,2 ; @S3C_SDHCI_CTRL2_SELBASECLK_MASK
	.comm	_S3C_SDHCI_CTRL2_SELBASECLK_SHIFT,4,2 ; @S3C_SDHCI_CTRL2_SELBASECLK_SHIFT
	.no_dead_strip	_sdhci_s3c_set_clock
.subsections_via_symbols
