	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function r852_ecc_calculate
_r852_ecc_calculate:                    ## @r852_ecc_calculate
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	callq	_nand_to_mtd
	movl	%eax, %edi
	callq	_r852_get_dev
	cmpq	$0, 8(%rax)
	jne	LBB0_2
## %bb.1:
	movq	%rax, %r15
	movq	_R852_CTL_ECC_ENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	notl	%edx
	andl	(%r15), %edx
	movl	%edx, (%r15)
	movq	_R852_CTL@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	_R852_CTL_ECC_ACCESS@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	movq	%r15, %rdi
	callq	_r852_write_reg
	movq	_R852_DATALINE@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	movq	%r15, %rdi
	callq	_r852_read_reg_dword
	movl	%eax, %ebx
	movl	(%r13), %esi
	movq	%r15, %rdi
	callq	_r852_read_reg_dword
	movzbl	%bl, %ecx
	movq	(%r14), %rdx
	movl	%ecx, (%rdx)
	movzbl	%bh, %ecx
	movl	%ecx, 4(%rdx)
	shrl	$16, %ebx
	movzbl	%bl, %ecx
	movl	%ecx, 8(%rdx)
	movzbl	%al, %ecx
	movq	8(%r14), %rdx
	movl	%ecx, (%rdx)
	movzbl	%ah, %ecx
	movl	%ecx, 4(%rdx)
	shrl	$16, %eax
	movzbl	%al, %eax
	movl	%eax, 8(%rdx)
	movl	(%r12), %esi
	movl	(%r15), %edx
	movq	%r15, %rdi
	callq	_r852_write_reg
LBB0_2:
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.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_calculate
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function r852_ecc_calculate
lCPI0_0:
	.long	4294967288                      ; 0xfffffff8
	.long	4294967280                      ; 0xfffffff0
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	2
_r852_ecc_calculate:                    ; @r852_ecc_calculate
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x19, x2
	bl	_nand_to_mtd
	bl	_r852_get_dev
	ldr	x8, [x0, #8]
	cbnz	x8, LBB0_2
; %bb.1:
	mov	x20, x0
Lloh0:
	adrp	x8, _R852_CTL_ECC_ENABLE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _R852_CTL_ECC_ENABLE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	ldr	w9, [x0]
	bic	w8, w9, w8
Lloh3:
	adrp	x22, _R852_CTL@GOTPAGE
Lloh4:
	ldr	x22, [x22, _R852_CTL@GOTPAGEOFF]
	str	w8, [x0]
	ldr	w1, [x22]
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
	bl	_r852_write_reg
Lloh8:
	adrp	x23, _R852_DATALINE@GOTPAGE
Lloh9:
	ldr	x23, [x23, _R852_DATALINE@GOTPAGEOFF]
	ldr	w1, [x23]
	mov	x0, x20
	bl	_r852_read_reg_dword
	mov	x21, x0
	ldr	w1, [x23]
	mov	x0, x20
	bl	_r852_read_reg_dword
	and	w8, w21, #0xff
	ldp	x9, x10, [x19]
	str	w8, [x9]
	dup.2s	v0, w21
Lloh10:
	adrp	x8, lCPI0_0@PAGE
Lloh11:
	ldr	d1, [x8, lCPI0_0@PAGEOFF]
	ushl.2s	v0, v0, v1
	movi	d2, #0x0000ff000000ff
	and.8b	v0, v0, v2
	stur	d0, [x9, #4]
	and	w8, w0, #0xff
	dup.2s	v0, w0
	str	w8, [x10]
	ushl.2s	v0, v0, v1
	and.8b	v0, v0, v2
	stur	d0, [x10, #4]
	ldr	w1, [x22]
	ldr	w2, [x20]
	mov	x0, x20
	bl	_r852_write_reg
LBB0_2:
	mov	w0, #0
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdr	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.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_calculate
.subsections_via_symbols
