	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nand_erase_op                  ## -- Begin function nand_erase_op
	.p2align	4, 0x90
_nand_erase_op:                         ## @nand_erase_op
	.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
	subq	$56, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -32(%rbp)
	movl	(%rdi), %ecx
	subl	4(%rdi), %ecx
	movl	%esi, %ebx
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %ebx
	callq	_nand_has_exec_op
	testq	%rax, %rax
	je	LBB0_6
## %bb.1:
	leaq	36(%r15), %rdi
	callq	_nand_get_sdr_timings
	movq	%rax, %r14
	movl	%ebx, -44(%rbp)
	movl	%ebx, %eax
	shrl	$8, %eax
	movl	%eax, -40(%rbp)
	shrl	$16, %ebx
	movl	%ebx, -36(%rbp)
	movq	_NAND_CMD_ERASE1@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	xorl	%esi, %esi
	callq	_NAND_OP_CMD
	movl	%eax, -64(%rbp)
	leaq	-44(%rbp), %rsi
	movl	$2, %edi
	xorl	%edx, %edx
	callq	_NAND_OP_ADDR
	movl	%eax, -60(%rbp)
	movq	_NAND_CMD_ERASE2@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movl	4(%r14), %edi
	callq	_PSEC_TO_MSEC
	movl	%ebx, %edi
	movl	%eax, %esi
	callq	_NAND_OP_CMD
	movl	%eax, -56(%rbp)
	movl	(%r14), %edi
	callq	_PSEC_TO_MSEC
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_NAND_OP_WAIT_RDY
	movl	%eax, -52(%rbp)
	movl	32(%r15), %edi
	leaq	-64(%rbp), %rsi
	callq	_NAND_OPERATION
	movl	%eax, -72(%rbp)
	movq	_NAND_ROW_ADDR_3@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 8(%r15)
	je	LBB0_3
## %bb.2:
	incl	-60(%rbp)
LBB0_3:
	leaq	-72(%rbp), %rsi
	movq	%r15, %rdi
	callq	_nand_exec_op
	testl	%eax, %eax
	jne	LBB0_10
## %bb.4:
	leaq	-76(%rbp), %rsi
	movq	%r15, %rdi
	callq	_nand_status_op
	testl	%eax, %eax
	jne	LBB0_10
## %bb.5:
	movl	-76(%rbp), %eax
	jmp	LBB0_7
LBB0_6:
	movq	_NAND_CMD_ERASE1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	movl	$-1, %edx
	movl	%ebx, %ecx
	callq	*24(%r15)
	movq	_NAND_CMD_ERASE2@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	movl	$-1, %edx
	movl	$-1, %ecx
	callq	*24(%r15)
	movq	%r15, %rdi
	callq	*16(%r15)
	testl	%eax, %eax
	js	LBB0_10
LBB0_7:
	movq	_NAND_STATUS_FAIL@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_8
## %bb.9:
	movq	_EIO@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_10
LBB0_8:
	xorl	%eax, %eax
LBB0_10:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-32(%rbp), %rcx
	jne	LBB0_12
## %bb.11:
	addq	$56, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_NAND_CMD_ERASE1,4,2            ## @NAND_CMD_ERASE1
	.comm	_NAND_CMD_ERASE2,4,2            ## @NAND_CMD_ERASE2
	.comm	_NAND_ROW_ADDR_3,4,2            ## @NAND_ROW_ADDR_3
	.comm	_NAND_STATUS_FAIL,4,2           ## @NAND_STATUS_FAIL
	.comm	_EIO,4,2                        ## @EIO
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function nand_erase_op
lCPI0_0:
	.long	4294967288                      ; 0xfffffff8
	.long	4294967280                      ; 0xfffffff0
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_nand_erase_op
	.p2align	2
_nand_erase_op:                         ; @nand_erase_op
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #40]
	ldp	w8, w9, [x0]
	sub	w8, w8, w9
	lsl	w20, w1, w8
	bl	_nand_has_exec_op
	cbz	x0, LBB0_6
