	.file	"extr_wl.c___erase_worker.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"erase PEB %d EC %d LEB %d:%d"
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC1:
	.string	"failed to erase PEB %d, error %d"
	.align 8
.LC2:
	.string	"bad physical eraseblock %d detected"
	.align 8
.LC3:
	.string	"no reserved/available physical eraseblocks"
	.section	.rodata.str1.1
.LC4:
	.string	"mark PEB %d as bad"
.LC5:
	.string	"%d PEBs left in the reserve"
	.section	.rodata.str1.8
	.align 8
.LC6:
	.string	"last PEB from the reserve was used"
	.align 8
.LC7:
	.string	"no PEBs in the reserved pool, used an available PEB"
	.text
	.p2align 4
	.type	__erase_worker, @function
__erase_worker:
.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
	mov	r12, rsi
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	rbp, rdi
	lea	rdi, .LC0[rip]
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 8
	.cfi_def_cfa_offset 64
	mov	r13, QWORD PTR 16[rsi]
	mov	r15d, DWORD PTR [rsi]
	mov	ebx, DWORD PTR 4[rsi]
	mov	r14d, DWORD PTR 0[r13]
	mov	edx, DWORD PTR 4[r13]
	mov	ecx, r15d
	mov	r8d, ebx
	mov	esi, r14d
	call	dbg_wl@PLT
	mov	edx, DWORD PTR 8[r12]
	mov	rsi, r13
	mov	rdi, rbp
	call	sync_erase@PLT
	test	eax, eax
	je	.L24
	mov	r12d, eax
	mov	ecx, eax
	mov	edx, r14d
	xor	eax, eax
	lea	rsi, .LC1[rip]
	mov	rdi, rbp
	call	ubi_err@PLT
	mov	eax, r12d
	add	eax, DWORD PTR EINTR[rip]
	je	.L3
	mov	eax, r12d
	add	eax, DWORD PTR ENOMEM[rip]
	je	.L3
	mov	eax, r12d
	add	eax, DWORD PTR EAGAIN[rip]
	je	.L3
	mov	eax, r12d
	add	eax, DWORD PTR EBUSY[rip]
	jne	.L4
.L3:
	mov	ecx, ebx
	xor	r9d, r9d
	xor	r8d, r8d
	mov	edx, r15d
	mov	rsi, r13
	mov	rdi, rbp
	call	schedule_erase@PLT
	mov	ebx, eax
	test	eax, eax
	jne	.L25
.L1:
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	eax, r12d
	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
.L24:
	.cfi_restore_state
	lea	r12, 32[rbp]
	mov	rdi, r12
	call	spin_lock@PLT
	lea	rsi, 40[rbp]
	mov	rdi, r13
	call	wl_tree_add@PLT
	add	DWORD PTR 36[rbp], 1
	mov	rdi, r12
	call	spin_unlock@PLT
	mov	rdi, rbp
	call	serve_prot_queue@PLT
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	rdi, rbp
	mov	esi, 1
	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
	jmp	ensure_wear_leveling@PLT
	.p2align 4,,10
	.p2align 3
.L25:
	.cfi_restore_state
	mov	rsi, r13
	mov	rdi, rbp
	mov	r12d, ebx
	call	wl_entry_destroy@PLT
.L6:
	mov	rdi, rbp
	call	ubi_ro_mode@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L4:
	mov	rsi, r13
	mov	rdi, rbp
	call	wl_entry_destroy@PLT
	mov	eax, r12d
	add	eax, DWORD PTR EIO[rip]
	jne	.L6
	mov	edx, DWORD PTR 28[rbp]
	test	edx, edx
	je	.L26
	lea	r13, 24[rbp]
	mov	rdi, r13
	call	spin_lock@PLT
	mov	eax, DWORD PTR 0[rbp]
	test	eax, eax
	jne	.L8
	mov	rax, QWORD PTR 8[rbp]
	test	rax, rax
	je	.L27
	sub	rax, 1
	mov	rdi, r13
	mov	QWORD PTR 8[rbp], rax
	call	spin_unlock@PLT
	mov	edx, r14d
	lea	rsi, .LC4[rip]
	mov	rdi, rbp
	call	ubi_msg@PLT
	mov	rdi, rbp
	mov	esi, r14d
	call	ubi_io_mark_bad@PLT
	mov	rdi, r13
	mov	r12d, eax
	test	eax, eax
	jne	.L10
	call	spin_lock@PLT
	mov	eax, DWORD PTR 0[rbp]
	test	eax, eax
	jle	.L11
	add	QWORD PTR 8[rbp], 1
.L14:
	sub	eax, 1
	mov	DWORD PTR 0[rbp], eax
