	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function usdhi6_clk_set
_usdhi6_clk_set:                        ## @usdhi6_clk_set
	.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
	movq	%rsi, %r13
	movq	%rdi, %r14
	movq	(%rsi), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movl	$-1000, %ebx                    ## imm = 0xFC18
	movq	_USDHI6_SD_INFO2@GOTPCREL(%rip), %r15
	movq	_USDHI6_SD_INFO2_SCLKDIVEN@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r15), %esi
	movq	%r14, %rdi
	callq	_usdhi6_read
	testl	%eax, (%r12)
	jne	LBB0_4
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	$10, %edi
	movl	$100, %esi
	callq	_usleep_range
	incl	%ebx
	jne	LBB0_1
## %bb.3:
	movl	16(%r14), %edi
	callq	_mmc_dev
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edi
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_dev_err                        ## TAILCALL
LBB0_4:
	movq	%r13, -48(%rbp)                 ## 8-byte Spill
	movq	_USDHI6_SD_CLK_CTRL@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	%r14, %rdi
	callq	_usdhi6_read
	movq	_USDHI6_SD_CLK_CTRL_DIV_MASK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r15d
	notl	%r15d
	andl	%eax, %r15d
	movq	-56(%rbp), %r13                 ## 8-byte Reload
	testq	%r13, %r13
	je	LBB0_14
## %bb.5:
	movq	(%r14), %r12
	cmpq	%r13, %r12
	jbe	LBB0_6
## %bb.9:
	movl	%r12d, %edi
	movq	%r13, %rsi
	callq	_DIV_ROUND_UP
	movl	%eax, %edi
	callq	_roundup_pow_of_two
	movq	%rax, %rcx
	shrq	$2, %rax
	orl	%eax, %r15d
	movq	(%r14), %rax
	movq	%rcx, %rdx
	orq	%rax, %rdx
	shrq	$32, %rdx
	je	LBB0_10
## %bb.11:
	xorl	%edx, %edx
	divq	%rcx
	movq	%rax, %r12
	cmpq	%r12, 8(%r14)
	jne	LBB0_13
	jmp	LBB0_23
LBB0_6:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	8(%rax), %rax
	movq	_MMC_TIMING_UHS_DDR50@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_7
## %bb.8:
	shrq	%r12
	cmpq	%r12, 8(%r14)
	jne	LBB0_13
	jmp	LBB0_23
LBB0_7:
	orl	$255, %r15d
	cmpq	%r12, 8(%r14)
	jne	LBB0_13
	jmp	LBB0_23
LBB0_10:
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%ecx
	movl	%eax, %r12d
	cmpq	%r12, 8(%r14)
	je	LBB0_23
LBB0_13:
	movq	%r12, 8(%r14)
	movl	16(%r14), %edi
	callq	_mmc_dev
	movzbl	%r15b, %ecx
	shll	$2, %ecx
	leaq	L_.str.1(%rip), %rsi
	movl	%eax, %edi
	movq	%r13, %rdx
	movq	%r12, %r8
	callq	_dev_dbg
	movq	_USDHI6_SD_CLK_CTRL@GOTPCREL(%rip), %rbx
LBB0_14:
	movq	(%r14), %rax
	cmpq	%r13, %rax
	jne	LBB0_15
LBB0_17:
	movl	(%rbx), %esi
	movq	_USDHI6_SD_CLK_CTRL_SCLKEN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	notl	%edx
	andl	%r15d, %edx
	movq	%r14, %rdi
	callq	_usdhi6_write
	jmp	LBB0_18
LBB0_15:
	cmpq	8(%r14), %rax
	je	LBB0_17
## %bb.16:
	testq	%r13, %r13
	je	LBB0_17
LBB0_18:
	testq	%r13, %r13
	je	LBB0_19
