	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function __erase_worker
___erase_worker:                        ## @__erase_worker
	.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	%rsi, %rbx
	movq	%rdi, %r13
	movq	16(%rsi), %r14
	movl	(%r14), %r15d
	movl	4(%r14), %edx
	movl	(%rsi), %r12d
	movl	4(%rsi), %r8d
	leaq	L_.str(%rip), %rdi
	movl	%r15d, %esi
	movl	%r12d, %ecx
	movl	%r8d, -44(%rbp)                 ## 4-byte Spill
	callq	_dbg_wl
	movl	8(%rbx), %edx
	movq	%r13, %rbx
	movq	%r13, %rdi
	movq	%r14, %rsi
	callq	_sync_erase
	testl	%eax, %eax
	je	LBB0_30
## %bb.1:
	movl	%eax, %r13d
	leaq	L_.str.1(%rip), %rsi
	movq	%rbx, %rdi
	movl	%r15d, -48(%rbp)                ## 4-byte Spill
	movl	%r15d, %edx
	movl	%eax, %ecx
	xorl	%eax, %eax
	callq	_ubi_err
	movq	_EINTR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%r13d, %eax
	je	LBB0_5
## %bb.2:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%r13d, %eax
	je	LBB0_5
## %bb.3:
	movq	_EAGAIN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%r13d, %eax
	je	LBB0_5
## %bb.4:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%r13d, %eax
	jne	LBB0_7
LBB0_5:
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	%r12d, %edx
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	_schedule_erase
	testl	%eax, %eax
	je	LBB0_29
## %bb.6:
	movl	%eax, %r15d
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_wl_entry_destroy
	movl	%r15d, %r13d
LBB0_28:
	movq	%rbx, %rdi
	callq	_ubi_ro_mode
LBB0_29:
	movl	%r13d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_30:
	leaq	32(%rbx), %r15
	movq	%r15, %rdi
	callq	_spin_lock
	leaq	40(%rbx), %rsi
	movq	%r14, %rdi
	callq	_wl_tree_add
	incl	36(%rbx)
	movq	%r15, %rdi
	callq	_spin_unlock
	movq	%rbx, %rdi
	callq	_serve_prot_queue
	movq	%rbx, %rdi
	movl	$1, %esi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ensure_wear_leveling           ## TAILCALL
LBB0_7:
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_wl_entry_destroy
	movq	_EIO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%r13d, %eax
	jne	LBB0_28
## %bb.8:
	cmpl	$0, 28(%rbx)
	je	LBB0_9
## %bb.10:
	leaq	24(%rbx), %r12
	movq	%r12, %rdi
	callq	_spin_lock
	movq	%rbx, %r14
	movl	(%rbx), %r15d
	xorl	%eax, %eax
	testl	%r15d, %r15d
	jne	LBB0_14
## %bb.11:
	movq	8(%r14), %rax
	testq	%rax, %rax
	je	LBB0_12
## %bb.13:
	decq	%rax
	movq	%rax, 8(%r14)
	movl	$1, %eax