; %bb.1:
	add	x0, x19, #36
	bl	_nand_get_sdr_timings
	mov	x21, x0
	str	w20, [sp, #28]
	dup.2s	v0, w20
Lloh3:
	adrp	x8, lCPI0_0@PAGE
Lloh4:
	ldr	d1, [x8, lCPI0_0@PAGEOFF]
	ushl.2s	v0, v0, v1
	stur	d0, [sp, #32]
Lloh5:
	adrp	x8, _NAND_CMD_ERASE1@GOTPAGE
Lloh6:
	ldr	x8, [x8, _NAND_CMD_ERASE1@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
	mov	w1, #0
	bl	_NAND_OP_CMD
	str	w0, [sp, #8]
	add	x1, sp, #28
	mov	w0, #2
	mov	w2, #0
	bl	_NAND_OP_ADDR
	str	w0, [sp, #12]
Lloh8:
	adrp	x8, _NAND_CMD_ERASE2@GOTPAGE
Lloh9:
	ldr	x8, [x8, _NAND_CMD_ERASE2@GOTPAGEOFF]
Lloh10:
	ldr	w20, [x8]
	ldr	w0, [x21, #4]
	bl	_PSEC_TO_MSEC
	mov	x1, x0
	mov	x0, x20
	bl	_NAND_OP_CMD
	str	w0, [sp, #16]
	ldr	w0, [x21]
	bl	_PSEC_TO_MSEC
	mov	w1, #0
	bl	_NAND_OP_WAIT_RDY
	str	w0, [sp, #20]
	ldr	w0, [x19, #32]
	add	x1, sp, #8
	bl	_NAND_OPERATION
	str	w0, [sp]
	ldr	w8, [x19, #8]
Lloh11:
	adrp	x9, _NAND_ROW_ADDR_3@GOTPAGE
Lloh12:
	ldr	x9, [x9, _NAND_ROW_ADDR_3@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_3
; %bb.2:
	ldr	w8, [sp, #12]
	add	w8, w8, #1
	str	w8, [sp, #12]
LBB0_3:
	mov	x1, sp
	mov	x0, x19
	bl	_nand_exec_op
	cbnz	w0, LBB0_10
; %bb.4:
	add	x1, sp, #4
	mov	x0, x19
	bl	_nand_status_op
	cbnz	w0, LBB0_10
; %bb.5:
	ldr	w0, [sp, #4]
	b	LBB0_7
LBB0_6:
	ldr	x8, [x19, #24]
Lloh14:
	adrp	x9, _NAND_CMD_ERASE1@GOTPAGE
Lloh15:
	ldr	x9, [x9, _NAND_CMD_ERASE1@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x9]
	mov	x0, x19
	mov	w2, #-1
	mov	x3, x20
	blr	x8
	ldr	x8, [x19, #24]
Lloh17:
	adrp	x9, _NAND_CMD_ERASE2@GOTPAGE
Lloh18:
	ldr	x9, [x9, _NAND_CMD_ERASE2@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x9]
	mov	x0, x19
	mov	w2, #-1
	mov	w3, #-1
	blr	x8
	ldr	x8, [x19, #16]
	mov	x0, x19
	blr	x8
	tbnz	w0, #31, LBB0_10
LBB0_7:
Lloh20:
	adrp	x8, _NAND_STATUS_FAIL@GOTPAGE
Lloh21:
	ldr	x8, [x8, _NAND_STATUS_FAIL@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	tst	w8, w0
	b.eq	LBB0_9
; %bb.8:
Lloh23:
	adrp	x8, _EIO@GOTPAGE
Lloh24:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_10
LBB0_9:
	mov	w0, #0
LBB0_10:
	ldr	x8, [sp, #40]
Lloh26:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh27:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh28:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_12
; %bb.11:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_12:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdrp	Lloh3, Lloh5
	.loh AdrpLdr	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_NAND_CMD_ERASE1,4,2            ; @NAND_CMD_ERASE1
	.comm	_NAND_CMD_ERASE2,4,2            ; @NAND_CMD_ERASE2
	.comm	_NAND_ROW_ADDR_3,4,2            ; @NAND_ROW_ADDR_3
	.comm	_NAND_STATUS_FAIL,4,2           ; @NAND_STATUS_FAIL
	.comm	_EIO,4,2                        ; @EIO
.subsections_via_symbols
