	.file	"extr_sd_fat_devoptab.c_sd_fat_write_r.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	sd_fat_write_r, @function
sd_fat_write_r:
.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, 24
	.cfi_def_cfa_offset 80
	mov	rax, QWORD PTR 8[rsi]
	mov	QWORD PTR 8[rsp], rdi
	mov	QWORD PTR [rsp], rdx
	test	rax, rax
	je	.L19
	mov	rbp, rsi
	mov	esi, DWORD PTR 20[rsi]
	test	esi, esi
	jne	.L4
	mov	eax, DWORD PTR EACCES[rip]
	mov	rcx, QWORD PTR 8[rsp]
	xor	r15d, r15d
	mov	DWORD PTR [rcx], eax
.L1:
	add	rsp, 24
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	rax, r15
	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
.L4:
	.cfi_restore_state
	mov	edi, DWORD PTR [rax]
	mov	r12, rcx
	mov	r13d, 16384
	call	OSLockMutex@PLT
	mov	rdi, r12
	call	FS_ALIGN@PLT
	mov	edi, DWORD PTR FS_ALIGNMENT[rip]
	cmp	rax, 16384
	cmovbe	r13, rax
	mov	rsi, r13
	call	memalign@PLT
	mov	r14, rax
	test	rax, rax
	je	.L5
	xor	r15d, r15d
	test	r12, r12
	jne	.L6
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L8:
	je	.L20
	movsx	rdx, eax
	add	DWORD PTR 0[rbp], eax
	add	r15, rdx
	cmp	r12, r15
	jbe	.L9
.L6:
	mov	rbx, r12
	mov	rax, QWORD PTR [rsp]
	mov	rdi, r14
	sub	rbx, r15
	cmp	rbx, r13
	lea	rsi, [rax+r15]
	cmova	rbx, r13
	mov	rdx, rbx
	call	memcpy@PLT
	mov	rax, QWORD PTR 8[rbp]
	mov	rdx, r14
	mov	r8, rbx
	mov	ecx, 1
	mov	esi, DWORD PTR 4[rax]
	mov	edi, DWORD PTR 8[rax]
	push	-1
	.cfi_def_cfa_offset 88
	push	0
	.cfi_def_cfa_offset 96
	mov	r9d, DWORD PTR 16[rbp]
	call	FSWriteFile@PLT
	pop	rdx
	.cfi_def_cfa_offset 88
	pop	rcx
	.cfi_def_cfa_offset 80
	test	eax, eax
	jns	.L8
	mov	rcx, QWORD PTR 8[rsp]
	mov	DWORD PTR [rcx], eax
.L9:
	mov	rdi, r14
	call	free@PLT
	mov	rax, QWORD PTR 8[rbp]
	mov	edi, DWORD PTR [rax]
	call	OSUnlockMutex@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L19:
	mov	eax, DWORD PTR ENODEV[rip]
	xor	r15d, r15d
	mov	DWORD PTR [rdi], eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L20:
	test	rbx, rbx
	je	.L9
.L7:
	xor	r15d, r15d
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L5:
	mov	eax, DWORD PTR ENOMEM[rip]
	mov	rcx, QWORD PTR 8[rsp]
	xor	r15d, r15d
	mov	DWORD PTR [rcx], eax
	mov	rax, QWORD PTR 8[rbp]
	mov	edi, DWORD PTR [rax]
	call	OSUnlockMutex@PLT
	jmp	.L1
	.cfi_endproc
.LFE0:
	.size	sd_fat_write_r, .-sd_fat_write_r
	.comm	FS_ALIGNMENT,4,4
	.comm	ENOMEM,4,4
	.comm	ENODEV,4,4
	.comm	EACCES,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_sd_fat_devoptab.c_sd_fat_write_r.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	sd_fat_write_r, %function
sd_fat_write_r:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	mov	r6, r1
	ldr	r1, [r1, #4]
	sub	sp, sp, #28
	cmp	r1, #0
	str	r0, [sp, #20]
	beq	.L18
	ldr	r4, [r6, #12]
	cmp	r4, #0
	bne	.L4
	ldr	r3, .L20
	ldr	r2, [sp, #20]
	ldr	r3, [r3]
	str	r3, [r2]
.L1:
	mov	r0, r4
	add	sp, sp, #28
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L4:
	mov	r7, r3
	ldr	r0, [r1]
	mov	r10, r2
	bl	OSLockMutex
	mov	r0, r7
	bl	FS_ALIGN
	cmp	r0, #16384
	movcc	r8, r0
	movcs	r8, #16384
	ldr	r3, .L20+4
	mov	r1, r8
	ldr	r0, [r3]
	bl	memalign
	subs	r9, r0, #0
	beq	.L5
	cmp	r7, #0
	movne	r4, #0
	mvnne	fp, #0
	bne	.L6
	b	.L7
.L8:
	beq	.L19
	ldr	r3, [r6]
	add	r4, r4, r0
	cmp	r7, r4
	add	r0, r3, r0
	str	r0, [r6]
	bls	.L9
.L6:
	sub	r5, r7, r4
	cmp	r5, r8
	movcs	r5, r8
	add	r1, r10, r4
	mov	r2, r5
	mov	r0, r9
	bl	memcpy
	ldr	r3, [r6, #4]
	ldr	r2, [r6, #8]
	ldr	r1, [r3, #4]
	ldr	r0, [r3, #8]
	mov	r3, #0
	str	r5, [sp]
	stmib	sp, {r2, r3}
	str	fp, [sp, #12]
	mov	r3, #1
	mov	r2, r9
	bl	FSWriteFile
	cmp	r0, #0
	bge	.L8
	ldr	r3, [sp, #20]
	str	r0, [r3]
.L9:
	mov	r0, r9
	bl	free
	ldr	r3, [r6, #4]
	ldr	r0, [r3]
	bl	OSUnlockMutex
	mov	r0, r4
	add	sp, sp, #28
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L18:
	mov	r4, r1
	ldr	r3, .L20+8
	ldr	r3, [r3]
	str	r3, [r0]
	mov	r0, r4
	add	sp, sp, #28
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L19:
	cmp	r5, #0
	beq	.L9
.L7:
	mov	r4, #0
	b	.L9
.L5:
	ldr	r2, [r6, #4]
	ldr	r3, .L20+12
	ldr	r0, [r2]
	ldr	r3, [r3]
	ldr	r2, [sp, #20]
	mov	r4, r9
	str	r3, [r2]
	bl	OSUnlockMutex
	b	.L1
.L21:
	.align	2
.L20:
	.word	EACCES
	.word	FS_ALIGNMENT
	.word	ENODEV
	.word	ENOMEM
	.size	sd_fat_write_r, .-sd_fat_write_r
	.comm	FS_ALIGNMENT,4,4
	.comm	ENOMEM,4,4
	.comm	ENODEV,4,4
	.comm	EACCES,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