LBB0_14:
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	%r12, %rdi
	callq	_spin_unlock
	leaq	L_.str.4(%rip), %rsi
	movq	%r14, %rdi
	movl	-48(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, %edx
	callq	_ubi_msg
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_ubi_io_mark_bad
	testl	%eax, %eax
	je	LBB0_15
## %bb.26:
	movl	%eax, %r13d
	movq	%r14, %rbx
	testl	%r15d, %r15d
	jne	LBB0_28
## %bb.27:
	movq	%r12, %rdi
	callq	_spin_lock
	incq	8(%rbx)
	movq	%r12, %rdi
	callq	_spin_unlock
	jmp	LBB0_28
LBB0_9:
	leaq	L_.str.2(%rip), %rsi
	movq	%rbx, %rdi
	movl	-48(%rbp), %edx                 ## 4-byte Reload
	xorl	%eax, %eax
	callq	_ubi_err
	jmp	LBB0_28
LBB0_15:
	movq	%r12, %rdi
	callq	_spin_lock
	movl	(%r14), %eax
	testl	%eax, %eax
	jle	LBB0_19
## %bb.16:
	testl	%r15d, %r15d
	jne	LBB0_18
## %bb.17:
	incq	8(%r14)
LBB0_18:
	decl	%eax
	movl	%eax, (%r14)
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
LBB0_19:
	incl	16(%r14)
	decl	20(%r14)
	movq	%r14, %rdi
	callq	_ubi_calculate_reserved
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_21
## %bb.20:
	leaq	L_.str.5(%rip), %rsi
LBB0_24:
	movq	%r14, %rdi
	callq	_ubi_warn
	jmp	LBB0_25
LBB0_12:
	movq	%r12, %rdi
	callq	_spin_unlock
	leaq	L_.str.3(%rip), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_ubi_err
	movq	%r14, %rbx
	jmp	LBB0_28
LBB0_21:
	movl	(%r14), %edx
	testl	%edx, %edx
	je	LBB0_23
## %bb.22:
	leaq	L_.str.6(%rip), %rsi
	movq	%r14, %rdi
	callq	_ubi_msg
LBB0_25:
	movq	%r12, %rdi
	callq	_spin_unlock
	xorl	%r13d, %r13d
	jmp	LBB0_29
LBB0_23:
	leaq	L_.str.7(%rip), %rsi
	jmp	LBB0_24
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"erase PEB %d EC %d LEB %d:%d"

L_.str.1:                               ## @.str.1
	.asciz	"failed to erase PEB %d, error %d"

	.comm	_EINTR,4,2                      ## @EINTR
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_EAGAIN,4,2                     ## @EAGAIN
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_EIO,4,2                        ## @EIO
L_.str.2:                               ## @.str.2
	.asciz	"bad physical eraseblock %d detected"

L_.str.3:                               ## @.str.3
	.asciz	"no reserved/available physical eraseblocks"

L_.str.4:                               ## @.str.4
	.asciz	"mark PEB %d as bad"

L_.str.5:                               ## @.str.5
	.asciz	"no PEBs in the reserved pool, used an available PEB"

L_.str.6:                               ## @.str.6
	.asciz	"%d PEBs left in the reserve"

L_.str.7:                               ## @.str.7
	.asciz	"last PEB from the reserve was used"

	.no_dead_strip	___erase_worker
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function __erase_worker
lCPI0_0:
	.long	1                               ; 0x1
	.long	4294967295                      ; 0xffffffff
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	2
___erase_worker:                        ; @__erase_worker
	.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
	mov	x20, x1
	mov	x19, x0
	ldr	x21, [x1, #16]
	ldp	w23, w24, [x1]
	ldp	w22, w2, [x21]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x22
	mov	x3, x23
	mov	x4, x24
	bl	_dbg_wl
	ldr	w2, [x20, #8]
	mov	x0, x19
	mov	x1, x21
	bl	_sync_erase
	cbz	w0, LBB0_9
; %bb.1:
	mov	x20, x0
	stp	x22, x20, [sp]
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_ubi_err
Lloh4:
	adrp	x8, _EINTR@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EINTR@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	cmn	w20, w8
	b.eq	LBB0_5
; %bb.2:
Lloh7:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh8:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	cmn	w20, w8
	b.eq	LBB0_5
; %bb.3:
Lloh10:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	cmn	w20, w8
	b.eq	LBB0_5
; %bb.4:
Lloh13:
	adrp	x8, _EBUSY@GOTPAGE
Lloh14:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	cmn	w20, w8
	b.ne	LBB0_10
LBB0_5:
	mov	x0, x19
	mov	x1, x21
	mov	x2, x23
	mov	x3, x24
	mov	w4, #0
	mov	w5, #0
	bl	_schedule_erase
	cbz	w0, LBB0_8
; %bb.6:
	mov	x22, x0
	mov	x0, x19
	mov	x1, x21
	bl	_wl_entry_destroy
	mov	x20, x22
LBB0_7:
	mov	x0, x19
	bl	_ubi_ro_mode
LBB0_8:
	mov	x0, x20
	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
LBB0_9:
	add	x20, x19, #32
	mov	x0, x20
	bl	_spin_lock
	add	x1, x19, #40
	mov	x0, x21
	bl	_wl_tree_add
	ldr	w8, [x19, #36]
	add	w8, w8, #1
	str	w8, [x19, #36]
	mov	x0, x20
	bl	_spin_unlock
	mov	x0, x19
	bl	_serve_prot_queue
	mov	x0, x19
	mov	w1, #1
	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
	b	_ensure_wear_leveling
LBB0_10:
	mov	x0, x19
	mov	x1, x21
	bl	_wl_entry_destroy
Lloh16:
	adrp	x8, _EIO@GOTPAGE
Lloh17:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	cmn	w20, w8
	b.ne	LBB0_7
; %bb.11:
	ldr	w8, [x19, #28]
	cbz	w8, LBB0_14
; %bb.12:
	add	x21, x19, #24
	mov	x0, x21
	bl	_spin_lock
	ldr	w24, [x19]
	cbz	w24, LBB0_16
; %bb.13:
	mov	w23, #0
	b	LBB0_18
LBB0_14:
                                        ; kill: def $w22 killed $w22 killed $x22 def $x22
	str	x22, [sp]
Lloh19:
	adrp	x1, l_.str.2@PAGE
Lloh20:
	add	x1, x1, l_.str.2@PAGEOFF
LBB0_15:
	mov	x0, x19
	bl	_ubi_err
	b	LBB0_7
LBB0_16:
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_28
; %bb.17:
	sub	x8, x8, #1
	str	x8, [x19, #8]
	mov	w23, #1
LBB0_18:
	mov	x0, x21
	bl	_spin_unlock
Lloh21:
	adrp	x1, l_.str.4@PAGE
Lloh22:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x0, x19
	mov	x2, x22
	bl	_ubi_msg
	mov	x0, x19
	mov	x1, x22
	bl	_ubi_io_mark_bad
	cbz	w0, LBB0_21
; %bb.19:
	mov	x20, x0
	cbnz	w24, LBB0_7
; %bb.20:
	mov	x0, x21
	bl	_spin_lock
	ldr	x8, [x19, #8]
	add	x8, x8, #1
	str	x8, [x19, #8]
	mov	x0, x21
	bl	_spin_unlock
	b	LBB0_7
LBB0_21:
	mov	x0, x21
	bl	_spin_lock
	ldr	w8, [x19]
	subs	w8, w8, #1
	b.lt	LBB0_25
; %bb.22:
	cbnz	w24, LBB0_24
; %bb.23:
	ldr	x9, [x19, #8]
	add	x9, x9, #1
	str	x9, [x19, #8]
LBB0_24:
	mov	w23, #0
	str	w8, [x19]
LBB0_25:
	ldr	d0, [x19, #16]
Lloh23:
	adrp	x8, lCPI0_0@PAGE
Lloh24:
	ldr	d1, [x8, lCPI0_0@PAGEOFF]
	add.2s	v0, v0, v1
	str	d0, [x19, #16]
	mov	x0, x19
	bl	_ubi_calculate_reserved
	cbz	w23, LBB0_29
; %bb.26:
Lloh25:
	adrp	x1, l_.str.5@PAGE
Lloh26:
	add	x1, x1, l_.str.5@PAGEOFF
LBB0_27:
	mov	x0, x19
	bl	_ubi_warn
	b	LBB0_31
LBB0_28:
	mov	x0, x21
	bl	_spin_unlock
Lloh27:
	adrp	x1, l_.str.3@PAGE
Lloh28:
	add	x1, x1, l_.str.3@PAGEOFF
	b	LBB0_15
LBB0_29:
	ldr	w2, [x19]
	cbz	w2, LBB0_32
; %bb.30:
Lloh29:
	adrp	x1, l_.str.6@PAGE
Lloh30:
	add	x1, x1, l_.str.6@PAGEOFF
	mov	x0, x19
	bl	_ubi_msg
LBB0_31:
	mov	x0, x21
	bl	_spin_unlock
	mov	w20, #0
	b	LBB0_8
LBB0_32:
Lloh31:
	adrp	x1, l_.str.7@PAGE
Lloh32:
	add	x1, x1, l_.str.7@PAGEOFF
	b	LBB0_27
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdr	Lloh23, Lloh24
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpAdd	Lloh31, Lloh32
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"erase PEB %d EC %d LEB %d:%d"

l_.str.1:                               ; @.str.1
	.asciz	"failed to erase PEB %d, error %d"

	.comm	_EINTR,4,2                      ; @EINTR
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_EAGAIN,4,2                     ; @EAGAIN
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_EIO,4,2                        ; @EIO
l_.str.2:                               ; @.str.2
	.asciz	"bad physical eraseblock %d detected"

l_.str.3:                               ; @.str.3
	.asciz	"no reserved/available physical eraseblocks"

l_.str.4:                               ; @.str.4
	.asciz	"mark PEB %d as bad"

l_.str.5:                               ; @.str.5
	.asciz	"no PEBs in the reserved pool, used an available PEB"

l_.str.6:                               ; @.str.6
	.asciz	"%d PEBs left in the reserve"

l_.str.7:                               ; @.str.7
	.asciz	"last PEB from the reserve was used"

	.no_dead_strip	___erase_worker
.subsections_via_symbols
