	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sd_power_on
_sd_power_on:                           ## @sd_power_on
	.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), %rax
	movq	_SDMMC_POWER_ON@GOTPCREL(%rip), %r12
	xorl	%r14d, %r14d
	cmpq	(%r12), %rax
	je	LBB0_10
## %bb.1:
	movq	%rdi, %r15
	movq	8(%rdi), %rbx
	movq	%rbx, %rdi
	callq	_rtsx_pci_init_cmd
	movq	_WRITE_REG_CMD@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	movq	_CARD_SELECT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_SD_MOD_SEL@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	%rbx, %rdi
	movl	$7, %ecx
	callq	_rtsx_pci_add_cmd
	movl	(%r13), %esi
	movq	_CARD_SHARE_MODE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_CARD_SHARE_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	_CARD_SHARE_48_SD@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	%rbx, %rdi
	callq	_rtsx_pci_add_cmd
	movl	(%r13), %esi
	movq	_CARD_CLK_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_SD_CLK_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%rbx, %rdi
	movl	%ecx, %r8d
	callq	_rtsx_pci_add_cmd
	movq	%rbx, %rdi
	movl	$100, %esi
	callq	_rtsx_pci_send_cmd
	testl	%eax, %eax
	js	LBB0_9
## %bb.2:
	movq	_RTSX_SD_CARD@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	movq	%rbx, %rdi
	callq	_rtsx_pci_card_pull_ctl_enable
	testl	%eax, %eax
	js	LBB0_9
## %bb.3:
	movl	(%r13), %esi
	movq	%rbx, %rdi
	callq	_rtsx_pci_card_power_on
	testl	%eax, %eax
	js	LBB0_9
## %bb.4:
	movq	_CARD_OE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_SD_OUTPUT_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%rbx, %rdi
	movl	%ecx, %edx
	callq	_rtsx_pci_write_register
	testl	%eax, %eax
	js	LBB0_9
## %bb.5:
	movq	(%r12), %rax
	movq	%rax, (%r15)
	jmp	LBB0_10
LBB0_9:
	movl	%eax, %r14d
LBB0_10:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SDMMC_POWER_ON,8,3             ## @SDMMC_POWER_ON
	.comm	_WRITE_REG_CMD,4,2              ## @WRITE_REG_CMD
	.comm	_CARD_SELECT,4,2                ## @CARD_SELECT
	.comm	_SD_MOD_SEL,4,2                 ## @SD_MOD_SEL
	.comm	_CARD_SHARE_MODE,4,2            ## @CARD_SHARE_MODE
	.comm	_CARD_SHARE_MASK,4,2            ## @CARD_SHARE_MASK
	.comm	_CARD_SHARE_48_SD,4,2           ## @CARD_SHARE_48_SD
	.comm	_CARD_CLK_EN,4,2                ## @CARD_CLK_EN
	.comm	_SD_CLK_EN,4,2                  ## @SD_CLK_EN
	.comm	_RTSX_SD_CARD,4,2               ## @RTSX_SD_CARD
	.comm	_CARD_OE,4,2                    ## @CARD_OE
	.comm	_SD_OUTPUT_EN,4,2               ## @SD_OUTPUT_EN
	.no_dead_strip	_sd_power_on
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sd_power_on
_sd_power_on:                           ; @sd_power_on
	.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
	ldr	x8, [x0]
Lloh0:
	adrp	x21, _SDMMC_POWER_ON@GOTPAGE
Lloh1:
	ldr	x21, [x21, _SDMMC_POWER_ON@GOTPAGEOFF]
	ldr	x9, [x21]
	cmp	x8, x9
	b.ne	LBB0_2
; %bb.1:
	mov	w0, #0
	b	LBB0_7
