	.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
	movl	%edx, %eax
	movq	%rsi, %rbx
	movq	8(%rsi), %r13
	movl	(%r13), %r15d
	movl	4(%r13), %edx
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rdi
	movl	%r15d, %esi
	callq	_dbg_wl
	movq	%rbx, %rdi
	callq	_kfree
	movq	_ubi_wl_entry_slab@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r13, %rsi
	callq	_kmem_cache_free
LBB0_23:
	xorl	%r12d, %r12d
LBB0_24:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movq	%rdi, %r14
	leaq	L_.str.1(%rip), %rdi
	movl	%r15d, %esi
	callq	_dbg_wl
	movl	(%rbx), %edx
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_sync_erase
	testl	%eax, %eax
	je	LBB0_25
## %bb.3:
	movl	%eax, %r12d
	leaq	L_.str.2(%rip), %rdi
	movl	%r15d, %esi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_ubi_err
	movq	%rbx, %rdi
	callq	_kfree
	movq	_ubi_wl_entry_slab@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r13, %rsi
	callq	_kmem_cache_free
	movq	_EINTR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%r12d, %eax
	je	LBB0_7
## %bb.4:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%r12d, %eax
	je	LBB0_7
## %bb.5:
	movq	_EAGAIN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%r12d, %eax
	je	LBB0_7
## %bb.6:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%r12d, %eax
	jne	LBB0_8
LBB0_7:
	movq	%r14, %rdi
	movq	%r13, %rsi
	xorl	%edx, %edx
	callq	_schedule_erase
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_24
LBB0_17:
	movq	%r14, %rdi
	callq	_ubi_ro_mode
	movl	%ebx, %r12d
	jmp	LBB0_24
LBB0_25:
	movq	%rbx, %rdi
	callq	_kfree
	leaq	32(%r14), %rbx
	movq	%rbx, %rdi
	callq	_spin_lock
	leaq	36(%r14), %rsi
	movq	%r13, %rdi
	callq	_wl_tree_add
	movq	%rbx, %rdi
	callq	_spin_unlock
	movq	%r14, %rdi
	callq	_serve_prot_queue
	movq	%r14, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ensure_wear_leveling           ## TAILCALL
LBB0_8:
	movq	_EIO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%r12d, %eax
	jne	LBB0_16
## %bb.9:
	cmpl	$0, 28(%r14)
	je	LBB0_10
## %bb.11:
	leaq	24(%r14), %r13
	movq	%r13, %rdi
	callq	_spin_lock
	movl	(%r14), %eax
	movl	4(%r14), %ebx
	subl	%ebx, %eax
	js	LBB0_14
## %bb.12:
	leal	1(%rax), %esi
	movl	8(%r14), %ecx
	cmpl	%eax, %ecx
	cmovlel	%ecx, %esi
	subl	%esi, %ecx
	movl	%ecx, 8(%r14)
	addl	%esi, 12(%r14)
	addl	%esi, %ebx
	movl	%ebx, 4(%r14)
	testl	%esi, %esi
	jle	LBB0_14
## %bb.13:
	leaq	L_.str.4(%rip), %rdi
	callq	_ubi_msg
	movl	4(%r14), %ebx
LBB0_14:
	movq	%r13, %rdi
	callq	_spin_unlock
	testl	%ebx, %ebx
	je	LBB0_15
## %bb.18:
	leaq	L_.str.6(%rip), %rdi
	movl	%r15d, %esi
	callq	_ubi_msg
	movq	%r14, %rdi
	movl	%r15d, %esi
	callq	_ubi_io_mark_bad
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_17
## %bb.19:
	movq	%r13, %rdi
	callq	_spin_lock
	decl	4(%r14)
	incl	16(%r14)
	decl	20(%r14)
	movq	%r14, %rdi
	callq	_ubi_calculate_reserved
	movl	4(%r14), %esi
	testl	%esi, %esi
	je	LBB0_21
## %bb.20:
	leaq	L_.str.7(%rip), %rdi
	callq	_ubi_msg
	jmp	LBB0_22
LBB0_10:
	leaq	L_.str.3(%rip), %rdi
	movl	%r15d, %esi
	xorl	%eax, %eax
	callq	_ubi_err
	jmp	LBB0_16
