	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function esdhc_set_clock
_esdhc_set_clock:                       ## @esdhc_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
	movq	%rdi, %r14
	movq	_ESDHC_SYSTEM_CONTROL@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	8(%r14), %rdi
	movq	_ESDHC_CLOCK_IPGEN@GOTPCREL(%rip), %r13
	movq	_ESDHC_CLOCK_HCKEN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	(%r13), %eax
	movq	_ESDHC_CLOCK_PEREN@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%esi, %ebx
	movq	_ESDHC_CLOCK_MASK@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%eax, %esi
	callq	_clrbits32
	testl	%ebx, %ebx
	je	LBB0_20
## %bb.1:
	movl	(%r14), %eax
	leal	31(%rax), %edx
	testl	%eax, %eax
	movl	%eax, %ecx
	cmovsl	%edx, %ecx
	sarl	$5, %ecx
	cmpl	%ebx, %ecx
	jbe	LBB0_2
## %bb.3:
	leal	3(%rax), %ecx
	leal	63(%rax), %esi
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	movl	%eax, %edi
	cmovsl	%esi, %edi
	sarl	$6, %edi
	cmpl	%ebx, %edi
	jbe	LBB0_4
## %bb.5:
	leal	7(%rax), %ecx
	leal	127(%rax), %r9d
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	movl	%eax, %edi
	cmovsl	%r9d, %edi
	sarl	$7, %edi
	cmpl	%ebx, %edi
	jbe	LBB0_6
## %bb.7:
	leal	15(%rax), %ecx
	leal	255(%rax), %r8d
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	movl	%eax, %edi
	cmovsl	%r8d, %edi
	sarl	$8, %edi
	cmpl	%ebx, %edi
	jbe	LBB0_8
## %bb.9:
	leal	511(%rax), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %edx
	cmovnsl	%eax, %ecx
	sarl	$9, %ecx
	cmpl	%ebx, %ecx
	jbe	LBB0_10
## %bb.11:
	leal	1023(%rax), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %esi
	cmovnsl	%eax, %ecx
	sarl	$10, %ecx
	cmpl	%ebx, %ecx
	jbe	LBB0_12
## %bb.13:
	leal	2047(%rax), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %r9d
	cmovnsl	%eax, %ecx
	sarl	$11, %ecx
	cmpl	%ebx, %ecx
	jbe	LBB0_14
## %bb.15:
	testl	%eax, %eax
	cmovnsl	%eax, %r8d
	sarl	$8, %r8d
	movl	$256, %r15d                     ## imm = 0x100
	movl	%r8d, %ecx
	jmp	LBB0_16
LBB0_2:
	movl	%eax, %ecx
	shrl	$31, %ecx
	addl	%eax, %ecx
	sarl	%ecx
	movl	$2, %r15d
	jmp	LBB0_16
LBB0_4:
	sarl	$2, %ecx
	movl	$4, %r15d
	jmp	LBB0_16
LBB0_6:
	sarl	$3, %ecx
	movl	$8, %r15d
	jmp	LBB0_16
LBB0_8:
	sarl	$4, %ecx
	movl	$16, %r15d
	jmp	LBB0_16
LBB0_10:
	sarl	$5, %edx
	movl	$32, %r15d
	movl	%edx, %ecx
	jmp	LBB0_16
LBB0_12:
	sarl	$6, %esi
	movl	$64, %r15d
	movl	%esi, %ecx
	jmp	LBB0_16
LBB0_14:
	sarl	$7, %r9d
	movl	$128, %r15d
	movl	%r9d, %ecx
LBB0_16:
	movl	$-1, %r12d
	.p2align	4, 0x90
LBB0_17:                                ## =>This Inner Loop Header: Depth=1
	leal	2(%r12), %esi
	movl	%ecx, %eax
	cltd
	idivl	%esi
	incl	%r12d
	cmpl	$15, %esi
	ja	LBB0_19
## %bb.18:                              ##   in Loop: Header=BB0_17 Depth=1
	cmpl	%ebx, %eax
	ja	LBB0_17
