	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function renesas_sdhi_set_clock
_renesas_sdhi_set_clock:                ## @renesas_sdhi_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
	movq	_CTL_SD_CARD_CLK_CTL@GOTPCREL(%rip), %r13
	movl	(%r13), %r15d
	movq	_CLK_CTL_SCLKEN@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	notl	%r12d
	movl	%r15d, %esi
	callq	_sd_ctrl_read16
	andl	%eax, %r12d
	movq	%r14, %rdi
	movl	%r15d, %esi
	movl	%r12d, %edx
	callq	_sd_ctrl_write16
	testl	%ebx, %ebx
	je	LBB0_1
## %bb.2:
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_renesas_sdhi_clk_update
                                        ## kill: def $eax killed $eax def $rax
	movq	8(%r14), %rcx
	movl	%eax, (%rcx)
	leal	511(%rax), %esi
	testl	%eax, %eax
	cmovnsl	%eax, %esi
	sarl	$9, %esi
	movl	$-2147483520, %eax              ## imm = 0x80000080
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movl	%eax, %edx
	addl	%esi, %esi
	sarl	%eax
	cmpl	%ebx, %esi
	jbe	LBB0_3
## %bb.4:
	movq	(%r14), %rax
	movq	_TMIO_MMC_CLK_ACTUAL@GOTPCREL(%rip), %rsi
	movl	(%rsi), %esi
	testl	%esi, (%rax)
	je	LBB0_9
## %bb.5:
	movl	%edx, %eax
	andl	$4194304, %eax                  ## imm = 0x400000
	je	LBB0_9
## %bb.6:
	movq	8(%rcx), %rax
	movq	_MMC_TIMING_MMC_HS400@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_7
## %bb.8:
	andl	$-256, %edx
	jmp	LBB0_9
LBB0_1:
	movq	8(%r14), %rax
	movl	$0, (%rax)
	jmp	LBB0_12
LBB0_7:
	orl	$255, %edx
LBB0_9:
	movl	(%r13), %esi
	movq	_CLK_CTL_DIV_MASK@GOTPCREL(%rip), %rax
	andl	(%rax), %edx
	movq	%r14, %rdi
	callq	_sd_ctrl_write16
	movq	(%r14), %rax
	movq	_TMIO_MMC_MIN_RCAR2@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%rax)
	jne	LBB0_11
## %bb.10:
	movl	$10000, %edi                    ## imm = 0x2710
	movl	$11000, %esi                    ## imm = 0x2AF8
	callq	_usleep_range
LBB0_11:
	movl	(%r13), %r15d
	movq	_CLK_CTL_SCLKEN@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	%r14, %rdi
	movl	%r15d, %esi
	callq	_sd_ctrl_read16
	orl	%eax, %ebx
	movq	%r14, %rdi
	movl	%r15d, %esi
	movl	%ebx, %edx
	callq	_sd_ctrl_write16
LBB0_12:
	movq	(%r14), %rax
	movq	_TMIO_MMC_MIN_RCAR2@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%rax)
	je	LBB0_14
## %bb.13:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_14:
	movl	$10000, %edi                    ## imm = 0x2710
	movl	$11000, %esi                    ## imm = 0x2AF8
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_usleep_range                   ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_CTL_SD_CARD_CLK_CTL,4,2        ## @CTL_SD_CARD_CLK_CTL
	.comm	_CLK_CTL_SCLKEN,4,2             ## @CLK_CTL_SCLKEN
	.comm	_TMIO_MMC_CLK_ACTUAL,4,2        ## @TMIO_MMC_CLK_ACTUAL
	.comm	_MMC_TIMING_MMC_HS400,8,3       ## @MMC_TIMING_MMC_HS400
	.comm	_CLK_CTL_DIV_MASK,4,2           ## @CLK_CTL_DIV_MASK
	.comm	_TMIO_MMC_MIN_RCAR2,4,2         ## @TMIO_MMC_MIN_RCAR2
	.no_dead_strip	_renesas_sdhi_set_clock
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function renesas_sdhi_set_clock
_renesas_sdhi_set_clock:                ; @renesas_sdhi_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	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x22, _CTL_SD_CARD_CLK_CTL@GOTPAGE
Lloh1:
	ldr	x22, [x22, _CTL_SD_CARD_CLK_CTL@GOTPAGEOFF]
	ldr	w21, [x22]
