	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function erase_block
_erase_block:                           ## @erase_block
	.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
	movl	%esi, %r15d
	movq	%rdi, %r14
	addq	$16, %rdi
	callq	_get_qcom_nand_controller
	movq	%rax, %rbx
	movq	_NAND_FLASH_CMD@GOTPCREL(%rip), %rsi
	movq	_OP_BLOCK_ERASE@GOTPCREL(%rip), %rax
	movq	_PAGE_ACC@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	movl	(%rsi), %esi
	movq	_LAST_PAGE@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_nandc_set_reg
	movq	_NAND_ADDR0@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	movl	%r15d, %edx
	callq	_nandc_set_reg
	movq	_NAND_ADDR1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_nandc_set_reg
	movq	_NAND_DEV0_CFG0@GOTPCREL(%rip), %rsi
	movq	_CW_PER_PAGE@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	movl	$7, %edx
	shll	%cl, %edx
	movl	(%rsi), %esi
	notl	%edx
	andl	(%r14), %edx
	movq	%rbx, %rdi
	callq	_nandc_set_reg
	movq	_NAND_DEV0_CFG1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	4(%r14), %edx
	movq	%rbx, %rdi
	callq	_nandc_set_reg
	movq	_NAND_EXEC_CMD@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movq	%rbx, %rdi
	movl	$1, %edx
	callq	_nandc_set_reg
	movq	_NAND_FLASH_STATUS@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	movl	8(%r14), %edx
	movq	%rbx, %rdi
	callq	_nandc_set_reg
	movq	_NAND_READ_STATUS@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movl	12(%r14), %edx
	movq	%rbx, %rdi
	callq	_nandc_set_reg
	movq	_NAND_FLASH_CMD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_NAND_BAM_NEXT_SGL@GOTPCREL(%rip), %r14
	movl	(%r14), %ecx
	movq	%rbx, %rdi
	movl	$3, %edx
	callq	_write_reg_dma
	movq	_NAND_DEV0_CFG0@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%r14), %ecx
	movq	%rbx, %rdi
	movl	$2, %edx
	callq	_write_reg_dma
	movl	(%r15), %esi
	movl	(%r14), %ecx
	movq	%rbx, %rdi
	movl	$1, %edx
	callq	_write_reg_dma
	movl	(%r13), %esi
	movl	(%r14), %ecx
	movq	%rbx, %rdi
	movl	$1, %edx
	callq	_read_reg_dma
	movl	(%r13), %esi
	movq	%rbx, %rdi
	movl	$1, %edx
	xorl	%ecx, %ecx
	callq	_write_reg_dma
	movl	(%r12), %esi
	movl	(%r14), %ecx
	movq	%rbx, %rdi
	movl	$1, %edx
	callq	_write_reg_dma
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_NAND_FLASH_CMD,4,2             ## @NAND_FLASH_CMD
	.comm	_OP_BLOCK_ERASE,4,2             ## @OP_BLOCK_ERASE
	.comm	_PAGE_ACC,4,2                   ## @PAGE_ACC
	.comm	_LAST_PAGE,4,2                  ## @LAST_PAGE
	.comm	_NAND_ADDR0,4,2                 ## @NAND_ADDR0
	.comm	_NAND_ADDR1,4,2                 ## @NAND_ADDR1
	.comm	_NAND_DEV0_CFG0,4,2             ## @NAND_DEV0_CFG0
	.comm	_CW_PER_PAGE,4,2                ## @CW_PER_PAGE
	.comm	_NAND_DEV0_CFG1,4,2             ## @NAND_DEV0_CFG1
	.comm	_NAND_EXEC_CMD,4,2              ## @NAND_EXEC_CMD
	.comm	_NAND_FLASH_STATUS,4,2          ## @NAND_FLASH_STATUS
	.comm	_NAND_READ_STATUS,4,2           ## @NAND_READ_STATUS
	.comm	_NAND_BAM_NEXT_SGL,4,2          ## @NAND_BAM_NEXT_SGL
	.no_dead_strip	_erase_block
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function erase_block
_erase_block:                           ; @erase_block
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x21, x1
	mov	x20, x0
	add	x0, x0, #16
	bl	_get_qcom_nand_controller
	mov	x19, x0
Lloh0:
	adrp	x22, _NAND_FLASH_CMD@GOTPAGE
Lloh1:
	ldr	x22, [x22, _NAND_FLASH_CMD@GOTPAGEOFF]
	ldr	w1, [x22]
Lloh2:
	adrp	x8, _OP_BLOCK_ERASE@GOTPAGE
