	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %ebx
	movq	%rdi, %r14
	callq	_to_s3c
	movl	%ebx, %ecx
	movq	%rax, %r15
	movq	_UINT_MAX@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	16(%r14), %rax
	movq	$0, (%rax)
	testl	%ecx, %ecx
	je	LBB0_3
## %bb.1:
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	movq	_MAX_BUS_CLK@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jle	LBB0_2
## %bb.5:
	xorl	%r14d, %r14d
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movl	%r14d, %esi
	movl	%ecx, %edx
	movl	%r13d, %r12d
	movq	%r15, %r13
	movl	%ecx, %r15d
	callq	_sdhci_s3c_consider_clock
	movl	%r15d, %ecx
	movq	%r13, %r15
	movl	%r12d, %r13d
	cmpl	%ebx, %eax
	cmovbl	%r14d, %r13d
	cmovbl	%eax, %ebx
	movq	_MAX_BUS_CLK@GOTPCREL(%rip), %rax
	incl	%r14d
	cmpl	(%rax), %r14d
	jl	LBB0_6
	jmp	LBB0_7
LBB0_3:
	movq	%r14, %rdi
	xorl	%esi, %esi
	jmp	LBB0_4
LBB0_2:
	xorl	%r13d, %r13d
LBB0_7:
	movq	24(%r15), %rdi
	leaq	L_.str(%rip), %rsi
	movl	%r13d, %edx
	movl	%ecx, %r14d
	movl	%ebx, %r8d
	callq	_dev_dbg
	cmpl	%r13d, (%r15)
	je	LBB0_11
## %bb.8:
	movq	16(%r15), %rax
	movslq	%r13d, %rbx
	movq	(%rax,%rbx,8), %rdi
	callq	_clk_prepare_enable
	movl	(%r15), %eax
	testl	%eax, %eax
	js	LBB0_10
## %bb.9:
	movq	16(%r15), %rcx
	movq	(%rcx,%rax,8), %rdi
	callq	_clk_disable_unprepare
LBB0_10:
	movl	%r13d, (%r15)
	movq	8(%r15), %rax
	movl	(%rax,%rbx,4), %eax
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, 8(%rcx)
LBB0_11:
	movq	_SDHCI_CLOCK_CONTROL@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	addq	(%rbx), %rsi
	xorl	%r12d, %r12d
	xorl	%edi, %edi
	callq	_writew
	movq	_S3C_SDHCI_CONTROL2@GOTPCREL(%rip), %r15
	movq	(%r15), %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	(%r15), %rsi
	addq	(%rbx), %rsi
	movl	%r13d, %edi
	callq	_writel
	movq	_S3C64XX_SDHCI_CONTROL4_DRIVE_9mA@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_S3C64XX_SDHCI_CONTROL4@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%rbx), %rsi
	callq	_writel
	movq	(%r15), %rdi
	addq	(%rbx), %rdi
	callq	_readl
	movq	_S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR@GOTPCREL(%rip), %rcx
	movq	_S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK@GOTPCREL(%rip), %rdx
	movq	_S3C_SDHCI_CTRL2_ENFBCLKRX@GOTPCREL(%rip), %rsi
	movq	_S3C_SDHCI_CTRL2_DFCNT_NONE@GOTPCREL(%rip), %rdi
	movq	_S3C_SDHCI_CTRL2_ENCLKOUTHOLD@GOTPCREL(%rip), %r8
	orl	(%rcx), %eax
	orl	(%rdx), %eax
	orl	(%rsi), %eax
	orl	(%rdi), %eax
	orl	(%r8), %eax
	movq	(%r15), %rsi
	addq	(%rbx), %rsi
	movl	%eax, %edi
	callq	_writel
	movq	_S3C_SDHCI_CTRL3_FCSEL1@GOTPCREL(%rip), %rax
	movq	_S3C_SDHCI_CTRL3_FCSEL0@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movq	_S3C_SDHCI_CTRL3_FCSEL3@GOTPCREL(%rip), %rax
	movq	_S3C_SDHCI_CTRL3_FCSEL2@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edi
	orl	(%rax), %edi
	cmpl	$25000000, %r14d                ## imm = 0x17D7840
	cmovael	%r12d, %edi
	orl	%ecx, %edi
	movq	_S3C_SDHCI_CONTROL3@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%rbx), %rsi
	callq	_writel
	movq	%rbx, %rdi
	movl	%r14d, %esi
