	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nor_erase_prepare
_nor_erase_prepare:                     ## @nor_erase_prepare
	.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	%r12
	pushq	%rbx
	subq	$32, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	%rdi, %r12
	movq	$0, -40(%rbp)
	movl	(%rdi), %ebx
	imull	%esi, %ebx
	addl	4(%rdi), %ebx
	movq	8(%rdi), %rdi
	leaq	-56(%rbp), %rcx
	leaq	-40(%rbp), %r8
	movl	%ebx, %esi
	movl	$4, %edx
	callq	*(%rdi)
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	LBB0_3
## %bb.1:
	subl	4(%r12), %ebx
	movq	8(%r12), %rdi
	leaq	-56(%rbp), %rcx
	leaq	-40(%rbp), %r8
	movl	%ebx, %esi
	movl	$4, %edx
	callq	*(%rdi)
	movl	%eax, %r15d
	testl	%eax, %eax
	je	LBB0_2
LBB0_3:
	leaq	-48(%rbp), %rdx
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	movl	%r14d, %esi
	xorl	%ecx, %ecx
	callq	_ubi_io_read_vid_hdr
	movq	_UBI_IO_BAD_VID_HDR@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	je	LBB0_5
## %bb.4:
	leaq	L_.str(%rip), %rdi
	movl	%r14d, %esi
	movl	%r15d, %edx
	movl	%eax, %ecx
	callq	_ubi_err
	movl	(%r12), %ecx
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	movl	%r14d, %esi
	xorl	%edx, %edx
	callq	_ubi_dbg_dump_flash
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_5
LBB0_2:
	xorl	%ebx, %ebx
LBB0_5:
	movl	%ebx, %eax
	addq	$32, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_UBI_IO_BAD_VID_HDR,4,2         ## @UBI_IO_BAD_VID_HDR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"cannot invalidate PEB %d, write returned %d read returned %d"

	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_nor_erase_prepare
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nor_erase_prepare
_nor_erase_prepare:                     ; @nor_erase_prepare
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	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
	mov	x19, x1
	mov	x20, x0
	str	xzr, [sp, #16]
	ldp	w8, w9, [x0]
	madd	w22, w8, w1, w9
	ldr	x0, [x0, #8]
	ldr	x8, [x0]
	add	x3, sp, #24
	add	x4, sp, #16
	mov	x1, x22
	mov	w2, #4
	blr	x8
	mov	x21, x0
	cbnz	w0, LBB0_2
; %bb.1:
	ldr	w8, [x20, #4]
	sub	w1, w22, w8
	ldr	x0, [x20, #8]
	ldr	x8, [x0]
	add	x3, sp, #24
	add	x4, sp, #16
	mov	w2, #4
	blr	x8
	mov	x21, x0
	cbz	w0, LBB0_4
LBB0_2:
	add	x2, sp, #8
	mov	x0, x20
	mov	x1, x19
	mov	w3, #0
	bl	_ubi_io_read_vid_hdr
	mov	x3, x0
	mov	w0, #0
Lloh0:
	adrp	x8, _UBI_IO_BAD_VID_HDR@GOTPAGE
Lloh1:
	ldr	x8, [x8, _UBI_IO_BAD_VID_HDR@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w3, w8
	b.eq	LBB0_4
; %bb.3:
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	mov	x2, x21
	bl	_ubi_err
	ldr	w3, [x20]
	mov	x0, x20
	mov	x1, x19
	mov	w2, #0
	bl	_ubi_dbg_dump_flash
Lloh5:
	adrp	x8, _EIO@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_4:
	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
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.comm	_UBI_IO_BAD_VID_HDR,4,2         ; @UBI_IO_BAD_VID_HDR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"cannot invalidate PEB %d, write returned %d read returned %d"

	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_nor_erase_prepare
.subsections_via_symbols
