	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_sdgecko_writeSectors           ## -- Begin function sdgecko_writeSectors
	.p2align	4, 0x90
_sdgecko_writeSectors:                  ## @sdgecko_writeSectors
	.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	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	testq	%rdi, %rdi
	js	LBB0_18
## %bb.1:
	movq	%rdi, %rbx
	movq	_MAX_DRIVE@GOTPCREL(%rip), %rax
	cmpq	%rdi, (%rax)
	jle	LBB0_18
## %bb.2:
	movq	%rcx, %r14
	movl	%esi, %r15d
	movl	%edx, %r12d
	movq	%rbx, %rdi
	callq	_sdgecko_preIO
	testq	%rax, %rax
	jne	LBB0_20
## %bb.3:
	movl	%r12d, %eax
	testl	%r12d, %r12d
	jle	LBB0_22
## %bb.4:
	movq	_PAGE_SIZE512@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	__ioPageSize@GOTPCREL(%rip), %r13
	movq	(%r13), %rax
	cmpq	(%rax,%rbx,8), %rsi
	je	LBB0_6
## %bb.5:
	movq	%rsi, (%rax,%rbx,8)
	movq	%rbx, %rdi
	callq	___card_setblocklen
	testq	%rax, %rax
	jne	LBB0_20
LBB0_6:
	movl	%r12d, %ecx
	movl	%r12d, %eax
	shrl	$24, %eax
	movl	%eax, -64(%rbp)
	movl	%r12d, %eax
	shrl	$16, %eax
	movzbl	%al, %eax
	movl	%eax, -60(%rbp)
	movzbl	%ch, %eax
	movl	%eax, -56(%rbp)
	movzbl	%cl, %eax
	movl	%eax, -52(%rbp)
	movq	%rbx, %rdi
	callq	___card_sendappcmd
	testq	%rax, %rax
	jne	LBB0_20
## %bb.7:
	leaq	-64(%rbp), %rdx
	movq	%rbx, %rdi
	movl	$23, %esi
	callq	___card_sendcmd
	testq	%rax, %rax
	jne	LBB0_20
## %bb.8:
	movq	%rbx, %rdi
	callq	___card_response1
	testq	%rax, %rax
	jne	LBB0_20
## %bb.9:
	leaq	-64(%rbp), %rdx
	movq	%rbx, %rdi
	movl	%r15d, %esi
	movq	%rdx, %r15
	callq	___convert_sector
	movq	%rbx, %rdi
	movl	$25, %esi
	movq	%r15, %rdx
	callq	___card_sendcmd
	testq	%rax, %rax
	jne	LBB0_20
## %bb.10:
	movq	%rbx, %rdi
	callq	___card_response1
	testq	%rax, %rax
	jne	LBB0_20
## %bb.11:
	movq	(%r13), %rax
	movq	(%rax,%rbx,8), %rdx
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	___card_multidatawrite
	testq	%rax, %rax
	jne	LBB0_20
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=1
	movq	%rbx, %rdi
	callq	___card_dataresponse
	testq	%rax, %rax
	jne	LBB0_23
## %bb.14:                              ##   in Loop: Header=BB0_12 Depth=1
	movq	(%r13), %rax
	movq	(%rax,%rbx,8), %rdx
	addq	%rdx, %r14
	decl	%r12d
	jne	LBB0_12
## %bb.15:
	movq	%rbx, %rdi
	callq	___card_multiwritestop
	testq	%rax, %rax
	jne	LBB0_20
## %bb.16:
	movq	%rbx, %rdi
	movl	$13, %esi
	xorl	%edx, %edx
	callq	___card_sendcmd
	testq	%rax, %rax
	jne	LBB0_20
## %bb.17:
	movq	%rbx, %rdi
	callq	___card_response2
	jmp	LBB0_20
LBB0_18:
	movq	_CARDIO_ERROR_NOCARD@GOTPCREL(%rip), %rax
LBB0_19:
	movq	(%rax), %rax
LBB0_20:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_25
## %bb.21:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_22:
	movq	_CARDIO_ERROR_INTERNAL@GOTPCREL(%rip), %rax
	jmp	LBB0_19
LBB0_23:
	leaq	-64(%rbp), %rdx
	movq	%rbx, %rdi
	movl	$12, %esi
	callq	___card_sendcmd
	testq	%rax, %rax
	jne	LBB0_20
## %bb.24:
	movq	%rbx, %rdi
	callq	___card_stopresponse
	jmp	LBB0_20
LBB0_25:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_DRIVE,8,3                  ## @MAX_DRIVE
	.comm	_CARDIO_ERROR_NOCARD,8,3        ## @CARDIO_ERROR_NOCARD
	.comm	_CARDIO_ERROR_INTERNAL,8,3      ## @CARDIO_ERROR_INTERNAL
	.comm	_PAGE_SIZE512,8,3               ## @PAGE_SIZE512
	.comm	__ioPageSize,8,3                ## @_ioPageSize
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function sdgecko_writeSectors
lCPI0_0:
	.long	4294967280                      ; 0xfffffff0
	.long	4294967288                      ; 0xfffffff8
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_sdgecko_writeSectors
	.p2align	2
