	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function r852_ecc_hwctl
_r852_ecc_hwctl:                        ## @r852_ecc_hwctl
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movl	%esi, %r14d
	callq	_nand_to_mtd
	movl	%eax, %edi
	callq	_r852_get_dev
	cmpq	$0, 8(%rax)
	je	LBB0_1
LBB0_7:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_1:
	movq	%rax, %rbx
	cmpl	$130, %r14d
	je	LBB0_4
## %bb.2:
	cmpl	$129, %r14d
	je	LBB0_5
## %bb.3:
	cmpl	$128, %r14d
	jne	LBB0_7
LBB0_4:
	movq	_R852_CTL_ECC_ENABLE@GOTPCREL(%rip), %rax
	movl	(%rbx), %edx
	orl	(%rax), %edx
	movl	%edx, (%rbx)
	movq	_R852_CTL@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	movq	_R852_CTL_ECC_ACCESS@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_r852_write_reg
	movq	_R852_DATALINE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_r852_read_reg_dword
	movl	(%r14), %esi
	movl	(%rbx), %edx
	jmp	LBB0_6
LBB0_5:
	movq	_R852_CTL_ECC_ENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	notl	%edx
	andl	(%rbx), %edx
	movl	%edx, (%rbx)
	movq	_R852_CTL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
LBB0_6:
	movq	%rbx, %rdi
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_r852_write_reg                 ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_R852_CTL_ECC_ENABLE,4,2        ## @R852_CTL_ECC_ENABLE
	.comm	_R852_CTL,4,2                   ## @R852_CTL
	.comm	_R852_CTL_ECC_ACCESS,4,2        ## @R852_CTL_ECC_ACCESS
	.comm	_R852_DATALINE,4,2              ## @R852_DATALINE
	.no_dead_strip	_r852_ecc_hwctl
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function r852_ecc_hwctl
_r852_ecc_hwctl:                        ; @r852_ecc_hwctl
	.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
	bl	_nand_to_mtd
	bl	_r852_get_dev
	ldr	x8, [x0, #8]
	cbz	x8, LBB0_2
LBB0_1:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_2:
	mov	x19, x0
	cmp	w20, #130
	b.eq	LBB0_5
; %bb.3:
	cmp	w20, #129
	b.eq	LBB0_6
; %bb.4:
	cmp	w20, #128
	b.ne	LBB0_1
LBB0_5:
Lloh0:
	adrp	x8, _R852_CTL_ECC_ENABLE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _R852_CTL_ECC_ENABLE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	ldr	w9, [x19]
	orr	w8, w9, w8
Lloh3:
	adrp	x20, _R852_CTL@GOTPAGE
Lloh4:
	ldr	x20, [x20, _R852_CTL@GOTPAGEOFF]
	str	w8, [x19]
	ldr	w1, [x20]
Lloh5:
	adrp	x9, _R852_CTL_ECC_ACCESS@GOTPAGE
Lloh6:
	ldr	x9, [x9, _R852_CTL_ECC_ACCESS@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	orr	w2, w9, w8
	mov	x0, x19
	bl	_r852_write_reg
Lloh8:
	adrp	x8, _R852_DATALINE@GOTPAGE
Lloh9:
	ldr	x8, [x8, _R852_DATALINE@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_r852_read_reg_dword
	ldr	w1, [x20]
	ldr	w2, [x19]
	b	LBB0_7
LBB0_6:
Lloh11:
	adrp	x8, _R852_CTL_ECC_ENABLE@GOTPAGE
Lloh12:
	ldr	x8, [x8, _R852_CTL_ECC_ENABLE@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	ldr	w9, [x19]
	bic	w2, w9, w8
	str	w2, [x19]
Lloh14:
	adrp	x8, _R852_CTL@GOTPAGE
Lloh15:
	ldr	x8, [x8, _R852_CTL@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x8]
LBB0_7:
	mov	x0, x19
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_r852_write_reg
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_R852_CTL_ECC_ENABLE,4,2        ; @R852_CTL_ECC_ENABLE
	.comm	_R852_CTL,4,2                   ; @R852_CTL
	.comm	_R852_CTL_ECC_ACCESS,4,2        ; @R852_CTL_ECC_ACCESS
	.comm	_R852_DATALINE,4,2              ; @R852_DATALINE
	.no_dead_strip	_r852_ecc_hwctl
.subsections_via_symbols