LBB0_15:
	leaq	L_.str.5(%rip), %rdi
	xorl	%eax, %eax
	callq	_ubi_err
LBB0_16:
	movl	%r12d, %ebx
	jmp	LBB0_17
LBB0_21:
	leaq	L_.str.8(%rip), %rdi
	callq	_ubi_warn
LBB0_22:
	movq	%r13, %rdi
	callq	_spin_unlock
	jmp	LBB0_23
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"cancel erasure of PEB %d EC %d"

	.comm	_ubi_wl_entry_slab,4,2          ## @ubi_wl_entry_slab
L_.str.1:                               ## @.str.1
	.asciz	"erase PEB %d EC %d"

L_.str.2:                               ## @.str.2
	.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.3:                               ## @.str.3
	.asciz	"bad physical eraseblock %d detected"

L_.str.4:                               ## @.str.4
	.asciz	"reserve more %d PEBs"

L_.str.5:                               ## @.str.5
	.asciz	"no reserved physical eraseblocks"

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

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

L_.str.8:                               ## @.str.8
	.asciz	"last PEB from the reserved pool 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	x8, x2
	mov	x23, x1
	ldr	x22, [x1, #8]
	ldp	w21, w2, [x22]
	cbz	w8, LBB0_4
; %bb.1:
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x21
	bl	_dbg_wl
	mov	x0, x23
	bl	_kfree
Lloh2:
	adrp	x8, _ubi_wl_entry_slab@GOTPAGE
Lloh3:
	ldr	x8, [x8, _ubi_wl_entry_slab@GOTPAGEOFF]
Lloh4:
	ldr	w0, [x8]
	mov	x1, x22
	bl	_kmem_cache_free
LBB0_2:
	mov	w20, #0
LBB0_3:
	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_4:
	mov	x19, x0
Lloh5:
	adrp	x0, l_.str.1@PAGE
Lloh6:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x21
	bl	_dbg_wl
	ldr	w2, [x23]
	mov	x0, x19
	mov	x1, x22
	bl	_sync_erase
	cbz	w0, LBB0_11
; %bb.5:
	mov	x20, x0
	stp	x21, x20, [sp]
Lloh7:
	adrp	x0, l_.str.2@PAGE
Lloh8:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_ubi_err
	mov	x0, x23
	bl	_kfree
Lloh9:
	adrp	x8, _ubi_wl_entry_slab@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ubi_wl_entry_slab@GOTPAGEOFF]
Lloh11:
	ldr	w0, [x8]
	mov	x1, x22
	bl	_kmem_cache_free
Lloh12:
	adrp	x8, _EINTR@GOTPAGE
