	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_ecc_config
_mtk_ecc_config:                        ## @mtk_ecc_config
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %r14
	movq	16(%rdi), %rcx
	movq	(%rcx), %rdx
	testq	%rdx, %rdx
	je	LBB0_1
## %bb.6:
	movq	8(%rcx), %rsi
	movl	(%r15), %edi
	xorl	%eax, %eax
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	cmpl	%edi, (%rsi,%rax,4)
	je	LBB0_2
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	incq	%rax
	cmpq	%rax, %rdx
	jne	LBB0_7
	jmp	LBB0_9
LBB0_1:
	xorl	%eax, %eax
LBB0_2:
	cmpq	%rdx, %rax
	jne	LBB0_3
LBB0_9:
	movl	24(%r14), %edi
	movl	(%r15), %edx
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_12:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	movq	8(%r15), %rsi
	movq	_ECC_ENCODE@GOTPCREL(%rip), %rdi
	movl	16(%r15), %edx
	shll	$3, %edx
	cmpq	(%rdi), %rsi
	jne	LBB0_10
## %bb.4:
	movq	24(%r15), %rsi
	movb	16(%rcx), %cl
	shlq	%cl, %rsi
	movslq	%edx, %rdi
	orq	%rax, %rsi
	movq	_ECC_MS_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shlq	%cl, %rdi
	orq	%rsi, %rdi
	movq	_ECC_ENCCNFG@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r14), %rsi
	callq	_writel
	movq	24(%r15), %rax
	movq	_ECC_NFI_MODE@GOTPCREL(%rip), %rcx
	xorl	%ebx, %ebx
	cmpq	(%rcx), %rax
	je	LBB0_12
## %bb.5:
	movl	36(%r15), %edi
	callq	_lower_32_bits
	movq	_ECC_ENCDIADDR@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rsi
	addq	8(%r14), %rsi
	movq	%rax, %rdi
	callq	_writel
	jmp	LBB0_12
LBB0_10:
	movl	24(%rcx), %esi
	imull	(%r15), %esi
	addl	%edx, %esi
	movslq	%esi, %rdx
	movq	24(%r15), %rdi
	movb	16(%rcx), %cl
	shlq	%cl, %rdi
	movq	_ECC_MS_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shlq	%cl, %rdx
	movq	_DEC_CNFG_CORRECT@GOTPCREL(%rip), %rcx
	orq	%rax, %rdi
	orq	(%rcx), %rdi
	movq	_DEC_EMPTY_EN@GOTPCREL(%rip), %rax
	orq	%rdx, %rdi
	orq	(%rax), %rdi
	movq	_ECC_DECCNFG@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r14), %rsi
	callq	_writel
	movl	32(%r15), %ecx
	xorl	%ebx, %ebx
	testl	%ecx, %ecx
	je	LBB0_12
