	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function write_eraseblock2
_write_eraseblock2:                     ## @write_eraseblock2
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_mtd@GOTPCREL(%rip), %rsi
	movq	(%rsi), %rax
	movl	(%rax), %eax
	movl	%eax, %r15d
	imull	%edi, %r15d
	incl	%edi
	movq	_subpgsize@GOTPCREL(%rip), %r14
	movl	(%r14), %edx
	leal	(%rdx,%r15), %ecx
	movl	%edi, -52(%rbp)                 ## 4-byte Spill
	imull	%edi, %eax
	xorl	%ebx, %ebx
	cmpl	%eax, %ecx
	jg	LBB0_10
## %bb.1:
	movl	$2, %r13d
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	leal	-1(%r13), %r12d
	movq	%rsi, %rbx
	movq	_writebuf@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_rnd_state@GOTPCREL(%rip), %rdi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_prandom_bytes_state
	movq	(%rbx), %rdi
	movl	(%r14), %edx
	imull	%r12d, %edx
	movq	_writebuf@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movl	%r15d, %esi
	leaq	-48(%rbp), %rcx
	callq	_mtd_write
	movl	%eax, %ebx
	movb	$1, %al
	testl	%ebx, %ebx
	jne	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	_subpgsize@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	movslq	%r12d, %rcx
	imulq	%rax, %rcx
	cmpq	%rcx, -48(%rbp)
	setne	%al
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	movzbl	%al, %edi
	callq	_unlikely
	testq	%rax, %rax
	jne	LBB0_5
## %bb.8:                               ##   in Loop: Header=BB0_2 Depth=1
	cmpl	$33, %r13d
	je	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	_subpgsize@GOTPCREL(%rip), %r14
	movl	(%r14), %edx
	imull	%edx, %r12d
	addl	%r15d, %r12d
	movq	_mtd@GOTPCREL(%rip), %rsi
	movq	(%rsi), %rax
	imull	%r13d, %edx
	leal	(%rdx,%r12), %ecx
	movl	(%rax), %eax
	imull	-52(%rbp), %eax                 ## 4-byte Folded Reload
	incl	%r13d
	movl	%r12d, %r15d
	cmpl	%eax, %ecx
	jle	LBB0_2
	jmp	LBB0_10
LBB0_5:
	movslq	%r15d, %rsi
	leaq	L_.str(%rip), %rdi
	callq	_pr_err
	movq	_subpgsize@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	movslq	%r12d, %rsi
	imulq	%rax, %rsi
	cmpq	%rsi, -48(%rbp)
	je	LBB0_7
## %bb.6:
	leaq	L_.str.1(%rip), %rdi
	callq	_pr_err
	movq	-48(%rbp), %rsi
	leaq	L_.str.2(%rip), %rdi
	callq	_pr_err
LBB0_7:
	xorl	%eax, %eax
	cmpl	$1, %ebx
	sbbl	%eax, %eax
	orl	%eax, %ebx
LBB0_10:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_mtd,8,3                        ## @mtd
	.comm	_subpgsize,4,2                  ## @subpgsize
	.comm	_rnd_state,4,2                  ## @rnd_state
	.comm	_writebuf,4,2                   ## @writebuf
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"error: write failed at %#llx\n"

L_.str.1:                               ## @.str.1
	.asciz	"  write size: %#x\n"

L_.str.2:                               ## @.str.2
	.asciz	"  written: %#08zx\n"

	.no_dead_strip	_write_eraseblock2
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function write_eraseblock2
_write_eraseblock2:                     ; @write_eraseblock2
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
Lloh0:
	adrp	x23, _mtd@GOTPAGE
Lloh1:
	ldr	x23, [x23, _mtd@GOTPAGEOFF]
	ldr	x8, [x23]
	ldr	w8, [x8]
	mul	w19, w8, w0
	add	w24, w0, #1
Lloh2:
	adrp	x22, _subpgsize@GOTPAGE
Lloh3:
	ldr	x22, [x22, _subpgsize@GOTPAGEOFF]
	ldr	w2, [x22]
	mul	w8, w8, w24
	add	w9, w2, w19
	cmp	w9, w8
	b.le	LBB0_2
; %bb.1:
	mov	w20, #0
	b	LBB0_11
LBB0_2:
	mov	w25, #2
Lloh4:
	adrp	x26, _writebuf@GOTPAGE
Lloh5:
	ldr	x26, [x26, _writebuf@GOTPAGEOFF]
Lloh6:
	adrp	x21, _rnd_state@GOTPAGE
Lloh7:
	ldr	x21, [x21, _rnd_state@GOTPAGEOFF]
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	sub	w27, w25, #1
	ldr	w1, [x26]
	mov	x0, x21
	bl	_prandom_bytes_state
	ldr	x0, [x23]
	ldr	w8, [x22]
	mul	w2, w8, w27
	ldr	w4, [x26]
	add	x3, sp, #8
	mov	x1, x19
	bl	_mtd_write
	mov	x20, x0
	cbz	w0, LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	w0, #1
	bl	_unlikely
	cbz	x0, LBB0_6
	b	LBB0_8
LBB0_5:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	x8, [sp, #8]
	ldrsw	x9, [x22]
	sxtw	x10, w27
	mul	x9, x9, x10
	cmp	x8, x9
	cset	w0, ne
	bl	_unlikely
	cbnz	x0, LBB0_8
LBB0_6:                                 ;   in Loop: Header=BB0_3 Depth=1
	cmp	w25, #33
	b.eq	LBB0_11
; %bb.7:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w8, [x22]
	madd	w19, w8, w27, w19
	ldr	x9, [x23]
	ldr	w9, [x9]
	mul	w2, w8, w25
	mul	w8, w9, w24
	add	w25, w25, #1
	add	w9, w2, w19
	cmp	w9, w8
	b.le	LBB0_3
	b	LBB0_11
LBB0_8:
	sxtw	x1, w19
Lloh8:
	adrp	x0, l_.str@PAGE
Lloh9:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_err
	ldr	x8, [sp, #8]
	ldrsw	x9, [x22]
                                        ; kill: def $w27 killed $w27 killed $x27 def $x27
	sxtw	x10, w27
	mul	x1, x9, x10
	cmp	x8, x1
	b.eq	LBB0_10
; %bb.9:
Lloh10:
	adrp	x0, l_.str.1@PAGE
Lloh11:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_pr_err
	ldr	x1, [sp, #8]
Lloh12:
	adrp	x0, l_.str.2@PAGE
Lloh13:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_pr_err
LBB0_10:
	cmp	w20, #0
	csinv	w20, w20, wzr, ne
LBB0_11:
	mov	x0, x20
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_mtd,8,3                        ; @mtd
	.comm	_subpgsize,4,2                  ; @subpgsize
	.comm	_rnd_state,4,2                  ; @rnd_state
	.comm	_writebuf,4,2                   ; @writebuf
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"error: write failed at %#llx\n"

l_.str.1:                               ; @.str.1
	.asciz	"  write size: %#x\n"

l_.str.2:                               ; @.str.2
	.asciz	"  written: %#08zx\n"

	.no_dead_strip	_write_eraseblock2
.subsections_via_symbols
