	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vf610_nfc_write_page
_vf610_nfc_write_page:                  ## @vf610_nfc_write_page
	.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
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r12d
	movq	%rsi, -80(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r14
	callq	_chip_to_nfc
	movq	%rax, %rbx
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	%r14, %rdi
	callq	_nand_to_mtd
	movq	%rax, %r13
	movl	4(%rax), %eax
	addl	(%r13), %eax
	movl	%eax, -56(%rbp)                 ## 4-byte Spill
	movl	$0, -48(%rbp)
	movl	(%r14), %esi
	movq	%r14, %rdi
	callq	_vf610_nfc_select_target
	movq	_NAND_CMD_SEQIN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_CMD_BYTE1_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shll	%cl, %edx
	movl	%edx, -52(%rbp)                 ## 4-byte Spill
	movq	_COMMAND_CMD_BYTE1@GOTPCREL(%rip), %rax
	movq	_COMMAND_CAR_BYTE1@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movq	_COMMAND_CAR_BYTE2@GOTPCREL(%rip), %rax
	orl	(%rax), %ecx
	movl	%ecx, -44(%rbp)
	leaq	-44(%rbp), %rdx
	leaq	-48(%rbp), %rcx
	movq	%r14, %rdi
	movl	%r12d, %esi
	callq	_vf610_nfc_fill_row
	movq	_NAND_CMD_PAGEPROG@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movq	_CMD_BYTE2_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shll	%cl, %r12d
	movq	_COMMAND_CMD_BYTE2@GOTPCREL(%rip), %rax
	movq	_COMMAND_WRITE_DATA@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	orl	%ecx, -44(%rbp)
	movq	8(%rbx), %r15
	xorl	%edi, %edi
	callq	_NFC_MAIN_AREA
	addq	%rax, %r15
	movl	(%r13), %edx
	movq	%r15, %rdi
	movq	-80(%rbp), %rsi                 ## 8-byte Reload
	xorl	%ecx, %ecx
	callq	_vf610_nfc_wr_to_sram
	movq	_COMMAND_RB_HANDSHAKE@GOTPCREL(%rip), %rax
	movl	-44(%rbp), %ebx
	orl	(%rax), %ebx
	movl	%ebx, -44(%rbp)
	movq	_CMD_CODE_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shll	%cl, %ebx
	orl	-52(%rbp), %ebx                 ## 4-byte Folded Reload
	movq	-72(%rbp), %r15                 ## 8-byte Reload
	movl	(%r15), %esi
	movq	%r15, %rdi
	callq	_vf610_nfc_ecc_mode
	movl	-48(%rbp), %edx
	movq	%r15, %rdi
	xorl	%esi, %esi
	movl	%r12d, %ecx
	movl	%ebx, %r8d
	movl	-56(%rbp), %r9d                 ## 4-byte Reload
	callq	_vf610_nfc_run
	movq	_ECC_BYPASS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_vf610_nfc_ecc_mode
	leaq	-60(%rbp), %rsi
	movq	%r14, %rdi
	callq	_nand_status_op
	testl	%eax, %eax
	jne	LBB0_3
## %bb.1:
	movq	_NAND_STATUS_FAIL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	$0, %eax
	testl	%ecx, -60(%rbp)
	je	LBB0_3
## %bb.2:
	movq	_EIO@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_3:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_NAND_CMD_SEQIN,4,2             ## @NAND_CMD_SEQIN
	.comm	_CMD_BYTE1_SHIFT,4,2            ## @CMD_BYTE1_SHIFT
	.comm	_COMMAND_CMD_BYTE1,4,2          ## @COMMAND_CMD_BYTE1
	.comm	_COMMAND_CAR_BYTE1,4,2          ## @COMMAND_CAR_BYTE1
	.comm	_COMMAND_CAR_BYTE2,4,2          ## @COMMAND_CAR_BYTE2
	.comm	_NAND_CMD_PAGEPROG,4,2          ## @NAND_CMD_PAGEPROG
	.comm	_CMD_BYTE2_SHIFT,4,2            ## @CMD_BYTE2_SHIFT
	.comm	_COMMAND_CMD_BYTE2,4,2          ## @COMMAND_CMD_BYTE2
	.comm	_COMMAND_WRITE_DATA,4,2         ## @COMMAND_WRITE_DATA
	.comm	_COMMAND_RB_HANDSHAKE,4,2       ## @COMMAND_RB_HANDSHAKE
	.comm	_CMD_CODE_SHIFT,4,2             ## @CMD_CODE_SHIFT
	.comm	_ECC_BYPASS,4,2                 ## @ECC_BYPASS
	.comm	_NAND_STATUS_FAIL,4,2           ## @NAND_STATUS_FAIL
	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_vf610_nfc_write_page
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vf610_nfc_write_page
_vf610_nfc_write_page:                  ; @vf610_nfc_write_page
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x24, x3
	mov	x22, x1
	mov	x19, x0
	bl	_chip_to_nfc
	mov	x20, x0
	mov	x0, x19
	bl	_nand_to_mtd
	mov	x23, x0
	ldp	w8, w9, [x0]
	add	w21, w9, w8
	str	wzr, [sp, #12]
	ldr	w1, [x19]
	mov	x0, x19
	bl	_vf610_nfc_select_target
Lloh0:
	adrp	x8, _NAND_CMD_SEQIN@GOTPAGE
Lloh1:
	ldr	x8, [x8, _NAND_CMD_SEQIN@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _CMD_BYTE1_SHIFT@GOTPAGE
Lloh4:
	ldr	x9, [x9, _CMD_BYTE1_SHIFT@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	lsl	w25, w8, w9
Lloh6:
	adrp	x8, _COMMAND_CMD_BYTE1@GOTPAGE
Lloh7:
	ldr	x8, [x8, _COMMAND_CMD_BYTE1@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
Lloh9:
	adrp	x9, _COMMAND_CAR_BYTE1@GOTPAGE
Lloh10:
	ldr	x9, [x9, _COMMAND_CAR_BYTE1@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh12:
	adrp	x9, _COMMAND_CAR_BYTE2@GOTPAGE
Lloh13:
	ldr	x9, [x9, _COMMAND_CAR_BYTE2@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	orr	w8, w8, w9
	str	w8, [sp, #8]
	add	x2, sp, #8
	add	x3, sp, #12
	mov	x0, x19
	mov	x1, x24
	bl	_vf610_nfc_fill_row
Lloh15:
	adrp	x8, _NAND_CMD_PAGEPROG@GOTPAGE
Lloh16:
	ldr	x8, [x8, _NAND_CMD_PAGEPROG@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
Lloh18:
	adrp	x9, _CMD_BYTE2_SHIFT@GOTPAGE
Lloh19:
	ldr	x9, [x9, _CMD_BYTE2_SHIFT@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	lsl	w24, w8, w9
Lloh21:
	adrp	x8, _COMMAND_CMD_BYTE2@GOTPAGE
Lloh22:
	ldr	x8, [x8, _COMMAND_CMD_BYTE2@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
Lloh24:
	adrp	x9, _COMMAND_WRITE_DATA@GOTPAGE
Lloh25:
	ldr	x9, [x9, _COMMAND_WRITE_DATA@GOTPAGEOFF]
Lloh26:
	ldr	w9, [x9]
	orr	w8, w9, w8
	ldr	w9, [sp, #8]
	orr	w8, w8, w9
	str	w8, [sp, #8]
	ldr	x26, [x20, #8]
	mov	w0, #0
	bl	_NFC_MAIN_AREA
	add	x0, x0, x26
	ldr	w2, [x23]
	mov	x1, x22
	mov	w3, #0
	bl	_vf610_nfc_wr_to_sram
Lloh27:
	adrp	x8, _COMMAND_RB_HANDSHAKE@GOTPAGE
Lloh28:
	ldr	x8, [x8, _COMMAND_RB_HANDSHAKE@GOTPAGEOFF]
Lloh29:
	ldr	w8, [x8]
	ldr	w9, [sp, #8]
	orr	w8, w9, w8
	str	w8, [sp, #8]
Lloh30:
	adrp	x9, _CMD_CODE_SHIFT@GOTPAGE
Lloh31:
	ldr	x9, [x9, _CMD_CODE_SHIFT@GOTPAGEOFF]
Lloh32:
	ldr	w9, [x9]
	lsl	w8, w8, w9
	orr	w22, w8, w25
	ldr	w1, [x20]
	mov	x0, x20
	bl	_vf610_nfc_ecc_mode
	ldr	w2, [sp, #12]
	mov	x0, x20
	mov	w1, #0
	mov	x3, x24
	mov	x4, x22
	mov	x5, x21
	bl	_vf610_nfc_run
Lloh33:
	adrp	x8, _ECC_BYPASS@GOTPAGE
Lloh34:
	ldr	x8, [x8, _ECC_BYPASS@GOTPAGEOFF]
Lloh35:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_vf610_nfc_ecc_mode
	add	x1, sp, #4
	mov	x0, x19
	bl	_nand_status_op
	cbnz	w0, LBB0_4
; %bb.1:
	ldr	w8, [sp, #4]
Lloh36:
	adrp	x9, _NAND_STATUS_FAIL@GOTPAGE
Lloh37:
	ldr	x9, [x9, _NAND_STATUS_FAIL@GOTPAGEOFF]
Lloh38:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_3
; %bb.2:
Lloh39:
	adrp	x8, _EIO@GOTPAGE
Lloh40:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh41:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_4
LBB0_3:
	mov	w0, #0
LBB0_4:
	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
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.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	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.cfi_endproc
                                        ; -- End function
	.comm	_NAND_CMD_SEQIN,4,2             ; @NAND_CMD_SEQIN
	.comm	_CMD_BYTE1_SHIFT,4,2            ; @CMD_BYTE1_SHIFT
	.comm	_COMMAND_CMD_BYTE1,4,2          ; @COMMAND_CMD_BYTE1
	.comm	_COMMAND_CAR_BYTE1,4,2          ; @COMMAND_CAR_BYTE1
	.comm	_COMMAND_CAR_BYTE2,4,2          ; @COMMAND_CAR_BYTE2
	.comm	_NAND_CMD_PAGEPROG,4,2          ; @NAND_CMD_PAGEPROG
	.comm	_CMD_BYTE2_SHIFT,4,2            ; @CMD_BYTE2_SHIFT
	.comm	_COMMAND_CMD_BYTE2,4,2          ; @COMMAND_CMD_BYTE2
	.comm	_COMMAND_WRITE_DATA,4,2         ; @COMMAND_WRITE_DATA
	.comm	_COMMAND_RB_HANDSHAKE,4,2       ; @COMMAND_RB_HANDSHAKE
	.comm	_CMD_CODE_SHIFT,4,2             ; @CMD_CODE_SHIFT
	.comm	_ECC_BYPASS,4,2                 ; @ECC_BYPASS
	.comm	_NAND_STATUS_FAIL,4,2           ; @NAND_STATUS_FAIL
	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_vf610_nfc_write_page
.subsections_via_symbols
