	.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_chunk
_sunxi_nfc_hw_ecc_read_chunk:           ## @sunxi_nfc_hw_ecc_read_chunk
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r9, %r15
	movl	%r8d, %ebx
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	movl	%edx, %r13d
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r12
	movl	16(%rdi), %edi
	callq	_to_sunxi_nfc
	movq	%rax, %r14
	movq	%r15, -80(%rbp)                 ## 8-byte Spill
	cmpl	%r13d, (%r15)
	je	LBB0_2
## %bb.1:
	movq	%r12, %rdi
	movl	%r13d, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	callq	_nand_change_read_column_op
LBB0_2:
	movl	4(%r12), %edx
	movq	%r12, %rdi
	xorl	%esi, %esi
	xorl	%ecx, %ecx
	movl	40(%rbp), %r8d
	callq	_sunxi_nfc_randomizer_read_buf
	movl	4(%r12), %eax
	movl	%r13d, -68(%rbp)                ## 4-byte Spill
	addl	%r13d, %eax
	cmpl	%ebx, %eax
	je	LBB0_4
## %bb.3:
	movq	%r12, %rdi
	movl	%ebx, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	callq	_nand_change_read_column_op
LBB0_4:
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	movq	%r14, %rbx
	movq	%r14, %rdi
	callq	_sunxi_nfc_wait_cmd_fifo_empty
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	LBB0_15
## %bb.5:
	movq	%r12, %rdi
	callq	_sunxi_nfc_randomizer_enable
	movq	_NFC_DATA_TRANS@GOTPCREL(%rip), %rax
	movq	_NFC_DATA_SWAP_METHOD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	orl	(%rax), %edi
	movq	_NFC_ECC_OP@GOTPCREL(%rip), %rax
	orl	(%rax), %edi
	movq	_NFC_REG_CMD@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%rbx), %rsi
	callq	_writel
	movq	_NFC_CMD_INT_FLAG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_sunxi_nfc_wait_events
	movl	%eax, %r15d
	movq	%r12, %rdi
	callq	_sunxi_nfc_randomizer_disable
	testl	%r15d, %r15d
	jne	LBB0_15
## %bb.6:
	movl	32(%rbp), %r14d
	movl	8(%r12), %eax
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	addl	%ecx, %eax
	addl	$4, %eax
	movq	-80(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, (%rcx)
	xorl	%eax, %eax
	testl	%r14d, %r14d
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	cmoveq	%rax, %r15
	movq	_NFC_REG_ECC_ST@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	(%rbx), %rdi
	callq	_readl
	leaq	-72(%rbp), %r9
	movq	%r12, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movq	%r15, %rdx
	xorl	%ecx, %ecx
	movl	%eax, %r8d
	callq	_sunxi_nfc_hw_ecc_correct
	movl	$1, %r15d
	cmpl	$0, -72(%rbp)
	jne	LBB0_15
## %bb.7:
	movl	%eax, %r13d
	testl	%eax, %eax
	js	LBB0_8
## %bb.12:
	movq	_NFC_RAM0_BASE@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%rbx), %rsi
	movl	4(%r12), %edx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_memcpy_fromio
	xorl	%r15d, %r15d
	testl	%r14d, %r14d
	je	LBB0_14
## %bb.13:
	movq	%r12, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
                                        ## kill: def $esi killed $esi killed $rsi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	callq	_nand_change_read_column_op
	movl	8(%r12), %edx
	addl	$4, %edx
	movq	%r12, %rdi
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rsi
	movl	$1, %ecx
	movl	40(%rbp), %r14d
	movl	%r14d, %r8d
	callq	_sunxi_nfc_randomizer_read_buf
	movq	%r12, %rdi
	movq	%rbx, %rsi
	xorl	%edx, %edx
	movl	24(%rbp), %ecx
	movl	%r14d, %r8d
	callq	_sunxi_nfc_hw_ecc_get_prot_oob_bytes
	jmp	LBB0_14
LBB0_8:
	movq	_NAND_NEED_SCRAMBLING@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r12)
	je	LBB0_10
## %bb.9:
	movl	4(%r12), %ecx
	movq	%r12, %rdi
	movl	-68(%rbp), %esi                 ## 4-byte Reload
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdx
	xorl	%r8d, %r8d
	callq	_nand_change_read_column_op
	jmp	LBB0_11
LBB0_10:
	movq	_NFC_RAM0_BASE@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%rbx), %rsi
	movl	4(%r12), %edx
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	callq	_memcpy_fromio
LBB0_11:
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	movl	8(%r12), %ecx
	addl	$4, %ecx
	movq	%r12, %rdi
                                        ## kill: def $esi killed $esi killed $rsi
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rdx
	xorl	%r8d, %r8d
	callq	_nand_change_read_column_op
	movl	4(%r12), %esi
	movl	8(%r12), %ecx
	addl	$4, %ecx
	movl	12(%r12), %eax
	movl	%eax, (%rsp)
	movq	%rbx, %rdi
	movq	%r14, %rdx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	_nand_check_erased_ecc_chunk
	movl	%eax, %r13d
	movl	%eax, %r15d
	notl	%r15d
	shrl	$31, %r15d
