	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ar934x_nfc_read_page
_ar934x_nfc_read_page:                  ## @ar934x_nfc_read_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	%r8d, %r15d
	movl	%ecx, %r13d
	movq	%rdx, -72(%rbp)                 ## 8-byte Spill
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r12
	callq	_mtd_to_ar934x_nfc
	movq	%rax, %rbx
	leaq	L_.str(%rip), %rsi
	movq	%rax, %rdi
	movl	%r15d, %edx
	movl	%r13d, %ecx
	callq	_nfc_dbg
	movq	%rbx, %rdi
	callq	_ar934x_nfc_enable_hwecc
	movq	_NAND_CMD_READ0@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	8(%r12), %r8d
	movq	%rbx, %rdi
	xorl	%edx, %edx
	movl	%r15d, %ecx
	callq	_ar934x_nfc_send_read
	movl	%eax, %r14d
	movq	%rbx, %rdi
	callq	_ar934x_nfc_disable_hwecc
	testl	%r14d, %r14d
	jne	LBB0_13
## %bb.1:
	movq	16(%rbx), %rsi
	movl	8(%r12), %edx
	movq	-72(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rdi
	callq	_memcpy
	movq	_AR934X_NFC_REG_ECC_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_ar934x_nfc_rr
	movq	_AR934X_NFC_ECC_CTRL_ERR_UNCORRECT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movl	%esi, %edx
	andl	%eax, %edx
	movq	_AR934X_NFC_ECC_CTRL_ERR_CORRECT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	%r13d, %edx
	je	LBB0_5
## %bb.2:
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	movl	%esi, -48(%rbp)                 ## 4-byte Spill
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movq	_NAND_CMD_READ0@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	8(%r12), %edx
	movl	12(%r12), %r8d
	movq	%rbx, %rdi
	movl	%r15d, %ecx
	callq	_ar934x_nfc_send_read
	movq	%r14, %rcx
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_13
## %bb.3:
	testl	%r13d, %r13d
	movq	%rcx, %r14
	movl	-52(%rbp), %eax                 ## 4-byte Reload
	movl	-48(%rbp), %esi                 ## 4-byte Reload
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	je	LBB0_5
## %bb.4:
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movq	16(%rax), %rdi
	movq	16(%rbx), %rsi
	movl	12(%r12), %edx
	callq	_memcpy
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	movl	-48(%rbp), %esi                 ## 4-byte Reload
	movl	-52(%rbp), %eax                 ## 4-byte Reload
LBB0_5:
	testl	%eax, %esi
	je	LBB0_9
## %bb.6:
	movq	(%rbx), %rdi
	shlq	$2, %rdi
	addq	16(%rbx), %rdi
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movl	8(%rax), %esi
	callq	_is_all_ff
	testl	%eax, %eax
	je	LBB0_8
## %bb.7:
	movq	%r14, %rdi
	movl	8(%r12), %esi
	callq	_is_all_ff
	xorl	%r14d, %r14d
	testl	%eax, %eax
	jne	LBB0_13
LBB0_8:
	addq	$4, %r12
	xorl	%r14d, %r14d
	movl	$1, %eax
	jmp	LBB0_12
LBB0_9:
	testl	%eax, %ecx
	je	LBB0_10
## %bb.11:
	movq	_AR934X_NFC_ECC_CTRL_ERR_OVER@GOTPCREL(%rip), %rcx
	addq	$8, %rbx
	testl	%eax, (%rcx)
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	cmovneq	%rax, %rbx
	movl	4(%rax), %eax
	imull	(%rbx), %eax
	movl	%eax, %r14d
LBB0_12:
	addl	%eax, (%r12)
	jmp	LBB0_13
LBB0_10:
	xorl	%r14d, %r14d
LBB0_13:
	movl	%r14d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"read_page: page:%d oob:%d\n"

	.comm	_NAND_CMD_READ0,4,2             ## @NAND_CMD_READ0
	.comm	_AR934X_NFC_REG_ECC_CTRL,4,2    ## @AR934X_NFC_REG_ECC_CTRL
	.comm	_AR934X_NFC_ECC_CTRL_ERR_UNCORRECT,4,2 ## @AR934X_NFC_ECC_CTRL_ERR_UNCORRECT
	.comm	_AR934X_NFC_ECC_CTRL_ERR_CORRECT,4,2 ## @AR934X_NFC_ECC_CTRL_ERR_CORRECT
	.comm	_AR934X_NFC_ECC_CTRL_ERR_OVER,4,2 ## @AR934X_NFC_ECC_CTRL_ERR_OVER
	.no_dead_strip	_ar934x_nfc_read_page
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ar934x_nfc_read_page
_ar934x_nfc_read_page:                  ; @ar934x_nfc_read_page
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x24, x4
	mov	x23, x3
	mov	x20, x2
	mov	x21, x1
	mov	x19, x0
	bl	_mtd_to_ar934x_nfc
	mov	x22, x0
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x24
	mov	x3, x23
	bl	_nfc_dbg
	mov	x0, x22
	bl	_ar934x_nfc_enable_hwecc
Lloh2:
	adrp	x27, _NAND_CMD_READ0@GOTPAGE
Lloh3:
	ldr	x27, [x27, _NAND_CMD_READ0@GOTPAGEOFF]
	ldr	w1, [x27]
	ldr	w4, [x19, #8]
	mov	x0, x22
	mov	w2, #0
	mov	x3, x24
	bl	_ar934x_nfc_send_read
	mov	x26, x0
	mov	x0, x22
	bl	_ar934x_nfc_disable_hwecc
	cbnz	w26, LBB0_13
; %bb.1:
	ldr	x1, [x22, #16]
	ldr	w2, [x19, #8]
	mov	x0, x20
	bl	_memcpy
Lloh4:
	adrp	x8, _AR934X_NFC_REG_ECC_CTRL@GOTPAGE
Lloh5:
	ldr	x8, [x8, _AR934X_NFC_REG_ECC_CTRL@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
	mov	x0, x22
	bl	_ar934x_nfc_rr
	mov	x25, x0
Lloh7:
	adrp	x8, _AR934X_NFC_ECC_CTRL_ERR_UNCORRECT@GOTPAGE
Lloh8:
	ldr	x8, [x8, _AR934X_NFC_ECC_CTRL_ERR_UNCORRECT@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	and	w28, w8, w0
Lloh10:
	adrp	x8, _AR934X_NFC_ECC_CTRL_ERR_CORRECT@GOTPAGE
Lloh11:
	ldr	x8, [x8, _AR934X_NFC_ECC_CTRL_ERR_CORRECT@GOTPAGEOFF]
Lloh12:
	ldr	w26, [x8]
	orr	w8, w23, w28
	cbz	w8, LBB0_5
; %bb.2:
	str	w26, [sp, #12]                  ; 4-byte Folded Spill
	ldr	w1, [x27]
	ldp	w2, w4, [x19, #8]
	mov	x0, x22
	mov	x3, x24
	bl	_ar934x_nfc_send_read
	mov	x26, x0
	cbnz	w0, LBB0_13
; %bb.3:
	ldr	w26, [sp, #12]                  ; 4-byte Folded Reload
	cbz	w23, LBB0_5
; %bb.4:
	ldr	x0, [x21, #16]
	ldr	x1, [x22, #16]
	ldr	w2, [x19, #12]
	bl	_memcpy
LBB0_5:
	cbz	w28, LBB0_9
; %bb.6:
	ldr	x8, [x22, #16]
	ldr	x9, [x22]
	add	x0, x8, x9, lsl #2
	ldr	w1, [x21, #8]
	bl	_is_all_ff
	cbz	w0, LBB0_8
; %bb.7:
	ldr	w1, [x19, #8]
	mov	x0, x20
	bl	_is_all_ff
	cbnz	w0, LBB0_12
LBB0_8:
	mov	w26, #0
	add	x19, x19, #4
	mov	w8, #1
	b	LBB0_11
LBB0_9:
	and	w8, w26, w25
	cbz	w8, LBB0_12
; %bb.10:
Lloh13:
	adrp	x8, _AR934X_NFC_ECC_CTRL_ERR_OVER@GOTPAGE
Lloh14:
	ldr	x8, [x8, _AR934X_NFC_ECC_CTRL_ERR_OVER@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	add	x9, x22, #8
	tst	w8, w25
	csel	x8, x9, x21, eq
	ldr	w8, [x8]
	ldr	w9, [x21, #4]
	mul	w8, w9, w8
	mov	x26, x8
LBB0_11:
	ldr	w9, [x19]
	add	w8, w9, w8
	str	w8, [x19]
	b	LBB0_13
LBB0_12:
	mov	w26, #0
LBB0_13:
	mov	x0, x26
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"read_page: page:%d oob:%d\n"

	.comm	_NAND_CMD_READ0,4,2             ; @NAND_CMD_READ0
	.comm	_AR934X_NFC_REG_ECC_CTRL,4,2    ; @AR934X_NFC_REG_ECC_CTRL
	.comm	_AR934X_NFC_ECC_CTRL_ERR_UNCORRECT,4,2 ; @AR934X_NFC_ECC_CTRL_ERR_UNCORRECT
	.comm	_AR934X_NFC_ECC_CTRL_ERR_CORRECT,4,2 ; @AR934X_NFC_ECC_CTRL_ERR_CORRECT
	.comm	_AR934X_NFC_ECC_CTRL_ERR_OVER,4,2 ; @AR934X_NFC_ECC_CTRL_ERR_OVER
	.no_dead_strip	_ar934x_nfc_read_page
.subsections_via_symbols
