	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_sdgecko_initIO                 ## -- Begin function sdgecko_initIO
	.p2align	4, 0x90
_sdgecko_initIO:                        ## @sdgecko_initIO
	.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	_MAX_DRIVE@GOTPCREL(%rip), %rax
	cmpq	%rdi, (%rax)
	jbe	LBB0_22
## %bb.1:
	movq	%rdi, %rbx
	movl	$0, -44(%rbp)
	movq	_EXI_DEVICE_0@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-44(%rbp), %rdx
	callq	_EXI_GetID
	cmpl	$-1, -44(%rbp)
	je	LBB0_2
LBB0_22:
	movq	_CARDIO_ERROR_NOCARD@GOTPCREL(%rip), %rax
LBB0_23:
	movq	(%rax), %rax
LBB0_24:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movq	__ioRetryCnt@GOTPCREL(%rip), %r14
	cmpl	$6, (%r14)
	jl	LBB0_4
## %bb.3:
	movl	$0, (%r14)
	movq	_CARDIO_ERROR_IOERROR@GOTPCREL(%rip), %rax
	jmp	LBB0_23
LBB0_4:
	movq	%rbx, %rdi
	callq	___card_check
	movq	__ioCardInserted@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	%rax, (%rcx,%rbx,8)
	movq	_TRUE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_22
## %bb.5:
	movq	__ioWPFlag@GOTPCREL(%rip), %r15
	movl	$0, (%r15)
	movq	_EXI_SPEED16MHZ@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	__ioCardFreq@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	movq	_TYPE_SD@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	__initType@GOTPCREL(%rip), %r13
	movq	(%r13), %rcx
	movq	%rax, (%rcx,%rbx,8)
	movq	_INITIALIZING@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	__ioFlag@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	%eax, (%rcx,%rbx,4)
	movq	_BYTE_ADDRESSING@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	__ioAddressingType@GOTPCREL(%rip), %r12
	movq	(%r12), %rcx
	movl	%eax, (%rcx,%rbx,4)
	movq	%rbx, %rdi
	callq	___card_softreset
	testq	%rax, %rax
	je	LBB0_7
## %bb.6:
	movl	$1, (%r15)
	movq	%rbx, %rdi
	callq	___card_softreset
	testq	%rax, %rax
	jne	LBB0_21
LBB0_7:
	movq	%rbx, %rdi
	callq	___card_sendCMD8
	testq	%rax, %rax
	jne	LBB0_21
## %bb.8:
	movq	__ioResponse@GOTPCREL(%rip), %r15
	movq	(%r15), %rax
	movq	(%rax,%rbx,8), %rax
	cmpl	$1, 12(%rax)
	jne	LBB0_11
## %bb.9:
	cmpl	$170, 16(%rax)
	jne	LBB0_11
## %bb.10:
	movq	_TYPE_SDHC@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%r13), %rcx
	movq	%rax, (%rcx,%rbx,8)
LBB0_11:
	movq	%rbx, %rdi
	callq	___card_sendopcond
	testq	%rax, %rax
	jne	LBB0_21
## %bb.12:
	movq	%rbx, %rdi
	callq	___card_readcsd
	testq	%rax, %rax
	jne	LBB0_21
## %bb.13:
	movq	%rbx, %rdi
	callq	___card_readcid
	testq	%rax, %rax
	jne	LBB0_21
## %bb.14:
	movq	(%r13), %rax
	movq	(%rax,%rbx,8), %rax
	movq	_TYPE_SDHC@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_18
## %bb.15:
	movq	%rbx, %rdi
	callq	___card_sendCMD58
	testq	%rax, %rax
	jne	LBB0_21
## %bb.16:
	movq	(%r15), %rax
	movq	(%rax,%rbx,8), %rax
	testb	$64, 4(%rax)
	je	LBB0_18
## %bb.17:
	movq	_SECTOR_ADDRESSING@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	(%r12), %rcx
	movl	%eax, (%rcx,%rbx,4)
LBB0_18:
	movq	%rbx, %rdi
	callq	_WRITE_BL_LEN
	movl	$1, %esi
	movl	%eax, %ecx
	shll	%cl, %esi
	movq	__ioPageSize@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	%esi, (%rax,%rbx,4)
	movq	%rbx, %rdi
	callq	___card_setblocklen
	testq	%rax, %rax
	jne	LBB0_21
## %bb.19:
	movq	%rbx, %rdi
	callq	___card_sd_status
	testq	%rax, %rax
	je	LBB0_20
LBB0_21:
	movq	___card_retrycb@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	__ioRetryCB@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	movq	%rbx, %rdi
	callq	_sdgecko_doUnmount
	jmp	LBB0_24