LBB0_4:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_sdhci_set_clock                ## TAILCALL
	.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
	.comm	_S3C64XX_SDHCI_CONTROL4_DRIVE_9mA,4,2 ## @S3C64XX_SDHCI_CONTROL4_DRIVE_9mA
	.comm	_S3C64XX_SDHCI_CONTROL4,8,3     ## @S3C64XX_SDHCI_CONTROL4
	.comm	_S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR,4,2 ## @S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR
	.comm	_S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK,4,2 ## @S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK
	.comm	_S3C_SDHCI_CTRL2_ENFBCLKRX,4,2  ## @S3C_SDHCI_CTRL2_ENFBCLKRX
	.comm	_S3C_SDHCI_CTRL2_DFCNT_NONE,4,2 ## @S3C_SDHCI_CTRL2_DFCNT_NONE
	.comm	_S3C_SDHCI_CTRL2_ENCLKOUTHOLD,4,2 ## @S3C_SDHCI_CTRL2_ENCLKOUTHOLD
	.comm	_S3C_SDHCI_CTRL3_FCSEL1,4,2     ## @S3C_SDHCI_CTRL3_FCSEL1
	.comm	_S3C_SDHCI_CTRL3_FCSEL0,4,2     ## @S3C_SDHCI_CTRL3_FCSEL0
	.comm	_S3C_SDHCI_CTRL3_FCSEL3,4,2     ## @S3C_SDHCI_CTRL3_FCSEL3
	.comm	_S3C_SDHCI_CTRL3_FCSEL2,4,2     ## @S3C_SDHCI_CTRL3_FCSEL2
	.comm	_S3C_SDHCI_CONTROL3,8,3         ## @S3C_SDHCI_CONTROL3
	.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:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x20, x1
	mov	x19, x0
	bl	_to_s3c
Lloh0:
	adrp	x8, _UINT_MAX@GOTPAGE
Lloh1:
	ldr	x8, [x8, _UINT_MAX@GOTPAGEOFF]
