	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ar934x_nfc_send_erase
_ar934x_nfc_send_erase:                 ## @ar934x_nfc_send_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	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r12d
	movl	%esi, %r14d
	movq	%rdi, %rbx
	leaq	-40(%rbp), %rcx
	leaq	-36(%rbp), %r8
	movl	%edx, %esi
	movl	%r12d, %edx
	callq	_ar934x_nfc_get_addr
	movl	(%rbx), %r15d
	cmpq	$0, 8(%rbx)
	je	LBB0_2
## %bb.1:
	movq	_AR934X_NFC_CTRL_ADDR_CYCLE0_M@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_AR934X_NFC_CTRL_ADDR_CYCLE0_S@GOTPCREL(%rip), %rax
	movb	(%rax), %al
	movl	%eax, %ecx
	shll	%cl, %edx
	movq	_AR934X_NFC_CTRL_ADDR_CYCLE1_M@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movq	_AR934X_NFC_CTRL_ADDR_CYCLE1_S@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %esi
	orl	%edx, %esi
	movq	_AR934X_NFC_CTRL_SMALL_PAGE@GOTPCREL(%rip), %rcx
	orl	(%rcx), %esi
	notl	%esi
	andl	%esi, %r15d
	movl	4(%rbx), %edx
	incl	%edx
	movl	%eax, %ecx
	shll	%cl, %edx
	orl	%edx, %r15d
