	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function dw_mci_setup_bus
_dw_mci_setup_bus:                      ## @dw_mci_setup_bus
	.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
	movl	%esi, %r13d
	movq	%rdi, %rbx
	movq	32(%rdi), %r14
	movl	(%rdi), %r15d
	movq	_SDMMC_CMD_UPD_CLK@GOTPCREL(%rip), %rax
	movq	_SDMMC_CMD_PRV_DAT_WAIT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r12d
	orl	(%rax), %r12d
	movq	(%r14), %rcx
	movq	_STATE_WAITING_CMD11_DONE@GOTPCREL(%rip), %rdx
	xorl	%eax, %eax
	cmpq	(%rdx), %rcx
	jne	LBB0_2
## %bb.1:
	movq	_SDMMC_CMD_VOLT_SWITCH@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_2:
	orl	%eax, %r12d
	movq	16(%rbx), %rax
	movl	$0, (%rax)
	testl	%r15d, %r15d
	je	LBB0_3
## %bb.4:
	testl	%r13d, %r13d
	jne	LBB0_6
## %bb.5:
	cmpl	8(%r14), %r15d
	je	LBB0_23
LBB0_6:
	movl	12(%r14), %ecx
	xorl	%eax, %eax
	cmpl	%r15d, %ecx
	je	LBB0_8
## %bb.7:
	movl	%ecx, %eax
	xorl	%edx, %edx
	divl	%r15d
	testl	%edx, %edx
	setne	%dl
	cmpl	%r15d, %ecx
	seta	%cl
	andb	%dl, %cl
	movzbl	%cl, %edi
	addl	%eax, %edi
	movl	$2, %esi
	callq	_DIV_ROUND_UP
LBB0_8:
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	cmpl	4(%rbx), %r15d
	jne	LBB0_9
## %bb.24:
	testl	%r13d, %r13d
	jne	LBB0_15
	jmp	LBB0_18
LBB0_3:
	movq	_CLKENA@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_mci_writel
	movq	%rbx, %rdi
	movl	%r12d, %esi
	xorl	%edx, %edx
	callq	_mci_send_cmd
	jmp	LBB0_23
LBB0_9:
	movq	_DW_MMC_CARD_NEEDS_POLL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	24(%rbx), %rsi
	callq	_test_bit
	testl	%r13d, %r13d
	jne	LBB0_11
## %bb.10:
	testl	%eax, %eax
	jne	LBB0_18
LBB0_11:
	testl	%r13d, %r13d
	jne	LBB0_15
## %bb.12:
	movq	16(%rbx), %rdi
	addq	$12, %rdi
	movl	8(%rbx), %r8d
	movl	12(%r14), %ecx
	movl	%ecx, %r9d
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	testl	%esi, %esi
	je	LBB0_14
## %bb.13:
	movl	%ecx, %eax
	xorl	%edx, %edx
	divl	%esi
	movl	%eax, %r9d
	shrl	%r9d
LBB0_14:
	movl	%esi, (%rsp)
	leaq	L_.str(%rip), %rsi
	movl	%r8d, %edx
	movl	%r15d, %r8d
	callq	_dev_info
LBB0_15:
	movq	16(%rbx), %rax
	movq	_MMC_CAP_NEEDS_POLL@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, 4(%rax)
	je	LBB0_18
## %bb.16:
	cmpl	%r15d, 8(%rax)
	jne	LBB0_18
## %bb.17:
	movq	_DW_MMC_CARD_NEEDS_POLL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	24(%rbx), %rsi
	callq	_set_bit
LBB0_18:
	movq	_CLKENA@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_mci_writel
	movq	_CLKSRC@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_mci_writel
	movq	%rbx, %rdi
	movl	%r12d, %esi
	xorl	%edx, %edx
	callq	_mci_send_cmd
	movq	_CLKDIV@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	callq	_mci_writel
	movq	%rbx, %rdi
	movl	%r12d, %esi
	xorl	%edx, %edx
	callq	_mci_send_cmd
	movq	_SDMMC_CLKEN_ENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movb	8(%rbx), %cl
	shll	%cl, %r13d
	movq	_DW_MMC_CARD_NO_LOW_PWR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	24(%rbx), %rsi
	callq	_test_bit
	testl	%eax, %eax
	jne	LBB0_20