LBB0_2:
	mov	x19, x0
	ldr	x20, [x0, #8]
	mov	x0, x20
	bl	_rtsx_pci_init_cmd
Lloh2:
	adrp	x22, _WRITE_REG_CMD@GOTPAGE
Lloh3:
	ldr	x22, [x22, _WRITE_REG_CMD@GOTPAGEOFF]
	ldr	w1, [x22]
Lloh4:
	adrp	x8, _CARD_SELECT@GOTPAGE
Lloh5:
	ldr	x8, [x8, _CARD_SELECT@GOTPAGEOFF]
Lloh6:
	ldr	w2, [x8]
Lloh7:
	adrp	x8, _SD_MOD_SEL@GOTPAGE
Lloh8:
	ldr	x8, [x8, _SD_MOD_SEL@GOTPAGEOFF]
Lloh9:
	ldr	w4, [x8]
	mov	x0, x20
	mov	w3, #7
	bl	_rtsx_pci_add_cmd
	ldr	w1, [x22]
Lloh10:
	adrp	x8, _CARD_SHARE_MODE@GOTPAGE
Lloh11:
	ldr	x8, [x8, _CARD_SHARE_MODE@GOTPAGEOFF]
Lloh12:
	ldr	w2, [x8]
Lloh13:
	adrp	x8, _CARD_SHARE_MASK@GOTPAGE
Lloh14:
	ldr	x8, [x8, _CARD_SHARE_MASK@GOTPAGEOFF]
Lloh15:
	ldr	w3, [x8]
Lloh16:
	adrp	x8, _CARD_SHARE_48_SD@GOTPAGE
Lloh17:
	ldr	x8, [x8, _CARD_SHARE_48_SD@GOTPAGEOFF]
Lloh18:
	ldr	w4, [x8]
	mov	x0, x20
	bl	_rtsx_pci_add_cmd
	ldr	w1, [x22]
Lloh19:
	adrp	x8, _CARD_CLK_EN@GOTPAGE
Lloh20:
	ldr	x8, [x8, _CARD_CLK_EN@GOTPAGEOFF]
Lloh21:
	ldr	w2, [x8]
Lloh22:
	adrp	x8, _SD_CLK_EN@GOTPAGE
Lloh23:
	ldr	x8, [x8, _SD_CLK_EN@GOTPAGEOFF]
Lloh24:
	ldr	w3, [x8]
	mov	x0, x20
	mov	x4, x3
	bl	_rtsx_pci_add_cmd
	mov	x0, x20
	mov	w1, #100
	bl	_rtsx_pci_send_cmd
	tbnz	w0, #31, LBB0_7
; %bb.3:
Lloh25:
	adrp	x22, _RTSX_SD_CARD@GOTPAGE
Lloh26:
	ldr	x22, [x22, _RTSX_SD_CARD@GOTPAGEOFF]
	ldr	w1, [x22]
	mov	x0, x20
	bl	_rtsx_pci_card_pull_ctl_enable
	tbnz	w0, #31, LBB0_7
; %bb.4:
	ldr	w1, [x22]
	mov	x0, x20
	bl	_rtsx_pci_card_power_on
	tbnz	w0, #31, LBB0_7
; %bb.5:
Lloh27:
	adrp	x8, _CARD_OE@GOTPAGE
Lloh28:
	ldr	x8, [x8, _CARD_OE@GOTPAGEOFF]
Lloh29:
	ldr	w1, [x8]
Lloh30:
	adrp	x8, _SD_OUTPUT_EN@GOTPAGE
Lloh31:
	ldr	x8, [x8, _SD_OUTPUT_EN@GOTPAGEOFF]
Lloh32:
	ldr	w2, [x8]
	mov	x0, x20
	mov	x3, x2
	bl	_rtsx_pci_write_register
	tbnz	w0, #31, LBB0_7
; %bb.6:
	mov	w0, #0
	ldr	x8, [x21]
	str	x8, [x19]
LBB0_7:
	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
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_SDMMC_POWER_ON,8,3             ; @SDMMC_POWER_ON
	.comm	_WRITE_REG_CMD,4,2              ; @WRITE_REG_CMD
	.comm	_CARD_SELECT,4,2                ; @CARD_SELECT
	.comm	_SD_MOD_SEL,4,2                 ; @SD_MOD_SEL
	.comm	_CARD_SHARE_MODE,4,2            ; @CARD_SHARE_MODE
	.comm	_CARD_SHARE_MASK,4,2            ; @CARD_SHARE_MASK
	.comm	_CARD_SHARE_48_SD,4,2           ; @CARD_SHARE_48_SD
	.comm	_CARD_CLK_EN,4,2                ; @CARD_CLK_EN
	.comm	_SD_CLK_EN,4,2                  ; @SD_CLK_EN
	.comm	_RTSX_SD_CARD,4,2               ; @RTSX_SD_CARD
	.comm	_CARD_OE,4,2                    ; @CARD_OE
	.comm	_SD_OUTPUT_EN,4,2               ; @SD_OUTPUT_EN
	.no_dead_strip	_sd_power_on
.subsections_via_symbols