LBB0_20:
	movl	$0, (%r14)
	movq	_INITIALIZED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	__ioFlag@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	%eax, (%rcx,%rbx,4)
	movq	_CARDIO_ERROR_READY@GOTPCREL(%rip), %rax
	jmp	LBB0_23
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_DRIVE,8,3                  ## @MAX_DRIVE
	.comm	_CARDIO_ERROR_NOCARD,8,3        ## @CARDIO_ERROR_NOCARD
	.comm	_EXI_DEVICE_0,4,2               ## @EXI_DEVICE_0
	.comm	__ioRetryCnt,4,2                ## @_ioRetryCnt
	.comm	_CARDIO_ERROR_IOERROR,8,3       ## @CARDIO_ERROR_IOERROR
	.comm	__ioCardInserted,8,3            ## @_ioCardInserted
	.comm	_TRUE,8,3                       ## @TRUE
	.comm	__ioWPFlag,4,2                  ## @_ioWPFlag
	.comm	_EXI_SPEED16MHZ,4,2             ## @EXI_SPEED16MHZ
	.comm	__ioCardFreq,4,2                ## @_ioCardFreq
	.comm	_TYPE_SD,8,3                    ## @TYPE_SD
	.comm	__initType,8,3                  ## @_initType
	.comm	_INITIALIZING,4,2               ## @INITIALIZING
	.comm	__ioFlag,8,3                    ## @_ioFlag
	.comm	_BYTE_ADDRESSING,4,2            ## @BYTE_ADDRESSING
	.comm	__ioAddressingType,8,3          ## @_ioAddressingType
	.comm	__ioResponse,8,3                ## @_ioResponse
	.comm	_TYPE_SDHC,8,3                  ## @TYPE_SDHC
	.comm	_SECTOR_ADDRESSING,4,2          ## @SECTOR_ADDRESSING
	.comm	__ioPageSize,8,3                ## @_ioPageSize
	.comm	_INITIALIZED,4,2                ## @INITIALIZED
	.comm	_CARDIO_ERROR_READY,8,3         ## @CARDIO_ERROR_READY
	.comm	___card_retrycb,4,2             ## @__card_retrycb
	.comm	__ioRetryCB,4,2                 ## @_ioRetryCB
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_sdgecko_initIO                 ; -- Begin function sdgecko_initIO
	.p2align	2
_sdgecko_initIO:                        ; @sdgecko_initIO
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
Lloh0:
	adrp	x8, _MAX_DRIVE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MAX_DRIVE@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x8, x0
	b.ls	LBB0_2
