	.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
	subq	$56, %rsp
	.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, %r12
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_dbg_io
	xorl	%r15d, %r15d
	jmp	LBB0_1
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_1 Depth=1
	leaq	L_.str.4(%rip), %rdi
	movl	%r14d, %esi
	xorl	%eax, %eax
	callq	_dbg_io
LBB0_4:                                 ##   in Loop: Header=BB0_1 Depth=1
	xorl	%eax, %eax
	callq	_yield
	incl	%r15d
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	leaq	-44(%rbp), %r13
	movq	%r13, %rdi
	callq	_init_waitqueue_head
	leaq	-88(%rbp), %rbx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	movl	$40, %edx
	callq	_memset
	movq	8(%r12), %rdi
	movq	%rdi, -56(%rbp)
	movl	(%r12), %eax
	movl	%eax, %ecx
	imull	%r14d, %ecx
	movl	%ecx, -88(%rbp)
	movl	%eax, -84(%rbp)
	movq	_erase_callback@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -64(%rbp)
	movq	%r13, -80(%rbp)
	movq	%rbx, %rsi
	callq	*(%rdi)
	testl	%eax, %eax
	je	LBB0_6
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	%eax, %r13d
	movq	_UBI_IO_RETRIES@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r15d
	jge	LBB0_5
## %bb.3:                               ##   in Loop: Header=BB0_1 Depth=1
	leaq	L_.str.1(%rip), %rdi
	movl	%r13d, %esi
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	_dbg_io
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_1 Depth=1
	movq	-72(%rbp), %rax
	movq	_MTD_ERASE_DONE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	sete	%cl
	movq	_MTD_ERASE_FAILED@GOTPCREL(%rip), %rbx
	cmpq	(%rbx), %rax
	movl	-44(%rbp), %edi
	sete	%al
	orb	%cl, %al
	movzbl	%al, %esi
	callq	_wait_event_interruptible
	testl	%eax, %eax
	jne	LBB0_7
## %bb.8:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	-72(%rbp), %rax
	cmpq	(%rbx), %rax
	jne	LBB0_12
## %bb.9:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	_UBI_IO_RETRIES@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r15d
	jl	LBB0_10
## %bb.11:
	leaq	L_.str.5(%rip), %rdi
	xorl	%r13d, %r13d
	movl	%r14d, %esi
	xorl	%eax, %eax
	callq	_ubi_err
	xorl	%eax, %eax
	callq	_ubi_dbg_dump_stack
	movq	_EIO@GOTPCREL(%rip), %rax
	jmp	LBB0_16
LBB0_5:
	leaq	L_.str.2(%rip), %rdi
	movl	%r14d, %esi
	movl	%r13d, %edx
	xorl	%eax, %eax
	callq	_ubi_err
	xorl	%eax, %eax
	callq	_ubi_dbg_dump_stack
	jmp	LBB0_17
LBB0_7:
	leaq	L_.str.3(%rip), %rdi
	xorl	%r13d, %r13d
	movl	%r14d, %esi
	xorl	%eax, %eax
	callq	_ubi_err
	movq	_EINTR@GOTPCREL(%rip), %rax
LBB0_16:
	subl	(%rax), %r13d
	jmp	LBB0_17
LBB0_12:
	movl	(%r12), %ecx
	xorl	%r13d, %r13d
	movq	%r12, %rdi
	movl	%r14d, %esi
	xorl	%edx, %edx
	callq	_ubi_dbg_check_all_ff
	testl	%eax, %eax
	je	LBB0_14
## %bb.13:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	subl	(%rcx), %r13d
	testl	%eax, %eax
	cmovlel	%eax, %r13d
LBB0_17:
	movl	%r13d, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_14:
	xorl	%eax, %eax
	callq	_ubi_dbg_is_erase_failure
	testq	%rax, %rax
	je	LBB0_17
## %bb.15:
	leaq	L_.str.6(%rip), %rdi
	movl	%r14d, %esi
	callq	_dbg_err
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"erase PEB %d"

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

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

	.comm	_MTD_ERASE_DONE,8,3             ## @MTD_ERASE_DONE
	.comm	_MTD_ERASE_FAILED,8,3           ## @MTD_ERASE_FAILED
L_.str.3:                               ## @.str.3
	.asciz	"interrupted PEB %d erasure"

	.comm	_EINTR,4,2                      ## @EINTR
L_.str.4:                               ## @.str.4
	.asciz	"error while erasing PEB %d, retry"

