	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sunxi_nfc_hw_ecc_read_page
_sunxi_nfc_hw_ecc_read_page:            ## @sunxi_nfc_hw_ecc_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	%ecx, %ebx
                                        ## kill: def $edx killed $edx def $rdx
	movq	%rdx, -64(%rbp)                 ## 8-byte Spill
	movq	%rsi, -72(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r15
	callq	_nand_to_mtd
	movq	%rax, %r13
	movl	$0, -48(%rbp)
	movl	$0, -44(%rbp)
	movl	8(%r15), %esi
	movq	%r15, %rdi
	callq	_sunxi_nfc_select_chip
	xorl	%r14d, %r14d
	movq	%r15, %rdi
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movl	%ebx, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	callq	_nand_read_page_op
	movq	%r15, %rdi
	callq	_sunxi_nfc_hw_ecc_enable
	cmpl	$0, 12(%r15)
	jle	LBB0_4
## %bb.1:
	xorl	%r12d, %r12d
	xorl	%r14d, %r14d
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movslq	16(%r15), %rdx
	movslq	%r12d, %rax
	imulq	%rax, %rdx
	movslq	20(%r15), %r8
	addq	$4, %r8
	imulq	%rax, %r8
	leaq	(,%r8,4), %rcx
	addq	(%r15), %rcx
	addq	(%r13), %r8
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	leaq	(%rsi,%rdx,4), %rsi
	xorl	%ebx, %ebx
	testl	%eax, %eax
	sete	%bl
	movq	%r15, %rdi
                                        ## kill: def $edx killed $edx killed $rdx
	leaq	-44(%rbp), %r9
	pushq	-56(%rbp)                       ## 8-byte Folded Reload
	pushq	-64(%rbp)                       ## 8-byte Folded Reload
	pushq	%rbx
	leaq	-48(%rbp), %rax
	pushq	%rax
	callq	_sunxi_nfc_hw_ecc_read_chunk
	addq	$32, %rsp
	testl	%eax, %eax
	js	LBB0_7
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	$1, %eax
	cmovnel	%eax, %r14d
	incl	%r12d
	cmpl	12(%r15), %r12d
	jl	LBB0_2
LBB0_4:
	cmpl	$0, -64(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_6
## %bb.5:
	movq	(%r15), %rsi
	xorl	%ecx, %ecx
	testl	%r14d, %r14d
	sete	%cl
	leaq	-44(%rbp), %rdx
	movq	%r15, %rdi
	movq	-56(%rbp), %r8                  ## 8-byte Reload
                                        ## kill: def $r8d killed $r8d killed $r8
	callq	_sunxi_nfc_hw_ecc_read_extra_oob
LBB0_6:
	movq	%r15, %rdi
	callq	_sunxi_nfc_hw_ecc_disable
	movl	-48(%rbp), %eax
LBB0_7:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_sunxi_nfc_hw_ecc_read_page
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sunxi_nfc_hw_ecc_read_page
_sunxi_nfc_hw_ecc_read_page:            ; @sunxi_nfc_hw_ecc_read_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	x20, x3
	mov	x21, x2
	mov	x22, x1
	mov	x19, x0
	bl	_nand_to_mtd
	mov	x23, x0
	str	xzr, [sp, #8]
	ldr	w1, [x19, #8]
	mov	x0, x19
	bl	_sunxi_nfc_select_chip
	mov	x0, x19
	mov	x1, x20
	mov	w2, #0
	mov	x3, #0
	mov	w4, #0
	bl	_nand_read_page_op
	mov	x0, x19
	bl	_sunxi_nfc_hw_ecc_enable
	ldr	w8, [x19, #12]
	cmp	w8, #1
	b.lt	LBB0_8
; %bb.1:
	mov	w25, #0
	mov	w24, #0
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldp	w8, w9, [x19, #16]
                                        ; kill: def $w9 killed $w9 def $x9
	sxtw	x9, w9
	mul	w2, w8, w25
	add	x8, x9, #4
	sxtw	x9, w25
	mul	x8, x8, x9
	add	x1, x22, w2, sxtw #2
	ldr	x9, [x19]
	add	x3, x9, x8, lsl #2
	ldr	x9, [x23]
	add	x4, x9, x8
	cmp	w25, #0
	cset	w7, eq
	stp	w21, w20, [sp]
	add	x5, sp, #8
	add	x6, sp, #12
	mov	x0, x19
	bl	_sunxi_nfc_hw_ecc_read_chunk
	tbnz	w0, #31, LBB0_7
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	cmp	w0, #0
	csinc	w24, w24, wzr, eq
	add	w25, w25, #1
	ldr	w8, [x19, #12]
	cmp	w25, w8
	b.lt	LBB0_2
; %bb.4:
	cbz	w21, LBB0_6
LBB0_5:
	ldr	x1, [x19]
	cmp	w24, #0
	cset	w3, eq
	add	x2, sp, #8
	mov	x0, x19
	mov	x4, x20
	bl	_sunxi_nfc_hw_ecc_read_extra_oob
LBB0_6:
	mov	x0, x19
	bl	_sunxi_nfc_hw_ecc_disable
	ldr	w0, [sp, #12]
LBB0_7:
	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
LBB0_8:
	mov	w24, #0
	cbnz	w21, LBB0_5
	b	LBB0_6
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_sunxi_nfc_hw_ecc_read_page
.subsections_via_symbols