## %bb.19:
	movq	_SDMMC_CLKEN_LOW_PWR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movb	8(%rbx), %cl
	shll	%cl, %eax
	orl	%eax, %r13d
LBB0_20:
	movq	_CLKENA@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	%r13d, %edx
	callq	_mci_writel
	movq	%rbx, %rdi
	movl	%r12d, %esi
	xorl	%edx, %edx
	callq	_mci_send_cmd
	movl	%r15d, 4(%rbx)
	movl	12(%r14), %eax
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	testl	%ecx, %ecx
	je	LBB0_22
## %bb.21:
	xorl	%edx, %edx
	divl	%ecx
	shrl	%eax
LBB0_22:
	movq	16(%rbx), %rcx
	movl	%eax, (%rcx)
LBB0_23:
	movl	%r15d, 8(%r14)
	movq	_CTYPE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	12(%rbx), %edx
	movb	8(%rbx), %cl
	shll	%cl, %edx
	movq	%r14, %rdi
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_mci_writel                     ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_SDMMC_CMD_UPD_CLK,4,2          ## @SDMMC_CMD_UPD_CLK
	.comm	_SDMMC_CMD_PRV_DAT_WAIT,4,2     ## @SDMMC_CMD_PRV_DAT_WAIT
	.comm	_STATE_WAITING_CMD11_DONE,8,3   ## @STATE_WAITING_CMD11_DONE
	.comm	_SDMMC_CMD_VOLT_SWITCH,4,2      ## @SDMMC_CMD_VOLT_SWITCH
	.comm	_CLKENA,4,2                     ## @CLKENA
	.comm	_DW_MMC_CARD_NEEDS_POLL,4,2     ## @DW_MMC_CARD_NEEDS_POLL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ div = %d)\n"

	.comm	_MMC_CAP_NEEDS_POLL,4,2         ## @MMC_CAP_NEEDS_POLL
	.comm	_CLKSRC,4,2                     ## @CLKSRC
	.comm	_CLKDIV,4,2                     ## @CLKDIV
	.comm	_SDMMC_CLKEN_ENABLE,4,2         ## @SDMMC_CLKEN_ENABLE
	.comm	_DW_MMC_CARD_NO_LOW_PWR,4,2     ## @DW_MMC_CARD_NO_LOW_PWR
	.comm	_SDMMC_CLKEN_LOW_PWR,4,2        ## @SDMMC_CLKEN_LOW_PWR
	.comm	_CTYPE,4,2                      ## @CTYPE
	.no_dead_strip	_dw_mci_setup_bus
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function dw_mci_setup_bus
_dw_mci_setup_bus:                      ; @dw_mci_setup_bus
	.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	x20, x0
	ldr	x19, [x0, #32]
Lloh0:
	adrp	x8, _SDMMC_CMD_UPD_CLK@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SDMMC_CMD_UPD_CLK@GOTPAGEOFF]
	ldr	w21, [x0]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _SDMMC_CMD_PRV_DAT_WAIT@GOTPAGE