## %bb.11:
	decb	%cl
	movl	$1, %eax
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %eax
	movl	%eax, (%r14)
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"invalid ecc strength %d\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_ECC_ENCODE,8,3                 ## @ECC_ENCODE
	.comm	_ECC_MS_SHIFT,8,3               ## @ECC_MS_SHIFT
	.comm	_ECC_ENCCNFG,8,3                ## @ECC_ENCCNFG
	.comm	_ECC_NFI_MODE,8,3               ## @ECC_NFI_MODE
	.comm	_ECC_ENCDIADDR,8,3              ## @ECC_ENCDIADDR
	.comm	_DEC_CNFG_CORRECT,8,3           ## @DEC_CNFG_CORRECT
	.comm	_DEC_EMPTY_EN,8,3               ## @DEC_EMPTY_EN
	.comm	_ECC_DECCNFG,8,3                ## @ECC_DECCNFG
	.no_dead_strip	_mtk_ecc_config
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_ecc_config
_mtk_ecc_config:                        ; @mtk_ecc_config
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x20, x1
	mov	x19, x0
	ldr	x9, [x0, #16]
	ldr	x10, [x9]
	cbz	x10, LBB0_4
; %bb.1:
	mov	x8, #0
	ldr	x11, [x9, #8]
	ldr	w12, [x20]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w13, [x11, x8, lsl #2]
	cmp	w13, w12
	b.eq	LBB0_5
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	add	x8, x8, #1
	cmp	x10, x8
	b.ne	LBB0_2
	b	LBB0_6
LBB0_4:
	mov	x8, #0
LBB0_5:
	cmp	x8, x10
	b.ne	LBB0_7
LBB0_6:
	ldr	w0, [x19, #24]
	ldr	w2, [x20]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
Lloh2:
	adrp	x8, _EINVAL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_13
LBB0_7:
	ldr	x11, [x20, #8]
Lloh5:
	adrp	x10, _ECC_ENCODE@GOTPAGE
Lloh6:
	ldr	x10, [x10, _ECC_ENCODE@GOTPAGEOFF]
Lloh7:
	ldr	x12, [x10]
	ldr	w10, [x20, #16]
	lsl	w10, w10, #3
	cmp	x11, x12
	b.ne	LBB0_10
; %bb.8:
	sxtw	x10, w10
	ldr	x11, [x20, #24]
	ldr	x9, [x9, #16]
	lsl	x9, x11, x9
	orr	x8, x9, x8
Lloh8:
	adrp	x9, _ECC_MS_SHIFT@GOTPAGE
Lloh9:
	ldr	x9, [x9, _ECC_MS_SHIFT@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x9]
	lsl	x9, x10, x9
	orr	x0, x8, x9
	ldr	x8, [x19, #8]
Lloh11:
	adrp	x9, _ECC_ENCCNFG@GOTPAGE
Lloh12:
	ldr	x9, [x9, _ECC_ENCCNFG@GOTPAGEOFF]
Lloh13:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	ldr	x8, [x20, #24]
Lloh14:
	adrp	x9, _ECC_NFI_MODE@GOTPAGE
Lloh15:
	ldr	x9, [x9, _ECC_NFI_MODE@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	cmp	x8, x9
	b.eq	LBB0_12
; %bb.9:
	ldr	w0, [x20, #36]
	bl	_lower_32_bits
	ldr	x8, [x19, #8]
Lloh17:
	adrp	x9, _ECC_ENCDIADDR@GOTPAGE
Lloh18:
	ldr	x9, [x9, _ECC_ENCDIADDR@GOTPAGEOFF]
Lloh19:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	b	LBB0_12
LBB0_10:
	ldr	w11, [x20]
	ldr	w12, [x9, #24]
	madd	w10, w12, w11, w10
	sxtw	x10, w10
	ldr	x11, [x20, #24]
	ldr	x9, [x9, #16]
Lloh20:
	adrp	x12, _ECC_MS_SHIFT@GOTPAGE
Lloh21:
	ldr	x12, [x12, _ECC_MS_SHIFT@GOTPAGEOFF]
	lsl	x9, x11, x9
Lloh22:
	ldr	x11, [x12]
	lsl	x10, x10, x11
Lloh23:
	adrp	x11, _DEC_CNFG_CORRECT@GOTPAGE
Lloh24:
	ldr	x11, [x11, _DEC_CNFG_CORRECT@GOTPAGEOFF]
Lloh25:
	ldr	x11, [x11]
Lloh26:
	adrp	x12, _DEC_EMPTY_EN@GOTPAGE
Lloh27:
	ldr	x12, [x12, _DEC_EMPTY_EN@GOTPAGEOFF]
Lloh28:
	ldr	x12, [x12]
	orr	x8, x9, x8
	orr	x8, x8, x11
	orr	x8, x8, x10
	orr	x0, x8, x12
	ldr	x8, [x19, #8]
Lloh29:
	adrp	x9, _ECC_DECCNFG@GOTPAGE
Lloh30:
	ldr	x9, [x9, _ECC_DECCNFG@GOTPAGEOFF]
Lloh31:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	ldr	w8, [x20, #32]
	cbz	w8, LBB0_12
; %bb.11:
	mov	w0, #0
	sub	w8, w8, #1
	mov	w9, #1
	lsl	w8, w9, w8
	str	w8, [x19]
	b	LBB0_13
LBB0_12:
	mov	w0, #0
LBB0_13:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"invalid ecc strength %d\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_ECC_ENCODE,8,3                 ; @ECC_ENCODE
	.comm	_ECC_MS_SHIFT,8,3               ; @ECC_MS_SHIFT
	.comm	_ECC_ENCCNFG,8,3                ; @ECC_ENCCNFG
	.comm	_ECC_NFI_MODE,8,3               ; @ECC_NFI_MODE
	.comm	_ECC_ENCDIADDR,8,3              ; @ECC_ENCDIADDR
	.comm	_DEC_CNFG_CORRECT,8,3           ; @DEC_CNFG_CORRECT
	.comm	_DEC_EMPTY_EN,8,3               ; @DEC_EMPTY_EN
	.comm	_ECC_DECCNFG,8,3                ; @ECC_DECCNFG
	.no_dead_strip	_mtk_ecc_config
.subsections_via_symbols
