	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sdhci_cns3xxx_set_clock
_sdhci_cns3xxx_set_clock:               ## @sdhci_cns3xxx_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, %r12d
	movq	%rdi, %r15
	movq	8(%rdi), %rdi
	callq	_mmc_dev
	movq	%rax, %r14
	movq	8(%r15), %rax
	movq	$0, (%rax)
	movq	_SDHCI_CLOCK_CONTROL@GOTPCREL(%rip), %r13
	movl	(%r13), %edx
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_sdhci_writew
	testl	%r12d, %r12d
	je	LBB0_17
## %bb.1:
	movl	(%r15), %ecx
	movl	$1, %ebx
	cmpl	%r12d, %ecx
	jbe	LBB0_2
## %bb.4:
	movl	$1, %ebx
	movl	%ecx, %eax
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_5 Depth=1
	incl	%ebx
LBB0_9:                                 ##   in Loop: Header=BB0_5 Depth=1
	movl	%ecx, %eax
	cltd
	idivl	%ebx
	cmpl	%r12d, %eax
	jbe	LBB0_10
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	cmpl	$3, %ebx
	jle	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	cmpl	$255, %ebx
	ja	LBB0_3
## %bb.8:                               ##   in Loop: Header=BB0_5 Depth=1
	addl	%ebx, %ebx
	jmp	LBB0_9
LBB0_17:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movl	%ecx, %eax
LBB0_3:
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	movl	%r12d, %edx
	movl	%eax, %ecx
	callq	_dev_dbg
	shrl	%ebx
	jmp	LBB0_11
LBB0_10:
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	movl	%r12d, %edx
	movl	%eax, %ecx
	callq	_dev_dbg
	movl	%ebx, %eax
	sarl	%eax
	cmpl	$3, %ebx
	cmovnel	%eax, %ebx
LBB0_11:
	movq	_SDHCI_DIVIDER_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shll	%cl, %ebx
	movq	_SDHCI_CLOCK_INT_EN@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	movl	(%r13), %edx
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_sdhci_writew
	movl	(%r13), %esi
	movq	%r15, %rdi
	callq	_sdhci_readw
	movl	%eax, %ebx
	movq	_SDHCI_CLOCK_INT_STABLE@GOTPCREL(%rip), %r12
	testl	%eax, (%r12)
	jne	LBB0_16
## %bb.12:
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	movq	$-20, %r14
	.p2align	4, 0x90
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	movl	$1, %edi
	callq	_mdelay
	movl	(%r13), %esi
	movq	%r15, %rdi
	callq	_sdhci_readw
	movl	%eax, %ebx
	testl	%eax, (%r12)
	jne	LBB0_16
## %bb.14:                              ##   in Loop: Header=BB0_13 Depth=1
	incq	%r14
	jne	LBB0_13
## %bb.15:
	leaq	L_.str.1(%rip), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_dev_warn
LBB0_16:
	movq	_SDHCI_CLOCK_CARD_EN@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	movl	(%r13), %edx
	movq	%r15, %rdi
	movl	%ebx, %esi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_sdhci_writew                   ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_SDHCI_CLOCK_CONTROL,4,2        ## @SDHCI_CLOCK_CONTROL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"desired SD clock: %d, actual: %d\n"

	.comm	_SDHCI_DIVIDER_SHIFT,4,2        ## @SDHCI_DIVIDER_SHIFT
	.comm	_SDHCI_CLOCK_INT_EN,4,2         ## @SDHCI_CLOCK_INT_EN
	.comm	_SDHCI_CLOCK_INT_STABLE,4,2     ## @SDHCI_CLOCK_INT_STABLE
L_.str.1:                               ## @.str.1
	.asciz	"clock is unstable"

	.comm	_SDHCI_CLOCK_CARD_EN,4,2        ## @SDHCI_CLOCK_CARD_EN
	.no_dead_strip	_sdhci_cns3xxx_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_cns3xxx_set_clock