Lloh4:
	ldr	x9, [x9, _SDMMC_CMD_PRV_DAT_WAIT@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	orr	w8, w9, w8
	ldr	x9, [x19]
Lloh6:
	adrp	x10, _STATE_WAITING_CMD11_DONE@GOTPAGE
Lloh7:
	ldr	x10, [x10, _STATE_WAITING_CMD11_DONE@GOTPAGEOFF]
Lloh8:
	ldr	x10, [x10]
Lloh9:
	adrp	x11, _SDMMC_CMD_VOLT_SWITCH@GOTPAGE
Lloh10:
	ldr	x11, [x11, _SDMMC_CMD_VOLT_SWITCH@GOTPAGEOFF]
Lloh11:
	ldr	w11, [x11]
	cmp	x9, x10
	csel	w9, w11, wzr, eq
	orr	w22, w8, w9
	ldr	x8, [x0, #16]
	str	wzr, [x8]
	cbz	w21, LBB0_5
; %bb.1:
	mov	x24, x1
	cbnz	w1, LBB0_3
; %bb.2:
	ldr	w8, [x19, #8]
	cmp	w21, w8
	b.eq	LBB0_23
LBB0_3:
	ldr	w8, [x19, #12]
	cmp	w8, w21
	b.ne	LBB0_6
; %bb.4:
	mov	w23, #0
	b	LBB0_7
LBB0_5:
Lloh12:
	adrp	x8, _CLKENA@GOTPAGE
Lloh13:
	ldr	x8, [x8, _CLKENA@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_mci_writel
	mov	x0, x20
	mov	x1, x22
	mov	w2, #0
	bl	_mci_send_cmd
	b	LBB0_23
LBB0_6:
	udiv	w9, w8, w21
	msub	w8, w9, w21, w8
	ccmp	w8, #0, #4, hi
	cinc	w0, w9, ne
	mov	w1, #2
	bl	_DIV_ROUND_UP
	mov	x23, x0
LBB0_7:
	ldr	w8, [x20, #4]
	cmp	w21, w8
	b.ne	LBB0_9
; %bb.8:
	cbnz	w24, LBB0_15
	b	LBB0_18
LBB0_9:
Lloh15:
	adrp	x8, _DW_MMC_CARD_NEEDS_POLL@GOTPAGE
Lloh16:
	ldr	x8, [x8, _DW_MMC_CARD_NEEDS_POLL@GOTPAGEOFF]
Lloh17:
	ldr	w0, [x8]
	add	x1, x20, #24
	bl	_test_bit
	cbnz	w24, LBB0_11
; %bb.10:
	cbnz	w0, LBB0_18
LBB0_11:
	cbnz	w24, LBB0_15
; %bb.12:
	ldr	x8, [x20, #16]
	add	x0, x8, #12
	ldr	w2, [x20, #8]
	ldr	w3, [x19, #12]
	mov	x5, x3
	cbz	w23, LBB0_14
; %bb.13:
	udiv	w8, w3, w23
	lsr	w5, w8, #1
LBB0_14:
Lloh18:
	adrp	x1, l_.str@PAGE
Lloh19:
	add	x1, x1, l_.str@PAGEOFF
	mov	x4, x21
	mov	x6, x23
	bl	_dev_info
LBB0_15:
	ldr	x8, [x20, #16]
	ldr	w9, [x8, #4]
Lloh20:
	adrp	x10, _MMC_CAP_NEEDS_POLL@GOTPAGE
Lloh21:
	ldr	x10, [x10, _MMC_CAP_NEEDS_POLL@GOTPAGEOFF]
Lloh22:
	ldr	w10, [x10]
	tst	w10, w9
	b.eq	LBB0_18
; %bb.16:
	ldr	w8, [x8, #8]
	cmp	w8, w21
	b.ne	LBB0_18
; %bb.17:
Lloh23:
	adrp	x8, _DW_MMC_CARD_NEEDS_POLL@GOTPAGE
Lloh24:
	ldr	x8, [x8, _DW_MMC_CARD_NEEDS_POLL@GOTPAGEOFF]
Lloh25:
	ldr	w0, [x8]
	add	x1, x20, #24
	bl	_set_bit
LBB0_18:
Lloh26:
	adrp	x25, _CLKENA@GOTPAGE
Lloh27:
	ldr	x25, [x25, _CLKENA@GOTPAGEOFF]
	ldr	w1, [x25]
	mov	x0, x19
	mov	w2, #0
	bl	_mci_writel
Lloh28:
	adrp	x8, _CLKSRC@GOTPAGE
Lloh29:
	ldr	x8, [x8, _CLKSRC@GOTPAGEOFF]
Lloh30:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_mci_writel
	mov	x0, x20
	mov	x1, x22
	mov	w2, #0
	bl	_mci_send_cmd
Lloh31:
	adrp	x8, _CLKDIV@GOTPAGE
Lloh32:
	ldr	x8, [x8, _CLKDIV@GOTPAGEOFF]
Lloh33:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x23
	bl	_mci_writel
	mov	x0, x20
	mov	x1, x22
	mov	w2, #0
	bl	_mci_send_cmd
Lloh34:
	adrp	x8, _SDMMC_CLKEN_ENABLE@GOTPAGE
Lloh35:
	ldr	x8, [x8, _SDMMC_CLKEN_ENABLE@GOTPAGEOFF]
Lloh36:
	ldr	w8, [x8]
	ldr	w9, [x20, #8]
	lsl	w24, w8, w9
Lloh37:
	adrp	x8, _DW_MMC_CARD_NO_LOW_PWR@GOTPAGE
Lloh38:
	ldr	x8, [x8, _DW_MMC_CARD_NO_LOW_PWR@GOTPAGEOFF]
Lloh39:
	ldr	w0, [x8]
	add	x1, x20, #24
	bl	_test_bit
	cbnz	w0, LBB0_20
; %bb.19:
Lloh40:
	adrp	x8, _SDMMC_CLKEN_LOW_PWR@GOTPAGE
Lloh41:
	ldr	x8, [x8, _SDMMC_CLKEN_LOW_PWR@GOTPAGEOFF]
Lloh42:
	ldr	w8, [x8]
	ldr	w9, [x20, #8]
	lsl	w8, w8, w9
	orr	w24, w8, w24
LBB0_20:
	ldr	w1, [x25]
	mov	x0, x19
	mov	x2, x24
	bl	_mci_writel
	mov	x0, x20
	mov	x1, x22
	mov	w2, #0
	bl	_mci_send_cmd
	str	w21, [x20, #4]
	ldr	w8, [x19, #12]
	cbz	w23, LBB0_22
; %bb.21:
	udiv	w8, w8, w23
	lsr	w8, w8, #1
LBB0_22:
	ldr	x9, [x20, #16]
	str	w8, [x9]
LBB0_23:
	str	w21, [x19, #8]
Lloh43:
	adrp	x8, _CTYPE@GOTPAGE
Lloh44:
	ldr	x8, [x8, _CTYPE@GOTPAGEOFF]
Lloh45:
	ldr	w1, [x8]
	ldp	w9, w8, [x20, #8]
	lsl	w2, w8, w9
	mov	x0, x19
	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
	b	_mci_writel
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.loh AdrpLdrGotLdr	Lloh43, Lloh44, Lloh45
	.cfi_endproc
                                        ; -- End function
	.comm	_SDMMC_CMD_UPD_CLK,4,2          ; @SDMMC_CMD_UPD_CLK
	.comm	_SDMMC_CMD_PRV_DAT_WAIT,4,2     ; @SDMMC_CMD_PRV_DAT_WAIT
	.comm	_STATE_WAITING_CMD11_DONE,8,3   ; @STATE_WAITING_CMD11_DONE
	.comm	_SDMMC_CMD_VOLT_SWITCH,4,2      ; @SDMMC_CMD_VOLT_SWITCH
	.comm	_CLKENA,4,2                     ; @CLKENA
	.comm	_DW_MMC_CARD_NEEDS_POLL,4,2     ; @DW_MMC_CARD_NEEDS_POLL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ div = %d)\n"

	.comm	_MMC_CAP_NEEDS_POLL,4,2         ; @MMC_CAP_NEEDS_POLL
	.comm	_CLKSRC,4,2                     ; @CLKSRC
	.comm	_CLKDIV,4,2                     ; @CLKDIV
	.comm	_SDMMC_CLKEN_ENABLE,4,2         ; @SDMMC_CLKEN_ENABLE
	.comm	_DW_MMC_CARD_NO_LOW_PWR,4,2     ; @DW_MMC_CARD_NO_LOW_PWR
	.comm	_SDMMC_CLKEN_LOW_PWR,4,2        ; @SDMMC_CLKEN_LOW_PWR
	.comm	_CTYPE,4,2                      ; @CTYPE
	.no_dead_strip	_dw_mci_setup_bus
.subsections_via_symbols
