	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function omap_calculate_ecc
_omap_calculate_ecc:                    ## @omap_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	%rdx, %r14
	callq	_nand_to_mtd
	movl	%eax, %edi
	callq	_mtd_to_omap
	movq	%rax, %rbx
	movl	8(%rax), %edi
	callq	_readl
	movq	_ECC_CONFIG_CS_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	sarl	%cl, %eax
	movq	_CS_MASK@GOTPCREL(%rip), %rcx
	andl	(%rcx), %eax
	cmpl	(%rbx), %eax
	jne	LBB0_1
## %bb.2:
	movl	4(%rbx), %edi
	callq	_readl
	movl	%eax, (%r14)
	movl	%eax, %ecx
	sarl	$16, %ecx
	movl	%ecx, 4(%r14)
	movl	%eax, %ecx
	shrl	$8, %ecx
	andl	$15, %ecx
	shrl	$20, %eax
	andl	$240, %eax
	orl	%ecx, %eax
	movl	%eax, 8(%r14)
	xorl	%eax, %eax
	jmp	LBB0_3
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_3:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ECC_CONFIG_CS_SHIFT,4,2        ## @ECC_CONFIG_CS_SHIFT
	.comm	_CS_MASK,4,2                    ## @CS_MASK
	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_omap_calculate_ecc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function omap_calculate_ecc
_omap_calculate_ecc:                    ; @omap_calculate_ecc
	.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	x19, x2
	bl	_nand_to_mtd
	bl	_mtd_to_omap
	mov	x20, x0
	ldr	w0, [x0, #8]
	bl	_readl
Lloh0:
	adrp	x8, _ECC_CONFIG_CS_SHIFT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ECC_CONFIG_CS_SHIFT@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	asr	w8, w0, w8
Lloh3:
	adrp	x9, _CS_MASK@GOTPAGE
Lloh4:
	ldr	x9, [x9, _CS_MASK@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	and	w8, w8, w9
	ldr	w9, [x20]
	cmp	w8, w9
	b.ne	LBB0_2
; %bb.1:
	ldr	w0, [x20, #4]
	bl	_readl
	mov	x8, x0
	mov	w0, #0
	asr	w9, w8, #16
	stp	w8, w9, [x19]
	lsr	w9, w8, #20
	and	w9, w9, #0xf0
	bfxil	w9, w8, #8, #4
	str	w9, [x19, #8]
	b	LBB0_3
LBB0_2:
Lloh6:
	adrp	x8, _EINVAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_3:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_ECC_CONFIG_CS_SHIFT,4,2        ; @ECC_CONFIG_CS_SHIFT
	.comm	_CS_MASK,4,2                    ; @CS_MASK
	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_omap_calculate_ecc
.subsections_via_symbols
