	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function overwrite_test
_overwrite_test:                        ## @overwrite_test
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	leaq	_overwrite_test.bitstats(%rip), %r13
	movq	%r13, %rdi
	xorl	%esi, %esi
	movl	$2048, %edx                     ## imm = 0x800
	callq	_memset
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_pr_info
	movq	_mtd@GOTPCREL(%rip), %r14
	movq	(%r14), %rax
	cmpl	$0, (%rax)
	je	LBB0_3
## %bb.1:
	xorl	%ebx, %ebx
	movq	_seed@GOTPCREL(%rip), %r15
	movq	_wbuffer@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r15), %rdi
	addq	%rbx, %rdi
	callq	_hash
	movq	(%r12), %rcx
	movl	%eax, (%rcx,%rbx,4)
	incq	%rbx
	movq	(%r14), %rax
	movl	(%rax), %eax
	cmpq	%rax, %rbx
	jb	LBB0_2
LBB0_3:
	movl	$1, %edi
	callq	_write_page
	movl	%eax, %r15d
	testl	%eax, %eax
	je	LBB0_5
LBB0_4:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movq	_max_overwrite@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	je	LBB0_16
## %bb.6:
	xorl	%r14d, %r14d
	xorl	%r12d, %r12d
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	xorl	%edi, %edi
	callq	_write_page
	testl	%eax, %eax
	jne	LBB0_21
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	xorl	%edi, %edi
	callq	_read_page
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_18
## %bb.9:                               ##   in Loop: Header=BB0_7 Depth=1
	cmpl	$512, %ebx                      ## imm = 0x200
	jae	LBB0_19
## %bb.10:                              ##   in Loop: Header=BB0_7 Depth=1
	movl	%ebx, %eax
	incl	(%r13,%rax,4)
	cmpl	%r12d, %ebx
	jbe	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_7 Depth=1
	leaq	L_.str.2(%rip), %rdi
	movl	%ebx, %esi
	xorl	%eax, %eax
	callq	_pr_info
	movl	%ebx, %r12d
LBB0_12:                                ##   in Loop: Header=BB0_7 Depth=1
	xorl	%edi, %edi
	callq	_verify_page
	testl	%eax, %eax
	jne	LBB0_20
## %bb.13:                              ##   in Loop: Header=BB0_7 Depth=1
	xorl	%eax, %eax
	callq	_mtdtest_relax
	testl	%eax, %eax
	jne	LBB0_21
## %bb.14:                              ##   in Loop: Header=BB0_7 Depth=1
	incl	%r14d
	movq	_max_overwrite@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r14d
	jb	LBB0_7
## %bb.15:
	xorl	%r15d, %r15d
	jmp	LBB0_22
LBB0_16:
	leaq	L_.str.5(%rip), %rdi
	xorl	%r15d, %r15d
	xorl	%esi, %esi
	xorl	%eax, %eax
	callq	_pr_info
	jmp	LBB0_4
LBB0_21:
	movl	%eax, %r15d
	jmp	LBB0_22
LBB0_18:
	leaq	L_.str.3(%rip), %rdi
	xorl	%r15d, %r15d
	movl	%ebx, %esi
	xorl	%eax, %eax
	callq	_pr_info
	jmp	LBB0_22
LBB0_19:
	leaq	L_.str.1(%rip), %rdi
	xorl	%r15d, %r15d
	xorl	%eax, %eax
	callq	_pr_info
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
	jmp	LBB0_22
LBB0_20:
	movl	%eax, %r15d
	movl	%r12d, %eax
	leaq	_overwrite_test.bitstats(%rip), %rcx
	movl	%r14d, (%rcx,%rax,4)
	leaq	L_.str.4(%rip), %rdi
	xorl	%eax, %eax
	callq	_pr_info
LBB0_22:
	leaq	L_.str.5(%rip), %rdi
	movl	%r14d, %esi
	xorl	%eax, %eax
	callq	_pr_info
	testl	%r12d, %r12d
	je	LBB0_4
