	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_nfc_update_ecc_stats
_mtk_nfc_update_ecc_stats:              ## @mtk_nfc_update_ecc_stats
	.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, %r14d
	movl	%edx, %ebx
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	callq	_mtd_to_nand
	movq	%rax, %r15
	movq	%rax, %rdi
	callq	_nand_get_controller_data
	movq	%rax, %r13
	movq	%r15, %rdi
	callq	_to_mtk_nand
	movl	(%rax), %r12d
	movq	_NFI_STA@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	callq	_nfi_readl
	movq	_STA_EMP_PAGE@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_3
## %bb.1:
	movl	(%r15), %edx
	imull	%r14d, %edx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	$255, %esi
	callq	_memset
	xorl	%r13d, %r13d
	testl	%r14d, %r14d
	jle	LBB0_4
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_oob_ptr
	movq	%rax, %rdi
	movl	$255, %esi
	movl	%r12d, %edx
	callq	_memset
	incl	%ebx
	decl	%r14d
	jne	LBB0_2
	jmp	LBB0_4
LBB0_3:
	movl	(%r13), %edi
	leaq	-80(%rbp), %rsi
	movl	%r14d, %edx
	callq	_mtk_ecc_get_stats
	movl	-64(%rbp), %eax
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	addl	%eax, 4(%rcx)
	movl	-72(%rbp), %eax
	addl	%eax, (%rcx)
	movl	-80(%rbp), %r13d
LBB0_4:
	movl	%r13d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_NFI_STA,4,2                    ## @NFI_STA
	.comm	_STA_EMP_PAGE,4,2               ## @STA_EMP_PAGE
	.no_dead_strip	_mtk_nfc_update_ecc_stats
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_nfc_update_ecc_stats
_mtk_nfc_update_ecc_stats:              ; @mtk_nfc_update_ecc_stats
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	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
	mov	x19, x3
	mov	x20, x2
	mov	x24, x1
	mov	x23, x0
	bl	_mtd_to_nand
	mov	x21, x0
	bl	_nand_get_controller_data
	mov	x25, x0
	mov	x0, x21
	bl	_to_mtk_nand
	ldr	w22, [x0]
Lloh0:
	adrp	x8, _NFI_STA@GOTPAGE
Lloh1:
	ldr	x8, [x8, _NFI_STA@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x0, x25
	bl	_nfi_readl
Lloh3:
	adrp	x8, _STA_EMP_PAGE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _STA_EMP_PAGE@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	tst	w8, w0
	b.eq	LBB0_4
; %bb.1:
	ldr	w8, [x21]
	mul	w2, w8, w19
	mov	x0, x24
	mov	w1, #255
	bl	_memset
	cmp	w19, #1
	b.lt	LBB0_3
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x21
	mov	x1, x20
	bl	_oob_ptr
	mov	w1, #255
	mov	x2, x22
	bl	_memset
	add	w20, w20, #1
	subs	w19, w19, #1
	b.ne	LBB0_2
LBB0_3:
	mov	w0, #0
	b	LBB0_5
LBB0_4:
	ldr	w0, [x25]
	add	x1, sp, #8
	mov	x2, x19
	bl	_mtk_ecc_get_stats
	ldur	q0, [sp, #16]
	ldr	d1, [x23]
	xtn.2s	v0, v0
	add.2s	v0, v1, v0
	str	d0, [x23]
	ldr	w0, [sp, #8]
LBB0_5:
	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
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_NFI_STA,4,2                    ; @NFI_STA
	.comm	_STA_EMP_PAGE,4,2               ; @STA_EMP_PAGE
	.no_dead_strip	_mtk_nfc_update_ecc_stats
.subsections_via_symbols
