	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function atmel_nand_correct
_atmel_nand_correct:                    ## @atmel_nand_correct
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r12
	movq	(%rdi), %rbx
	movq	8(%rbx), %r14
	movl	4(%r14), %edi
	movq	_SR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_ecc_readl
	movl	%eax, %r13d
	movq	_ATMEL_ECC_RECERR@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	movl	(%rax), %eax
	andl	%r13d, %eax
	sete	%dil
	callq	_likely
	xorl	%r15d, %r15d
	testq	%rax, %rax
	je	LBB0_1
LBB0_11:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movq	%r12, -48(%rbp)                 ## 8-byte Spill
	movl	4(%r14), %edi
	movq	_PR@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	callq	_ecc_readl
	movl	%eax, %ebx
	movq	_ATMEL_ECC_BITADDR@GOTPCREL(%rip), %rax
	andl	(%rax), %ebx
	movl	4(%r14), %edi
	movl	(%r12), %esi
	callq	_ecc_readl
	movl	%eax, %r12d
	movq	_ATMEL_ECC_WORDADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	%eax, %r12d
	shrq	$4, %r12
	movq	_ATMEL_ECC_MULERR@GOTPCREL(%rip), %rcx
	testl	%r13d, (%rcx)
	je	LBB0_5
## %bb.2:
	movq	_ATMEL_ECC_BITADDR@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %ebx
	jne	LBB0_4
## %bb.3:
	sarl	$4, %eax
	cmpl	%eax, %r12d
	je	LBB0_11
LBB0_4:
	movl	(%r14), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%r15d, %r15d
	xorl	%eax, %eax
	callq	_dev_dbg
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
	jmp	LBB0_11
LBB0_5:
	movq	_ATMEL_ECC_ECCERR@GOTPCREL(%rip), %rax
	movl	(%r14), %edi
	testl	%r13d, (%rax)
	je	LBB0_7
## %bb.6:
	leaq	L_.str.1(%rip), %rsi
	xorl	%r15d, %r15d
	xorl	%eax, %eax
	callq	_dev_dbg
	jmp	LBB0_11
LBB0_7:
	leaq	L_.str.2(%rip), %rsi
	movl	%r12d, %edx
	movl	%ebx, %ecx
	xorl	%eax, %eax
	callq	_dev_dbg
	movl	$1, %eax
	movl	%ebx, %ecx
	shll	%cl, %eax
	movq	_NAND_BUSWIDTH_16@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	testl	%ecx, (%rdx)
	je	LBB0_9
## %bb.8:
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	xorw	%ax, (%rcx,%r12,2)
	jmp	LBB0_10