## %bb.23:
	movl	%r12d, %r12d
	leaq	L_.str.6(%rip), %r14
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_24:                                ## =>This Inner Loop Header: Depth=1
	movl	(%r13), %edx
	movq	%r14, %rdi
	movl	%ebx, %esi
	xorl	%eax, %eax
	callq	_pr_info
	incq	%rbx
	addq	$4, %r13
	cmpq	%rbx, %r12
	jne	LBB0_24
	jmp	LBB0_4
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_overwrite_test.bitstats,2048,4 ## @overwrite_test.bitstats
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"overwrite biterrors test\n"

	.comm	_mtd,8,3                        ## @mtd
	.comm	_seed,8,3                       ## @seed
	.comm	_wbuffer,8,3                    ## @wbuffer
	.comm	_max_overwrite,4,2              ## @max_overwrite
L_.str.1:                               ## @.str.1
	.asciz	"Implausible number of bit errors corrected\n"

	.comm	_EIO,4,2                        ## @EIO
L_.str.2:                               ## @.str.2
	.asciz	"Read reported %d corrected bit errors\n"

L_.str.3:                               ## @.str.3
	.asciz	"Read reported error %d\n"

L_.str.4:                               ## @.str.4
	.asciz	"ECC failure, read data is incorrect despite read success\n"

L_.str.5:                               ## @.str.5
	.asciz	"Bit error histogram (%d operations total):\n"

L_.str.6:                               ## @.str.6
	.asciz	"Page reads with %3d corrected bit errors: %d\n"

	.comm	_MAXBITS,4,2                    ## @MAXBITS
	.no_dead_strip	_overwrite_test
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function overwrite_test
_overwrite_test:                        ; @overwrite_test
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
Lloh0:
	adrp	x19, _overwrite_test.bitstats@PAGE
Lloh1:
	add	x19, x19, _overwrite_test.bitstats@PAGEOFF
	mov	x0, x19
	mov	w1, #0
	mov	w2, #2048
	bl	_memset
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_info
Lloh4:
	adrp	x20, _mtd@GOTPAGE
Lloh5:
	ldr	x20, [x20, _mtd@GOTPAGEOFF]
	ldr	x8, [x20]
	ldr	w8, [x8]
	cbz	w8, LBB0_3
; %bb.1:
	mov	x21, #0
Lloh6:
	adrp	x22, _seed@GOTPAGE
Lloh7:
	ldr	x22, [x22, _seed@GOTPAGEOFF]
Lloh8:
	adrp	x23, _wbuffer@GOTPAGE