LBB0_2:
	movq	_NAND_CMD_ERASE1@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_AR934X_NFC_CMD_CMD0_S@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %eax
	movq	_AR934X_NFC_CMD_CMD1_S@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %r14d
	orl	%eax, %r14d
	movq	_AR934X_NFC_CMD_SEQ_ERASE@GOTPCREL(%rip), %rax
	orl	(%rax), %r14d
	movl	-40(%rbp), %ecx
	movl	-36(%rbp), %r8d
	movl	%r15d, (%rsp)
	leaq	L_.str(%rip), %rsi
	movq	%rbx, %rdi
	movl	%r12d, %edx
	movl	%r14d, %r9d
	callq	_nfc_dbg
	movq	_AR934X_NFC_REG_INT_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_ar934x_nfc_wr
	movq	_AR934X_NFC_REG_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	movl	%r15d, %edx
	callq	_ar934x_nfc_wr
	movq	_AR934X_NFC_REG_ADDR0_0@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	-40(%rbp), %edx
	movq	%rbx, %rdi
	callq	_ar934x_nfc_wr
	movq	_AR934X_NFC_REG_ADDR0_1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	-36(%rbp), %edx
	movq	%rbx, %rdi
	callq	_ar934x_nfc_wr
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_ar934x_nfc_write_cmd_reg
	movq	%rbx, %rdi
	callq	_ar934x_nfc_wait_dev_ready
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AR934X_NFC_CTRL_ADDR_CYCLE0_M,4,2 ## @AR934X_NFC_CTRL_ADDR_CYCLE0_M
	.comm	_AR934X_NFC_CTRL_ADDR_CYCLE0_S,4,2 ## @AR934X_NFC_CTRL_ADDR_CYCLE0_S
	.comm	_AR934X_NFC_CTRL_ADDR_CYCLE1_M,4,2 ## @AR934X_NFC_CTRL_ADDR_CYCLE1_M
	.comm	_AR934X_NFC_CTRL_ADDR_CYCLE1_S,4,2 ## @AR934X_NFC_CTRL_ADDR_CYCLE1_S
	.comm	_AR934X_NFC_CTRL_SMALL_PAGE,4,2 ## @AR934X_NFC_CTRL_SMALL_PAGE
	.comm	_NAND_CMD_ERASE1,4,2            ## @NAND_CMD_ERASE1
	.comm	_AR934X_NFC_CMD_CMD0_S,4,2      ## @AR934X_NFC_CMD_CMD0_S
	.comm	_AR934X_NFC_CMD_CMD1_S,4,2      ## @AR934X_NFC_CMD_CMD1_S
	.comm	_AR934X_NFC_CMD_SEQ_ERASE,4,2   ## @AR934X_NFC_CMD_SEQ_ERASE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"erase page %d, a0:%08x a1:%08x cmd:%08x ctrl:%08x\n"

	.comm	_AR934X_NFC_REG_INT_STATUS,4,2  ## @AR934X_NFC_REG_INT_STATUS
	.comm	_AR934X_NFC_REG_CTRL,4,2        ## @AR934X_NFC_REG_CTRL
	.comm	_AR934X_NFC_REG_ADDR0_0,4,2     ## @AR934X_NFC_REG_ADDR0_0
	.comm	_AR934X_NFC_REG_ADDR0_1,4,2     ## @AR934X_NFC_REG_ADDR0_1
	.no_dead_strip	_ar934x_nfc_send_erase
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ar934x_nfc_send_erase
_ar934x_nfc_send_erase:                 ; @ar934x_nfc_send_erase
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x21, x3
	mov	x22, x1
	mov	x19, x0
	add	x3, sp, #12
	add	x4, sp, #8
	mov	x1, x2
	mov	x2, x21
	bl	_ar934x_nfc_get_addr
	ldr	w20, [x19]
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _AR934X_NFC_CTRL_ADDR_CYCLE0_M@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AR934X_NFC_CTRL_ADDR_CYCLE0_M@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _AR934X_NFC_CTRL_ADDR_CYCLE0_S@GOTPAGE
Lloh4:
	ldr	x9, [x9, _AR934X_NFC_CTRL_ADDR_CYCLE0_S@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	lsl	w8, w8, w9
Lloh6:
	adrp	x10, _AR934X_NFC_CTRL_ADDR_CYCLE1_M@GOTPAGE
Lloh7:
	ldr	x10, [x10, _AR934X_NFC_CTRL_ADDR_CYCLE1_M@GOTPAGEOFF]
Lloh8:
	ldr	w10, [x10]
Lloh9:
	adrp	x11, _AR934X_NFC_CTRL_ADDR_CYCLE1_S@GOTPAGE
Lloh10:
	ldr	x11, [x11, _AR934X_NFC_CTRL_ADDR_CYCLE1_S@GOTPAGEOFF]
Lloh11:
	ldr	w11, [x11]
	lsl	w10, w10, w11
	orr	w8, w10, w8
Lloh12:
	adrp	x10, _AR934X_NFC_CTRL_SMALL_PAGE@GOTPAGE
Lloh13:
	ldr	x10, [x10, _AR934X_NFC_CTRL_SMALL_PAGE@GOTPAGEOFF]
Lloh14:
	ldr	w10, [x10]
	orr	w8, w8, w10
	bic	w8, w20, w8
	ldr	w10, [x19, #4]
	add	w10, w10, #1
	lsl	w9, w10, w9
	orr	w20, w8, w9
LBB0_2:
Lloh15:
	adrp	x8, _NAND_CMD_ERASE1@GOTPAGE
Lloh16:
	ldr	x8, [x8, _NAND_CMD_ERASE1@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
Lloh18:
	adrp	x9, _AR934X_NFC_CMD_CMD0_S@GOTPAGE
Lloh19:
	ldr	x9, [x9, _AR934X_NFC_CMD_CMD0_S@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	lsl	w8, w8, w9
Lloh21:
	adrp	x9, _AR934X_NFC_CMD_CMD1_S@GOTPAGE
Lloh22:
	ldr	x9, [x9, _AR934X_NFC_CMD_CMD1_S@GOTPAGEOFF]
Lloh23:
	ldr	w9, [x9]
	lsl	w9, w22, w9
	orr	w8, w9, w8
Lloh24:
	adrp	x9, _AR934X_NFC_CMD_SEQ_ERASE@GOTPAGE
Lloh25:
	ldr	x9, [x9, _AR934X_NFC_CMD_SEQ_ERASE@GOTPAGEOFF]
Lloh26:
	ldr	w9, [x9]
	orr	w22, w8, w9
	ldp	w4, w3, [sp, #8]
Lloh27:
	adrp	x1, l_.str@PAGE
Lloh28:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	mov	x2, x21
	mov	x5, x22
	mov	x6, x20
	bl	_nfc_dbg
Lloh29:
	adrp	x8, _AR934X_NFC_REG_INT_STATUS@GOTPAGE
Lloh30:
	ldr	x8, [x8, _AR934X_NFC_REG_INT_STATUS@GOTPAGEOFF]
Lloh31:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_ar934x_nfc_wr
Lloh32:
	adrp	x8, _AR934X_NFC_REG_CTRL@GOTPAGE
Lloh33:
	ldr	x8, [x8, _AR934X_NFC_REG_CTRL@GOTPAGEOFF]
Lloh34:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x20
	bl	_ar934x_nfc_wr
Lloh35:
	adrp	x8, _AR934X_NFC_REG_ADDR0_0@GOTPAGE
Lloh36:
	ldr	x8, [x8, _AR934X_NFC_REG_ADDR0_0@GOTPAGEOFF]
Lloh37:
	ldr	w1, [x8]
	ldr	w2, [sp, #12]
	mov	x0, x19
	bl	_ar934x_nfc_wr
Lloh38:
	adrp	x8, _AR934X_NFC_REG_ADDR0_1@GOTPAGE
Lloh39:
	ldr	x8, [x8, _AR934X_NFC_REG_ADDR0_1@GOTPAGEOFF]
Lloh40:
	ldr	w1, [x8]
	ldr	w2, [sp, #8]
	mov	x0, x19
	bl	_ar934x_nfc_wr
	mov	x0, x19
	mov	x1, x22
	bl	_ar934x_nfc_write_cmd_reg
	mov	x0, x19
	bl	_ar934x_nfc_wait_dev_ready
	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
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_AR934X_NFC_CTRL_ADDR_CYCLE0_M,4,2 ; @AR934X_NFC_CTRL_ADDR_CYCLE0_M
	.comm	_AR934X_NFC_CTRL_ADDR_CYCLE0_S,4,2 ; @AR934X_NFC_CTRL_ADDR_CYCLE0_S
	.comm	_AR934X_NFC_CTRL_ADDR_CYCLE1_M,4,2 ; @AR934X_NFC_CTRL_ADDR_CYCLE1_M
	.comm	_AR934X_NFC_CTRL_ADDR_CYCLE1_S,4,2 ; @AR934X_NFC_CTRL_ADDR_CYCLE1_S
	.comm	_AR934X_NFC_CTRL_SMALL_PAGE,4,2 ; @AR934X_NFC_CTRL_SMALL_PAGE
	.comm	_NAND_CMD_ERASE1,4,2            ; @NAND_CMD_ERASE1
	.comm	_AR934X_NFC_CMD_CMD0_S,4,2      ; @AR934X_NFC_CMD_CMD0_S
	.comm	_AR934X_NFC_CMD_CMD1_S,4,2      ; @AR934X_NFC_CMD_CMD1_S
	.comm	_AR934X_NFC_CMD_SEQ_ERASE,4,2   ; @AR934X_NFC_CMD_SEQ_ERASE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"erase page %d, a0:%08x a1:%08x cmd:%08x ctrl:%08x\n"

	.comm	_AR934X_NFC_REG_INT_STATUS,4,2  ; @AR934X_NFC_REG_INT_STATUS
	.comm	_AR934X_NFC_REG_CTRL,4,2        ; @AR934X_NFC_REG_CTRL
	.comm	_AR934X_NFC_REG_ADDR0_0,4,2     ; @AR934X_NFC_REG_ADDR0_0
	.comm	_AR934X_NFC_REG_ADDR0_1,4,2     ; @AR934X_NFC_REG_ADDR0_1
	.no_dead_strip	_ar934x_nfc_send_erase
.subsections_via_symbols
