	.file	"extr_fatfile.c__FAT_syncToDisc.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	_FAT_syncToDisc
	.type	_FAT_syncToDisc, @function
_FAT_syncToDisc:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	r14
	push	r13
	push	r12
	push	rbx
	.cfi_offset 14, -24
	.cfi_offset 13, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	mov	rbx, rdi
	sub	rsp, 16
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -40[rbp], rax
	xor	eax, eax
	movsx	rax, DWORD PTR DIR_ENTRY_DATA_SIZE[rip]
	mov	rcx, rsp
	mov	r12, rax
	lea	rax, 15[0+rax*4]
	mov	rdx, rax
	and	rax, -4096
	sub	rcx, rax
	and	rdx, -16
	mov	rax, rcx
	cmp	rsp, rax
	je	.L3
.L18:
	sub	rsp, 4096
	or	QWORD PTR 4088[rsp], 0
	cmp	rsp, rax
	jne	.L18
.L3:
	and	edx, 4095
	sub	rsp, rdx
	test	rdx, rdx
	jne	.L19
.L4:
	mov	r13, rsp
	test	rbx, rbx
	je	.L5
	mov	edx, DWORD PTR 56[rbx]
	test	edx, edx
	je	.L5
	cmp	QWORD PTR 48[rbx], 0
	je	.L8
	mov	eax, DWORD PTR [rbx]
	test	eax, eax
	jne	.L20
.L8:
	mov	DWORD PTR [rbx], 0
	xor	eax, eax
.L1:
	mov	rsi, QWORD PTR -40[rbp]
	xor	rsi, QWORD PTR fs:40
	jne	.L21
	lea	rsp, -32[rbp]
	pop	rbx
	pop	r12
	pop	r13
	pop	r14
	pop	rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	.cfi_restore_state
	mov	eax, DWORD PTR EBADF[rip]
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L19:
	or	QWORD PTR -8[rsp+rdx], 0
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L20:
	mov	esi, DWORD PTR 32[rbx]
	mov	rdi, QWORD PTR 8[rbx]
	mov	r14d, DWORD PTR 16[rbx]
	call	_FAT_fat_clusterToSector@PLT
	add	rax, QWORD PTR 24[rbx]
	mov	r8d, r12d
	mov	rsi, r13
	imul	r14d, r12d
	mov	rdx, rax
	mov	rax, QWORD PTR 8[rbx]
	mov	edi, DWORD PTR [rax]
	mov	ecx, r14d
	call	_FAT_cache_readPartialSector@PLT
	mov	edx, DWORD PTR 40[rbx]
	mov	esi, DWORD PTR DIR_ENTRY_fileSize[rip]
	mov	rdi, r13
	call	u32_to_u8array@PLT
	mov	edx, DWORD PTR 4[rbx]
	mov	esi, DWORD PTR DIR_ENTRY_cluster[rip]
	mov	rdi, r13
	call	u16_to_u8array@PLT
	movsx	edx, WORD PTR 6[rbx]
	mov	esi, DWORD PTR DIR_ENTRY_clusterHigh[rip]
	mov	rdi, r13
	call	u16_to_u8array@PLT
	xor	eax, eax
	call	_FAT_filetime_getTimeFromRTC@PLT
	mov	esi, DWORD PTR DIR_ENTRY_mTime[rip]
	mov	rdi, r13
	mov	edx, eax
	call	u16_to_u8array@PLT
	xor	eax, eax
	call	_FAT_filetime_getDateFromRTC@PLT
	mov	esi, DWORD PTR DIR_ENTRY_mDate[rip]
	mov	rdi, r13
	mov	edx, eax
	call	u16_to_u8array@PLT
	xor	eax, eax
	call	_FAT_filetime_getDateFromRTC@PLT
	mov	esi, DWORD PTR DIR_ENTRY_aDate[rip]
	mov	rdi, r13
	mov	edx, eax
	call	u16_to_u8array@PLT
	mov	rax, QWORD PTR DIR_ENTRY_attributes[rip]
	mov	esi, DWORD PTR 32[rbx]
	mov	rdi, QWORD PTR 8[rbx]
	mov	r12d, DWORD PTR DIR_ENTRY_DATA_SIZE[rip]
	mov	r14d, DWORD PTR 16[rbx]
	mov	edx, DWORD PTR ATTRIB_ARCH[rip]
	or	DWORD PTR 0[r13+rax*4], edx
	call	_FAT_fat_clusterToSector@PLT
	add	rax, QWORD PTR 24[rbx]
	imul	r14d, r12d
	mov	r8d, r12d
	mov	rdx, rax
	mov	rax, QWORD PTR 8[rbx]
	mov	rsi, r13
	mov	edi, DWORD PTR [rax]
	mov	ecx, r14d
	call	_FAT_cache_writePartialSector@PLT
	mov	rax, QWORD PTR 8[rbx]
	mov	edi, DWORD PTR [rax]
	call	_FAT_cache_flush@PLT
	test	eax, eax
	jne	.L8
	mov	eax, DWORD PTR EIO[rip]
	jmp	.L1
.L21:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	_FAT_syncToDisc, .-_FAT_syncToDisc
	.comm	EIO,4,4
	.comm	EBADF,4,4
	.comm	DIR_ENTRY_mTime,4,4
	.comm	DIR_ENTRY_mDate,4,4
	.comm	DIR_ENTRY_fileSize,4,4
	.comm	DIR_ENTRY_clusterHigh,4,4
	.comm	DIR_ENTRY_cluster,4,4
	.comm	DIR_ENTRY_attributes,8,8
	.comm	DIR_ENTRY_aDate,4,4
	.comm	DIR_ENTRY_DATA_SIZE,4,4
	.comm	ATTRIB_ARCH,4,4
	.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_fatfile.c__FAT_syncToDisc.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	_FAT_syncToDisc
	.syntax unified
	.arm
	.fpu softvfp
	.type	_FAT_syncToDisc, %function