; %bb.1:
	mov	x19, x0
	str	wzr, [sp, #12]
Lloh3:
	adrp	x8, _EXI_DEVICE_0@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EXI_DEVICE_0@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	add	x2, sp, #12
	bl	_EXI_GetID
	ldr	w8, [sp, #12]
	cmn	w8, #1
	b.eq	LBB0_5
LBB0_2:
Lloh6:
	adrp	x8, _CARDIO_ERROR_NOCARD@GOTPAGE
Lloh7:
	ldr	x8, [x8, _CARDIO_ERROR_NOCARD@GOTPAGEOFF]
LBB0_3:
	ldr	x0, [x8]
LBB0_4:
	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
	add	sp, sp, #80
	ret
LBB0_5:
Lloh8:
	adrp	x20, __ioRetryCnt@GOTPAGE
Lloh9:
	ldr	x20, [x20, __ioRetryCnt@GOTPAGEOFF]
	ldr	w8, [x20]
	cmp	w8, #6
	b.lt	LBB0_7
; %bb.6:
	str	wzr, [x20]
Lloh10:
	adrp	x8, _CARDIO_ERROR_IOERROR@GOTPAGE
Lloh11:
	ldr	x8, [x8, _CARDIO_ERROR_IOERROR@GOTPAGEOFF]
	b	LBB0_3
LBB0_7:
	mov	x0, x19
	bl	___card_check
Lloh12:
	adrp	x8, __ioCardInserted@GOTPAGE
Lloh13:
	ldr	x8, [x8, __ioCardInserted@GOTPAGEOFF]
Lloh14:
	ldr	x8, [x8]
	str	x0, [x8, x19, lsl #3]
Lloh15:
	adrp	x8, _TRUE@GOTPAGE
Lloh16:
	ldr	x8, [x8, _TRUE@GOTPAGEOFF]
Lloh17:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_2
; %bb.8:
Lloh18:
	adrp	x24, __ioWPFlag@GOTPAGE
Lloh19:
	ldr	x24, [x24, __ioWPFlag@GOTPAGEOFF]
Lloh20:
	adrp	x8, _EXI_SPEED16MHZ@GOTPAGE
Lloh21:
	ldr	x8, [x8, _EXI_SPEED16MHZ@GOTPAGEOFF]
	str	wzr, [x24]
Lloh22:
	ldr	w8, [x8]
Lloh23:
	adrp	x9, __ioCardFreq@GOTPAGE
Lloh24:
	ldr	x9, [x9, __ioCardFreq@GOTPAGEOFF]
Lloh25:
	adrp	x10, _TYPE_SD@GOTPAGE
Lloh26:
	ldr	x10, [x10, _TYPE_SD@GOTPAGEOFF]
Lloh27:
	ldr	x10, [x10]
Lloh28:
	adrp	x23, __initType@GOTPAGE
Lloh29:
	ldr	x23, [x23, __initType@GOTPAGEOFF]
	ldr	x11, [x23]
	str	x10, [x11, x19, lsl #3]
Lloh30:
	str	w8, [x9]
Lloh31:
	adrp	x8, _INITIALIZING@GOTPAGE
Lloh32:
	ldr	x8, [x8, _INITIALIZING@GOTPAGEOFF]
Lloh33:
	ldr	w8, [x8]
Lloh34:
	adrp	x21, __ioFlag@GOTPAGE
Lloh35:
	ldr	x21, [x21, __ioFlag@GOTPAGEOFF]
	ldr	x9, [x21]
	lsl	x10, x19, #2
	str	w8, [x9, x10]
Lloh36:
	adrp	x8, _BYTE_ADDRESSING@GOTPAGE
Lloh37:
	ldr	x8, [x8, _BYTE_ADDRESSING@GOTPAGEOFF]
Lloh38:
	ldr	w8, [x8]
Lloh39:
	adrp	x22, __ioAddressingType@GOTPAGE
Lloh40:
	ldr	x22, [x22, __ioAddressingType@GOTPAGEOFF]
	ldr	x9, [x22]
	str	w8, [x9, x10]
	mov	x0, x19
	bl	___card_softreset
	cbz	x0, LBB0_10
; %bb.9:
	mov	w8, #1
	str	w8, [x24]
	mov	x0, x19
	bl	___card_softreset
	cbnz	x0, LBB0_23
LBB0_10:
	mov	x0, x19
	bl	___card_sendCMD8
	cbnz	x0, LBB0_23
; %bb.11:
Lloh41:
	adrp	x24, __ioResponse@GOTPAGE
Lloh42:
	ldr	x24, [x24, __ioResponse@GOTPAGEOFF]
	ldr	x8, [x24]
	ldr	x8, [x8, x19, lsl #3]
	ldr	w9, [x8, #12]
	cmp	w9, #1
	b.ne	LBB0_14
; %bb.12:
	ldr	w8, [x8, #16]
	cmp	w8, #170
	b.ne	LBB0_14
; %bb.13:
Lloh43:
	adrp	x8, _TYPE_SDHC@GOTPAGE
Lloh44:
	ldr	x8, [x8, _TYPE_SDHC@GOTPAGEOFF]
Lloh45:
	ldr	x8, [x8]
	ldr	x9, [x23]
	str	x8, [x9, x19, lsl #3]
LBB0_14:
	mov	x0, x19
	bl	___card_sendopcond
	cbnz	x0, LBB0_23
; %bb.15:
	mov	x0, x19
	bl	___card_readcsd
	cbnz	x0, LBB0_23
; %bb.16:
	mov	x0, x19
	bl	___card_readcid
	cbnz	x0, LBB0_23
; %bb.17:
	ldr	x8, [x23]
	ldr	x8, [x8, x19, lsl #3]
Lloh46:
	adrp	x9, _TYPE_SDHC@GOTPAGE
Lloh47:
	ldr	x9, [x9, _TYPE_SDHC@GOTPAGEOFF]
Lloh48:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_21
; %bb.18:
	mov	x0, x19
	bl	___card_sendCMD58
	cbnz	x0, LBB0_23
; %bb.19:
	ldr	x8, [x24]
	ldr	x8, [x8, x19, lsl #3]
	ldrb	w8, [x8, #4]
	tbz	w8, #6, LBB0_21
; %bb.20:
Lloh49:
	adrp	x8, _SECTOR_ADDRESSING@GOTPAGE
Lloh50:
	ldr	x8, [x8, _SECTOR_ADDRESSING@GOTPAGEOFF]
Lloh51:
	ldr	w8, [x8]
	ldr	x9, [x22]
	str	w8, [x9, x19, lsl #2]
LBB0_21:
	mov	x0, x19
	bl	_WRITE_BL_LEN
	mov	w8, #1
	lsl	w1, w8, w0
Lloh52:
	adrp	x8, __ioPageSize@GOTPAGE
Lloh53:
	ldr	x8, [x8, __ioPageSize@GOTPAGEOFF]
Lloh54:
	ldr	x8, [x8]
	str	w1, [x8, x19, lsl #2]
	mov	x0, x19
	bl	___card_setblocklen
	cbnz	x0, LBB0_23
; %bb.22:
	mov	x0, x19
	bl	___card_sd_status
	cbz	x0, LBB0_24
LBB0_23:
Lloh55:
	adrp	x8, ___card_retrycb@GOTPAGE
Lloh56:
	ldr	x8, [x8, ___card_retrycb@GOTPAGEOFF]
Lloh57:
	ldr	w8, [x8]
Lloh58:
	adrp	x9, __ioRetryCB@GOTPAGE
Lloh59:
	ldr	x9, [x9, __ioRetryCB@GOTPAGEOFF]
Lloh60:
	str	w8, [x9]
	mov	x0, x19
	bl	_sdgecko_doUnmount
	b	LBB0_4
LBB0_24:
	str	wzr, [x20]
Lloh61:
	adrp	x8, _INITIALIZED@GOTPAGE
Lloh62:
	ldr	x8, [x8, _INITIALIZED@GOTPAGEOFF]
Lloh63:
	ldr	w8, [x8]
	ldr	x9, [x21]
	str	w8, [x9, x19, lsl #2]
Lloh64:
	adrp	x8, _CARDIO_ERROR_READY@GOTPAGE
Lloh65:
	ldr	x8, [x8, _CARDIO_ERROR_READY@GOTPAGEOFF]
	b	LBB0_3
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh39, Lloh40
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGot	Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGot	Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotStr	Lloh23, Lloh24, Lloh30
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh41, Lloh42
	.loh AdrpLdrGotLdr	Lloh43, Lloh44, Lloh45
	.loh AdrpLdrGotLdr	Lloh46, Lloh47, Lloh48
	.loh AdrpLdrGotLdr	Lloh49, Lloh50, Lloh51
	.loh AdrpLdrGotLdr	Lloh52, Lloh53, Lloh54
	.loh AdrpLdrGotStr	Lloh58, Lloh59, Lloh60
	.loh AdrpLdrGotLdr	Lloh55, Lloh56, Lloh57
	.loh AdrpLdrGot	Lloh64, Lloh65
	.loh AdrpLdrGotLdr	Lloh61, Lloh62, Lloh63
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_DRIVE,8,3                  ; @MAX_DRIVE
	.comm	_CARDIO_ERROR_NOCARD,8,3        ; @CARDIO_ERROR_NOCARD
	.comm	_EXI_DEVICE_0,4,2               ; @EXI_DEVICE_0
	.comm	__ioRetryCnt,4,2                ; @_ioRetryCnt
	.comm	_CARDIO_ERROR_IOERROR,8,3       ; @CARDIO_ERROR_IOERROR
	.comm	__ioCardInserted,8,3            ; @_ioCardInserted
	.comm	_TRUE,8,3                       ; @TRUE
	.comm	__ioWPFlag,4,2                  ; @_ioWPFlag
	.comm	_EXI_SPEED16MHZ,4,2             ; @EXI_SPEED16MHZ
	.comm	__ioCardFreq,4,2                ; @_ioCardFreq
	.comm	_TYPE_SD,8,3                    ; @TYPE_SD
	.comm	__initType,8,3                  ; @_initType
	.comm	_INITIALIZING,4,2               ; @INITIALIZING
	.comm	__ioFlag,8,3                    ; @_ioFlag
	.comm	_BYTE_ADDRESSING,4,2            ; @BYTE_ADDRESSING
	.comm	__ioAddressingType,8,3          ; @_ioAddressingType
	.comm	__ioResponse,8,3                ; @_ioResponse
	.comm	_TYPE_SDHC,8,3                  ; @TYPE_SDHC
	.comm	_SECTOR_ADDRESSING,4,2          ; @SECTOR_ADDRESSING
	.comm	__ioPageSize,8,3                ; @_ioPageSize
	.comm	_INITIALIZED,4,2                ; @INITIALIZED
	.comm	_CARDIO_ERROR_READY,8,3         ; @CARDIO_ERROR_READY
	.comm	___card_retrycb,4,2             ; @__card_retrycb
	.comm	__ioRetryCB,4,2                 ; @_ioRetryCB
.subsections_via_symbols
