	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function do_sync_erase
_do_sync_erase:                         ## @do_sync_erase
	.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
	movl	%esi, %r14d
	movq	%rdi, %r15
	leaq	L_.str(%rip), %rdi
	callq	_dbg_io
	xorl	%edi, %edi
	testl	%r14d, %r14d
	js	LBB0_2
## %bb.1:
	cmpl	%r14d, (%r15)
	setg	%dil
LBB0_2:
	callq	_ubi_assert
	cmpq	$0, 16(%r15)
	je	LBB0_3
## %bb.12:
	leaq	L_.str.1(%rip), %rsi
	xorl	%ebx, %ebx
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	_ubi_err
	movq	_EROFS@GOTPCREL(%rip), %rax
LBB0_10:
	subl	(%rax), %ebx
LBB0_11:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	leaq	-48(%rbp), %rbx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	movl	$8, %edx
	callq	_memset
	movl	4(%r15), %eax
	movl	%eax, %ecx
	imull	%r14d, %ecx
	movl	%ecx, -48(%rbp)
	movl	%eax, -44(%rbp)
	movl	8(%r15), %edi
	movq	%rbx, %rsi
	callq	_mtd_erase
	testl	%eax, %eax
	je	LBB0_7
## %bb.4:
	movl	%eax, %ebx
	movl	$-1, %r12d
	leaq	-48(%rbp), %r13
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	incl	%r12d
	movq	_UBI_IO_RETRIES@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jge	LBB0_13
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	%r15, %rdi
	leaq	L_.str.2(%rip), %rsi
	movl	%ebx, %edx
	movl	%r14d, %ecx
	callq	_ubi_warn
	xorl	%eax, %eax
	callq	_yield
	movq	%r13, %rdi
	xorl	%esi, %esi
	movl	$8, %edx
	callq	_memset
	movl	4(%r15), %eax
	movl	%eax, %ecx
	imull	%r14d, %ecx
	movl	%ecx, -48(%rbp)
	movl	%eax, -44(%rbp)
	movl	8(%r15), %edi
	movq	%r13, %rsi
	callq	_mtd_erase
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_5
LBB0_7:
	movl	4(%r15), %ecx
	movq	%r15, %rdi
	movl	%r14d, %esi
	xorl	%edx, %edx
	callq	_ubi_self_check_all_ff
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_11
## %bb.8:
	movq	%r15, %rdi
	callq	_ubi_dbg_is_erase_failure
	movl	$0, %ebx
	testq	%rax, %rax
	je	LBB0_11
## %bb.9:
	leaq	L_.str.4(%rip), %rsi
	xorl	%ebx, %ebx
	movq	%r15, %rdi
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	_ubi_err
	movq	_EIO@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_13:
	leaq	L_.str.3(%rip), %rsi
	movq	%r15, %rdi
	movl	%r14d, %edx
	movl	%ebx, %ecx
	xorl	%eax, %eax
	callq	_ubi_err
	xorl	%eax, %eax
	callq	_dump_stack
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"erase PEB %d"

L_.str.1:                               ## @.str.1
	.asciz	"read-only mode"

	.comm	_EROFS,4,2                      ## @EROFS
	.comm	_UBI_IO_RETRIES,4,2             ## @UBI_IO_RETRIES
L_.str.2:                               ## @.str.2
	.asciz	"error %d while erasing PEB %d, retry"

L_.str.3:                               ## @.str.3
	.asciz	"cannot erase PEB %d, error %d"

L_.str.4:                               ## @.str.4
	.asciz	"cannot erase PEB %d (emulated)"

	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_do_sync_erase
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function do_sync_erase
_do_sync_erase:                         ; @do_sync_erase
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_dbg_io
	tbnz	w20, #31, LBB0_2
; %bb.1:
	ldr	w8, [x19]
	cmp	w8, w20
	cset	w0, gt
	b	LBB0_3
LBB0_2:
	mov	w0, #0
LBB0_3:
	bl	_ubi_assert
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_7
; %bb.4:
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_ubi_err
Lloh4:
	adrp	x8, _EROFS@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EROFS@GOTPAGEOFF]
LBB0_5:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_6:
	mov	x0, x21
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_7:
	add	x0, sp, #24
	mov	w1, #0
	mov	w2, #8
	bl	_memset
	ldp	w8, w0, [x19, #4]
	mul	w9, w8, w20
	stp	w9, w8, [sp, #24]
	add	x1, sp, #24
	bl	_mtd_erase
	cbz	w0, LBB0_11
; %bb.8:
	mov	x21, x0
	mov	w23, #-1
Lloh6:
	adrp	x24, _UBI_IO_RETRIES@GOTPAGE
Lloh7:
	ldr	x24, [x24, _UBI_IO_RETRIES@GOTPAGEOFF]
Lloh8:
	adrp	x22, l_.str.2@PAGE
Lloh9:
	add	x22, x22, l_.str.2@PAGEOFF
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x24]
	add	w23, w23, #1
	cmp	w23, w8
	b.ge	LBB0_14
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
	mov	x0, x19
	mov	x1, x22
	mov	x2, x21
	mov	x3, x20
	bl	_ubi_warn
	bl	_yield
	add	x0, sp, #24
	mov	w1, #0
	mov	w2, #8
	bl	_memset
	ldp	w8, w0, [x19, #4]
	mul	w9, w8, w20
	stp	w9, w8, [sp, #24]
	add	x1, sp, #24
	bl	_mtd_erase
	mov	x21, x0
	cbnz	w0, LBB0_9
LBB0_11:
	ldr	w3, [x19, #4]
	mov	x0, x19
	mov	x1, x20
	mov	w2, #0
	bl	_ubi_self_check_all_ff
	mov	x21, x0
	cbnz	w0, LBB0_6
; %bb.12:
	mov	x0, x19
	bl	_ubi_dbg_is_erase_failure
	cbz	x0, LBB0_15
; %bb.13:
                                        ; kill: def $w20 killed $w20 killed $x20 def $x20
	str	x20, [sp]
Lloh10:
	adrp	x1, l_.str.4@PAGE
Lloh11:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x0, x19
	bl	_ubi_err
Lloh12:
	adrp	x8, _EIO@GOTPAGE
Lloh13:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_5
LBB0_14:
	stp	x20, x21, [sp]
Lloh14:
	adrp	x1, l_.str.3@PAGE
Lloh15:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x19
	bl	_ubi_err
	bl	_dump_stack
	b	LBB0_6
LBB0_15:
	mov	w21, #0
	b	LBB0_6
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"erase PEB %d"

l_.str.1:                               ; @.str.1
	.asciz	"read-only mode"

	.comm	_EROFS,4,2                      ; @EROFS
	.comm	_UBI_IO_RETRIES,4,2             ; @UBI_IO_RETRIES
l_.str.2:                               ; @.str.2
	.asciz	"error %d while erasing PEB %d, retry"

l_.str.3:                               ; @.str.3
	.asciz	"cannot erase PEB %d, error %d"

l_.str.4:                               ; @.str.4
	.asciz	"cannot erase PEB %d (emulated)"

	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_do_sync_erase
.subsections_via_symbols
