	.file	"extr_sdgecko_io.c_sdgecko_writeSectors.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	sdgecko_writeSectors
	.type	sdgecko_writeSectors, @function
sdgecko_writeSectors:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 40
	.cfi_def_cfa_offset 96
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 24[rsp], rax
	xor	eax, eax
	test	rdi, rdi
	js	.L2
	cmp	QWORD PTR MAX_DRIVE[rip], rdi
	mov	rbp, rdi
	jg	.L3
.L2:
	mov	rax, QWORD PTR CARDIO_ERROR_NOCARD[rip]
.L1:
	mov	rbx, QWORD PTR 24[rsp]
	xor	rbx, QWORD PTR fs:40
	jne	.L16
	add	rsp, 40
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L3:
	.cfi_restore_state
	mov	r12d, esi
	mov	r15d, edx
	mov	rbx, rcx
	call	sdgecko_preIO@PLT
	test	rax, rax
	jne	.L1
	mov	rax, QWORD PTR CARDIO_ERROR_INTERNAL[rip]
	test	r15d, r15d
	jle	.L1
	mov	rax, QWORD PTR _ioPageSize[rip]
	lea	r13, 0[0+rbp*8]
	mov	rsi, QWORD PTR PAGE_SIZE512[rip]
	add	rax, r13
	cmp	QWORD PTR [rax], rsi
	je	.L8
	mov	QWORD PTR [rax], rsi
	mov	rdi, rbp
	call	__card_setblocklen@PLT
	test	rax, rax
	jne	.L1
.L8:
	mov	eax, r15d
	mov	rdi, rbp
	shr	eax, 24
	mov	DWORD PTR [rsp], eax
	mov	eax, r15d
	sar	eax, 16
	and	eax, 255
	mov	DWORD PTR 4[rsp], eax
	mov	eax, r15d
	movzx	eax, ah
	mov	DWORD PTR 8[rsp], eax
	movzx	eax, r15b
	mov	DWORD PTR 12[rsp], eax
	call	__card_sendappcmd@PLT
	test	rax, rax
	jne	.L1
	mov	r14, rsp
	mov	esi, 23
	mov	rdi, rbp
	mov	rdx, r14
	call	__card_sendcmd@PLT
	test	rax, rax
	jne	.L1
	mov	rdi, rbp
	call	__card_response1@PLT
	test	rax, rax
	jne	.L1
	mov	rdx, r14
	mov	esi, r12d
	mov	rdi, rbp
	call	__convert_sector@PLT
	mov	rdx, r14
	mov	esi, 25
	mov	rdi, rbp
	call	__card_sendcmd@PLT
	test	rax, rax
	jne	.L1
	mov	rdi, rbp
	call	__card_response1@PLT
	test	rax, rax
	jne	.L1
	mov	rax, QWORD PTR _ioPageSize[rip]
	xor	r12d, r12d
	mov	rdx, QWORD PTR [rax+rbp*8]
	.p2align 4,,10
	.p2align 3
.L10:
	mov	rsi, rbx
	mov	rdi, rbp
	call	__card_multidatawrite@PLT
	test	rax, rax
	jne	.L1
	mov	rdi, rbp
	call	__card_dataresponse@PLT
	test	rax, rax
	jne	.L17
	mov	rax, QWORD PTR _ioPageSize[rip]
	add	r12d, 1
	mov	rdx, QWORD PTR [rax+r13]
	add	rbx, rdx
	cmp	r15d, r12d
	jne	.L10
	mov	rdi, rbp
	call	__card_multiwritestop@PLT
	test	rax, rax
	jne	.L1
	xor	edx, edx
	mov	esi, 13
	mov	rdi, rbp
	call	__card_sendcmd@PLT
	test	rax, rax
	jne	.L1
	mov	rdi, rbp
	call	__card_response2@PLT
	jmp	.L1
.L17:
	mov	rdx, r14
	mov	esi, 12
	mov	rdi, rbp
	call	__card_sendcmd@PLT
	test	rax, rax
	jne	.L1
	mov	rdi, rbp
	call	__card_stopresponse@PLT
	jmp	.L1
.L16:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	sdgecko_writeSectors, .-sdgecko_writeSectors
	.comm	_ioPageSize,8,8
	.comm	PAGE_SIZE512,8,8
	.comm	MAX_DRIVE,8,8
	.comm	CARDIO_ERROR_NOCARD,8,8
	.comm	CARDIO_ERROR_INTERNAL,8,8
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_sdgecko_io.c_sdgecko_writeSectors.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	sdgecko_writeSectors
	.syntax unified
	.arm
	.fpu softvfp
	.type	sdgecko_writeSectors, %function
