	.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, %rbx
	movq	%rdi, %r12
	callq	_to_sst25l_flash
	movq	%rax, %r14
	movl	(%rbx), %r15d
	movl	(%r12), %ecx
	movl	%r15d, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	jne	LBB0_1
## %bb.2:
	movl	4(%rbx), %r13d
	movl	%r13d, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	je	LBB0_3
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_10:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	movq	%r14, %rdi
	callq	_mutex_lock
	movq	%r14, %rdi
	callq	_sst25l_wait_till_ready
	testl	%eax, %eax
	je	LBB0_4
## %bb.11:
	movl	%eax, %ebx
	movq	%r14, %rdi
	callq	_mutex_unlock
	jmp	LBB0_10
LBB0_4:
	testl	%r15d, %r15d
	jle	LBB0_9
## %bb.5:
	addl	%r13d, %r15d
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	movl	%r13d, %esi
	callq	_sst25l_erase_sector
	testl	%eax, %eax
	jne	LBB0_7
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=1
	addl	(%r12), %r13d
	cmpl	%r15d, %r13d
	jl	LBB0_6
LBB0_9:
	movq	%r14, %rdi
	callq	_mutex_unlock
	xorl	%ebx, %ebx
	jmp	LBB0_10
LBB0_7:
	movl	%eax, %ebx
	movq	%r14, %rdi
	callq	_mutex_unlock
	movq	8(%r14), %rdi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Erase failed\n"

	.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	x21, x1
	mov	x20, x0
	bl	_to_sst25l_flash
	ldr	w23, [x21]
	ldr	w8, [x20]
	sdiv	w9, w23, w8
	msub	w9, w9, w8, w23
	cbnz	w9, LBB0_2
; %bb.1:
	ldr	w21, [x21, #4]
	sdiv	w9, w21, w8
	msub	w8, w9, w8, w21
	cbz	w8, LBB0_4
LBB0_2:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_3:
	mov	x0, x22
	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_4:
	mov	x19, x0
	bl	_mutex_lock
	mov	x0, x19
	bl	_sst25l_wait_till_ready
	cbz	w0, LBB0_6
; %bb.5:
	mov	x22, x0
	mov	x0, x19
	bl	_mutex_unlock
	b	LBB0_3
LBB0_6:
	cmp	w23, #1
	b.lt	LBB0_10
; %bb.7:
	add	w23, w21, w23
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	mov	x1, x21
	bl	_sst25l_erase_sector
	cbnz	w0, LBB0_11
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	ldr	w8, [x20]
	add	w21, w8, w21
	cmp	w21, w23
	b.lt	LBB0_8
LBB0_10:
	mov	x0, x19
	bl	_mutex_unlock
	mov	w22, #0
	b	LBB0_3
LBB0_11:
	mov	x22, x0
	mov	x0, x19
	bl	_mutex_unlock
	ldr	x0, [x19, #8]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_3
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Erase failed\n"

	.no_dead_strip	_sst25l_erase
.subsections_via_symbols
