	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function write_eraseblock
_write_eraseblock:                      ## @write_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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_mtd@GOTPCREL(%rip), %r12
	movq	(%r12), %rax
	movslq	(%rax), %rax
	movslq	%edi, %rbx
	imulq	%rax, %rbx
	movq	_writebuf@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	movq	_subpgsize@GOTPCREL(%rip), %r15
	movq	(%r15), %rdx
	movq	_rnd_state@GOTPCREL(%rip), %rdi
	callq	_prandom_bytes_state
	movq	(%r12), %rdi
	movq	(%r15), %rdx
	movl	(%r13), %r8d
	leaq	-48(%rbp), %rcx
	movl	%ebx, %esi
	callq	_mtd_write
	movl	%eax, %r14d
	testl	%eax, %eax
	setne	%al
	movq	-48(%rbp), %rcx
	cmpq	(%r15), %rcx
	setne	%cl
	orb	%al, %cl
	movzbl	%cl, %edi
	callq	_unlikely
	testq	%rax, %rax
	je	LBB0_4
## %bb.1:
	leaq	L_.str(%rip), %rdi
	movq	%rbx, %rsi
	callq	_pr_err
	movq	(%r15), %rsi
	cmpq	%rsi, -48(%rbp)
	je	LBB0_3
## %bb.2:
	leaq	L_.str.1(%rip), %rdi
	callq	_pr_err
	movq	-48(%rbp), %rsi
	leaq	L_.str.2(%rip), %rdi
	callq	_pr_err
LBB0_3:
	xorl	%eax, %eax
	cmpl	$1, %r14d
	sbbl	%eax, %eax
	orl	%r14d, %eax
	jmp	LBB0_9
LBB0_4:
	movq	(%r15), %rdx
	leal	(%rbx,%rdx), %r14d
	movl	(%r13), %esi
	movq	_rnd_state@GOTPCREL(%rip), %rdi
	callq	_prandom_bytes_state
	movq	(%r12), %rdi
	movq	(%r15), %rdx
	movl	(%r13), %r8d
	leaq	-48(%rbp), %rcx
	movl	%r14d, %esi
	callq	_mtd_write
	movl	%eax, %ebx
	testl	%eax, %eax
	setne	%al
	movq	-48(%rbp), %rcx
	cmpq	(%r15), %rcx
	setne	%cl
	orb	%al, %cl
	movzbl	%cl, %edi
	callq	_unlikely
	testq	%rax, %rax
	je	LBB0_5
## %bb.6:
	movslq	%r14d, %rsi
	leaq	L_.str(%rip), %rdi
	callq	_pr_err
	movq	(%r15), %rsi
	cmpq	%rsi, -48(%rbp)
	je	LBB0_8
## %bb.7:
	leaq	L_.str.1(%rip), %rdi
	callq	_pr_err
	movq	-48(%rbp), %rsi
	leaq	L_.str.2(%rip), %rdi
	callq	_pr_err
LBB0_8:
	xorl	%eax, %eax
	cmpl	$1, %ebx
	sbbl	%eax, %eax
	orl	%ebx, %eax
	jmp	LBB0_9
LBB0_5:
	movl	%ebx, %eax
LBB0_9:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_mtd,8,3                        ## @mtd
	.comm	_rnd_state,4,2                  ## @rnd_state
	.comm	_writebuf,4,2                   ## @writebuf
	.comm	_subpgsize,8,3                  ## @subpgsize
	.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: %#zx\n"

	.no_dead_strip	_write_eraseblock
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function write_eraseblock
_write_eraseblock:                      ; @write_eraseblock
	.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
                                        ; kill: def $w0 killed $w0 def $x0
Lloh0:
	adrp	x22, _mtd@GOTPAGE
Lloh1:
	ldr	x22, [x22, _mtd@GOTPAGEOFF]
	ldr	x8, [x22]
	ldrsw	x8, [x8]
	sxtw	x9, w0
	mul	x19, x8, x9
Lloh2:
	adrp	x23, _writebuf@GOTPAGE
Lloh3:
	ldr	x23, [x23, _writebuf@GOTPAGEOFF]
	ldr	w1, [x23]
Lloh4:
	adrp	x21, _subpgsize@GOTPAGE
Lloh5:
	ldr	x21, [x21, _subpgsize@GOTPAGEOFF]
	ldr	x2, [x21]
Lloh6:
	adrp	x0, _rnd_state@GOTPAGE
Lloh7:
	ldr	x0, [x0, _rnd_state@GOTPAGEOFF]
	bl	_prandom_bytes_state
	ldr	x0, [x22]
	ldr	x2, [x21]
	ldr	w4, [x23]
	add	x3, sp, #8
	mov	x1, x19
	bl	_mtd_write
	mov	x20, x0
	cmp	w0, #0
	ldr	x8, [sp, #8]
	ldr	x9, [x21]
	ccmp	x8, x9, #0, eq
	cset	w0, ne
	bl	_unlikely
	cbz	x0, LBB0_4
; %bb.1:
Lloh8:
	adrp	x0, l_.str@PAGE
Lloh9:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	bl	_pr_err
	ldr	x8, [sp, #8]
	ldr	x1, [x21]
	cmp	x8, x1
	b.eq	LBB0_3
; %bb.2:
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_3:
	cmp	w20, #0
	csinv	w19, w20, wzr, ne
	b	LBB0_8
LBB0_4:
	ldr	x2, [x21]
	add	w20, w19, w2
	ldr	w1, [x23]
Lloh14:
	adrp	x0, _rnd_state@GOTPAGE
Lloh15:
	ldr	x0, [x0, _rnd_state@GOTPAGEOFF]
	bl	_prandom_bytes_state
	ldr	x0, [x22]
	ldr	x2, [x21]
	ldr	w4, [x23]
	add	x3, sp, #8
	mov	x1, x20
	bl	_mtd_write
	mov	x19, x0
	cmp	w0, #0
	ldr	x8, [sp, #8]
	ldr	x9, [x21]
	ccmp	x8, x9, #0, eq
	cset	w0, ne
	bl	_unlikely
	cbz	x0, LBB0_8
; %bb.5:
	sxtw	x1, w20
Lloh16:
	adrp	x0, l_.str@PAGE
Lloh17:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_err
	ldr	x8, [sp, #8]
	ldr	x1, [x21]
	cmp	x8, x1
	b.eq	LBB0_7
; %bb.6:
Lloh18:
	adrp	x0, l_.str.1@PAGE
Lloh19:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_pr_err
	ldr	x1, [sp, #8]
Lloh20:
	adrp	x0, l_.str.2@PAGE
Lloh21:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_pr_err
LBB0_7:
	cmp	w19, #0
	csinv	w19, w19, wzr, ne
LBB0_8:
	mov	x0, x19
	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
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_mtd,8,3                        ; @mtd
	.comm	_rnd_state,4,2                  ; @rnd_state
	.comm	_writebuf,4,2                   ; @writebuf
	.comm	_subpgsize,8,3                  ; @subpgsize
	.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: %#zx\n"

	.no_dead_strip	_write_eraseblock
.subsections_via_symbols