## %bb.20:
	movq	%rbx, %r12
	movl	(%rbx), %esi
	movq	%r14, %rdi
	movl	%r15d, %edx
	callq	_usdhi6_write
	movq	(%r14), %rax
	cmpq	%r13, %rax
	je	LBB0_24
## %bb.21:
	cmpq	8(%r14), %rax
	je	LBB0_24
## %bb.22:
	movq	_USDHI6_SD_CLK_CTRL_SCLKEN@GOTPCREL(%rip), %rax
	testl	%r15d, (%rax)
	jne	LBB0_23
LBB0_24:
	movl	(%r12), %esi
	movq	_USDHI6_SD_CLK_CTRL_SCLKEN@GOTPCREL(%rip), %rax
	orl	(%rax), %r15d
	movq	%r14, %rdi
	movl	%r15d, %edx
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_usdhi6_write                   ## TAILCALL
LBB0_19:
	movq	$0, 8(%r14)
LBB0_23:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_USDHI6_SD_INFO2,4,2            ## @USDHI6_SD_INFO2
	.comm	_USDHI6_SD_INFO2_SCLKDIVEN,4,2  ## @USDHI6_SD_INFO2_SCLKDIVEN
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"SD bus busy, clock set aborted\n"

	.comm	_USDHI6_SD_CLK_CTRL,4,2         ## @USDHI6_SD_CLK_CTRL
	.comm	_USDHI6_SD_CLK_CTRL_DIV_MASK,4,2 ## @USDHI6_SD_CLK_CTRL_DIV_MASK
	.comm	_MMC_TIMING_UHS_DDR50,8,3       ## @MMC_TIMING_UHS_DDR50
L_.str.1:                               ## @.str.1
	.asciz	"target %lu, div %u, set %lu\n"

	.comm	_USDHI6_SD_CLK_CTRL_SCLKEN,4,2  ## @USDHI6_SD_CLK_CTRL_SCLKEN
	.no_dead_strip	_usdhi6_clk_set
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function usdhi6_clk_set
_usdhi6_clk_set:                        ; @usdhi6_clk_set
	.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	x22, x1
	mov	x19, x0
	ldr	x20, [x1]
	mov	w21, #-1000
Lloh0:
	adrp	x23, _USDHI6_SD_INFO2@GOTPAGE
Lloh1:
	ldr	x23, [x23, _USDHI6_SD_INFO2@GOTPAGEOFF]
Lloh2:
	adrp	x24, _USDHI6_SD_INFO2_SCLKDIVEN@GOTPAGE
Lloh3:
	ldr	x24, [x24, _USDHI6_SD_INFO2_SCLKDIVEN@GOTPAGEOFF]
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x23]
	mov	x0, x19
	bl	_usdhi6_read
	ldr	w8, [x24]
	tst	w8, w0
	b.ne	LBB0_4
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	mov	w0, #10
	mov	w1, #100
	bl	_usleep_range
	adds	w21, w21, #1
	b.lo	LBB0_1