.L22:
	add	DWORD PTR 16[rbp], 1
	mov	rdi, rbp
	sub	DWORD PTR 20[rbp], 1
	call	ubi_calculate_reserved@PLT
	mov	edx, DWORD PTR 0[rbp]
	test	edx, edx
	je	.L12
	lea	rsi, .LC5[rip]
	mov	rdi, rbp
	call	ubi_msg@PLT
.L13:
	mov	rdi, r13
	xor	r12d, r12d
	call	spin_unlock@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L26:
	mov	edx, r14d
	lea	rsi, .LC2[rip]
	mov	rdi, rbp
	xor	eax, eax
	call	ubi_err@PLT
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L8:
	mov	rdi, r13
	call	spin_unlock@PLT
	mov	edx, r14d
	lea	rsi, .LC4[rip]
	mov	rdi, rbp
	call	ubi_msg@PLT
	mov	esi, r14d
	mov	rdi, rbp
	call	ubi_io_mark_bad@PLT
	mov	r12d, eax
	test	eax, eax
	jne	.L6
	mov	rdi, r13
	call	spin_lock@PLT
	mov	eax, DWORD PTR 0[rbp]
	test	eax, eax
	jg	.L14
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L10:
	call	spin_lock@PLT
	add	QWORD PTR 8[rbp], 1
	mov	rdi, r13
	call	spin_unlock@PLT
	jmp	.L6
.L11:
	add	DWORD PTR 16[rbp], 1
	mov	rdi, rbp
	sub	DWORD PTR 20[rbp], 1
	call	ubi_calculate_reserved@PLT
	lea	rsi, .LC7[rip]
	mov	rdi, rbp
	call	ubi_warn@PLT
	jmp	.L13
.L12:
	lea	rsi, .LC6[rip]
	mov	rdi, rbp
	call	ubi_warn@PLT
	jmp	.L13
.L27:
	mov	rdi, r13
	call	spin_unlock@PLT
	lea	rsi, .LC3[rip]
	mov	rdi, rbp
	xor	eax, eax
	call	ubi_err@PLT
	jmp	.L6
	.cfi_endproc
.LFE0:
	.size	__erase_worker, .-__erase_worker
	.comm	ENOMEM,4,4
	.comm	EIO,4,4
	.comm	EINTR,4,4
	.comm	EBUSY,4,4
	.comm	EAGAIN,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_wl.c___erase_worker.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"erase PEB %d EC %d LEB %d:%d\000"
	.align	2
.LC1:
	.ascii	"failed to erase PEB %d, error %d\000"
	.align	2
.LC2:
	.ascii	"bad physical eraseblock %d detected\000"
	.align	2
.LC3:
	.ascii	"no reserved/available physical eraseblocks\000"
	.align	2
.LC4:
	.ascii	"mark PEB %d as bad\000"
	.align	2
.LC5:
	.ascii	"%d PEBs left in the reserve\000"
	.align	2
.LC6:
	.ascii	"last PEB from the reserve was used\000"
	.align	2
.LC7:
	.ascii	"no PEBs in the reserved pool, used an available PEB"
	.ascii	"\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	__erase_worker, %function
