	.file	"extr_ms_block.c_msb_ftl_scan.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Start of media scanning"
.LC1:
	.string	"pba %05d -> [boot block]"
.LC2:
	.string	"pba %05d -> [factory bad]"
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC3:
	.string	"oob of pba %d damaged, will try to erase it"
	.align 8
.LC4:
	.string	"unknown error %d on read of oob of pba %d - aborting"
	.section	.rodata.str1.1
.LC5:
	.string	"pba %05d -> [BAD]"
	.section	.rodata.str1.8
	.align 8
.LC6:
	.string	"pba %05d -> [reserved management flag %02x]"
	.align 8
.LC7:
	.string	"pba %05d -> [temp table] - will erase"
	.section	.rodata.str1.1
.LC8:
	.string	"pba %05d -> [free]"
	.section	.rodata.str1.8
	.align 8
.LC9:
	.string	"pba %05d -> [bad lba %05d] - will erase"
	.section	.rodata.str1.1
.LC10:
	.string	"pba %05d -> [lba %05d]"
	.section	.rodata.str1.8
	.align 8
.LC11:
	.string	"Collision between pba %d and pba %d"
	.align 8
.LC12:
	.string	"pba %d is marked as stable, use it"
	.align 8
.LC13:
	.string	"collision between blocks %d and %d, without stable flag set on both, erasing pba %d"
	.section	.rodata.str1.1
.LC14:
	.string	"End of media scanning"
	.text
	.p2align 4
	.type	msb_ftl_scan, @function
msb_ftl_scan:
.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
	mov	rbx, rdi
	sub	rsp, 56
	.cfi_def_cfa_offset 112
	mov	esi, DWORD PTR GFP_KERNEL[rip]
	mov	rdi, QWORD PTR [rdi]
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 40[rsp], rax
	xor	eax, eax
	call	kzalloc@PLT
	mov	r13d, DWORD PTR ENOMEM[rip]
	neg	r13d
	test	rax, rax
	je	.L1
	mov	rbp, rax
	lea	rdi, .LC0[rip]
	xor	eax, eax
	call	dbg@PLT
	cmp	QWORD PTR [rbx], 0
	je	.L4
	xor	r12d, r12d
	lea	r14, 28[rsp]
	.p2align 4,,10
	.p2align 3
.L19:
	mov	rax, QWORD PTR 8[rbx]
	cmp	QWORD PTR [rax], r12
	je	.L5
	cmp	QWORD PTR 8[rax], r12
	je	.L5
	mov	esi, DWORD PTR 24[rbx]
	mov	rdi, r12
	call	test_bit@PLT
	test	rax, rax
	jne	.L26
	xor	esi, esi
	mov	edx, 12
	mov	rdi, r14
	call	memset@PLT
	xor	edx, edx
	mov	rcx, r14
	mov	rsi, r12
	mov	rdi, rbx
	call	msb_read_oob@PLT
	mov	r13d, eax
	add	eax, DWORD PTR EBADMSG[rip]
	je	.L27
	test	r13d, r13d
	jne	.L28
	mov	edi, DWORD PTR 36[rsp]
	call	be16_to_cpu@PLT
	mov	ecx, DWORD PTR 32[rsp]
	mov	edx, DWORD PTR 28[rsp]
	mov	r13, rax
	mov	DWORD PTR 0[rbp+r12*4], ecx
	test	DWORD PTR MEMSTICK_OVERWRITE_BKST[rip], ecx
	je	.L29
	mov	eax, DWORD PTR MEMSTICK_MANAGEMENT_FLAG_NORMAL[rip]
	mov	esi, eax
	and	esi, edx
	cmp	eax, esi
	jne	.L30
	test	DWORD PTR MEMSTICK_MANAGEMENT_ATFLG[rip], edx
	je	.L31
	cmp	QWORD PTR MS_BLOCK_INVALID[rip], r13
	je	.L32
	mov	rsi, r12
	mov	rdi, rbx
	mov	DWORD PTR 8[rsp], ecx
	call	msb_mark_block_used@PLT
	mov	rdi, r13
	call	msb_get_zone_from_lba@PLT
	mov	rdi, r12
	mov	r15, rax
	call	msb_get_zone_from_pba@PLT
	mov	ecx, DWORD PTR 8[rsp]
	cmp	r15, rax
	jne	.L33
	mov	rax, QWORD PTR 16[rbx]
	mov	r15, QWORD PTR [rax+r13*8]
	cmp	r15, QWORD PTR MS_BLOCK_INVALID[rip]
	je	.L34
	mov	eax, DWORD PTR 0[rbp+r15*4]
	mov	rdx, r15
	mov	rsi, r12
	mov	DWORD PTR 8[rsp], ecx
	lea	rdi, .LC11[rip]
	mov	DWORD PTR 12[rsp], eax
	xor	eax, eax
	call	pr_notice@PLT
	mov	eax, DWORD PTR MEMSTICK_OVERWRITE_UDST[rip]
	mov	ecx, DWORD PTR 8[rsp]
	test	eax, ecx
	je	.L35
	test	DWORD PTR 12[rsp], eax
	je	.L36
	mov	rcx, r15
	mov	rdx, r15
	mov	rsi, r12
	xor	eax, eax
	lea	rdi, .LC13[rip]
	call	pr_notice@PLT