LBB0_19:
	movl	16(%r14), %edi
	callq	_mmc_dev
	movl	%eax, %edi
	movl	(%r14), %eax
	cltd
	idivl	%r15d
	leal	1(%r12), %ecx
	cltd
	idivl	%ecx
	leaq	L_.str(%rip), %rsi
	movl	%ebx, %edx
	movl	%eax, %ecx
	callq	_dev_dbg
	movq	_ESDHC_SYSTEM_CONTROL@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	8(%r14), %rdi
	movq	_ESDHC_CLOCK_HCKEN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	(%r13), %eax
	movq	_ESDHC_CLOCK_PEREN@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movq	_ESDHC_DIVIDER_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %r12d
	shrl	%r15d
	orl	%eax, %r12d
	movq	_ESDHC_PREDIV_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shll	%cl, %r15d
	orl	%r12d, %r15d
	movl	%r15d, %esi
	callq	_setbits32
	movl	$100, %edi
	callq	_mdelay
LBB0_20:
	movl	%ebx, 4(%r14)
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ESDHC_SYSTEM_CONTROL,8,3       ## @ESDHC_SYSTEM_CONTROL
	.comm	_ESDHC_CLOCK_IPGEN,4,2          ## @ESDHC_CLOCK_IPGEN
	.comm	_ESDHC_CLOCK_HCKEN,4,2          ## @ESDHC_CLOCK_HCKEN
	.comm	_ESDHC_CLOCK_PEREN,4,2          ## @ESDHC_CLOCK_PEREN
	.comm	_ESDHC_CLOCK_MASK,4,2           ## @ESDHC_CLOCK_MASK
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"desired SD clock: %d, actual: %d\n"

	.comm	_ESDHC_DIVIDER_SHIFT,4,2        ## @ESDHC_DIVIDER_SHIFT
	.comm	_ESDHC_PREDIV_SHIFT,4,2         ## @ESDHC_PREDIV_SHIFT
	.no_dead_strip	_esdhc_set_clock
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function esdhc_set_clock
_esdhc_set_clock:                       ; @esdhc_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	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x21, _ESDHC_SYSTEM_CONTROL@GOTPAGE
Lloh1:
	ldr	x21, [x21, _ESDHC_SYSTEM_CONTROL@GOTPAGEOFF]
	ldr	x8, [x0, #8]
	ldr	x9, [x21]
	add	x0, x9, x8
Lloh2:
	adrp	x22, _ESDHC_CLOCK_IPGEN@GOTPAGE
Lloh3:
	ldr	x22, [x22, _ESDHC_CLOCK_IPGEN@GOTPAGEOFF]
	ldr	w8, [x22]
Lloh4:
	adrp	x23, _ESDHC_CLOCK_HCKEN@GOTPAGE
Lloh5:
	ldr	x23, [x23, _ESDHC_CLOCK_HCKEN@GOTPAGEOFF]
	ldr	w9, [x23]
	orr	w8, w9, w8
Lloh6:
	adrp	x24, _ESDHC_CLOCK_PEREN@GOTPAGE
Lloh7:
	ldr	x24, [x24, _ESDHC_CLOCK_PEREN@GOTPAGEOFF]
	ldr	w9, [x24]
	orr	w8, w8, w9
Lloh8:
	adrp	x9, _ESDHC_CLOCK_MASK@GOTPAGE
Lloh9:
	ldr	x9, [x9, _ESDHC_CLOCK_MASK@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	orr	w1, w8, w9
	bl	_clrbits32
	cbz	w19, LBB0_18
; %bb.1:
	ldr	w8, [x20]
	add	w9, w8, #31
	cmp	w8, #0
	csel	w10, w9, w8, lt
	cinc	w9, w8, lt
	cmp	w19, w10, asr #5
	b.hs	LBB0_8
; %bb.2:
	add	w9, w8, #3
	cmp	w8, #0
	csel	w9, w9, w8, lt
	add	w10, w8, #63
	csel	w10, w10, w8, lt
	cmp	w19, w10, asr #6
	b.hs	LBB0_9
; %bb.3:
	add	w9, w8, #7
	cmp	w8, #0
	csel	w9, w9, w8, lt
	add	w10, w8, #127
	csel	w10, w10, w8, lt
	cmp	w19, w10, asr #7
	b.hs	LBB0_10
; %bb.4:
	add	w9, w8, #15
	cmp	w8, #0
	csel	w9, w9, w8, lt
	add	w10, w8, #255
	csel	w10, w10, w8, lt
	cmp	w19, w10, asr #8
	b.hs	LBB0_11
; %bb.5:
	add	w9, w8, #31
	cmp	w8, #0
	csel	w9, w9, w8, lt
	add	w10, w8, #511
	csel	w10, w10, w8, lt
	cmp	w19, w10, asr #9
	b.hs	LBB0_12
; %bb.6:
	add	w9, w8, #63
	cmp	w8, #0
	csel	w9, w9, w8, lt
	add	w10, w8, #1023
	csel	w10, w10, w8, lt
	cmp	w19, w10, asr #10
	b.hs	LBB0_13
; %bb.7:
	add	w9, w8, #127
	cmp	w8, #0
	csel	w9, w9, w8, lt
	asr	w9, w9, #7
	add	w10, w8, #2047
	csel	w10, w10, w8, lt
	mov	w11, #128
	add	w12, w8, #255
	cmp	w8, #0
	csel	w8, w12, w8, lt
	asr	w8, w8, #8
	mov	w12, #256
	cmp	w19, w10, asr #11
	csel	w25, w11, w12, hs
	csel	w8, w9, w8, hs
	b	LBB0_14
LBB0_8:
	asr	w8, w9, #1
	mov	w25, #2
	b	LBB0_14
LBB0_9:
	asr	w8, w9, #2
	mov	w25, #4
	b	LBB0_14
LBB0_10:
	asr	w8, w9, #3
	mov	w25, #8
	b	LBB0_14
LBB0_11:
	asr	w8, w9, #4
	mov	w25, #16
	b	LBB0_14
LBB0_12:
	asr	w8, w9, #5
	mov	w25, #32
	b	LBB0_14
LBB0_13:
	asr	w8, w9, #6
	mov	w25, #64
LBB0_14:
	mov	w26, #-1
LBB0_15:                                ; =>This Inner Loop Header: Depth=1
	add	w9, w26, #2
	add	w26, w26, #1
	cmp	w9, #15
	b.hi	LBB0_17
; %bb.16:                               ;   in Loop: Header=BB0_15 Depth=1
	sdiv	w9, w8, w9
	cmp	w9, w19
	b.hi	LBB0_15
LBB0_17:
	ldr	w0, [x20, #16]
	bl	_mmc_dev
	ldr	w8, [x20]
	sdiv	w8, w8, w25
	add	w9, w26, #1
	sdiv	w3, w8, w9
Lloh11:
	adrp	x1, l_.str@PAGE
Lloh12:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x19
	bl	_dev_dbg
	lsr	w8, w25, #1
	ldr	x9, [x20, #8]
	ldr	x10, [x21]
	add	x0, x10, x9
	ldr	w9, [x22]
	ldr	w10, [x23]
	orr	w9, w10, w9
	ldr	w10, [x24]
	orr	w9, w9, w10
Lloh13:
	adrp	x10, _ESDHC_DIVIDER_SHIFT@GOTPAGE
Lloh14:
	ldr	x10, [x10, _ESDHC_DIVIDER_SHIFT@GOTPAGEOFF]
Lloh15:
	ldr	w10, [x10]
	lsl	w10, w26, w10
	orr	w9, w9, w10
Lloh16:
	adrp	x10, _ESDHC_PREDIV_SHIFT@GOTPAGE
Lloh17:
	ldr	x10, [x10, _ESDHC_PREDIV_SHIFT@GOTPAGEOFF]
Lloh18:
	ldr	w10, [x10]
	lsl	w8, w8, w10
	orr	w1, w9, w8
	bl	_setbits32
	mov	w0, #100
	bl	_mdelay
LBB0_18:
	str	w19, [x20, #4]
	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
	ret
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_ESDHC_SYSTEM_CONTROL,8,3       ; @ESDHC_SYSTEM_CONTROL
	.comm	_ESDHC_CLOCK_IPGEN,4,2          ; @ESDHC_CLOCK_IPGEN
	.comm	_ESDHC_CLOCK_HCKEN,4,2          ; @ESDHC_CLOCK_HCKEN
	.comm	_ESDHC_CLOCK_PEREN,4,2          ; @ESDHC_CLOCK_PEREN
	.comm	_ESDHC_CLOCK_MASK,4,2           ; @ESDHC_CLOCK_MASK
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"desired SD clock: %d, actual: %d\n"

	.comm	_ESDHC_DIVIDER_SHIFT,4,2        ; @ESDHC_DIVIDER_SHIFT
	.comm	_ESDHC_PREDIV_SHIFT,4,2         ; @ESDHC_PREDIV_SHIFT
	.no_dead_strip	_esdhc_set_clock
.subsections_via_symbols