__erase_worker:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, lr}
	mov	r5, r1
	mov	r4, r0
	ldr	r6, [r1, #12]
	ldr	r8, [r1]
	ldr	r7, [r6]
	ldr	r9, [r1, #4]
	sub	sp, sp, #12
	ldr	r2, [r6, #4]
	mov	r1, r7
	mov	r3, r8
	ldr	r0, .L27
	str	r9, [sp]
	bl	dbg_wl
	ldr	r2, [r5, #8]
	mov	r1, r6
	mov	r0, r4
	bl	sync_erase
	subs	r5, r0, #0
	beq	.L23
	mov	r3, r5
	mov	r2, r7
	mov	r0, r4
	ldr	r1, .L27+4
	bl	ubi_err
	ldr	r3, .L27+8
	ldr	r3, [r3]
	cmn	r5, r3
	beq	.L3
	ldr	r3, .L27+12
	ldr	r3, [r3]
	cmn	r5, r3
	beq	.L3
	ldr	r3, .L27+16
	ldr	r3, [r3]
	cmn	r5, r3
	beq	.L3
	ldr	r3, .L27+20
	ldr	r3, [r3]
	cmn	r5, r3
	bne	.L4
.L3:
	mov	r1, #0
	mov	r3, r9
	str	r1, [sp, #4]
	str	r1, [sp]
	mov	r2, r8
	mov	r1, r6
	mov	r0, r4
	bl	schedule_erase
	subs	r3, r0, #0
	bne	.L24
.L1:
	mov	r0, r5
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, pc}
.L23:
	add	r5, r4, #24
	mov	r0, r5
	bl	spin_lock
	add	r1, r4, #32
	mov	r0, r6
	bl	wl_tree_add
	ldr	r3, [r4, #28]
	mov	r0, r5
	add	r3, r3, #1
	str	r3, [r4, #28]
	bl	spin_unlock
	mov	r0, r4
	bl	serve_prot_queue
	mov	r0, r4
	mov	r1, #1
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, lr}
	b	ensure_wear_leveling
.L24:
	mov	r1, r6
	mov	r0, r4
	mov	r5, r3
	bl	wl_entry_destroy
.L6:
	mov	r0, r4
	bl	ubi_ro_mode
	mov	r0, r5
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, pc}
.L4:
	mov	r1, r6
	mov	r0, r4
	bl	wl_entry_destroy
	ldr	r3, .L27+24
	ldr	r3, [r3]
	cmn	r5, r3
	bne	.L6
	ldr	r3, [r4, #20]
	cmp	r3, #0
	beq	.L25
	add	r6, r4, #16
	mov	r0, r6
	bl	spin_lock
	ldr	r3, [r4]
	cmp	r3, #0
	bne	.L8
	ldr	r3, [r4, #4]
	cmp	r3, #0
	beq	.L26
	sub	r3, r3, #1
	str	r3, [r4, #4]
	mov	r0, r6
	bl	spin_unlock
	mov	r2, r7
	ldr	r1, .L27+28
	mov	r0, r4
	bl	ubi_msg
	mov	r1, r7
	mov	r0, r4
	bl	ubi_io_mark_bad
	subs	r5, r0, #0
	mov	r0, r6
	bne	.L10
	bl	spin_lock
	ldr	r3, [r4]
	cmp	r3, #0
	ble	.L11
	ldr	r2, [r4, #4]
	add	r2, r2, #1
	str	r2, [r4, #4]
.L14:
	ldr	r1, [r4, #8]
	ldr	r2, [r4, #12]
	sub	r3, r3, #1
	add	r1, r1, #1
	sub	r2, r2, #1
	mov	r0, r4
	str	r3, [r4]
	str	r1, [r4, #8]
	str	r2, [r4, #12]
	bl	ubi_calculate_reserved
.L16:
	ldr	r2, [r4]
	mov	r0, r4
	cmp	r2, #0
	beq	.L12
	ldr	r1, .L27+32
	bl	ubi_msg
.L13:
	mov	r0, r6
	bl	spin_unlock
	mov	r5, #0
	b	.L1
.L25:
	mov	r2, r7
	mov	r0, r4
	ldr	r1, .L27+36
	bl	ubi_err
	b	.L6
.L8:
	mov	r0, r6
	bl	spin_unlock
	mov	r2, r7
	ldr	r1, .L27+28
	mov	r0, r4
	bl	ubi_msg
	mov	r1, r7
	mov	r0, r4
	bl	ubi_io_mark_bad
	subs	r5, r0, #0
	bne	.L6
	mov	r0, r6
	bl	spin_lock
	ldr	r3, [r4]
	cmp	r3, #0
	bgt	.L14
	ldr	r2, [r4, #8]
	ldr	r3, [r4, #12]
	add	r2, r2, #1
	sub	r3, r3, #1
	mov	r0, r4
	str	r2, [r4, #8]
	str	r3, [r4, #12]
	bl	ubi_calculate_reserved
	b	.L16
.L10:
	bl	spin_lock
	ldr	r3, [r4, #4]
	mov	r0, r6
	add	r3, r3, #1
	str	r3, [r4, #4]
	bl	spin_unlock
	b	.L6
.L11:
	ldr	r2, [r4, #8]
	ldr	r3, [r4, #12]
	add	r2, r2, #1
	sub	r3, r3, #1
	mov	r0, r4
	str	r2, [r4, #8]
	str	r3, [r4, #12]
	bl	ubi_calculate_reserved
	mov	r0, r4
	ldr	r1, .L27+40
	bl	ubi_warn
	b	.L13
.L12:
	ldr	r1, .L27+44
	bl	ubi_warn
	b	.L13
.L26:
	mov	r0, r6
	bl	spin_unlock
	mov	r0, r4
	ldr	r1, .L27+48
	bl	ubi_err
	b	.L6
.L28:
	.align	2
.L27:
	.word	.LC0
	.word	.LC1
	.word	EINTR
	.word	ENOMEM
	.word	EAGAIN
	.word	EBUSY
	.word	EIO
	.word	.LC4
	.word	.LC5
	.word	.LC2
	.word	.LC7
	.word	.LC6
	.word	.LC3
	.size	__erase_worker, .-__erase_worker
	.comm	ENOMEM,4,4
	.comm	EIO,4,4
	.comm	EINTR,4,4
	.comm	EBUSY,4,4
	.comm	EAGAIN,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
