	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_SPIEraseAreaEx                 ## -- Begin function SPIEraseAreaEx
	.p2align	4, 0x90
_SPIEraseAreaEx:                        ## @SPIEraseAreaEx
	.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
                                        ## kill: def $esi killed $esi def $rsi
	movq	_FLASH_SECTOR_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	cmpl	$1, %ecx
	setne	%al
	movl	$1, %r14d
	testb	%dil, %al
	je	LBB0_1
LBB0_14:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movq	_FLASH_BLOCK_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cltd
	idivl	%ecx
	movl	%eax, %r14d
	movl	%edi, %eax
	cltd
	idivl	%ecx
	movl	%eax, %r13d
	leal	(%rsi,%rcx), %eax
	decl	%eax
	cltd
	idivl	%ecx
	movl	%r13d, %r15d
	addl	%eax, %r15d
	testl	%eax, %eax
	jle	LBB0_7
## %bb.2:
	leal	-1(%r14), %r12d
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	testl	%r12d, %r13d
	je	LBB0_7
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	%r13d, %edi
	callq	_SPIEraseSector
	testq	%rax, %rax
	jne	LBB0_5
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=1
	incl	%r13d
	cmpl	%r15d, %r13d
	jl	LBB0_3
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_7 Depth=1
	movl	%r13d, %eax
	cltd
	idivl	%r14d
	movl	%eax, %edi
	callq	_SPIEraseBlock
	movl	%ebx, %r13d
	testq	%rax, %rax
	jne	LBB0_10
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	leal	(%r14,%r13), %ebx
	cmpl	%r15d, %ebx
	jle	LBB0_9
## %bb.8:
	xorl	%r14d, %r14d
	cmpl	%r15d, %r13d
	jge	LBB0_14
	.p2align	4, 0x90
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movl	%r13d, %edi
	callq	_SPIEraseSector
	testq	%rax, %rax
	jne	LBB0_13
## %bb.11:                              ##   in Loop: Header=BB0_12 Depth=1
	incl	%r13d
	cmpl	%r13d, %r15d
	jne	LBB0_12
	jmp	LBB0_14
LBB0_10:
	movl	$3, %r14d
	jmp	LBB0_14
LBB0_5:
	movl	$2, %r14d
	jmp	LBB0_14
LBB0_13:
	movl	$4, %r14d
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_FLASH_SECTOR_SIZE,4,2          ## @FLASH_SECTOR_SIZE
	.comm	_FLASH_BLOCK_SIZE,4,2           ## @FLASH_BLOCK_SIZE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_SPIEraseAreaEx                 ; -- Begin function SPIEraseAreaEx
	.p2align	2
_SPIEraseAreaEx:                        ; @SPIEraseAreaEx
	.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
Lloh0:
	adrp	x8, _FLASH_SECTOR_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _FLASH_SECTOR_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, #1
	cset	w9, ne
	tst	w9, w0
	b.eq	LBB0_3
; %bb.1:
	mov	w0, #1
LBB0_2:
	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
LBB0_3:
Lloh3:
	adrp	x9, _FLASH_BLOCK_SIZE@GOTPAGE
Lloh4:
	ldr	x9, [x9, _FLASH_BLOCK_SIZE@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	sdiv	w19, w0, w8
	add	w10, w1, w8
	sub	w10, w10, #1
	sdiv	w10, w10, w8
	add	w20, w10, w19
	sdiv	w21, w9, w8
	cmp	w10, #1
	b.lt	LBB0_9
; %bb.4:
	sub	w22, w21, #1
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	tst	w19, w22
	b.eq	LBB0_9
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x19
	bl	_SPIEraseSector
	cbnz	x0, LBB0_15
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	add	w19, w19, #1
	cmp	w19, w20
	b.lt	LBB0_5
	b	LBB0_9
LBB0_8:                                 ;   in Loop: Header=BB0_9 Depth=1
	sdiv	w0, w19, w21
	bl	_SPIEraseBlock
	mov	x19, x22
	cbnz	x0, LBB0_14
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	add	w22, w19, w21
	cmp	w22, w20
	b.le	LBB0_8
; %bb.10:
	cmp	w19, w20
	b.ge	LBB0_13
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	bl	_SPIEraseSector
	cbnz	x0, LBB0_16
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	add	w19, w19, #1
	cmp	w20, w19
	b.ne	LBB0_11
LBB0_13:
	mov	w0, #0
	b	LBB0_2
LBB0_14:
	mov	w0, #3
	b	LBB0_2
LBB0_15:
	mov	w0, #2
	b	LBB0_2
LBB0_16:
	mov	w0, #4
	b	LBB0_2
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_FLASH_SECTOR_SIZE,4,2          ; @FLASH_SECTOR_SIZE
	.comm	_FLASH_BLOCK_SIZE,4,2           ; @FLASH_BLOCK_SIZE
.subsections_via_symbols
