	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function calculate_clk_divider
_calculate_clk_divider:                 ## @calculate_clk_divider
	.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	%rsi, %rbx
	callq	_mmc_priv
	movq	%rax, %r14
	movq	(%rbx), %rax
	movq	_MMC_BUSMODE_OPENDRAIN@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_2
## %bb.1:
	movq	_DAVINCI_MMCCLK@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rdi
	addq	8(%r14), %rdi
	callq	_readl
	movq	_MMCCLK_CLKRT_MASK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	notl	%edi
	andl	%eax, %edi
	orl	$255, %edi
	movq	(%rbx), %rsi
	addq	8(%r14), %rsi
	callq	_writel
	movq	_MMCSD_INIT_CLOCK@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	imulq	$274877907, %rax, %rcx          ## imm = 0x10624DD3
	movq	%rcx, %rax
	shrq	$63, %rax
	sarq	$38, %rcx
	addl	%eax, %ecx
	movl	$1000000, %eax                  ## imm = 0xF4240
	xorl	%edx, %edx
	idivl	%ecx
	movl	%eax, (%r14)
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movl	8(%rbx), %esi
	movq	%r14, %rdi
	callq	_calculate_freq_for_card
	cmpl	$255, %eax
	movl	$255, %r12d
	cmovbl	%eax, %r12d
	movq	_DAVINCI_MMCCLK@GOTPCREL(%rip), %r15
	movq	(%r15), %rdi
	addq	8(%r14), %rdi
	callq	_readl
	movq	_MMCCLK_CLKEN@GOTPCREL(%rip), %r13
	movl	(%r13), %edi
	notl	%edi
	andl	%eax, %edi
	movq	(%r15), %rsi
	addq	8(%r14), %rsi
	callq	_writel
	movl	$10, %edi
	callq	_udelay
	movq	(%r15), %rdi
	addq	8(%r14), %rdi
	callq	_readl
	movq	_MMCCLK_CLKRT_MASK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ebx
	notl	%ebx
	andl	%eax, %ebx
	orl	%r12d, %ebx
	movq	(%r15), %rsi
	addq	8(%r14), %rsi
	movl	%ebx, %edi
	callq	_writel
	orl	(%r13), %ebx
	movq	(%r15), %rsi
	addq	8(%r14), %rsi
	movl	%ebx, %edi
	callq	_writel
	movl	$10, %edi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_udelay                         ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_MMC_BUSMODE_OPENDRAIN,8,3      ## @MMC_BUSMODE_OPENDRAIN
	.comm	_MMCSD_INIT_CLOCK,4,2           ## @MMCSD_INIT_CLOCK
	.comm	_DAVINCI_MMCCLK,8,3             ## @DAVINCI_MMCCLK
	.comm	_MMCCLK_CLKRT_MASK,4,2          ## @MMCCLK_CLKRT_MASK
	.comm	_MMCCLK_CLKEN,4,2               ## @MMCCLK_CLKEN
	.no_dead_strip	_calculate_clk_divider
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function calculate_clk_divider
_calculate_clk_divider:                 ; @calculate_clk_divider
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x20, x1
	bl	_mmc_priv
	mov	x19, x0
	ldr	x8, [x20]
Lloh0:
	adrp	x9, _MMC_BUSMODE_OPENDRAIN@GOTPAGE
Lloh1:
	ldr	x9, [x9, _MMC_BUSMODE_OPENDRAIN@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_2
; %bb.1:
	ldr	x8, [x19, #8]
Lloh3:
	adrp	x20, _DAVINCI_MMCCLK@GOTPAGE
Lloh4:
	ldr	x20, [x20, _DAVINCI_MMCCLK@GOTPAGEOFF]
	ldr	x9, [x20]
	add	x0, x9, x8
	bl	_readl
Lloh5:
	adrp	x8, _MMCCLK_CLKRT_MASK@GOTPAGE
Lloh6:
	ldr	x8, [x8, _MMCCLK_CLKRT_MASK@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	bic	w8, w0, w8
	orr	w0, w8, #0xff
	ldr	x8, [x19, #8]
	ldr	x9, [x20]
	add	x1, x9, x8
	bl	_writel
Lloh8:
	adrp	x8, _MMCSD_INIT_CLOCK@GOTPAGE
Lloh9:
	ldr	x8, [x8, _MMCSD_INIT_CLOCK@GOTPAGEOFF]
Lloh10:
	ldrsw	x8, [x8]
	mov	w9, #19923
	movk	w9, #4194, lsl #16
	mul	x8, x8, x9
	lsr	x9, x8, #63
	asr	x8, x8, #38
	add	w8, w8, w9
	mov	w9, #16960
	movk	w9, #15, lsl #16
	sdiv	w8, w9, w8
	str	w8, [x19]
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_2:
	ldr	w1, [x20, #8]
	mov	x0, x19
	bl	_calculate_freq_for_card
	mov	w8, #255
	cmp	w0, #255
	csel	w20, w0, w8, lo
	ldr	x8, [x19, #8]
Lloh11:
	adrp	x21, _DAVINCI_MMCCLK@GOTPAGE
Lloh12:
	ldr	x21, [x21, _DAVINCI_MMCCLK@GOTPAGEOFF]
	ldr	x9, [x21]
	add	x0, x9, x8
	bl	_readl
Lloh13:
	adrp	x22, _MMCCLK_CLKEN@GOTPAGE
Lloh14:
	ldr	x22, [x22, _MMCCLK_CLKEN@GOTPAGEOFF]
	ldr	w8, [x22]
	bic	w0, w0, w8
	ldr	x8, [x19, #8]
	ldr	x9, [x21]
	add	x1, x9, x8
	bl	_writel
	mov	w0, #10
	bl	_udelay
	ldr	x8, [x19, #8]
	ldr	x9, [x21]
	add	x0, x9, x8
	bl	_readl
Lloh15:
	adrp	x8, _MMCCLK_CLKRT_MASK@GOTPAGE
Lloh16:
	ldr	x8, [x8, _MMCCLK_CLKRT_MASK@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	bic	w8, w0, w8
	orr	w20, w8, w20
	ldr	x8, [x19, #8]
	ldr	x9, [x21]
	add	x1, x9, x8
	mov	x0, x20
	bl	_writel
	ldr	w8, [x22]
	orr	w0, w8, w20
	ldr	x8, [x19, #8]
	ldr	x9, [x21]
	add	x1, x9, x8
	bl	_writel
	mov	w0, #10
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_udelay
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_MMC_BUSMODE_OPENDRAIN,8,3      ; @MMC_BUSMODE_OPENDRAIN
	.comm	_MMCSD_INIT_CLOCK,4,2           ; @MMCSD_INIT_CLOCK
	.comm	_DAVINCI_MMCCLK,8,3             ; @DAVINCI_MMCCLK
	.comm	_MMCCLK_CLKRT_MASK,4,2          ; @MMCCLK_CLKRT_MASK
	.comm	_MMCCLK_CLKEN,4,2               ; @MMCCLK_CLKEN
	.no_dead_strip	_calculate_clk_divider
.subsections_via_symbols