LBB0_9:
	movl	%r12d, %ecx
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	xorl	%eax, (%rdx,%rcx,4)
LBB0_10:
	movl	(%r14), %edi
	leaq	L_.str.3(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_dbg
	movl	$1, %r15d
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.comm	_SR,4,2                         ## @SR
	.comm	_ATMEL_ECC_RECERR,4,2           ## @ATMEL_ECC_RECERR
	.comm	_PR,4,2                         ## @PR
	.comm	_ATMEL_ECC_BITADDR,4,2          ## @ATMEL_ECC_BITADDR
	.comm	_ATMEL_ECC_WORDADDR,4,2         ## @ATMEL_ECC_WORDADDR
	.comm	_ATMEL_ECC_MULERR,4,2           ## @ATMEL_ECC_MULERR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"atmel_nand : multiple errors detected. Unable to correct.\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_ATMEL_ECC_ECCERR,4,2           ## @ATMEL_ECC_ECCERR
L_.str.1:                               ## @.str.1
	.asciz	"atmel_nand : one bit error on ECC code. Nothing to correct\n"

L_.str.2:                               ## @.str.2
	.asciz	"atmel_nand : one bit error on data. (word offset in the page : 0x%x bit offset : 0x%x)\n"

	.comm	_NAND_BUSWIDTH_16,4,2           ## @NAND_BUSWIDTH_16
L_.str.3:                               ## @.str.3
	.asciz	"atmel_nand : error corrected\n"

	.no_dead_strip	_atmel_nand_correct
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function atmel_nand_correct
_atmel_nand_correct:                    ; @atmel_nand_correct
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x19, x1
	ldr	x22, [x0]
	ldr	x21, [x22, #8]
	ldr	w0, [x21, #4]
Lloh0:
	adrp	x8, _SR@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SR@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_ecc_readl
	mov	x20, x0
Lloh3:
	adrp	x8, _ATMEL_ECC_RECERR@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ATMEL_ECC_RECERR@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	tst	w8, w0
	cset	w0, eq
	bl	_likely
	cbz	x0, LBB0_3
LBB0_1:
	mov	w0, #0
LBB0_2:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_3:
	ldr	w0, [x21, #4]
Lloh6:
	adrp	x24, _PR@GOTPAGE
Lloh7:
	ldr	x24, [x24, _PR@GOTPAGEOFF]
	ldr	w1, [x24]
	bl	_ecc_readl
Lloh8:
	adrp	x25, _ATMEL_ECC_BITADDR@GOTPAGE
Lloh9:
	ldr	x25, [x25, _ATMEL_ECC_BITADDR@GOTPAGEOFF]
	ldr	w8, [x25]
	and	w23, w8, w0
	ldr	w0, [x21, #4]
	ldr	w1, [x24]
	bl	_ecc_readl
Lloh10:
	adrp	x8, _ATMEL_ECC_WORDADDR@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ATMEL_ECC_WORDADDR@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	mov	w9, w0
	and	x9, x8, x9
	lsr	x24, x9, #4
Lloh13:
	adrp	x9, _ATMEL_ECC_MULERR@GOTPAGE
Lloh14:
	ldr	x9, [x9, _ATMEL_ECC_MULERR@GOTPAGEOFF]
Lloh15:
	ldr	w9, [x9]
	tst	w9, w20
	b.eq	LBB0_6
; %bb.4:
	ldr	w9, [x25]
	asr	w8, w8, #4
	cmp	w23, w9
	ccmp	w24, w8, #0, eq
	b.eq	LBB0_1
; %bb.5:
	ldr	w0, [x21]
Lloh16:
	adrp	x1, l_.str@PAGE
Lloh17:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
Lloh18:
	adrp	x8, _EIO@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_2
LBB0_6:
Lloh21:
	adrp	x8, _ATMEL_ECC_ECCERR@GOTPAGE
Lloh22:
	ldr	x8, [x8, _ATMEL_ECC_ECCERR@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	ldr	w0, [x21]
	tst	w8, w20
	b.eq	LBB0_8
; %bb.7:
Lloh24:
	adrp	x1, l_.str.1@PAGE
Lloh25:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_dbg
	b	LBB0_1
LBB0_8:
	mov	x8, x24
	stp	x8, x23, [sp]
Lloh26:
	adrp	x1, l_.str.2@PAGE
Lloh27:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_dbg
	ldr	w9, [x22]
Lloh28:
	adrp	x8, _NAND_BUSWIDTH_16@GOTPAGE
Lloh29:
	ldr	x8, [x8, _NAND_BUSWIDTH_16@GOTPAGEOFF]
Lloh30:
	ldr	w10, [x8]
	mov	w8, #1
	lsl	w8, w8, w23
	tst	w10, w9
	b.eq	LBB0_10
; %bb.9:
	lsl	x9, x24, #1
	ldrh	w10, [x19, x9]
	eor	w8, w10, w8
	strh	w8, [x19, x9]
	b	LBB0_11
LBB0_10:
	mov	w9, w24
	lsl	x9, x9, #2
	ldr	w10, [x19, x9]
	eor	w8, w10, w8
	str	w8, [x19, x9]
LBB0_11:
	ldr	w0, [x21]
Lloh31:
	adrp	x1, l_.str.3@PAGE
Lloh32:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_dbg
	mov	w0, #1
	b	LBB0_2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpAdd	Lloh31, Lloh32
	.cfi_endproc
                                        ; -- End function
	.comm	_SR,4,2                         ; @SR
	.comm	_ATMEL_ECC_RECERR,4,2           ; @ATMEL_ECC_RECERR
	.comm	_PR,4,2                         ; @PR
	.comm	_ATMEL_ECC_BITADDR,4,2          ; @ATMEL_ECC_BITADDR
	.comm	_ATMEL_ECC_WORDADDR,4,2         ; @ATMEL_ECC_WORDADDR
	.comm	_ATMEL_ECC_MULERR,4,2           ; @ATMEL_ECC_MULERR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"atmel_nand : multiple errors detected. Unable to correct.\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_ATMEL_ECC_ECCERR,4,2           ; @ATMEL_ECC_ECCERR
l_.str.1:                               ; @.str.1
	.asciz	"atmel_nand : one bit error on ECC code. Nothing to correct\n"

l_.str.2:                               ; @.str.2
	.asciz	"atmel_nand : one bit error on data. (word offset in the page : 0x%x bit offset : 0x%x)\n"

	.comm	_NAND_BUSWIDTH_16,4,2           ; @NAND_BUSWIDTH_16
l_.str.3:                               ; @.str.3
	.asciz	"atmel_nand : error corrected\n"

	.no_dead_strip	_atmel_nand_correct
.subsections_via_symbols