Lloh2:
	adrp	x23, _CLK_CTL_SCLKEN@GOTPAGE
Lloh3:
	ldr	x23, [x23, _CLK_CTL_SCLKEN@GOTPAGEOFF]
	ldr	w24, [x23]
	mov	x1, x21
	bl	_sd_ctrl_read16
	bic	w2, w0, w24
	mov	x0, x19
	mov	x1, x21
	bl	_sd_ctrl_write16
Lloh4:
	adrp	x21, _TMIO_MMC_MIN_RCAR2@GOTPAGE
Lloh5:
	ldr	x21, [x21, _TMIO_MMC_MIN_RCAR2@GOTPAGEOFF]
	cbz	w20, LBB0_8
; %bb.1:
	mov	x0, x19
	mov	x1, x20
	bl	_renesas_sdhi_clk_update
	ldr	x9, [x19, #8]
	str	w0, [x9]
	add	w8, w0, #511
	cmp	w0, #0
	csel	w8, w8, w0, lt
	asr	w10, w8, #9
	mov	w11, #128
	movk	w11, #32768, lsl #16
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	mov	x8, x11
	lsl	w10, w10, #1
	asr	w11, w11, #1
	cmp	w10, w20
	b.ls	LBB0_2
; %bb.3:
	ldr	x10, [x19]
Lloh6:
	adrp	x11, _TMIO_MMC_CLK_ACTUAL@GOTPAGE
Lloh7:
	ldr	x11, [x11, _TMIO_MMC_CLK_ACTUAL@GOTPAGEOFF]
	ldr	w10, [x10]
Lloh8:
	ldr	w11, [x11]
	and	w10, w11, w10
	and	w11, w8, #0x400000
	cmp	w10, #0
	ccmp	w11, #0, #4, ne
	b.eq	LBB0_5
; %bb.4:
Lloh9:
	adrp	x10, _MMC_TIMING_MMC_HS400@GOTPAGE
Lloh10:
	ldr	x10, [x10, _MMC_TIMING_MMC_HS400@GOTPAGEOFF]
	ldr	x9, [x9, #8]
Lloh11:
	ldr	x10, [x10]
	cmp	x9, x10
	and	w9, w8, #0xffffff00
	orr	w8, w8, #0xff
	csel	w8, w9, w8, eq
LBB0_5:
	ldr	w1, [x22]
Lloh12:
	adrp	x9, _CLK_CTL_DIV_MASK@GOTPAGE
Lloh13:
	ldr	x9, [x9, _CLK_CTL_DIV_MASK@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	and	w2, w9, w8
	mov	x0, x19
	bl	_sd_ctrl_write16
	ldr	x8, [x19]
	ldr	w8, [x8]
	ldr	w9, [x21]
	tst	w9, w8
	b.ne	LBB0_7
; %bb.6:
	mov	w0, #10000
	mov	w1, #11000
	bl	_usleep_range
LBB0_7:
	ldr	w20, [x22]
	ldr	w22, [x23]
	mov	x0, x19
	mov	x1, x20
	bl	_sd_ctrl_read16
	orr	w2, w0, w22
	mov	x0, x19
	mov	x1, x20
	bl	_sd_ctrl_write16
	b	LBB0_9
LBB0_8:
	ldr	x8, [x19, #8]
	str	wzr, [x8]
LBB0_9:
	ldr	x8, [x19]
	ldr	w8, [x8]
	ldr	w9, [x21]
	tst	w9, w8
	b.eq	LBB0_11
; %bb.10:
	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_11:
	mov	w0, #10000
	mov	w1, #11000
	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	_usleep_range
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_CTL_SD_CARD_CLK_CTL,4,2        ; @CTL_SD_CARD_CLK_CTL
	.comm	_CLK_CTL_SCLKEN,4,2             ; @CLK_CTL_SCLKEN
	.comm	_TMIO_MMC_CLK_ACTUAL,4,2        ; @TMIO_MMC_CLK_ACTUAL
	.comm	_MMC_TIMING_MMC_HS400,8,3       ; @MMC_TIMING_MMC_HS400
	.comm	_CLK_CTL_DIV_MASK,4,2           ; @CLK_CTL_DIV_MASK
	.comm	_TMIO_MMC_MIN_RCAR2,4,2         ; @TMIO_MMC_MIN_RCAR2
	.no_dead_strip	_renesas_sdhi_set_clock
.subsections_via_symbols