sdgecko_writeSectors:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	mov	r8, r3
	ldr	r3, .L20
	sub	sp, sp, #24
	subs	r5, r0, #0
	ldr	r3, [r3]
	str	r3, [sp, #20]
	mov	r3,#0
	blt	.L2
	ldr	r3, .L20+4
	ldr	r3, [r3]
	cmp	r3, r5
	bgt	.L3
.L2:
	ldr	r3, .L20+8
	ldr	r4, [r3]
.L1:
	ldr	r3, .L20
	ldr	r2, [r3]
	ldr	r3, [sp, #20]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L17
	mov	r0, r4
	add	sp, sp, #24
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L3:
	mov	r6, r1
	mov	r7, r2
	bl	sdgecko_preIO
	subs	r4, r0, #0
	bne	.L1
	cmp	r7, #0
	ble	.L18
	ldr	r9, .L20+12
	ldr	r2, .L20+16
	ldr	r3, [r9]
	ldr	r1, [r2]
	ldr	r2, [r3, r5, lsl #2]
	lsl	r10, r5, #2
	cmp	r2, r1
	beq	.L8
	mov	r0, r5
	str	r1, [r3, r5, lsl #2]
	bl	__card_setblocklen
	subs	r4, r0, #0
	bne	.L1
.L8:
	asr	r2, r7, #16
	asr	r3, r7, #8
	and	r2, r2, #255
	and	r3, r3, #255
	str	r2, [sp, #8]
	str	r3, [sp, #12]
	lsr	r2, r7, #24
	and	r3, r7, #255
	mov	r0, r5
	str	r2, [sp, #4]
	str	r3, [sp, #16]
	bl	__card_sendappcmd
	subs	r4, r0, #0
	bne	.L1
	mov	r1, #23
	mov	r0, r5
	add	r2, sp, #4
	bl	__card_sendcmd
	subs	r4, r0, #0
	bne	.L1
	mov	r0, r5
	bl	__card_response1
	subs	r4, r0, #0
	bne	.L1
	mov	r1, r6
	add	r2, sp, #4
	mov	r0, r5
	bl	__convert_sector
	mov	r1, #25
	mov	r0, r5
	add	r2, sp, #4
	bl	__card_sendcmd
	subs	r4, r0, #0
	bne	.L1
	mov	r0, r5
	bl	__card_response1
	subs	r4, r0, #0
	bne	.L1
	ldr	r3, [r9]
	ldr	r2, [r3, r5, lsl #2]
.L10:
	mov	r1, r8
	mov	r0, r5
	bl	__card_multidatawrite
	cmp	r0, #0
	bne	.L12
	mov	r0, r5
	bl	__card_dataresponse
	cmp	r0, #0
	bne	.L19
	ldr	r3, [r9]
	add	r4, r4, #1
	ldr	r2, [r3, r10]
	cmp	r7, r4
	add	r8, r8, r2
	bne	.L10
	mov	r0, r5
	bl	__card_multiwritestop
	subs	r4, r0, #0
	bne	.L1
	mov	r2, r4
	mov	r1, #13
	mov	r0, r5
	bl	__card_sendcmd
	subs	r4, r0, #0
	bne	.L1
	mov	r0, r5
	bl	__card_response2
	mov	r4, r0
	b	.L1
.L18:
	ldr	r3, .L20+20
	ldr	r4, [r3]
	b	.L1
.L12:
	mov	r4, r0
	b	.L1
.L19:
	mov	r1, #12
	mov	r0, r5
	add	r2, sp, #4
	bl	__card_sendcmd
	subs	r4, r0, #0
	bne	.L1
	mov	r0, r5
	bl	__card_stopresponse
	mov	r4, r0
	b	.L1
.L17:
	bl	__stack_chk_fail
.L21:
	.align	2
.L20:
	.word	.LC0
	.word	MAX_DRIVE
	.word	CARDIO_ERROR_NOCARD
	.word	_ioPageSize
	.word	PAGE_SIZE512
	.word	CARDIO_ERROR_INTERNAL
	.size	sdgecko_writeSectors, .-sdgecko_writeSectors
	.comm	_ioPageSize,4,4
	.comm	PAGE_SIZE512,4,4
	.comm	MAX_DRIVE,4,4
	.comm	CARDIO_ERROR_NOCARD,4,4
	.comm	CARDIO_ERROR_INTERNAL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
