	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function do_write
_do_write:                              ## @do_write
	.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
	xorl	%eax, %eax
	callq	_rand_eb
	movl	%eax, %r15d
	movq	_offsets@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movslq	%r15d, %r13
	movl	(%rax,%r13,4), %r14d
	movq	_mtd@GOTPCREL(%rip), %r12
	movq	(%r12), %rdi
	cmpl	(%rdi), %r14d
	jl	LBB0_3
## %bb.1:
	movq	%r12, %rbx
	movl	%r15d, %esi
	callq	_mtdtest_erase_eraseblock
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_14
## %bb.2:
	movq	_offsets@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	$0, (%rax,%r13,4)
	xorl	%r14d, %r14d
	movq	%rbx, %r12
LBB0_3:
	movl	%r14d, %edi
	callq	_rand_len
                                        ## kill: def $eax killed $eax def $rax
	movq	_pgsize@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	leal	(%rax,%rcx), %ebx
	decl	%ebx
	movl	%ebx, %eax
	cltd
	idivl	%ecx
	subl	%edx, %ebx
	leal	(%rbx,%r14), %eax
	movq	(%r12), %rdi
	movl	(%rdi), %esi
	cmpl	%esi, %eax
	jle	LBB0_8
## %bb.4:
	movq	_bbt@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	$0, 8(%rax,%r13,8)
	je	LBB0_6
## %bb.5:
	movl	%esi, %ebx
	subl	%r14d, %ebx
LBB0_8:
	imull	%r15d, %esi
	addl	%r14d, %esi
	movq	_writebuf@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	%ebx, %edx
	callq	_mtdtest_write
	movl	%eax, %r12d
	movl	%eax, %edi
	callq	_unlikely
	testq	%rax, %rax
	jne	LBB0_14
## %bb.9:
	addl	%r14d, %ebx
	movq	_mtd@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	movl	(%rcx), %edx
	movq	_offsets@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpl	%edx, %ebx
	jle	LBB0_13
## %bb.10:
	leaq	(%rax,%r13,4), %rsi
	shlq	$32, %r13
	movabsq	$4294967296, %rdi               ## imm = 0x100000000
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	addq	%rdi, %r13
	movl	%edx, (%rsi)
	movl	(%rcx), %edx
	subl	%edx, %ebx
	addq	$4, %rsi
	cmpl	%edx, %ebx
	jg	LBB0_11
## %bb.12:
	sarq	$32, %r13
LBB0_13:
	movl	%ebx, (%rax,%r13,4)
	xorl	%r12d, %r12d
	jmp	LBB0_14
LBB0_6:
	leaq	1(%r13), %rsi
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_mtdtest_erase_eraseblock
	movl	%eax, %r12d
	testl	%eax, %eax
	je	LBB0_7
LBB0_14:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movq	_offsets@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movl	$0, (%rax,%rcx,4)
	movq	_mtd@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movl	(%rdi), %esi
	jmp	LBB0_8
	.cfi_endproc
                                        ## -- End function
	.comm	_offsets,8,3                    ## @offsets
	.comm	_mtd,8,3                        ## @mtd
	.comm	_pgsize,4,2                     ## @pgsize
	.comm	_bbt,8,3                        ## @bbt
	.comm	_writebuf,4,2                   ## @writebuf
	.no_dead_strip	_do_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function do_write
_do_write:                              ; @do_write
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	bl	_rand_eb
                                        ; kill: def $w0 killed $w0 def $x0
Lloh0:
	adrp	x24, _offsets@GOTPAGE
Lloh1:
	ldr	x24, [x24, _offsets@GOTPAGEOFF]
	ldr	x8, [x24]
	ldr	w20, [x8, w0, sxtw #2]
	sxtw	x19, w0
Lloh2:
	adrp	x25, _mtd@GOTPAGE
Lloh3:
	ldr	x25, [x25, _mtd@GOTPAGEOFF]
	ldr	x0, [x25]
	ldr	w8, [x0]
	cmp	w20, w8
	b.lt	LBB0_3
; %bb.1:
	mov	x1, x19
	bl	_mtdtest_erase_eraseblock
	mov	x22, x0
	cbnz	w0, LBB0_13
; %bb.2:
	mov	w20, #0
	ldr	x8, [x24]
	str	wzr, [x8, x19, lsl #2]
LBB0_3:
	mov	x0, x20
	bl	_rand_len
Lloh4:
	adrp	x8, _pgsize@GOTPAGE
Lloh5:
	ldr	x8, [x8, _pgsize@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	add	w9, w0, w8
	sub	w9, w9, #1
	sdiv	w9, w9, w8
	mul	w21, w9, w8
	ldr	x0, [x25]
	ldr	w8, [x0]
	add	w9, w21, w20
	cmp	w9, w8
	b.le	LBB0_6
; %bb.4:
Lloh7:
	adrp	x9, _bbt@GOTPAGE
Lloh8:
	ldr	x9, [x9, _bbt@GOTPAGEOFF]
Lloh9:
	ldr	x9, [x9]
	add	x23, x19, #1
	ldr	x9, [x9, x23, lsl #3]
	cbz	x9, LBB0_12
; %bb.5:
	sub	w21, w8, w20
LBB0_6:
	madd	w1, w8, w19, w20
Lloh10:
	adrp	x8, _writebuf@GOTPAGE
Lloh11:
	ldr	x8, [x8, _writebuf@GOTPAGEOFF]
Lloh12:
	ldr	w3, [x8]
	mov	x2, x21
	bl	_mtdtest_write
	mov	x22, x0
	bl	_unlikely
	cbnz	x0, LBB0_13
; %bb.7:
	ldr	x10, [x25]
	ldr	w11, [x10]
	ldr	x8, [x24]
	add	w9, w21, w20
	cmp	w9, w11
	b.le	LBB0_11
; %bb.8:
	lsl	x12, x19, #32
	mov	x13, #4294967296
	add	x14, x8, x19, lsl #2
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	str	w11, [x14], #4
	ldr	w11, [x10]
	add	x12, x12, x13
	sub	w9, w9, w11
	cmp	w9, w11
	b.gt	LBB0_9
; %bb.10:
	asr	x19, x12, #32
LBB0_11:
	mov	w22, #0
	str	w9, [x8, x19, lsl #2]
	b	LBB0_13
LBB0_12:
	mov	x1, x23
	bl	_mtdtest_erase_eraseblock
	mov	x22, x0
	cbz	w0, LBB0_14
LBB0_13:
	mov	x0, x22
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_14:
	ldr	x8, [x24]
	str	wzr, [x8, x23, lsl #2]
	ldr	x0, [x25]
	ldr	w8, [x0]
	b	LBB0_6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_offsets,8,3                    ; @offsets
	.comm	_mtd,8,3                        ; @mtd
	.comm	_pgsize,4,2                     ; @pgsize
	.comm	_bbt,8,3                        ; @bbt
	.comm	_writebuf,4,2                   ; @writebuf
	.no_dead_strip	_do_write
.subsections_via_symbols
