	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nand_calculate_ecc             ## -- Begin function nand_calculate_ecc
	.p2align	4, 0x90
_nand_calculate_ecc:                    ## @nand_calculate_ecc
	.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
	movq	_nand_ecc_precalc_table@GOTPCREL(%rip), %rax
	movq	(%rax), %r8
	xorl	%r10d, %r10d
	xorl	%r9d, %r9d
	xorl	%eax, %eax
	xorl	%edx, %edx
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movslq	(%rdi,%r10,4), %rcx
	movl	(%r8,%rcx,4), %r14d
	movl	%r14d, %ebx
	andl	$63, %ebx
	xorl	%r9d, %ebx
	movl	%r14d, %r11d
	shll	$25, %r11d
	sarl	$31, %r11d
	movl	%edx, %ecx
	xorl	%r10d, %ecx
	testb	$64, %r14b
	notl	%ecx
	cmovel	%edx, %ecx
	andl	%r10d, %r11d
	xorl	%eax, %r11d
	movslq	4(%rdi,%r10,4), %rax
	movl	(%r8,%rax,4), %r14d
	movl	%r14d, %r9d
	andl	$63, %r9d
	xorl	%ebx, %r9d
	movl	%r14d, %eax
	shll	$25, %eax
	sarl	$31, %eax
	leal	1(%r10), %ebx
	movl	%ecx, %edx
	xorl	%ebx, %edx
	testb	$64, %r14b
	notl	%edx
	cmovel	%ecx, %edx
	andl	%ebx, %eax
	xorl	%r11d, %eax
	addq	$2, %r10
	cmpl	$256, %r10d                     ## imm = 0x100
	jne	LBB0_1
## %bb.2:
	movl	%eax, %ecx
	andl	$128, %ecx
	movl	%edx, %ebx
	shrl	%ebx
	andl	$64, %ebx
	orl	%ecx, %ebx
	movl	%eax, %r8d
	shrl	%r8d
	andl	$32, %r8d
	movl	%edx, %ecx
	shrl	$2, %ecx
	andl	$16, %ecx
	orl	%ebx, %ecx
	movl	%eax, %r10d
	shrl	$2, %r10d
	andl	$8, %r10d
	movl	%edx, %edi
	shrl	$3, %edi
	andl	$4, %edi
	orl	%ecx, %edi
	movl	%eax, %ebx
	shrl	$3, %ebx
	andl	$2, %ebx
	movl	%edx, %ecx
	shrl	$4, %ecx
	andl	$1, %ecx
	orl	%edi, %ecx
	orl	%r8d, %ecx
	orl	%r10d, %ecx
	orl	%ebx, %ecx
	movl	%eax, %edi
	andl	$8, %edi
	shll	$4, %edi
	movl	%edx, %r10d
	andl	$8, %r10d
	movl	%eax, %r8d
	andl	$4, %r8d
	movl	%edx, %r14d
	andl	$4, %r14d
	movl	%eax, %r11d
	andl	$2, %r11d
	movl	%edx, %ebx
	andl	$2, %ebx
	addl	%eax, %eax
	andl	$2, %eax
	andl	$1, %edx
	leal	(%rdx,%r10,8), %edx
	leal	(%rdx,%r14,4), %edx
	leal	(%rdx,%rbx,2), %edx
	orl	%edi, %edx
	leal	(%rdx,%r8,8), %edx
	leal	(%rdx,%r11,4), %edx
	orl	%eax, %edx
	notl	%ecx
	movl	%ecx, (%rsi)
	notl	%edx
	movl	%edx, 4(%rsi)
	notl	%r9d
	leal	3(,%r9,4), %eax
	movl	%eax, 8(%rsi)
	xorl	%eax, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_nand_ecc_precalc_table,8,3     ## @nand_ecc_precalc_table
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nand_calculate_ecc             ; -- Begin function nand_calculate_ecc
	.p2align	2
_nand_calculate_ecc:                    ; @nand_calculate_ecc
	.cfi_startproc
; %bb.0:
	mov	x11, #0
	mov	w8, #0
	mov	w10, #0
	mov	w9, #0
Lloh0:
	adrp	x12, _nand_ecc_precalc_table@GOTPAGE
Lloh1:
	ldr	x12, [x12, _nand_ecc_precalc_table@GOTPAGEOFF]
Lloh2:
	ldr	x12, [x12]
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	ldrsw	x13, [x0, x11, lsl #2]
	ldr	w13, [x12, x13, lsl #2]
	and	w14, w13, #0x3f
	eor	w8, w14, w8
	lsl	w14, w13, #25
	eor	w15, w9, w11
	tst	w13, #0x40
	csinv	w9, w9, w15, eq
	and	w13, w11, w14, asr #31
	eor	w10, w13, w10
	add	x11, x11, #1
	cmp	w11, #256
	b.ne	LBB0_1
; %bb.2:
	lsr	w11, w10, #1
	lsr	w12, w10, #2
	lsr	w13, w10, #3
	and	w14, w10, #0x80
	lsr	w15, w9, #1
	lsr	w16, w9, #2
	lsr	w17, w9, #3
	and	w0, w15, #0x40
	orr	w14, w14, w0
	and	w0, w11, #0x20
	and	w2, w16, #0x10
	and	w3, w12, #0x8
	and	w4, w17, #0x4
	and	w5, w13, #0x2
	orr	w14, w14, w2
	orr	w14, w14, w4
	bfxil	w14, w9, #4, #1
	orr	w14, w14, w0
	orr	w14, w14, w3
	orr	w14, w14, w5
	ubfiz	w10, w10, #1, #1
	and	w9, w9, #0x1
	bfi	w9, w17, #6, #1
	bfi	w9, w16, #4, #1
	bfi	w9, w15, #2, #1
	bfi	w9, w13, #7, #1
	bfi	w9, w12, #5, #1
	bfi	w9, w11, #3, #1
	orr	w9, w9, w10
	mvn	w10, w14
	mvn	w9, w9
	stp	w10, w9, [x1]
	mvn	w8, w8
	mov	w9, #3
	bfi	w9, w8, #2, #30
	str	w9, [x1, #8]
	mov	w0, #0
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_nand_ecc_precalc_table,8,3     ; @nand_ecc_precalc_table
.subsections_via_symbols
