	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function erase_chip
_erase_chip:                            ## @erase_chip
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
	movq	%rdi, %rbx
	movl	16(%rdi), %eax
	movl	20(%rdi), %edi
	sarl	$10, %eax
	movslq	%eax, %rdx
	leaq	L_.str(%rip), %rsi
	callq	_dev_dbg
	cmpq	$0, 8(%rbx)
	je	LBB0_2
## %bb.1:
	movq	_SPINOR_OP_CHIP_ERASE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	$1, %esi
	callq	_SPI_MEM_OP_CMD
	movq	_SPI_MEM_OP_NO_ADDR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movq	_SPI_MEM_OP_NO_DUMMY@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movq	_SPI_MEM_OP_NO_DATA@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%eax, %edi
	callq	_SPI_MEM_OP
	movl	%eax, -16(%rbp)
	movq	8(%rbx), %rdi
	leaq	-16(%rbp), %rsi
	callq	_spi_mem_exec_op
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
LBB0_2:
	movq	(%rbx), %rax
	movq	_SPINOR_OP_CHIP_ERASE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	jmpq	*%rax                           ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	" %lldKiB\n"

	.comm	_SPINOR_OP_CHIP_ERASE,4,2       ## @SPINOR_OP_CHIP_ERASE
	.comm	_SPI_MEM_OP_NO_ADDR,4,2         ## @SPI_MEM_OP_NO_ADDR
	.comm	_SPI_MEM_OP_NO_DUMMY,4,2        ## @SPI_MEM_OP_NO_DUMMY
	.comm	_SPI_MEM_OP_NO_DATA,4,2         ## @SPI_MEM_OP_NO_DATA
	.no_dead_strip	_erase_chip
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function erase_chip
_erase_chip:                            ; @erase_chip
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.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
	mov	x19, x0
	ldr	w0, [x0, #20]
	ldr	w8, [x19, #16]
	sbfx	x2, x8, #10, #22
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_2
; %bb.1:
Lloh2:
	adrp	x8, _SPINOR_OP_CHIP_ERASE@GOTPAGE
Lloh3:
	ldr	x8, [x8, _SPINOR_OP_CHIP_ERASE@GOTPAGEOFF]
Lloh4:
	ldr	w0, [x8]
	mov	w1, #1
	bl	_SPI_MEM_OP_CMD
Lloh5:
	adrp	x8, _SPI_MEM_OP_NO_ADDR@GOTPAGE
Lloh6:
	ldr	x8, [x8, _SPI_MEM_OP_NO_ADDR@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
Lloh8:
	adrp	x8, _SPI_MEM_OP_NO_DUMMY@GOTPAGE
Lloh9:
	ldr	x8, [x8, _SPI_MEM_OP_NO_DUMMY@GOTPAGEOFF]
Lloh10:
	ldr	w2, [x8]
Lloh11:
	adrp	x8, _SPI_MEM_OP_NO_DATA@GOTPAGE
Lloh12:
	ldr	x8, [x8, _SPI_MEM_OP_NO_DATA@GOTPAGEOFF]
Lloh13:
	ldr	w3, [x8]
	bl	_SPI_MEM_OP
	str	w0, [sp, #8]
	ldr	x0, [x19, #8]
	add	x1, sp, #8
	bl	_spi_mem_exec_op
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
LBB0_2:
Lloh14:
	adrp	x8, _SPINOR_OP_CHIP_ERASE@GOTPAGE
Lloh15:
	ldr	x8, [x8, _SPINOR_OP_CHIP_ERASE@GOTPAGEOFF]
	ldr	x4, [x19]
Lloh16:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, #0
	mov	w3, #0
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	br	x4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	" %lldKiB\n"

	.comm	_SPINOR_OP_CHIP_ERASE,4,2       ; @SPINOR_OP_CHIP_ERASE
	.comm	_SPI_MEM_OP_NO_ADDR,4,2         ; @SPI_MEM_OP_NO_ADDR
	.comm	_SPI_MEM_OP_NO_DUMMY,4,2        ; @SPI_MEM_OP_NO_DUMMY
	.comm	_SPI_MEM_OP_NO_DATA,4,2         ; @SPI_MEM_OP_NO_DATA
	.no_dead_strip	_erase_chip
.subsections_via_symbols