Lloh9:
	ldr	x23, [x23, _wbuffer@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x22]
	add	x0, x21, x8
	bl	_hash
	ldr	x8, [x23]
	str	w0, [x8, x21, lsl #2]
	add	x21, x21, #1
	ldr	x8, [x20]
	ldr	w8, [x8]
	cmp	x21, x8
	b.lo	LBB0_2
LBB0_3:
	mov	w0, #1
	bl	_write_page
	mov	x20, x0
	cbz	w0, LBB0_5
LBB0_4:
	mov	x0, x20
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_5:
Lloh10:
	adrp	x24, _max_overwrite@GOTPAGE
Lloh11:
	ldr	x24, [x24, _max_overwrite@GOTPAGEOFF]
	ldr	w8, [x24]
	cbz	w8, LBB0_15
; %bb.6:
	mov	w22, #0
	mov	w23, #0
Lloh12:
	adrp	x21, l_.str.2@PAGE
Lloh13:
	add	x21, x21, l_.str.2@PAGEOFF
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	mov	w0, #0
	bl	_write_page
	cbnz	w0, LBB0_16
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	bl	_read_page
	mov	x20, x0
	tbnz	w0, #31, LBB0_17
; %bb.9:                                ;   in Loop: Header=BB0_7 Depth=1
	cmp	w20, #512
	b.hs	LBB0_19
; %bb.10:                               ;   in Loop: Header=BB0_7 Depth=1
	mov	w8, w20
	lsl	x8, x8, #2
	ldr	w9, [x19, x8]
	add	w9, w9, #1
	str	w9, [x19, x8]
	cmp	w20, w23
	b.ls	LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_7 Depth=1
	str	x20, [sp]
	mov	x0, x21
	bl	_pr_info
	mov	x23, x20
LBB0_12:                                ;   in Loop: Header=BB0_7 Depth=1
	mov	w0, #0
	bl	_verify_page
	cbnz	w0, LBB0_20
; %bb.13:                               ;   in Loop: Header=BB0_7 Depth=1
	bl	_mtdtest_relax
	cbnz	w0, LBB0_16
; %bb.14:                               ;   in Loop: Header=BB0_7 Depth=1
	add	w22, w22, #1
	ldr	w8, [x24]
	cmp	w22, w8
	b.lo	LBB0_7
	b	LBB0_18
LBB0_15:
	str	xzr, [sp]
Lloh14:
	adrp	x0, l_.str.5@PAGE
Lloh15:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_pr_info
	mov	w20, #0
	b	LBB0_4
LBB0_16:
	mov	x20, x0
	b	LBB0_21
LBB0_17:
                                        ; kill: def $w20 killed $w20 killed $x20 def $x20
	str	x20, [sp]
Lloh16:
	adrp	x0, l_.str.3@PAGE
Lloh17:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_pr_info
LBB0_18:
	mov	w20, #0
	b	LBB0_21
LBB0_19:
Lloh18:
	adrp	x0, l_.str.1@PAGE
Lloh19:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_pr_info
Lloh20:
	adrp	x8, _EIO@GOTPAGE
Lloh21:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_21
LBB0_20:
	mov	x20, x0
	str	w22, [x19, w23, uxtw #2]
Lloh23:
	adrp	x0, l_.str.4@PAGE
Lloh24:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_pr_info
LBB0_21:
	str	x22, [sp]
Lloh25:
	adrp	x0, l_.str.5@PAGE
Lloh26:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_pr_info
	cbz	w23, LBB0_4
; %bb.22:
	mov	x22, #0
	mov	w23, w23
Lloh27:
	adrp	x21, l_.str.6@PAGE
Lloh28:
	add	x21, x21, l_.str.6@PAGEOFF
LBB0_23:                                ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x19, x22, lsl #2]
	stp	x22, x8, [sp]
	mov	x0, x21
	bl	_pr_info
	add	x22, x22, #1
	cmp	x23, x22
	b.ne	LBB0_23
	b	LBB0_4
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpAdd	Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_overwrite_test.bitstats,2048,2 ; @overwrite_test.bitstats
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"overwrite biterrors test\n"

	.comm	_mtd,8,3                        ; @mtd
	.comm	_seed,8,3                       ; @seed
	.comm	_wbuffer,8,3                    ; @wbuffer
	.comm	_max_overwrite,4,2              ; @max_overwrite
l_.str.1:                               ; @.str.1
	.asciz	"Implausible number of bit errors corrected\n"

	.comm	_EIO,4,2                        ; @EIO
l_.str.2:                               ; @.str.2
	.asciz	"Read reported %d corrected bit errors\n"

l_.str.3:                               ; @.str.3
	.asciz	"Read reported error %d\n"

l_.str.4:                               ; @.str.4
	.asciz	"ECC failure, read data is incorrect despite read success\n"

l_.str.5:                               ; @.str.5
	.asciz	"Bit error histogram (%d operations total):\n"

l_.str.6:                               ; @.str.6
	.asciz	"Page reads with %3d corrected bit errors: %d\n"

	.comm	_MAXBITS,4,2                    ; @MAXBITS
	.no_dead_strip	_overwrite_test
.subsections_via_symbols
