	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ubi_io_sync_erase              ## -- Begin function ubi_io_sync_erase
	.p2align	4, 0x90
_ubi_io_sync_erase:                     ## @ubi_io_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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r15d
	movl	%esi, %ebx
	movq	%rdi, %r14
	xorl	%edi, %edi
	testl	%esi, %esi
	js	LBB0_2
## %bb.1:
	cmpl	%ebx, (%r14)
	setg	%dil
LBB0_2:
	callq	_ubi_assert
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_paranoid_check_not_bad
	testl	%eax, %eax
	je	LBB0_4
## %bb.3:
	movl	%eax, %ecx
	movq	_EINVAL@GOTPCREL(%rip), %rdx
	xorl	%eax, %eax
	subl	(%rdx), %eax
	testl	%ecx, %ecx
	cmovlel	%ecx, %eax
	jmp	LBB0_13
LBB0_4:
	cmpq	$0, 16(%r14)
	je	LBB0_6
## %bb.5:
	leaq	L_.str(%rip), %rdi
	callq	_ubi_err
	movq	_EROFS@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_13:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	cmpq	$0, 8(%r14)
	je	LBB0_8
## %bb.7:
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_nor_erase_prepare
	testl	%eax, %eax
	jne	LBB0_13
LBB0_8:
	testl	%r15d, %r15d
	je	LBB0_9
## %bb.10:
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_torture_peb
	movl	%eax, %r15d
	testl	%eax, %eax
	jns	LBB0_11
	jmp	LBB0_13
LBB0_9:
	xorl	%r15d, %r15d
LBB0_11:
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_do_sync_erase
	testl	%eax, %eax
	jne	LBB0_13
## %bb.12:
	incl	%r15d
	movl	%r15d, %eax
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"read-only mode"

	.comm	_EROFS,4,2                      ## @EROFS
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ubi_io_sync_erase              ; -- Begin function ubi_io_sync_erase
	.p2align	2
_ubi_io_sync_erase:                     ; @ubi_io_sync_erase
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x21, x2
	mov	x19, x1
	mov	x20, x0
	tbnz	w1, #31, LBB0_2
; %bb.1:
	ldr	w8, [x20]
	cmp	w8, w19
	cset	w0, gt
	b	LBB0_3
LBB0_2:
	mov	w0, #0
LBB0_3:
	bl	_ubi_assert
	mov	x0, x20
	mov	x1, x19
	bl	_paranoid_check_not_bad
	cbz	w0, LBB0_5
; %bb.4:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w0, #0
	csneg	w22, w0, w8, le
	b	LBB0_13
LBB0_5:
	ldr	x8, [x20, #16]
	cbz	x8, LBB0_7
; %bb.6:
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	bl	_ubi_err
Lloh5:
	adrp	x8, _EROFS@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EROFS@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_13
LBB0_7:
	ldr	x8, [x20, #8]
	cbz	x8, LBB0_9
; %bb.8:
	mov	x0, x20
	mov	x1, x19
	bl	_nor_erase_prepare
	mov	x22, x0
	cbnz	w0, LBB0_13
LBB0_9:
	cbz	w21, LBB0_11
; %bb.10:
	mov	x0, x20
	mov	x1, x19
	bl	_torture_peb
	mov	x22, x0
	tbz	w0, #31, LBB0_12
	b	LBB0_13
LBB0_11:
	mov	w22, #0
LBB0_12:
	mov	x0, x20
	mov	x1, x19
	bl	_do_sync_erase
	cmp	w0, #0
	csinc	w22, w0, w22, ne
LBB0_13:
	mov	x0, x22
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"read-only mode"

	.comm	_EROFS,4,2                      ; @EROFS
.subsections_via_symbols