Lloh2:
	ldr	w23, [x8]
	ldr	x8, [x19, #16]
	str	xzr, [x8]
	cbz	w20, LBB0_4
; %bb.1:
	mov	x22, x0
Lloh3:
	adrp	x25, _MAX_BUS_CLK@GOTPAGE
Lloh4:
	ldr	x25, [x25, _MAX_BUS_CLK@GOTPAGEOFF]
	ldr	w8, [x25]
	cmp	w8, #1
	b.lt	LBB0_5
; %bb.2:
	mov	w24, #0
	mov	w21, #0
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x22
	mov	x1, x24
	mov	x2, x20
	bl	_sdhci_s3c_consider_clock
	cmp	w0, w23
	csel	w21, w24, w21, lo
	csel	w23, w0, w23, lo
	add	w24, w24, #1
	ldr	w8, [x25]
	cmp	w24, w8
	b.lt	LBB0_3
	b	LBB0_6
LBB0_4:
	mov	x0, x19
	mov	w1, #0
	b	LBB0_11
LBB0_5:
	mov	w21, #0
LBB0_6:
	ldr	x0, [x22, #24]
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x21
	mov	x3, x20
	mov	x4, x23
	bl	_dev_dbg
	ldr	w8, [x22]
	cmp	w8, w21
	b.eq	LBB0_10
; %bb.7:
	ldr	x8, [x22, #16]
	sxtw	x23, w21
	ldr	x0, [x8, w21, sxtw #3]
	bl	_clk_prepare_enable
	ldr	w8, [x22]
	tbnz	w8, #31, LBB0_9
; %bb.8:
	ldr	x9, [x22, #16]
	ldr	x0, [x9, x8, lsl #3]
	bl	_clk_disable_unprepare
LBB0_9:
	str	w21, [x22]
	ldr	x8, [x22, #8]
	ldr	w8, [x8, x23, lsl #2]
	str	w8, [x19, #8]
LBB0_10:
	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
	ldr	x8, [x19]
Lloh10:
	adrp	x22, _S3C_SDHCI_CONTROL2@GOTPAGE
Lloh11:
	ldr	x22, [x22, _S3C_SDHCI_CONTROL2@GOTPAGEOFF]
	ldr	x9, [x22]
	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, w21, w9
	orr	w0, w9, w8
	ldr	x8, [x19]
	ldr	x9, [x22]
	add	x1, x9, x8
	bl	_writel
Lloh18:
	adrp	x8, _S3C64XX_SDHCI_CONTROL4_DRIVE_9mA@GOTPAGE
Lloh19:
	ldr	x8, [x8, _S3C64XX_SDHCI_CONTROL4_DRIVE_9mA@GOTPAGEOFF]
Lloh20:
	ldr	w0, [x8]
	ldr	x8, [x19]
Lloh21:
	adrp	x9, _S3C64XX_SDHCI_CONTROL4@GOTPAGE
Lloh22:
	ldr	x9, [x9, _S3C64XX_SDHCI_CONTROL4@GOTPAGEOFF]
Lloh23:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	ldr	x8, [x19]
	ldr	x9, [x22]
	add	x0, x9, x8
	bl	_readl
Lloh24:
	adrp	x8, _S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR@GOTPAGE
Lloh25:
	ldr	x8, [x8, _S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR@GOTPAGEOFF]
Lloh26:
	ldr	w8, [x8]
Lloh27:
	adrp	x9, _S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK@GOTPAGE
Lloh28:
	ldr	x9, [x9, _S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK@GOTPAGEOFF]
Lloh29:
	ldr	w9, [x9]
Lloh30:
	adrp	x10, _S3C_SDHCI_CTRL2_ENFBCLKRX@GOTPAGE
Lloh31:
	ldr	x10, [x10, _S3C_SDHCI_CTRL2_ENFBCLKRX@GOTPAGEOFF]
Lloh32:
	ldr	w10, [x10]
Lloh33:
	adrp	x11, _S3C_SDHCI_CTRL2_DFCNT_NONE@GOTPAGE
Lloh34:
	ldr	x11, [x11, _S3C_SDHCI_CTRL2_DFCNT_NONE@GOTPAGEOFF]
Lloh35:
	ldr	w11, [x11]
Lloh36:
	adrp	x12, _S3C_SDHCI_CTRL2_ENCLKOUTHOLD@GOTPAGE
Lloh37:
	ldr	x12, [x12, _S3C_SDHCI_CTRL2_ENCLKOUTHOLD@GOTPAGEOFF]
Lloh38:
	ldr	w12, [x12]
	orr	w8, w8, w0
	orr	w8, w8, w9
	orr	w8, w8, w10
	orr	w8, w8, w11
	orr	w0, w8, w12
	ldr	x8, [x19]
	ldr	x9, [x22]
	add	x1, x9, x8
	bl	_writel
Lloh39:
	adrp	x8, _S3C_SDHCI_CTRL3_FCSEL1@GOTPAGE
Lloh40:
	ldr	x8, [x8, _S3C_SDHCI_CTRL3_FCSEL1@GOTPAGEOFF]
Lloh41:
	ldr	w8, [x8]
Lloh42:
	adrp	x9, _S3C_SDHCI_CTRL3_FCSEL0@GOTPAGE
Lloh43:
	ldr	x9, [x9, _S3C_SDHCI_CTRL3_FCSEL0@GOTPAGEOFF]
Lloh44:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh45:
	adrp	x9, _S3C_SDHCI_CTRL3_FCSEL3@GOTPAGE
Lloh46:
	ldr	x9, [x9, _S3C_SDHCI_CTRL3_FCSEL3@GOTPAGEOFF]
Lloh47:
	adrp	x10, _S3C_SDHCI_CTRL3_FCSEL2@GOTPAGE
Lloh48:
	ldr	x10, [x10, _S3C_SDHCI_CTRL3_FCSEL2@GOTPAGEOFF]
Lloh49:
	ldr	w9, [x9]
Lloh50:
	ldr	w10, [x10]
	orr	w9, w10, w9
	mov	w10, #30784
	movk	w10, #381, lsl #16
	cmp	w20, w10
	csel	w9, w9, wzr, lo
	orr	w0, w8, w9
	ldr	x8, [x19]
Lloh51:
	adrp	x9, _S3C_SDHCI_CONTROL3@GOTPAGE
Lloh52:
	ldr	x9, [x9, _S3C_SDHCI_CONTROL3@GOTPAGEOFF]
Lloh53:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	mov	x0, x19
	mov	x1, x20
LBB0_11:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	b	_sdhci_set_clock
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh51, Lloh52, Lloh53
	.loh AdrpLdrGotLdr	Lloh47, Lloh48, Lloh50
	.loh AdrpLdrGotLdr	Lloh45, Lloh46, Lloh49
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh44
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.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
	.comm	_S3C64XX_SDHCI_CONTROL4_DRIVE_9mA,4,2 ; @S3C64XX_SDHCI_CONTROL4_DRIVE_9mA
	.comm	_S3C64XX_SDHCI_CONTROL4,8,3     ; @S3C64XX_SDHCI_CONTROL4
	.comm	_S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR,4,2 ; @S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR
	.comm	_S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK,4,2 ; @S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK
	.comm	_S3C_SDHCI_CTRL2_ENFBCLKRX,4,2  ; @S3C_SDHCI_CTRL2_ENFBCLKRX
	.comm	_S3C_SDHCI_CTRL2_DFCNT_NONE,4,2 ; @S3C_SDHCI_CTRL2_DFCNT_NONE
	.comm	_S3C_SDHCI_CTRL2_ENCLKOUTHOLD,4,2 ; @S3C_SDHCI_CTRL2_ENCLKOUTHOLD
	.comm	_S3C_SDHCI_CTRL3_FCSEL1,4,2     ; @S3C_SDHCI_CTRL3_FCSEL1
	.comm	_S3C_SDHCI_CTRL3_FCSEL0,4,2     ; @S3C_SDHCI_CTRL3_FCSEL0
	.comm	_S3C_SDHCI_CTRL3_FCSEL3,4,2     ; @S3C_SDHCI_CTRL3_FCSEL3
	.comm	_S3C_SDHCI_CTRL3_FCSEL2,4,2     ; @S3C_SDHCI_CTRL3_FCSEL2
	.comm	_S3C_SDHCI_CONTROL3,8,3         ; @S3C_SDHCI_CONTROL3
	.no_dead_strip	_sdhci_s3c_set_clock
.subsections_via_symbols