Lloh13:
	ldr	x8, [x8, _EINTR@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	cmn	w20, w8
	b.eq	LBB0_9
; %bb.6:
Lloh15:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh16:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	cmn	w20, w8
	b.eq	LBB0_9
; %bb.7:
Lloh18:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	cmn	w20, w8
	b.eq	LBB0_9
; %bb.8:
Lloh21:
	adrp	x8, _EBUSY@GOTPAGE
Lloh22:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	cmn	w20, w8
	b.ne	LBB0_12
LBB0_9:
	mov	x0, x19
	mov	x1, x22
	mov	w2, #0
	bl	_schedule_erase
	mov	x21, x0
	cbz	w0, LBB0_3
LBB0_10:
	mov	x0, x19
	bl	_ubi_ro_mode
	mov	x20, x21
	b	LBB0_3
LBB0_11:
	mov	x0, x23
	bl	_kfree
	add	x20, x19, #32
	mov	x0, x20
	bl	_spin_lock
	add	x1, x19, #36
	mov	x0, x22
	bl	_wl_tree_add
	mov	x0, x20
	bl	_spin_unlock
	mov	x0, x19
	bl	_serve_prot_queue
	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
	b	_ensure_wear_leveling
LBB0_12:
Lloh24:
	adrp	x8, _EIO@GOTPAGE
Lloh25:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh26:
	ldr	w8, [x8]
	cmn	w20, w8
	b.ne	LBB0_21
; %bb.13:
	ldr	w8, [x19, #28]
	cbz	w8, LBB0_22
; %bb.14:
	add	x22, x19, #24
	mov	x0, x22
	bl	_spin_lock
	ldp	w8, w23, [x19]
	subs	w8, w8, w23
	b.mi	LBB0_17
; %bb.15:
	ldp	w9, w10, [x19, #8]
	cmp	w9, w8
	csinc	w1, w9, w8, le
	sub	w8, w9, w1
	add	w9, w10, w1
	stp	w8, w9, [x19, #8]
	add	w23, w1, w23
	str	w23, [x19, #4]
	cmp	w1, #1
	b.lt	LBB0_17
; %bb.16:
Lloh27:
	adrp	x0, l_.str.4@PAGE
Lloh28:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_ubi_msg
	ldr	w23, [x19, #4]
LBB0_17:
	mov	x0, x22
	bl	_spin_unlock
	cbz	w23, LBB0_23
; %bb.18:
Lloh29:
	adrp	x0, l_.str.6@PAGE
Lloh30:
	add	x0, x0, l_.str.6@PAGEOFF
	mov	x1, x21
	bl	_ubi_msg
	mov	x0, x19
	mov	x1, x21
	bl	_ubi_io_mark_bad
	mov	x21, x0
	cbnz	w0, LBB0_10
; %bb.19:
	mov	x0, x22
	bl	_spin_lock
	ldr	w8, [x19, #4]
	sub	w8, w8, #1
	str	w8, [x19, #4]
	ldr	d0, [x19, #16]
Lloh31:
	adrp	x8, lCPI0_0@PAGE
Lloh32:
	ldr	d1, [x8, lCPI0_0@PAGEOFF]
	add.2s	v0, v0, v1
	str	d0, [x19, #16]
	mov	x0, x19
	bl	_ubi_calculate_reserved
	ldr	w1, [x19, #4]
	cbz	w1, LBB0_25
; %bb.20:
Lloh33:
	adrp	x0, l_.str.7@PAGE
Lloh34:
	add	x0, x0, l_.str.7@PAGEOFF
	bl	_ubi_msg
	b	LBB0_26
LBB0_21:
	mov	x21, x20
	b	LBB0_10
LBB0_22:
                                        ; kill: def $w21 killed $w21 killed $x21 def $x21
	str	x21, [sp]
Lloh35:
	adrp	x0, l_.str.3@PAGE
Lloh36:
	add	x0, x0, l_.str.3@PAGEOFF
	b	LBB0_24
LBB0_23:
Lloh37:
	adrp	x0, l_.str.5@PAGE
Lloh38:
	add	x0, x0, l_.str.5@PAGEOFF
LBB0_24:
	bl	_ubi_err
	mov	x21, x20
	b	LBB0_10
LBB0_25:
Lloh39:
	adrp	x0, l_.str.8@PAGE
Lloh40:
	add	x0, x0, l_.str.8@PAGEOFF
	bl	_ubi_warn
LBB0_26:
	mov	x0, x22
	bl	_spin_unlock
	b	LBB0_2
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpLdr	Lloh31, Lloh32
	.loh AdrpAdd	Lloh33, Lloh34
	.loh AdrpAdd	Lloh35, Lloh36
	.loh AdrpAdd	Lloh37, Lloh38
	.loh AdrpAdd	Lloh39, Lloh40
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"cancel erasure of PEB %d EC %d"

	.comm	_ubi_wl_entry_slab,4,2          ; @ubi_wl_entry_slab
l_.str.1:                               ; @.str.1
	.asciz	"erase PEB %d EC %d"

l_.str.2:                               ; @.str.2
	.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.3:                               ; @.str.3
	.asciz	"bad physical eraseblock %d detected"

l_.str.4:                               ; @.str.4
	.asciz	"reserve more %d PEBs"

l_.str.5:                               ; @.str.5
	.asciz	"no reserved physical eraseblocks"

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

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

l_.str.8:                               ; @.str.8
	.asciz	"last PEB from the reserved pool was used"

	.no_dead_strip	_erase_worker
.subsections_via_symbols
