	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function check_eraseblock
_check_eraseblock:                      ## @check_eraseblock
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, -80(%rbp)                 ## 8-byte Spill
	movl	%edi, %ecx
	movq	_mtd@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movl	(%rdi), %edx
	movq	_pgcnt@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	je	LBB0_1
## %bb.2:
	incl	%ecx
	imull	%ecx, %edx
	movq	_pgsize@GOTPCREL(%rip), %rcx
	imull	(%rcx), %eax
	subl	%eax, %edx
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	movl	%eax, %edx
	jmp	LBB0_3
LBB0_1:
	movl	%edx, %eax
	imull	%ecx, %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
LBB0_3:
	movl	%edx, -60(%rbp)                 ## 4-byte Spill
	movslq	%edx, %r15
	movq	_check_buf@GOTPCREL(%rip), %r12
	xorl	%r14d, %r14d
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r12, %r13
	movl	(%r12), %r8d
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movq	%r15, %rdx
	leaq	-72(%rbp), %rcx
	callq	_mtd_read
	movl	%eax, %r12d
	movl	%eax, %edi
	callq	_mtd_is_bitflip
	testq	%rax, %rax
	je	LBB0_8
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	leaq	L_.str(%rip), %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
                                        ## kill: def $esi killed $esi killed $rsi
	xorl	%eax, %eax
	callq	_pr_err
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_4 Depth=1
	testl	%r12d, %r12d
	jne	LBB0_9
LBB0_6:                                 ##   in Loop: Header=BB0_4 Depth=1
	movq	-72(%rbp), %rcx
	cmpq	%r15, %rcx
	jne	LBB0_7
## %bb.10:                              ##   in Loop: Header=BB0_4 Depth=1
	movq	%r13, %r12
	movl	(%r13), %esi
	movq	%rbx, %rdi
	movq	%r15, %rdx
	callq	_memcmp
	testq	%rax, %rax
	je	LBB0_14
## %bb.11:                              ##   in Loop: Header=BB0_4 Depth=1
	leaq	L_.str.3(%rip), %rdi
	movq	-56(%rbp), %r13                 ## 8-byte Reload
	movl	%r13d, %esi
	xorl	%eax, %eax
	callq	_pr_err
	movl	(%r12), %edi
	movq	%rbx, %rsi
	callq	_report_corrupt
	movq	_RETRIES@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	cmpl	%esi, %r14d
	jge	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_4 Depth=1
	incl	%r14d
	xorl	%eax, %eax
	callq	_yield
	leaq	L_.str.4(%rip), %rdi
	movl	%r13d, %esi
	callq	_pr_info
	movq	_mtd@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	jmp	LBB0_4
LBB0_7:
	leaq	L_.str.2(%rip), %rdi
	xorl	%r12d, %r12d
	movl	-60(%rbp), %esi                 ## 4-byte Reload
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
                                        ## kill: def $edx killed $edx killed $rdx
	xorl	%eax, %eax
	callq	_pr_err
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %r12d
	jmp	LBB0_16
LBB0_14:
	xorl	%r12d, %r12d
	testl	%r14d, %r14d
	je	LBB0_16
## %bb.15:
	leaq	L_.str.6(%rip), %rdi
	movl	%r14d, %esi
	callq	_pr_info
	jmp	LBB0_16
LBB0_13:
	leaq	L_.str.5(%rip), %rdi
	callq	_pr_info
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
	jmp	LBB0_16
LBB0_9:
	movq	-72(%rbp), %rcx
	leaq	L_.str.1(%rip), %rdi
	movl	%r12d, %esi
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
                                        ## kill: def $edx killed $edx killed $rdx
	xorl	%eax, %eax
	callq	_pr_err
LBB0_16:
	movl	%r12d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_mtd,8,3                        ## @mtd
	.comm	_pgcnt,4,2                      ## @pgcnt
	.comm	_pgsize,4,2                     ## @pgsize
	.comm	_check_buf,4,2                  ## @check_buf
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"single bit flip occurred at EB %d MTD reported that it was fixed.\n"

L_.str.1:                               ## @.str.1
	.asciz	"error %d while reading EB %d, read %zd\n"

L_.str.2:                               ## @.str.2
	.asciz	"failed to read %zd bytes from EB %d, read only %zd, but no error reported\n"

	.comm	_EIO,4,2                        ## @EIO
L_.str.3:                               ## @.str.3
	.asciz	"read wrong data from EB %d\n"

	.comm	_RETRIES,4,2                    ## @RETRIES
L_.str.4:                               ## @.str.4
	.asciz	"re-try reading data from EB %d\n"

L_.str.5:                               ## @.str.5
	.asciz	"retried %d times, still errors, give-up\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.6:                               ## @.str.6
	.asciz	"only attempt number %d was OK (!!!)\n"

	.no_dead_strip	_check_eraseblock
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function check_eraseblock
_check_eraseblock:                      ; @check_eraseblock
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _mtd@GOTPAGE
Lloh1:
	ldr	x8, [x8, _mtd@GOTPAGEOFF]
Lloh2:
	ldr	x0, [x8]
	ldr	w8, [x0]
Lloh3:
	adrp	x9, _pgcnt@GOTPAGE
