	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sync_erase
_sync_erase:                            ## @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	%edx, %r13d
	movq	%rsi, %r14
	movq	%rdi, %r15
	movq	(%rsi), %r12
	movl	8(%rsi), %esi
	leaq	L_.str(%rip), %rdi
	movq	%r12, %rdx
	callq	_dbg_wl
	movl	8(%r14), %esi
	movq	(%r14), %rdx
	movq	%r15, %rdi
	callq	_paranoid_check_ec
	testl	%eax, %eax
	jle	LBB0_3
## %bb.1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_14
LBB0_3:
	movl	12(%r15), %edi
	movq	_GFP_NOFS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_kzalloc
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	testq	%rax, %rax
	je	LBB0_4
## %bb.5:
	movl	8(%r14), %esi
	movq	%r15, %rdi
	movl	%r13d, %edx
	callq	_ubi_io_sync_erase
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_6
## %bb.7:
	movl	%ebx, %eax
	addq	%rax, %r12
	movq	_UBI_MAX_ERASECOUNTER@GOTPCREL(%rip), %rax
	movl	8(%r14), %esi
	cmpq	(%rax), %r12
	movq	-48(%rbp), %r13                 ## 8-byte Reload
	jbe	LBB0_9
## %bb.8:
	leaq	L_.str.1(%rip), %rdi
	movq	%r12, %rdx
	callq	_ubi_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_13
LBB0_4:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_6:
	movq	-48(%rbp), %r13                 ## 8-byte Reload
	jmp	LBB0_13
LBB0_9:
	leaq	L_.str.2(%rip), %rdi
	movq	%r12, %rdx
	callq	_dbg_wl
	movq	%r12, %rdi
	callq	_cpu_to_be64
	movl	%eax, (%r13)
	movl	8(%r14), %esi
	movq	%r15, %rdi
	movq	%r13, %rdx
	callq	_ubi_io_write_ec_hdr
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_13
## %bb.10:
	movq	%r12, (%r14)
	leaq	8(%r15), %rbx
	movq	%rbx, %rdi
	callq	_spin_lock
	movq	(%r14), %rax
	cmpq	(%r15), %rax
	jbe	LBB0_12
## %bb.11:
	movq	%rax, (%r15)
LBB0_12:
	movq	%rbx, %rdi
	callq	_spin_unlock
	xorl	%ebx, %ebx
LBB0_13:
	movq	%r13, %rdi
	callq	_kfree
LBB0_14:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"erase PEB %d, old EC %llu"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_GFP_NOFS,4,2                   ## @GFP_NOFS
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_UBI_MAX_ERASECOUNTER,8,3       ## @UBI_MAX_ERASECOUNTER
L_.str.1:                               ## @.str.1
	.asciz	"erase counter overflow at PEB %d, EC %llu"

L_.str.2:                               ## @.str.2
	.asciz	"erased PEB %d, new EC %llu"

	.no_dead_strip	_sync_erase
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sync_erase
_sync_erase:                            ; @sync_erase
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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	x23, x2
	mov	x21, x1
	mov	x19, x0
	ldr	x22, [x1]
	ldr	w1, [x1, #8]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x2, x22
	bl	_dbg_wl
	ldr	w1, [x21, #8]
	ldr	x2, [x21]
	mov	x0, x19
	bl	_paranoid_check_ec
	cmp	w0, #1
	b.lt	LBB0_3
; %bb.1:
Lloh2:
	adrp	x8, _EINVAL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_2:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_13
LBB0_3:
	ldr	w0, [x19, #12]
Lloh4:
	adrp	x8, _GFP_NOFS@GOTPAGE
Lloh5:
	ldr	x8, [x8, _GFP_NOFS@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
	bl	_kzalloc
	cbz	x0, LBB0_7
; %bb.4:
	mov	x20, x0
	ldr	w1, [x21, #8]
	mov	x0, x19
	mov	x2, x23
	bl	_ubi_io_sync_erase
	mov	x23, x0
	tbnz	w0, #31, LBB0_12
; %bb.5:
	add	x22, x22, w23, uxtw
Lloh7:
	adrp	x8, _UBI_MAX_ERASECOUNTER@GOTPAGE
Lloh8:
	ldr	x8, [x8, _UBI_MAX_ERASECOUNTER@GOTPAGEOFF]
Lloh9:
	ldr	x8, [x8]
	ldr	w1, [x21, #8]
	cmp	x22, x8
	b.ls	LBB0_8
; %bb.6:
Lloh10:
	adrp	x0, l_.str.1@PAGE
Lloh11:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x2, x22
	bl	_ubi_err
Lloh12:
	adrp	x8, _EINVAL@GOTPAGE
Lloh13:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_12
LBB0_7:
Lloh15:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh16:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_2
LBB0_8:
Lloh17:
	adrp	x0, l_.str.2@PAGE
Lloh18:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	x2, x22
	bl	_dbg_wl
	mov	x0, x22
	bl	_cpu_to_be64
	str	w0, [x20]
	ldr	w1, [x21, #8]
	mov	x0, x19
	mov	x2, x20
	bl	_ubi_io_write_ec_hdr
	mov	x23, x0
	cbnz	w0, LBB0_12
; %bb.9:
	str	x22, [x21]
	add	x22, x19, #8
	mov	x0, x22
	bl	_spin_lock
	ldr	x8, [x21]
	ldr	x9, [x19]
	cmp	x8, x9
	b.ls	LBB0_11
; %bb.10:
	str	x8, [x19]
LBB0_11:
	mov	x0, x22
	bl	_spin_unlock
	mov	w23, #0
LBB0_12:
	mov	x0, x20
	bl	_kfree
LBB0_13:
	mov	x0, x23
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"erase PEB %d, old EC %llu"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_GFP_NOFS,4,2                   ; @GFP_NOFS
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_UBI_MAX_ERASECOUNTER,8,3       ; @UBI_MAX_ERASECOUNTER
l_.str.1:                               ; @.str.1
	.asciz	"erase counter overflow at PEB %d, EC %llu"

l_.str.2:                               ; @.str.2
	.asciz	"erased PEB %d, new EC %llu"

	.no_dead_strip	_sync_erase
.subsections_via_symbols