_sdhci_cns3xxx_set_clock:               ; @sdhci_cns3xxx_set_clock
	.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	x19, x0
	ldr	x0, [x0, #8]
	bl	_mmc_dev
	mov	x20, x0
	ldr	x8, [x19, #8]
	str	xzr, [x8]
Lloh0:
	adrp	x22, _SDHCI_CLOCK_CONTROL@GOTPAGE
Lloh1:
	ldr	x22, [x22, _SDHCI_CLOCK_CONTROL@GOTPAGEOFF]
	ldr	w2, [x22]
	mov	x0, x19
	mov	w1, #0
	bl	_sdhci_writew
	cbz	w21, LBB0_8
; %bb.1:
	ldr	w3, [x19]
	mov	w23, #1
	cmp	w3, w21
	b.ls	LBB0_11
; %bb.2:
	mov	x8, x3
	b	LBB0_5
LBB0_3:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	w23, w23, #1
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	sdiv	w8, w3, w23
	cmp	w8, w21
	b.ls	LBB0_9
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	cmp	w23, #3
	b.le	LBB0_3
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	cmp	w23, #255
	b.hi	LBB0_10
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	lsl	w23, w23, #1
	b	LBB0_4
LBB0_8:
	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
LBB0_9:
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	mov	x2, x21
	mov	x3, x8
	bl	_dev_dbg
	asr	w8, w23, #1
	cmp	w23, #3
	csel	w8, w23, w8, eq
	b	LBB0_12
LBB0_10:
	mov	x3, x8
LBB0_11:
Lloh4:
	adrp	x1, l_.str@PAGE
Lloh5:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	mov	x2, x21
	bl	_dev_dbg
	lsr	w8, w23, #1
LBB0_12:
Lloh6:
	adrp	x9, _SDHCI_DIVIDER_SHIFT@GOTPAGE
Lloh7:
	ldr	x9, [x9, _SDHCI_DIVIDER_SHIFT@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	lsl	w8, w8, w9
Lloh9:
	adrp	x9, _SDHCI_CLOCK_INT_EN@GOTPAGE
Lloh10:
	ldr	x9, [x9, _SDHCI_CLOCK_INT_EN@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	orr	w1, w8, w9
	ldr	w2, [x22]
	mov	x0, x19
	bl	_sdhci_writew
	ldr	w1, [x22]
	mov	x0, x19
	bl	_sdhci_readw
	mov	x21, x0
Lloh12:
	adrp	x23, _SDHCI_CLOCK_INT_STABLE@GOTPAGE
Lloh13:
	ldr	x23, [x23, _SDHCI_CLOCK_INT_STABLE@GOTPAGEOFF]
	ldr	w8, [x23]
	tst	w8, w0
	b.ne	LBB0_17
; %bb.13:
	mov	x24, #-20
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	mov	w0, #1
	bl	_mdelay
	ldr	w1, [x22]
	mov	x0, x19
	bl	_sdhci_readw
	mov	x21, x0
	ldr	w8, [x23]
	tst	w8, w0
	b.ne	LBB0_17
; %bb.15:                               ;   in Loop: Header=BB0_14 Depth=1
	adds	x24, x24, #1
	b.lo	LBB0_14
; %bb.16:
Lloh14:
	adrp	x1, l_.str.1@PAGE
Lloh15:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x20
	bl	_dev_warn
LBB0_17:
Lloh16:
	adrp	x8, _SDHCI_CLOCK_CARD_EN@GOTPAGE
Lloh17:
	ldr	x8, [x8, _SDHCI_CLOCK_CARD_EN@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	orr	w1, w8, w21
	ldr	w2, [x22]
	mov	x0, x19
	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
	b	_sdhci_writew
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_SDHCI_CLOCK_CONTROL,4,2        ; @SDHCI_CLOCK_CONTROL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"desired SD clock: %d, actual: %d\n"

	.comm	_SDHCI_DIVIDER_SHIFT,4,2        ; @SDHCI_DIVIDER_SHIFT
	.comm	_SDHCI_CLOCK_INT_EN,4,2         ; @SDHCI_CLOCK_INT_EN
	.comm	_SDHCI_CLOCK_INT_STABLE,4,2     ; @SDHCI_CLOCK_INT_STABLE
l_.str.1:                               ; @.str.1
	.asciz	"clock is unstable"

	.comm	_SDHCI_CLOCK_CARD_EN,4,2        ; @SDHCI_CLOCK_CARD_EN
	.no_dead_strip	_sdhci_cns3xxx_set_clock
.subsections_via_symbols