Lloh4:
	ldr	x9, [x9, _pgcnt@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	cbz	w9, LBB0_2
; %bb.1:
	madd	w10, w8, w19, w8
Lloh6:
	adrp	x8, _pgsize@GOTPAGE
Lloh7:
	ldr	x8, [x8, _pgsize@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	mul	w8, w8, w9
	sub	w21, w10, w8
	b	LBB0_3
LBB0_2:
	mul	w21, w8, w19
LBB0_3:
	mov	w22, #0
	sxtw	x23, w8
Lloh9:
	adrp	x26, _check_buf@GOTPAGE
Lloh10:
	ldr	x26, [x26, _check_buf@GOTPAGEOFF]
Lloh11:
	adrp	x24, l_.str.3@PAGE
Lloh12:
	add	x24, x24, l_.str.3@PAGEOFF
Lloh13:
	adrp	x28, _RETRIES@GOTPAGE
Lloh14:
	ldr	x28, [x28, _RETRIES@GOTPAGEOFF]
Lloh15:
	adrp	x25, l_.str.4@PAGE
Lloh16:
	add	x25, x25, l_.str.4@PAGEOFF
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w4, [x26]
	add	x3, sp, #24
	mov	x1, x21
	mov	x2, x23
	bl	_mtd_read
	mov	x27, x0
	bl	_mtd_is_bitflip
	cbz	x0, LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
Lloh17:
	adrp	x0, l_.str@PAGE
Lloh18:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	bl	_pr_err
	b	LBB0_7
LBB0_6:                                 ;   in Loop: Header=BB0_4 Depth=1
	cbnz	w27, LBB0_18
LBB0_7:                                 ;   in Loop: Header=BB0_4 Depth=1
	ldr	x8, [sp, #24]
	cmp	x8, x23
	b.ne	LBB0_11
; %bb.8:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w1, [x26]
	mov	x0, x20
	mov	x2, x23
	bl	_memcmp
	cbz	x0, LBB0_12
; %bb.9:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x24
	mov	x1, x19
	bl	_pr_err
	ldr	w0, [x26]
	mov	x1, x20
	bl	_report_corrupt
	ldr	w1, [x28]
	cmp	w22, w1
	b.ge	LBB0_15
; %bb.10:                               ;   in Loop: Header=BB0_4 Depth=1
	add	w22, w22, #1
	bl	_yield
	mov	x0, x25
	mov	x1, x19
	bl	_pr_info
Lloh19:
	adrp	x8, _mtd@GOTPAGE
Lloh20:
	ldr	x8, [x8, _mtd@GOTPAGEOFF]
Lloh21:
	ldr	x0, [x8]
	b	LBB0_4
LBB0_11:
                                        ; kill: def $w19 killed $w19 killed $x19 def $x19
	stp	x19, x8, [sp]
Lloh22:
	adrp	x0, l_.str.2@PAGE
Lloh23:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	x1, x23
	bl	_pr_err
Lloh24:
	adrp	x8, _EIO@GOTPAGE
Lloh25:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_16
LBB0_12:
	cbz	w22, LBB0_14
; %bb.13:
Lloh26:
	adrp	x0, l_.str.6@PAGE
Lloh27:
	add	x0, x0, l_.str.6@PAGEOFF
	mov	x1, x22
	bl	_pr_info
LBB0_14:
	mov	w27, #0
	b	LBB0_17
LBB0_15:
Lloh28:
	adrp	x0, l_.str.5@PAGE
Lloh29:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_pr_info
Lloh30:
	adrp	x8, _EINVAL@GOTPAGE
Lloh31:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_16:
	ldr	w8, [x8]
	neg	w27, w8
LBB0_17:
	mov	x0, x27
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_18:
	ldr	x8, [sp, #24]
	stp	x19, x8, [sp]
Lloh32:
	adrp	x0, l_.str.1@PAGE
Lloh33:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x27
	bl	_pr_err
	b	LBB0_17
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh30, Lloh31
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpAdd	Lloh32, Lloh33
	.cfi_endproc
                                        ; -- End function
	.comm	_mtd,8,3                        ; @mtd
	.comm	_pgcnt,4,2                      ; @pgcnt
	.comm	_pgsize,4,2                     ; @pgsize
	.comm	_check_buf,4,2                  ; @check_buf
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"single bit flip occurred at EB %d MTD reported that it was fixed.\n"

l_.str.1:                               ; @.str.1
	.asciz	"error %d while reading EB %d, read %zd\n"

l_.str.2:                               ; @.str.2
	.asciz	"failed to read %zd bytes from EB %d, read only %zd, but no error reported\n"

	.comm	_EIO,4,2                        ; @EIO
l_.str.3:                               ; @.str.3
	.asciz	"read wrong data from EB %d\n"

	.comm	_RETRIES,4,2                    ; @RETRIES
l_.str.4:                               ; @.str.4
	.asciz	"re-try reading data from EB %d\n"

l_.str.5:                               ; @.str.5
	.asciz	"retried %d times, still errors, give-up\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.6:                               ; @.str.6
	.asciz	"only attempt number %d was OK (!!!)\n"

	.no_dead_strip	_check_eraseblock
.subsections_via_symbols