; %bb.3:
	ldr	w0, [x19, #16]
	bl	_mmc_dev
Lloh4:
	adrp	x1, l_.str@PAGE
Lloh5:
	add	x1, x1, l_.str@PAGEOFF
	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	_dev_err
LBB0_4:
Lloh6:
	adrp	x23, _USDHI6_SD_CLK_CTRL@GOTPAGE
Lloh7:
	ldr	x23, [x23, _USDHI6_SD_CLK_CTRL@GOTPAGEOFF]
	ldr	w1, [x23]
	mov	x0, x19
	bl	_usdhi6_read
Lloh8:
	adrp	x8, _USDHI6_SD_CLK_CTRL_DIV_MASK@GOTPAGE
Lloh9:
	ldr	x8, [x8, _USDHI6_SD_CLK_CTRL_DIV_MASK@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	bic	w21, w0, w8
	cbz	x20, LBB0_10
; %bb.5:
	ldr	x0, [x19]
	cmp	x0, x20
	b.ls	LBB0_7
; %bb.6:
                                        ; kill: def $w0 killed $w0 killed $x0
	mov	x1, x20
	bl	_DIV_ROUND_UP
	bl	_roundup_pow_of_two
	lsr	x8, x0, #2
	orr	w21, w21, w8
	ldr	x8, [x19]
	udiv	x22, x8, x0
	b	LBB0_8
LBB0_7:
	ldr	x8, [x22, #8]
Lloh11:
	adrp	x9, _MMC_TIMING_UHS_DDR50@GOTPAGE
Lloh12:
	ldr	x9, [x9, _MMC_TIMING_UHS_DDR50@GOTPAGEOFF]
Lloh13:
	ldr	x9, [x9]
	lsr	x10, x0, #1
	orr	w11, w21, #0xff
	cmp	x8, x9
	csel	x22, x10, x0, eq
	csel	w21, w21, w11, eq
LBB0_8:
	ldr	x8, [x19, #8]
	cmp	x8, x22
	b.eq	LBB0_20
; %bb.9:
	str	x22, [x19, #8]
	ldr	w0, [x19, #16]
	bl	_mmc_dev
	ubfiz	w3, w21, #2, #8
Lloh14:
	adrp	x1, l_.str.1@PAGE
Lloh15:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x20
	mov	x4, x22
	bl	_dev_dbg
LBB0_10:
	ldr	x8, [x19]
Lloh16:
	adrp	x22, _USDHI6_SD_CLK_CTRL_SCLKEN@GOTPAGE
Lloh17:
	ldr	x22, [x22, _USDHI6_SD_CLK_CTRL_SCLKEN@GOTPAGEOFF]
	cmp	x8, x20
	b.ne	LBB0_12
LBB0_11:
	ldr	w1, [x23]
	ldr	w8, [x22]
	bic	w2, w21, w8
	mov	x0, x19
	bl	_usdhi6_write
	b	LBB0_14
LBB0_12:
	ldr	x9, [x19, #8]
	cmp	x8, x9
	b.eq	LBB0_11
; %bb.13:
	cbz	x20, LBB0_11
LBB0_14:
	cbz	x20, LBB0_19
; %bb.15:
	ldr	w1, [x23]
	mov	x0, x19
	mov	x2, x21
	bl	_usdhi6_write
	ldr	x8, [x19]
	cmp	x8, x20
	b.eq	LBB0_18
; %bb.16:
	ldr	x9, [x19, #8]
	cmp	x8, x9
	b.eq	LBB0_18
; %bb.17:
	ldr	w8, [x22]
	tst	w8, w21
	b.ne	LBB0_20
LBB0_18:
	ldr	w1, [x23]
	ldr	w8, [x22]
	orr	w2, w8, w21
	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	_usdhi6_write
LBB0_19:
	str	xzr, [x19, #8]
LBB0_20:
	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
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_USDHI6_SD_INFO2,4,2            ; @USDHI6_SD_INFO2
	.comm	_USDHI6_SD_INFO2_SCLKDIVEN,4,2  ; @USDHI6_SD_INFO2_SCLKDIVEN
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"SD bus busy, clock set aborted\n"

	.comm	_USDHI6_SD_CLK_CTRL,4,2         ; @USDHI6_SD_CLK_CTRL
	.comm	_USDHI6_SD_CLK_CTRL_DIV_MASK,4,2 ; @USDHI6_SD_CLK_CTRL_DIV_MASK
	.comm	_MMC_TIMING_UHS_DDR50,8,3       ; @MMC_TIMING_UHS_DDR50
l_.str.1:                               ; @.str.1
	.asciz	"target %lu, div %u, set %lu\n"

	.comm	_USDHI6_SD_CLK_CTRL_SCLKEN,4,2  ; @USDHI6_SD_CLK_CTRL_SCLKEN
	.no_dead_strip	_usdhi6_clk_set
.subsections_via_symbols
