	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sst25l_erase
_sst25l_erase:                          ## @sst25l_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
	movq	%rsi, %r15
	movq	%rdi, %r12
	callq	_to_sst25l_flash
	movq	%rax, %rbx
	movq	(%r15), %r13
	movq	8(%r15), %rax
	leaq	(%rax,%r13), %r14
	cmpq	16(%rbx), %r14
	jg	LBB0_1
## %bb.2:
	movl	(%r12), %ecx
                                        ## kill: def $eax killed $eax killed $rax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	jne	LBB0_1
## %bb.3:
	movl	%r13d, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	je	LBB0_4
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_11:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movq	%rbx, %rdi
	callq	_mutex_lock
	movq	%rbx, %rdi
	callq	_sst25l_wait_till_ready
	movq	%rbx, %rdi
	testl	%eax, %eax
	je	LBB0_5
## %bb.12:
	movl	%eax, %ebx
	callq	_mutex_unlock
	jmp	LBB0_11
LBB0_5:
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	cmpl	%r14d, %r13d
	jge	LBB0_10
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	%r13d, %esi
	callq	_sst25l_erase_sector
	testl	%eax, %eax
	jne	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_7 Depth=1
	addl	(%r12), %r13d
	cmpl	%r14d, %r13d
	jl	LBB0_7
LBB0_10:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_mutex_unlock
	movq	_MTD_ERASE_DONE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 16(%r15)
	movq	%r15, %rdi
	callq	_mtd_erase_callback
	xorl	%ebx, %ebx
	jmp	LBB0_11
LBB0_8:
	movl	%eax, %ebx
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rdi
	callq	_mutex_unlock
	movq	_MTD_ERASE_FAILED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 16(%r15)
	movq	8(%r14), %rdi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_MTD_ERASE_FAILED,4,2           ## @MTD_ERASE_FAILED
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Erase failed\n"

	.comm	_MTD_ERASE_DONE,4,2             ## @MTD_ERASE_DONE
	.no_dead_strip	_sst25l_erase
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sst25l_erase
_sst25l_erase:                          ; @sst25l_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	x19, x1
	mov	x21, x0
	bl	_to_sst25l_flash
	ldp	x22, x8, [x19]
	ldr	x9, [x0, #16]
	add	x24, x8, x22
	cmp	x24, x9
	b.gt	LBB0_3
; %bb.1:
	ldr	w9, [x21]
	sdiv	w10, w8, w9
	msub	w8, w10, w9, w8
	cbnz	w8, LBB0_3
; %bb.2:
	sdiv	w8, w22, w9
	msub	w8, w8, w9, w22
	cbz	w8, LBB0_5
LBB0_3:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_4:
	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
LBB0_5:
	mov	x20, x0
	bl	_mutex_lock
	mov	x0, x20
	bl	_sst25l_wait_till_ready
	cbz	w0, LBB0_9
; %bb.6:
	mov	x23, x0
	mov	x0, x20
	bl	_mutex_unlock
	b	LBB0_4
LBB0_7:                                 ;   in Loop: Header=BB0_9 Depth=1
	mov	x0, x20
	mov	x1, x22
	bl	_sst25l_erase_sector
	cbnz	w0, LBB0_11
; %bb.8:                                ;   in Loop: Header=BB0_9 Depth=1
	ldr	w8, [x21]
	add	w22, w8, w22
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	cmp	w22, w24
	b.lt	LBB0_7
; %bb.10:
	mov	x0, x20
	bl	_mutex_unlock
Lloh3:
	adrp	x8, _MTD_ERASE_DONE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MTD_ERASE_DONE@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	str	w8, [x19, #16]
	mov	x0, x19
	bl	_mtd_erase_callback
	mov	w23, #0
	b	LBB0_4
LBB0_11:
	mov	x23, x0
	mov	x0, x20
	bl	_mutex_unlock
Lloh6:
	adrp	x8, _MTD_ERASE_FAILED@GOTPAGE
Lloh7:
	ldr	x8, [x8, _MTD_ERASE_FAILED@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	str	w8, [x19, #16]
	ldr	x0, [x20, #8]
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_MTD_ERASE_FAILED,4,2           ; @MTD_ERASE_FAILED
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Erase failed\n"

	.comm	_MTD_ERASE_DONE,4,2             ; @MTD_ERASE_DONE
	.no_dead_strip	_sst25l_erase
.subsections_via_symbols