Lloh3:
	ldr	x8, [x8, _OP_BLOCK_ERASE@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
Lloh5:
	adrp	x9, _PAGE_ACC@GOTPAGE
Lloh6:
	ldr	x9, [x9, _PAGE_ACC@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh8:
	adrp	x9, _LAST_PAGE@GOTPAGE
Lloh9:
	ldr	x9, [x9, _LAST_PAGE@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	orr	w2, w8, w9
	bl	_nandc_set_reg
Lloh11:
	adrp	x8, _NAND_ADDR0@GOTPAGE
Lloh12:
	ldr	x8, [x8, _NAND_ADDR0@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x21
	bl	_nandc_set_reg
Lloh14:
	adrp	x8, _NAND_ADDR1@GOTPAGE
Lloh15:
	ldr	x8, [x8, _NAND_ADDR1@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_nandc_set_reg
Lloh17:
	adrp	x21, _NAND_DEV0_CFG0@GOTPAGE
Lloh18:
	ldr	x21, [x21, _NAND_DEV0_CFG0@GOTPAGEOFF]
	ldr	w1, [x21]
	ldr	w8, [x20]
Lloh19:
	adrp	x9, _CW_PER_PAGE@GOTPAGE
Lloh20:
	ldr	x9, [x9, _CW_PER_PAGE@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
	mov	w10, #7
	lsl	w9, w10, w9
	bic	w2, w8, w9
	mov	x0, x19
	bl	_nandc_set_reg
Lloh22:
	adrp	x8, _NAND_DEV0_CFG1@GOTPAGE
Lloh23:
	ldr	x8, [x8, _NAND_DEV0_CFG1@GOTPAGEOFF]
Lloh24:
	ldr	w1, [x8]
	ldr	w2, [x20, #4]
	mov	x0, x19
	bl	_nandc_set_reg
Lloh25:
	adrp	x23, _NAND_EXEC_CMD@GOTPAGE
Lloh26:
	ldr	x23, [x23, _NAND_EXEC_CMD@GOTPAGEOFF]
	ldr	w1, [x23]
	mov	x0, x19
	mov	w2, #1
	bl	_nandc_set_reg
Lloh27:
	adrp	x24, _NAND_FLASH_STATUS@GOTPAGE
Lloh28:
	ldr	x24, [x24, _NAND_FLASH_STATUS@GOTPAGEOFF]
	ldr	w1, [x24]
	ldr	w2, [x20, #8]
	mov	x0, x19
	bl	_nandc_set_reg
Lloh29:
	adrp	x25, _NAND_READ_STATUS@GOTPAGE
Lloh30:
	ldr	x25, [x25, _NAND_READ_STATUS@GOTPAGEOFF]
	ldr	w1, [x25]
	ldr	w2, [x20, #12]
	mov	x0, x19
	bl	_nandc_set_reg
	ldr	w1, [x22]
Lloh31:
	adrp	x20, _NAND_BAM_NEXT_SGL@GOTPAGE
Lloh32:
	ldr	x20, [x20, _NAND_BAM_NEXT_SGL@GOTPAGEOFF]
	ldr	w3, [x20]
	mov	x0, x19
	mov	w2, #3
	bl	_write_reg_dma
	ldr	w1, [x21]
	ldr	w3, [x20]
	mov	x0, x19
	mov	w2, #2
	bl	_write_reg_dma
	ldr	w1, [x23]
	ldr	w3, [x20]
	mov	x0, x19
	mov	w2, #1
	bl	_write_reg_dma
	ldr	w1, [x24]
	ldr	w3, [x20]
	mov	x0, x19
	mov	w2, #1
	bl	_read_reg_dma
	ldr	w1, [x24]
	mov	x0, x19
	mov	w2, #1
	mov	w3, #0
	bl	_write_reg_dma
	ldr	w1, [x25]
	ldr	w3, [x20]
	mov	x0, x19
	mov	w2, #1
	bl	_write_reg_dma
	mov	w0, #0
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_NAND_FLASH_CMD,4,2             ; @NAND_FLASH_CMD
	.comm	_OP_BLOCK_ERASE,4,2             ; @OP_BLOCK_ERASE
	.comm	_PAGE_ACC,4,2                   ; @PAGE_ACC
	.comm	_LAST_PAGE,4,2                  ; @LAST_PAGE
	.comm	_NAND_ADDR0,4,2                 ; @NAND_ADDR0
	.comm	_NAND_ADDR1,4,2                 ; @NAND_ADDR1
	.comm	_NAND_DEV0_CFG0,4,2             ; @NAND_DEV0_CFG0
	.comm	_CW_PER_PAGE,4,2                ; @CW_PER_PAGE
	.comm	_NAND_DEV0_CFG1,4,2             ; @NAND_DEV0_CFG1
	.comm	_NAND_EXEC_CMD,4,2              ; @NAND_EXEC_CMD
	.comm	_NAND_FLASH_STATUS,4,2          ; @NAND_FLASH_STATUS
	.comm	_NAND_READ_STATUS,4,2           ; @NAND_READ_STATUS
	.comm	_NAND_BAM_NEXT_SGL,4,2          ; @NAND_BAM_NEXT_SGL
	.no_dead_strip	_erase_block
.subsections_via_symbols
