	.file	"extr_mtdswap.c_mtdswap_write_block.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"Write to MTD device failed: %d (%zd written)"
	.align 8
.LC1:
	.string	"Short write to MTD device: %zd written"
	.text
	.p2align 4
	.type	mtdswap_write_block, @function
mtdswap_write_block:
.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
	mov	r14, rdi
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	mov	r12d, edx
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	ebp, r8d
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	rbx, rcx
	sub	rsp, 56
	.cfi_def_cfa_offset 112
	mov	QWORD PTR 16[rsp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 40[rsp], rax
	xor	eax, eax
	mov	rax, QWORD PTR 40[rdi]
	mov	QWORD PTR 8[rsp], rax
	lea	rax, 32[rsp]
	mov	QWORD PTR 24[rsp], rax
.L2:
	test	ebp, ebp
	je	.L3
.L8:
	mov	rdx, rbx
	mov	esi, r12d
	mov	rdi, r14
	call	mtdswap_map_free_block@PLT
	xor	edx, edx
	mov	r13d, eax
	mov	eax, DWORD PTR [rbx]
	div	DWORD PTR [r14]
	mov	rdx, QWORD PTR 32[r14]
	lea	r15, [rdx+rax*4]
	mov	eax, r13d
	add	eax, DWORD PTR EIO[rip]
	je	.L4
	mov	edi, r13d
	call	mtd_is_eccerr@PLT
	test	rax, rax
	jne	.L4
	test	r13d, r13d
	js	.L1
	mov	ecx, DWORD PTR PAGE_SHIFT[rip]
	mov	esi, DWORD PTR [rbx]
	mov	r8, QWORD PTR 16[rsp]
	mov	rdx, QWORD PTR PAGE_SIZE[rip]
	sal	esi, cl
	mov	rdi, QWORD PTR 8[rsp]
	mov	rcx, QWORD PTR 24[rsp]
	call	mtd_write@PLT
	mov	r13d, eax
	add	eax, DWORD PTR EIO[rip]
	je	.L11
	mov	edi, r13d
	call	mtd_is_eccerr@PLT
	test	rax, rax
	je	.L21
.L11:
	sub	DWORD PTR 16[r14], 1
	mov	rax, QWORD PTR 8[r14]
	mov	rsi, r15
	mov	rdi, r14
	sub	DWORD PTR [r15], 1
	mov	rcx, QWORD PTR PAGE_UNDEF[rip]
	mov	edx, DWORD PTR [rbx]
	mov	QWORD PTR [rax+rdx*8], rcx
	call	mtdswap_handle_write_error@PLT
	test	ebp, ebp
	jne	.L8
	.p2align 4,,10
	.p2align 3
.L3:
	mov	rdi, r14
	call	mtdswap_enough_free_pages@PLT
	test	eax, eax
	jne	.L8
	xor	esi, esi
	mov	rdi, r14
	call	mtdswap_gc@PLT
	test	rax, rax
	jle	.L3
	mov	r13d, DWORD PTR ENOSPC[rip]
	neg	r13d
.L1:
	mov	rax, QWORD PTR 40[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L22
	add	rsp, 56
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	eax, r13d
	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	QWORD PTR 24[r14], 0
	mov	rax, QWORD PTR 8[r14]
	sub	DWORD PTR [r15], 1
	mov	rcx, QWORD PTR PAGE_UNDEF[rip]
	mov	edx, DWORD PTR [rbx]
	mov	QWORD PTR [rax+rdx*8], rcx
	jmp	.L2
.L21:
	mov	rdx, QWORD PTR 32[rsp]
	test	r13d, r13d
	js	.L23
	cmp	QWORD PTR PAGE_SIZE[rip], rdx
	je	.L1
	mov	edi, DWORD PTR 20[r14]
	lea	rsi, .LC1[rip]
	xor	eax, eax
	call	dev_err@PLT
	mov	r13d, DWORD PTR EIO[rip]
	neg	r13d
.L13:
	sub	DWORD PTR 16[r14], 1
	mov	rax, QWORD PTR 8[r14]
	sub	DWORD PTR [r15], 1
	mov	rcx, QWORD PTR PAGE_UNDEF[rip]
	mov	edx, DWORD PTR [rbx]
	mov	QWORD PTR [rax+rdx*8], rcx
	jmp	.L1
.L23:
	movsx	rax, r13d
	mov	edi, DWORD PTR 20[r14]
	mov	rcx, rdx
	lea	rsi, .LC0[rip]
	mov	rdx, rax
	xor	eax, eax
	call	dev_err@PLT
	jmp	.L13
.L22:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	mtdswap_write_block, .-mtdswap_write_block
	.comm	PAGE_UNDEF,8,8
	.comm	PAGE_SIZE,8,8
	.comm	PAGE_SHIFT,4,4
	.comm	ENOSPC,4,4
	.comm	EIO,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_mtdswap.c_mtdswap_write_block.c"
	.text
	.global	__aeabi_uidiv
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"Write to MTD device failed: %d (%zd written)\000"
	.align	2
.LC1:
	.ascii	"Short write to MTD device: %zd written\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC2:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	mtdswap_write_block, %function
mtdswap_write_block:
	@ args = 4, pretend = 0, frame = 24
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	mov	r4, r0
	mov	r8, r2
	sub	sp, sp, #36
	mov	r6, r3
	ldr	r3, .L25
	str	r1, [sp, #20]
	ldr	r3, [r3]
	str	r3, [sp, #28]
	mov	r3,#0
	ldr	r3, [r0, #24]
	ldr	r9, .L25+4
	ldr	fp, .L25+8
	str	r3, [sp, #16]
.L2:
	ldr	r3, [sp, #72]
	cmp	r3, #0
	beq	.L3
.L8:
	mov	r2, r6
	mov	r1, r8
	mov	r0, r4
	bl	mtdswap_map_free_block
	ldr	r1, [r4]
	mov	r10, r0
	ldr	r0, [r6]
	bl	__aeabi_uidiv
	ldr	r2, [r9]
	ldr	r7, [r4, #20]
	cmn	r10, r2
	add	r3, r7, r0, lsl #2
	mov	r5, r0
	str	r3, [sp, #12]
	beq	.L4
	mov	r0, r10
	bl	mtd_is_eccerr
	cmp	r0, #0
	bne	.L4
	cmp	r10, #0
	blt	.L1
	ldr	r2, [sp, #20]
	ldr	r3, .L25+12
	ldr	r1, [r6]
	ldr	r3, [r3]
	str	r2, [sp]
	ldr	r2, .L25+16
	lsl	r1, r1, r3
	ldr	r2, [r2]
	ldr	r0, [sp, #16]
	add	r3, sp, #24
	bl	mtd_write
	ldr	r2, [r9]
	mov	r10, r0
	cmn	r0, r2
	beq	.L11
	bl	mtd_is_eccerr
	cmp	r0, #0
	beq	.L22
.L11:
	ldr	r2, [r4, #8]
	ldr	r3, [r7, r5, lsl #2]
	sub	r2, r2, #1
	sub	r3, r3, #1
	str	r2, [r4, #8]
	str	r3, [r7, r5, lsl #2]
	ldr	r0, [fp]
	ldr	r3, [r4, #4]
	ldr	r2, [r6]
	ldr	r1, [sp, #12]
	str	r0, [r3, r2, lsl #2]
	mov	r0, r4
	bl	mtdswap_handle_write_error
	ldr	r3, [sp, #72]
	cmp	r3, #0
	bne	.L8
.L3:
	mov	r0, r4
	bl	mtdswap_enough_free_pages
	subs	r1, r0, #0
	bne	.L8
	mov	r0, r4
	bl	mtdswap_gc
	cmp	r0, #0
	ble	.L3
	ldr	r3, .L25+20
	ldr	r2, [r3]
	rsb	r10, r2, #0
.L1:
	ldr	r3, .L25
	ldr	r2, [r3]
	ldr	r3, [sp, #28]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L23
	mov	r0, r10
	add	sp, sp, #36
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L4:
	mov	r2, #0
	ldr	r3, [r7, r5, lsl #2]
	str	r2, [r4, #16]
	sub	r3, r3, #1
	str	r3, [r7, r5, lsl #2]
	ldr	r2, [r6]
	ldr	r1, [fp]
	ldr	r3, [r4, #4]
	str	r1, [r3, r2, lsl #2]
	b	.L2
.L22:
	cmp	r10, #0
	ldr	r3, [sp, #24]
	blt	.L24
	ldr	r2, .L25+16
	ldr	r1, [r2]
	cmp	r1, r3
	beq	.L1
	mov	r2, r3
	ldr	r1, .L25+24
	ldr	r0, [r4, #12]
	bl	dev_err
	ldr	r2, [r9]
	rsb	r10, r2, #0
.L13:
	ldr	r2, [sp, #12]
	ldr	r1, [r4, #8]
	ldr	r3, [r2]
	sub	r1, r1, #1
	sub	r3, r3, #1
	ldr	r0, .L25+8
	str	r1, [r4, #8]
	str	r3, [r2]
	ldr	r1, [r6]
	ldr	r3, [r4, #4]
	ldr	r0, [r0]
	str	r0, [r3, r1, lsl #2]
	b	.L1
.L24:
	mov	r2, r10
	ldr	r1, .L25+28
	ldr	r0, [r4, #12]
	bl	dev_err
	b	.L13
.L23:
	bl	__stack_chk_fail
.L26:
	.align	2
.L25:
	.word	.LC2
	.word	EIO
	.word	PAGE_UNDEF
	.word	PAGE_SHIFT
	.word	PAGE_SIZE
	.word	ENOSPC
	.word	.LC1
	.word	.LC0
	.size	mtdswap_write_block, .-mtdswap_write_block
	.comm	PAGE_UNDEF,4,4
	.comm	PAGE_SIZE,4,4
	.comm	PAGE_SHIFT,4,4
	.comm	ENOSPC,4,4
	.comm	EIO,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