LBB0_14:
	movq	%r12, %rdi
	movq	16(%rbp), %rsi
	movl	%r13d, %edx
	callq	_sunxi_nfc_hw_ecc_update_stats
LBB0_15:
	movl	%r15d, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_NFC_DATA_TRANS,4,2             ## @NFC_DATA_TRANS
	.comm	_NFC_DATA_SWAP_METHOD,4,2       ## @NFC_DATA_SWAP_METHOD
	.comm	_NFC_ECC_OP,4,2                 ## @NFC_ECC_OP
	.comm	_NFC_REG_CMD,8,3                ## @NFC_REG_CMD
	.comm	_NFC_CMD_INT_FLAG,4,2           ## @NFC_CMD_INT_FLAG
	.comm	_NFC_REG_ECC_ST,8,3             ## @NFC_REG_ECC_ST
	.comm	_NAND_NEED_SCRAMBLING,4,2       ## @NAND_NEED_SCRAMBLING
	.comm	_NFC_RAM0_BASE,8,3              ## @NFC_RAM0_BASE
	.no_dead_strip	_sunxi_nfc_hw_ecc_read_chunk
.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_chunk
_sunxi_nfc_hw_ecc_read_chunk:           ; @sunxi_nfc_hw_ecc_read_chunk
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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, x7
	str	x6, [sp, #16]                   ; 8-byte Folded Spill
	mov	x28, x5
	mov	x22, x4
	mov	x21, x3
	mov	x26, x2
	mov	x23, x1
	mov	x20, x0
	ldr	w25, [x29, #20]
	ldr	w0, [x0, #16]
	bl	_to_sunxi_nfc
	mov	x27, x0
	ldr	w8, [x28]
	cmp	w8, w26
	b.eq	LBB0_2
; %bb.1:
	mov	x0, x20
	mov	x1, x26
	mov	x2, #0
	mov	w3, #0
	mov	w4, #0
	bl	_nand_change_read_column_op
LBB0_2:
	ldr	w2, [x20, #4]
	mov	x0, x20
	mov	x1, #0
	mov	w3, #0
	mov	x4, x25
	bl	_sunxi_nfc_randomizer_read_buf
	ldr	w8, [x20, #4]
	add	w8, w8, w26
	cmp	w8, w22
	b.eq	LBB0_4
; %bb.3:
	mov	x0, x20
	mov	x1, x22
	mov	x2, #0
	mov	w3, #0
	mov	w4, #0
	bl	_nand_change_read_column_op
LBB0_4:
	mov	x0, x27
	bl	_sunxi_nfc_wait_cmd_fifo_empty
	mov	x19, x0
	cbnz	w0, LBB0_17
; %bb.5:
	mov	x0, x20
	bl	_sunxi_nfc_randomizer_enable
Lloh0:
	adrp	x8, _NFC_DATA_TRANS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _NFC_DATA_TRANS@GOTPAGEOFF]
Lloh2:
	adrp	x9, _NFC_DATA_SWAP_METHOD@GOTPAGE
Lloh3:
	ldr	x9, [x9, _NFC_DATA_SWAP_METHOD@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
Lloh5:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh6:
	adrp	x9, _NFC_ECC_OP@GOTPAGE
Lloh7:
	ldr	x9, [x9, _NFC_ECC_OP@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	orr	w0, w8, w9
	ldr	x8, [x27]
Lloh9:
	adrp	x9, _NFC_REG_CMD@GOTPAGE
Lloh10:
	ldr	x9, [x9, _NFC_REG_CMD@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
Lloh12:
	adrp	x8, _NFC_CMD_INT_FLAG@GOTPAGE
Lloh13:
	ldr	x8, [x8, _NFC_CMD_INT_FLAG@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	mov	x0, x27
	mov	w2, #0
	mov	w3, #0
	bl	_sunxi_nfc_wait_events
	mov	x19, x0
	mov	x0, x20
	bl	_sunxi_nfc_randomizer_disable
	cbnz	w19, LBB0_17
; %bb.6:
	str	w24, [sp, #12]                  ; 4-byte Folded Spill
	mov	x24, x21
	ldr	w21, [x29, #16]
	ldr	w8, [x20, #8]
	add	w8, w22, w8
	add	w8, w8, #4
	str	w8, [x28]
	cmp	w21, #0
	csel	x19, xzr, x24, eq
	ldr	x8, [x27]
Lloh15:
	adrp	x9, _NFC_REG_ECC_ST@GOTPAGE
Lloh16:
	ldr	x9, [x9, _NFC_REG_ECC_ST@GOTPAGEOFF]
Lloh17:
	ldr	x9, [x9]
	add	x0, x9, x8
	bl	_readl
	mov	x4, x0
	add	x5, sp, #28
	mov	x0, x20
	mov	x1, x23
	mov	x2, x19
	mov	w3, #0
	bl	_sunxi_nfc_hw_ecc_correct
	ldr	w8, [sp, #28]
	cbz	w8, LBB0_8
; %bb.7:
	mov	w19, #1
	b	LBB0_17
LBB0_8:
	mov	x28, x0
	tbnz	w0, #31, LBB0_12
; %bb.9:
	ldr	x8, [x27]
Lloh18:
	adrp	x9, _NFC_RAM0_BASE@GOTPAGE
Lloh19:
	ldr	x9, [x9, _NFC_RAM0_BASE@GOTPAGEOFF]
Lloh20:
	ldr	x9, [x9]
	add	x1, x9, x8
	ldr	w2, [x20, #4]
	mov	x0, x23
	bl	_memcpy_fromio
	cbz	w21, LBB0_11
; %bb.10:
	mov	x0, x20
	mov	x1, x22
	mov	x2, #0
	mov	w3, #0
	mov	w4, #0
	bl	_nand_change_read_column_op
	ldr	w8, [x20, #8]
	add	w2, w8, #4
	mov	x0, x20
	mov	x1, x24
	mov	w3, #1
	mov	x4, x25
	bl	_sunxi_nfc_randomizer_read_buf
	mov	x0, x20
	mov	x1, x24
	mov	w2, #0
	ldr	w3, [sp, #12]                   ; 4-byte Folded Reload
	mov	x4, x25
	bl	_sunxi_nfc_hw_ecc_get_prot_oob_bytes
LBB0_11:
	mov	w19, #0
	b	LBB0_16
LBB0_12:
	ldr	w8, [x20]
Lloh21:
	adrp	x9, _NAND_NEED_SCRAMBLING@GOTPAGE
Lloh22:
	ldr	x9, [x9, _NAND_NEED_SCRAMBLING@GOTPAGEOFF]
Lloh23:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_14
; %bb.13:
	ldr	w3, [x20, #4]
	mov	x0, x20
	mov	x1, x26
	mov	x2, x23
	mov	w4, #0
	bl	_nand_change_read_column_op
	b	LBB0_15
LBB0_14:
	ldr	x8, [x27]
Lloh24:
	adrp	x9, _NFC_RAM0_BASE@GOTPAGE
Lloh25:
	ldr	x9, [x9, _NFC_RAM0_BASE@GOTPAGEOFF]
Lloh26:
	ldr	x9, [x9]
	add	x1, x9, x8
	ldr	w2, [x20, #4]
	mov	x0, x23
	bl	_memcpy_fromio
LBB0_15:
	ldr	w8, [x20, #8]
	add	w3, w8, #4
	mov	x0, x20
	mov	x1, x22
	mov	x2, x24
	mov	w4, #0
	bl	_nand_change_read_column_op
	ldp	w1, w8, [x20, #4]
	add	w3, w8, #4
	ldr	w6, [x20, #12]
	mov	x0, x23
	mov	x2, x24
	mov	x4, #0
	mov	w5, #0
	bl	_nand_check_erased_ecc_chunk
	mov	x28, x0
	mvn	w8, w0
	lsr	w19, w8, #31
LBB0_16:
	mov	x0, x20
	ldr	x1, [sp, #16]                   ; 8-byte Folded Reload
	mov	x2, x28
	bl	_sunxi_nfc_hw_ecc_update_stats
LBB0_17:
	mov	x0, x19
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh4
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_NFC_DATA_TRANS,4,2             ; @NFC_DATA_TRANS
	.comm	_NFC_DATA_SWAP_METHOD,4,2       ; @NFC_DATA_SWAP_METHOD
	.comm	_NFC_ECC_OP,4,2                 ; @NFC_ECC_OP
	.comm	_NFC_REG_CMD,8,3                ; @NFC_REG_CMD
	.comm	_NFC_CMD_INT_FLAG,4,2           ; @NFC_CMD_INT_FLAG
	.comm	_NFC_REG_ECC_ST,8,3             ; @NFC_REG_ECC_ST
	.comm	_NAND_NEED_SCRAMBLING,4,2       ; @NAND_NEED_SCRAMBLING
	.comm	_NFC_RAM0_BASE,8,3              ; @NFC_RAM0_BASE
	.no_dead_strip	_sunxi_nfc_hw_ecc_read_chunk
.subsections_via_symbols