.L24:
	mov	rsi, r15
	mov	rdi, rbx
	call	msb_erase_block@PLT
	mov	rax, QWORD PTR 16[rbx]
	mov	QWORD PTR [rax+r13*8], r12
	add	r12, 1
	cmp	QWORD PTR [rbx], r12
	ja	.L19
	.p2align 4,,10
	.p2align 3
.L4:
	lea	rdi, .LC14[rip]
	xor	eax, eax
	xor	r13d, r13d
	call	dbg@PLT
	mov	rdi, rbp
	call	kfree@PLT
.L1:
	mov	rax, QWORD PTR 40[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L37
	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
.L5:
	.cfi_restore_state
	mov	rsi, r12
	lea	rdi, .LC1[rip]
	xor	eax, eax
	call	dbg_verbose@PLT
	mov	rsi, r12
	mov	rdi, rbx
	call	msb_mark_block_used@PLT
.L7:
	add	r12, 1
	cmp	QWORD PTR [rbx], r12
	ja	.L19
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L26:
	mov	rsi, r12
	lea	rdi, .LC2[rip]
	xor	eax, eax
	call	dbg_verbose@PLT
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L30:
	mov	rsi, r12
	lea	rdi, .LC6[rip]
	xor	eax, eax
	call	dbg@PLT
	mov	rsi, r12
	mov	rdi, rbx
	call	msb_mark_block_used@PLT
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L29:
	mov	rsi, r12
	lea	rdi, .LC5[rip]
	xor	eax, eax
	call	dbg@PLT
	mov	rsi, r12
	mov	rdi, rbx
	call	msb_mark_block_used@PLT
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L27:
	mov	rsi, r12
	lea	rdi, .LC3[rip]
	xor	eax, eax
	call	pr_notice@PLT
.L23:
	mov	rsi, r12
	mov	rdi, rbx
	call	msb_mark_block_used@PLT
	mov	rsi, r12
	mov	rdi, rbx
	call	msb_erase_block@PLT
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L33:
	mov	rsi, r12
	mov	rdx, r13
	lea	rdi, .LC9[rip]
	xor	eax, eax
	call	pr_notice@PLT
	mov	rsi, r12
	mov	rdi, rbx
	call	msb_erase_block@PLT
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L31:
	mov	rsi, r12
	lea	rdi, .LC7[rip]
	xor	eax, eax
	call	dbg@PLT
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L32:
	mov	rsi, r12
	lea	rdi, .LC8[rip]
	xor	eax, eax
	call	dbg_verbose@PLT
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L35:
	mov	rsi, r12
	lea	rdi, .LC12[rip]
	xor	eax, eax
	call	pr_notice@PLT
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L28:
	mov	rdx, r12
	mov	esi, r13d
	lea	rdi, .LC4[rip]
	call	pr_err@PLT
	mov	rdi, rbp
	call	kfree@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L36:
	mov	rsi, r15
	lea	rdi, .LC12[rip]
	xor	eax, eax
	call	pr_notice@PLT
	mov	rsi, r12
	mov	rdi, rbx
	call	msb_erase_block@PLT
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L34:
	mov	rdx, r13
	mov	rsi, r12
	lea	rdi, .LC10[rip]
	xor	eax, eax
	call	dbg_verbose@PLT
	mov	rax, QWORD PTR 16[rbx]
	mov	QWORD PTR [rax+r13*8], r12
	jmp	.L7
.L37:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	msb_ftl_scan, .-msb_ftl_scan
	.comm	MS_BLOCK_INVALID,8,8
	.comm	MEMSTICK_OVERWRITE_UDST,4,4
	.comm	MEMSTICK_OVERWRITE_BKST,4,4
	.comm	MEMSTICK_MANAGEMENT_FLAG_NORMAL,4,4
	.comm	MEMSTICK_MANAGEMENT_ATFLG,4,4
	.comm	GFP_KERNEL,4,4
	.comm	ENOMEM,4,4
	.comm	EBADMSG,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_ms_block.c_msb_ftl_scan.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"Start of media scanning\000"
	.align	2
.LC1:
	.ascii	"pba %05d -> [boot block]\000"
	.align	2
.LC2:
	.ascii	"pba %05d -> [factory bad]\000"
	.align	2
.LC3:
	.ascii	"oob of pba %d damaged, will try to erase it\000"
	.align	2
.LC4:
	.ascii	"unknown error %d on read of oob of pba %d - abortin"
	.ascii	"g\000"
	.align	2
.LC5:
	.ascii	"pba %05d -> [BAD]\000"
	.align	2
.LC6:
	.ascii	"pba %05d -> [reserved management flag %02x]\000"
	.align	2
.LC7:
	.ascii	"pba %05d -> [temp table] - will erase\000"
	.align	2
.LC8:
	.ascii	"pba %05d -> [free]\000"
	.align	2
.LC9:
	.ascii	"pba %05d -> [bad lba %05d] - will erase\000"
	.align	2
.LC10:
	.ascii	"pba %05d -> [lba %05d]\000"
	.align	2
.LC11:
	.ascii	"Collision between pba %d and pba %d\000"
	.align	2
.LC12:
	.ascii	"pba %d is marked as stable, use it\000"
	.align	2
.LC13:
	.ascii	"collision between blocks %d and %d, without stable "
	.ascii	"flag set on both, erasing pba %d\000"
	.align	2
.LC14:
	.ascii	"End of media scanning\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC15:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	msb_ftl_scan, %function
msb_ftl_scan:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	ldr	r3, .L42
	sub	sp, sp, #28
	ldr	r1, [r3]
	ldr	r3, .L42+4
	mov	r5, r0
	ldr	r0, [r0]
	ldr	r3, [r3]
	str	r3, [sp, #20]
	mov	r3,#0
	bl	kzalloc
	subs	r7, r0, #0
	beq	.L29
	ldr	r0, .L42+8
	bl	dbg
	ldr	r3, [r5]
	cmp	r3, #0
	beq	.L4
	mov	r4, #0
	ldr	r8, .L42+12
	ldr	r9, .L42+16
	ldr	r10, .L42+20
.L19:
	ldr	r3, [r5, #4]
	ldr	r2, [r3]
	cmp	r2, r4
	beq	.L5
	ldr	r3, [r3, #4]
	cmp	r3, r4
	beq	.L5
	mov	r0, r4
	ldr	r1, [r5, #12]
	bl	test_bit
	subs	r2, r0, #0
	bne	.L30
	add	r3, sp, #8
	mov	r1, r4
	mov	r0, r5
	str	r2, [sp, #8]
	str	r2, [sp, #12]
	str	r2, [sp, #16]
	bl	msb_read_oob
	ldr	r3, [r9]
	cmn	r0, r3
	beq	.L31
	cmp	r0, #0
	bne	.L32
	ldr	r0, [sp, #16]
	bl	be16_to_cpu
	ldr	r3, [sp, #12]
	ldr	r2, [sp, #8]
	str	r3, [r7, r4, lsl #2]
	ldr	r1, [r10]
	mov	r6, r0
	tst	r3, r1
	beq	.L33
	ldr	r1, .L42+24
	ldr	r1, [r1]
	bics	r1, r1, r2
	bne	.L34
	ldr	r1, .L42+28
	ldr	r1, [r1]
	tst	r2, r1
	beq	.L35
	ldr	r2, .L42+32
	ldr	r2, [r2]
	cmp	r2, r0
	beq	.L36
	mov	r1, r4
	mov	r0, r5
	str	r3, [sp]
	bl	msb_mark_block_used
	mov	r0, r6
	bl	msb_get_zone_from_lba
	mov	fp, r0
	mov	r0, r4
	bl	msb_get_zone_from_pba
	cmp	fp, r0
	ldr	r3, [sp]
	bne	.L37
	ldr	r2, [r5, #8]
	ldr	r1, .L42+32
	ldr	fp, [r2, r6, lsl #2]
	ldr	r1, [r1]
	cmp	fp, r1
	beq	.L38
	str	r3, [sp]
	ldr	r3, [r7, fp, lsl #2]
	mov	r1, r4
	mov	r2, fp
	ldr	r0, .L42+36
	str	r3, [sp, #4]
	bl	pr_notice
	ldr	r1, .L42+40
	ldr	r3, [sp]
	ldr	r1, [r1]
	tst	r1, r3
	beq	.L39
	ldr	r3, [sp, #4]
	tst	r1, r3
	beq	.L40
	mov	r3, fp
	mov	r2, fp
	mov	r1, r4
	ldr	r0, .L42+44
	bl	pr_notice
.L27:
	mov	r1, fp
	mov	r0, r5
	bl	msb_erase_block
	ldr	r3, [r5, #8]
	str	r4, [r3, r6, lsl #2]
	ldr	r3, [r5]
	add	r4, r4, #1
	cmp	r3, r4
	bhi	.L19
.L4:
	ldr	r0, .L42+48
	bl	dbg
	mov	r0, r7
	bl	kfree
	mov	r6, #0
.L1:
	ldr	r3, .L42+4
	ldr	r2, [r3]
	ldr	r3, [sp, #20]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L41
	mov	r0, r6
	add	sp, sp, #28
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L5:
	mov	r1, r4
	mov	r0, r8
	bl	dbg_verbose
	mov	r1, r4
	mov	r0, r5
	bl	msb_mark_block_used
.L7:
	ldr	r3, [r5]
	add	r4, r4, #1
	cmp	r3, r4
	bhi	.L19
	b	.L4
.L30:
	mov	r1, r4
	ldr	r0, .L42+52
	bl	dbg_verbose
	b	.L7
.L34:
	mov	r1, r4
	ldr	r0, .L42+56
	bl	dbg
	mov	r1, r4
	mov	r0, r5
	bl	msb_mark_block_used
	b	.L7
.L33:
	mov	r1, r4
	ldr	r0, .L42+60
	bl	dbg
	mov	r1, r4
	mov	r0, r5
	bl	msb_mark_block_used
	b	.L7
.L31:
	mov	r1, r4
	ldr	r0, .L42+64
	bl	pr_notice
.L26:
	mov	r1, r4
	mov	r0, r5
	bl	msb_mark_block_used
	mov	r1, r4
	mov	r0, r5
	bl	msb_erase_block
	b	.L7
.L37:
	mov	r1, r4
	mov	r2, r6
	ldr	r0, .L42+68
	bl	pr_notice
	mov	r1, r4
	mov	r0, r5
	bl	msb_erase_block
	b	.L7
.L35:
	mov	r1, r4
	ldr	r0, .L42+72
	bl	dbg
	b	.L26
.L29:
	ldr	r3, .L42+76
	ldr	r6, [r3]
	rsb	r6, r6, #0
	b	.L1
.L36:
	mov	r1, r4
	ldr	r0, .L42+80
	bl	dbg_verbose
	b	.L7
.L39:
	mov	r1, r4
	ldr	r0, .L42+84
	bl	pr_notice
	b	.L27
.L32:
	mov	r1, r0
	mov	r6, r0
	mov	r2, r4
	ldr	r0, .L42+88
	bl	pr_err
	mov	r0, r7
	bl	kfree
	b	.L1
.L40:
	mov	r1, fp
	ldr	r0, .L42+84
	bl	pr_notice
	mov	r1, r4
	mov	r0, r5
	bl	msb_erase_block
	b	.L7
.L38:
	mov	r2, r6
	mov	r1, r4
	ldr	r0, .L42+92
	bl	dbg_verbose
	ldr	r3, [r5, #8]
	str	r4, [r3, r6, lsl #2]
	b	.L7
.L41:
	bl	__stack_chk_fail
.L43:
	.align	2
.L42:
	.word	GFP_KERNEL
	.word	.LC15
	.word	.LC0
	.word	.LC1
	.word	EBADMSG
	.word	MEMSTICK_OVERWRITE_BKST
	.word	MEMSTICK_MANAGEMENT_FLAG_NORMAL
	.word	MEMSTICK_MANAGEMENT_ATFLG
	.word	MS_BLOCK_INVALID
	.word	.LC11
	.word	MEMSTICK_OVERWRITE_UDST
	.word	.LC13
	.word	.LC14
	.word	.LC2
	.word	.LC6
	.word	.LC5
	.word	.LC3
	.word	.LC9
	.word	.LC7
	.word	ENOMEM
	.word	.LC8
	.word	.LC12
	.word	.LC4
	.word	.LC10
	.size	msb_ftl_scan, .-msb_ftl_scan
	.comm	MS_BLOCK_INVALID,4,4
	.comm	MEMSTICK_OVERWRITE_UDST,4,4
	.comm	MEMSTICK_OVERWRITE_BKST,4,4
	.comm	MEMSTICK_MANAGEMENT_FLAG_NORMAL,4,4
	.comm	MEMSTICK_MANAGEMENT_ATFLG,4,4
	.comm	GFP_KERNEL,4,4
	.comm	ENOMEM,4,4
	.comm	EBADMSG,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