_FAT_syncToDisc:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, fp, lr}
	add	fp, sp, #20
	sub	sp, sp, #16
	ldr	r5, .L20
	ldr	r2, .L20+4
	ldr	r3, [r5]
	subs	r4, r0, #0
	lsl	r3, r3, #2
	add	r3, r3, #7
	bic	r3, r3, #7
	ldr	r2, [r2]
	str	r2, [fp, #-24]
	mov	r2,#0
	sub	sp, sp, r3
	beq	.L2
	ldr	r3, [r4, #32]
	cmp	r3, #0
	beq	.L2
	ldr	r3, [r4, #28]
	cmp	r3, #0
	bne	.L18
.L5:
	mov	r3, #0
	mov	r0, r3
	str	r3, [r4]
.L1:
	ldr	r3, .L20+4
	ldr	r2, [r3]
	ldr	r3, [fp, #-24]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L19
	sub	sp, fp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, fp, pc}
.L18:
	ldr	r3, [r4]
	cmp	r3, #0
	beq	.L5
	ldr	r0, [r4, #8]
	ldr	r1, [r4, #20]
	ldr	r7, [r0]
	bl	_FAT_fat_clusterToSector
	mov	ip, r0
	ldr	r1, [r4, #12]
	ldr	r2, [r4, #16]
	ldr	r3, [r5]
	add	r6, sp, #8
	add	r2, ip, r2
	mov	r0, r7
	str	r3, [sp]
	mul	r3, r1, r3
	mov	r1, r6
	bl	_FAT_cache_readPartialSector
	ldr	r3, .L20+8
	ldr	r2, [r4, #24]
	ldr	r1, [r3]
	mov	r0, r6
	bl	u32_to_u8array
	ldr	r3, .L20+12
	ldr	r2, [r4, #4]
	ldr	r1, [r3]
	mov	r0, r6
	bl	u16_to_u8array
	ldr	r3, .L20+16
	ldrsh	r2, [r4, #6]
	ldr	r1, [r3]
	mov	r0, r6
	bl	u16_to_u8array
	ldr	r3, .L20+20
	ldr	r7, [r3]
	bl	_FAT_filetime_getTimeFromRTC
	mov	r1, r7
	mov	r2, r0
	mov	r0, r6
	bl	u16_to_u8array
	ldr	r3, .L20+24
	ldr	r7, [r3]
	bl	_FAT_filetime_getDateFromRTC
	mov	r1, r7
	mov	r2, r0
	mov	r0, r6
	bl	u16_to_u8array
	ldr	r3, .L20+28
	ldr	r7, [r3]
	bl	_FAT_filetime_getDateFromRTC
	mov	r1, r7
	mov	r2, r0
	mov	r0, r6
	bl	u16_to_u8array
	ldr	r2, .L20+32
	ldr	r3, .L20+36
	ldr	r2, [r2]
	ldr	r1, [r3]
	ldr	r3, [r6, r2, lsl #2]
	ldr	r0, [r4, #8]
	orr	r3, r3, r1
	str	r3, [r6, r2, lsl #2]
	ldr	r1, [r4, #20]
	ldr	r7, [r0]
	bl	_FAT_fat_clusterToSector
	mov	ip, r0
	ldr	lr, [r4, #12]
	ldr	r3, [r5]
	ldr	r2, [r4, #16]
	mov	r1, r6
	str	r3, [sp]
	add	r2, ip, r2
	mul	r3, lr, r3
	mov	r0, r7
	bl	_FAT_cache_writePartialSector
	ldr	r3, [r4, #8]
	ldr	r0, [r3]
	bl	_FAT_cache_flush
	cmp	r0, #0
	bne	.L5
	ldr	r3, .L20+40
	ldr	r0, [r3]
	b	.L1
.L2:
	ldr	r3, .L20+44
	ldr	r0, [r3]
	b	.L1
.L19:
	bl	__stack_chk_fail
.L21:
	.align	2
.L20:
	.word	DIR_ENTRY_DATA_SIZE
	.word	.LC0
	.word	DIR_ENTRY_fileSize
	.word	DIR_ENTRY_cluster
	.word	DIR_ENTRY_clusterHigh
	.word	DIR_ENTRY_mTime
	.word	DIR_ENTRY_mDate
	.word	DIR_ENTRY_aDate
	.word	DIR_ENTRY_attributes
	.word	ATTRIB_ARCH
	.word	EIO
	.word	EBADF
	.size	_FAT_syncToDisc, .-_FAT_syncToDisc
	.comm	EIO,4,4
	.comm	EBADF,4,4
	.comm	DIR_ENTRY_mTime,4,4
	.comm	DIR_ENTRY_mDate,4,4
	.comm	DIR_ENTRY_fileSize,4,4
	.comm	DIR_ENTRY_clusterHigh,4,4
	.comm	DIR_ENTRY_cluster,4,4
	.comm	DIR_ENTRY_attributes,4,4
	.comm	DIR_ENTRY_aDate,4,4
	.comm	DIR_ENTRY_DATA_SIZE,4,4
	.comm	ATTRIB_ARCH,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