L_.str.5:                               ## @.str.5
	.asciz	"cannot erase PEB %d"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.6:                               ## @.str.6
	.asciz	"cannot erase PEB %d (emulated)"

	.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, #160
	.cfi_def_cfa_offset 160
	stp	x28, x27, [sp, #64]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #80]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #96]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #112]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #128]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #144]            ; 16-byte Folded Spill
	add	x29, sp, #144
	.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
	mov	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_dbg_io
	mov	w24, #0
	add	x25, sp, #20
Lloh2:
	adrp	x26, _erase_callback@GOTPAGE
Lloh3:
	ldr	x26, [x26, _erase_callback@GOTPAGEOFF]
Lloh4:
	adrp	x27, _MTD_ERASE_DONE@GOTPAGE
Lloh5:
	ldr	x27, [x27, _MTD_ERASE_DONE@GOTPAGEOFF]
Lloh6:
	adrp	x28, _MTD_ERASE_FAILED@GOTPAGE
Lloh7:
	ldr	x28, [x28, _MTD_ERASE_FAILED@GOTPAGEOFF]
Lloh8:
	adrp	x21, _UBI_IO_RETRIES@GOTPAGE
Lloh9:
	ldr	x21, [x21, _UBI_IO_RETRIES@GOTPAGEOFF]
Lloh10:
	adrp	x22, l_.str.1@PAGE
Lloh11:
	add	x22, x22, l_.str.1@PAGEOFF
	b	LBB0_4
LBB0_1:                                 ;   in Loop: Header=BB0_4 Depth=1
	mov	x23, x0
	ldr	w8, [x21]
	cmp	w24, w8
	b.ge	LBB0_9
; %bb.2:                                ;   in Loop: Header=BB0_4 Depth=1
	str	x19, [sp]
	mov	x0, x22
	mov	x1, x23
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	bl	_dbg_io
	bl	_yield
	add	w24, w24, #1
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	add	x0, sp, #20
	bl	_init_waitqueue_head
	add	x0, sp, #24
	mov	w1, #0
	mov	w2, #40
	bl	_memset
	ldr	x0, [x20, #8]
	str	x0, [sp, #56]
	ldr	w8, [x20]
	mul	w9, w8, w19
	stp	w9, w8, [sp, #24]
	ldr	w8, [x26]
	str	w8, [sp, #48]
	str	x25, [sp, #32]
	ldr	x8, [x0]
	add	x1, sp, #24
	blr	x8
	cbnz	w0, LBB0_1
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w0, [sp, #20]
	ldr	x8, [sp, #40]
	ldr	x9, [x27]
	cmp	x8, x9
	ldr	x9, [x28]
	ccmp	x8, x9, #4, ne
	cset	w1, eq
	bl	_wait_event_interruptible
	cbnz	w0, LBB0_10
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	x8, [sp, #40]
	ldr	x9, [x28]
	cmp	x8, x9
	b.ne	LBB0_11
; %bb.7:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w8, [x21]
	cmp	w24, w8
	b.ge	LBB0_13
; %bb.8:                                ;   in Loop: Header=BB0_4 Depth=1
Lloh12:
	adrp	x0, l_.str.4@PAGE
Lloh13:
	add	x0, x0, l_.str.4@PAGEOFF
	mov	x1, x19
	b	LBB0_3
LBB0_9:
	str	x23, [sp]
Lloh14:
	adrp	x0, l_.str.2@PAGE
Lloh15:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	x1, x19
	bl	_ubi_err
	bl	_ubi_dbg_dump_stack
	b	LBB0_16
LBB0_10:
Lloh16:
	adrp	x0, l_.str.3@PAGE
Lloh17:
	add	x0, x0, l_.str.3@PAGEOFF
	mov	x1, x19
	bl	_ubi_err
Lloh18:
	adrp	x8, _EINTR@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EINTR@GOTPAGEOFF]
	b	LBB0_15
LBB0_11:
	ldr	w3, [x20]
	mov	x0, x20
	mov	x1, x19
	mov	w2, #0
	bl	_ubi_dbg_check_all_ff
	cbz	w0, LBB0_17
; %bb.12:
Lloh20:
	adrp	x8, _EINVAL@GOTPAGE
Lloh21:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	cmp	w0, #0
	csneg	w23, w0, w8, le
	b	LBB0_16
LBB0_13:
Lloh23:
	adrp	x0, l_.str.5@PAGE
Lloh24:
	add	x0, x0, l_.str.5@PAGEOFF
	mov	x1, x19
	bl	_ubi_err
	bl	_ubi_dbg_dump_stack
LBB0_14:
Lloh25:
	adrp	x8, _EIO@GOTPAGE
Lloh26:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
LBB0_15:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_16:
	mov	x0, x23
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #80]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #160
	ret
LBB0_17:
	bl	_ubi_dbg_is_erase_failure
	cbz	x0, LBB0_19
; %bb.18:
Lloh27:
	adrp	x0, l_.str.6@PAGE
Lloh28:
	add	x0, x0, l_.str.6@PAGEOFF
	mov	x1, x19
	bl	_dbg_err
	b	LBB0_14
LBB0_19:
	mov	w23, #0
	b	LBB0_16
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpAdd	Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"erase PEB %d"

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

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

	.comm	_MTD_ERASE_DONE,8,3             ; @MTD_ERASE_DONE
	.comm	_MTD_ERASE_FAILED,8,3           ; @MTD_ERASE_FAILED
l_.str.3:                               ; @.str.3
	.asciz	"interrupted PEB %d erasure"

	.comm	_EINTR,4,2                      ; @EINTR
l_.str.4:                               ; @.str.4
	.asciz	"error while erasing PEB %d, retry"

l_.str.5:                               ; @.str.5
	.asciz	"cannot erase PEB %d"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.6:                               ; @.str.6
	.asciz	"cannot erase PEB %d (emulated)"

	.no_dead_strip	_do_sync_erase
.subsections_via_symbols