_sdgecko_writeSectors:                  ; @sdgecko_writeSectors
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #24]
	tbnz	x0, #63, LBB0_18
; %bb.1:
	mov	x19, x0
Lloh3:
	adrp	x8, _MAX_DRIVE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MAX_DRIVE@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	cmp	x8, x0
	b.le	LBB0_18
; %bb.2:
	mov	x20, x3
	mov	x21, x2
	mov	x22, x1
	mov	x0, x19
	bl	_sdgecko_preIO
	cbnz	x0, LBB0_20
; %bb.3:
	cmp	w21, #0
	b.le	LBB0_22
; %bb.4:
Lloh6:
	adrp	x8, _PAGE_SIZE512@GOTPAGE
Lloh7:
	ldr	x8, [x8, _PAGE_SIZE512@GOTPAGEOFF]
Lloh8:
	ldr	x1, [x8]
Lloh9:
	adrp	x23, __ioPageSize@GOTPAGE
Lloh10:
	ldr	x23, [x23, __ioPageSize@GOTPAGEOFF]
	ldr	x8, [x23]
	ldr	x9, [x8, x19, lsl #3]
	cmp	x1, x9
	b.eq	LBB0_6
; %bb.5:
	str	x1, [x8, x19, lsl #3]
	mov	x0, x19
	bl	___card_setblocklen
	cbnz	x0, LBB0_20
LBB0_6:
	lsr	w8, w21, #24
	str	w8, [sp, #8]
	dup.2s	v0, w21
Lloh11:
	adrp	x8, lCPI0_0@PAGE
Lloh12:
	ldr	d1, [x8, lCPI0_0@PAGEOFF]
	ushl.2s	v0, v0, v1
	movi	d1, #0x0000ff000000ff
	and.8b	v0, v0, v1
	stur	d0, [sp, #12]
	and	w8, w21, #0xff
	str	w8, [sp, #20]
	mov	x0, x19
	bl	___card_sendappcmd
	cbnz	x0, LBB0_20
; %bb.7:
	add	x2, sp, #8
	mov	x0, x19
	mov	w1, #23
	bl	___card_sendcmd
	cbnz	x0, LBB0_20
; %bb.8:
	mov	x0, x19
	bl	___card_response1
	cbnz	x0, LBB0_20
; %bb.9:
	add	x2, sp, #8
	mov	x0, x19
	mov	x1, x22
	bl	___convert_sector
	add	x2, sp, #8
	mov	x0, x19
	mov	w1, #25
	bl	___card_sendcmd
	cbnz	x0, LBB0_20
; %bb.10:
	mov	x0, x19
	bl	___card_response1
	cbnz	x0, LBB0_20
; %bb.11:
	ldr	x8, [x23]
	ldr	x2, [x8, x19, lsl #3]
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	mov	x1, x20
	bl	___card_multidatawrite
	cbnz	x0, LBB0_20
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=1
	mov	x0, x19
	bl	___card_dataresponse
	cbnz	x0, LBB0_23
; %bb.14:                               ;   in Loop: Header=BB0_12 Depth=1
	ldr	x8, [x23]
	ldr	x2, [x8, x19, lsl #3]
	add	x20, x20, x2
	subs	w21, w21, #1
	b.ne	LBB0_12
; %bb.15:
	mov	x0, x19
	bl	___card_multiwritestop
	cbnz	x0, LBB0_20
; %bb.16:
	mov	x0, x19
	mov	w1, #13
	mov	x2, #0
	bl	___card_sendcmd
	cbnz	x0, LBB0_20
; %bb.17:
	mov	x0, x19
	bl	___card_response2
	b	LBB0_20
LBB0_18:
Lloh13:
	adrp	x8, _CARDIO_ERROR_NOCARD@GOTPAGE
Lloh14:
	ldr	x8, [x8, _CARDIO_ERROR_NOCARD@GOTPAGEOFF]
LBB0_19:
	ldr	x0, [x8]
LBB0_20:
	ldr	x8, [sp, #24]
Lloh15:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh16:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh17:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_25
; %bb.21:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_22:
Lloh18:
	adrp	x8, _CARDIO_ERROR_INTERNAL@GOTPAGE
Lloh19:
	ldr	x8, [x8, _CARDIO_ERROR_INTERNAL@GOTPAGEOFF]
	b	LBB0_19
LBB0_23:
	add	x2, sp, #8
	mov	x0, x19
	mov	w1, #12
	bl	___card_sendcmd
	cbnz	x0, LBB0_20
; %bb.24:
	mov	x0, x19
	bl	___card_stopresponse
	b	LBB0_20
LBB0_25:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdr	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_DRIVE,8,3                  ; @MAX_DRIVE
	.comm	_CARDIO_ERROR_NOCARD,8,3        ; @CARDIO_ERROR_NOCARD
	.comm	_CARDIO_ERROR_INTERNAL,8,3      ; @CARDIO_ERROR_INTERNAL
	.comm	_PAGE_SIZE512,8,3               ; @PAGE_SIZE512
	.comm	__ioPageSize,8,3                ; @_ioPageSize
.subsections_via_symbols
