	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function atmel_nand_pmecc_correct_data
_atmel_nand_pmecc_correct_data:         ## @atmel_nand_pmecc_correct_data
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r12d
	movq	%rsi, %rbx
	movq	%rdi, %r14
	callq	_to_atmel_nand
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	%r14, %rdi
	callq	_nand_to_mtd
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movl	24(%r14), %edi
	callq	_to_nand_controller
	xorl	%r13d, %r13d
	testl	%r12d, %r12d
	jne	LBB0_11
## %bb.1:
	movq	%rax, %r15
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edi
	callq	_atmel_pmecc_wait_rdy
	testl	%eax, %eax
	je	LBB0_3
## %bb.2:
	movl	%eax, %r13d
	movl	(%r15), %edi
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edx
	callq	_dev_err
LBB0_11:
	movl	%r13d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	xorl	%r13d, %r13d
	leaq	-56(%rbp), %rdx
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	xorl	%esi, %esi
	callq	_mtd_ooblayout_ecc
	cmpl	$0, (%r14)
	jle	LBB0_11
## %bb.4:
	movslq	-56(%rbp), %r12
	addq	16(%r14), %r12
	xorl	%r13d, %r13d
	xorl	%r15d, %r15d
	jmp	LBB0_5
LBB0_7:                                 ##   in Loop: Header=BB0_5 Depth=1
	movl	4(%r14), %ecx
	movl	8(%r14), %esi
	movl	12(%r14), %eax
	movl	%eax, (%rsp)
	movq	%rbx, %rdi
	movq	%r12, %rdx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	_nand_check_erased_ecc_chunk
	testl	%eax, %eax
	js	LBB0_9
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_5 Depth=1
	movl	%eax, %edi
	movl	%r13d, %esi
	callq	_max
	movl	%eax, %r13d
LBB0_10:                                ##   in Loop: Header=BB0_5 Depth=1
	movslq	8(%r14), %rax
	addq	%rax, %rbx
	movslq	4(%r14), %rax
	addq	%rax, %r12
	incl	%r15d
	cmpl	(%r14), %r15d
	jge	LBB0_11
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edi
	movl	%r15d, %esi
	movq	%rbx, %rdx
	movq	%r12, %rcx
	callq	_atmel_pmecc_correct_sector
	testl	%eax, %eax
	jns	LBB0_8
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edi
	callq	_atmel_pmecc_correct_erased_chunks
	testl	%eax, %eax
	je	LBB0_7
LBB0_9:                                 ##   in Loop: Header=BB0_5 Depth=1
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	incl	(%rax)
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to read NAND page data (err = %d)\n"

	.no_dead_strip	_atmel_nand_pmecc_correct_data
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function atmel_nand_pmecc_correct_data
_atmel_nand_pmecc_correct_data:         ; @atmel_nand_pmecc_correct_data
	.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	x23, x2
	mov	x19, x1
	mov	x20, x0
	bl	_to_atmel_nand
	mov	x21, x0
	mov	x0, x20
	bl	_nand_to_mtd
	mov	x22, x0
	ldr	w0, [x20, #24]
	bl	_to_nand_controller
	cbz	w23, LBB0_2
LBB0_1:
	mov	w23, #0
	b	LBB0_4
LBB0_2:
	mov	x24, x0
	ldr	w0, [x21]
	bl	_atmel_pmecc_wait_rdy
	cbz	w0, LBB0_5
; %bb.3:
	mov	x23, x0
	ldr	w0, [x24]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x23
	bl	_dev_err
LBB0_4:
	mov	x0, x23
	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_5:
	add	x2, sp, #8
	mov	x0, x22
	mov	w1, #0
	bl	_mtd_ooblayout_ecc
	ldr	w8, [x20]
	cmp	w8, #1
	b.lt	LBB0_1
; %bb.6:
	mov	w23, #0
	mov	w24, #0
	ldr	x8, [x20, #16]
	ldrsw	x9, [sp, #8]
	add	x25, x8, x9
	b	LBB0_10
LBB0_7:                                 ;   in Loop: Header=BB0_10 Depth=1
	ldp	w3, w1, [x20, #4]
	ldr	w6, [x20, #12]
	mov	x0, x19
	mov	x2, x25
	mov	x4, #0
	mov	w5, #0
	bl	_nand_check_erased_ecc_chunk
	tbnz	w0, #31, LBB0_12
LBB0_8:                                 ;   in Loop: Header=BB0_10 Depth=1
	mov	x1, x23
	bl	_max
	mov	x23, x0
LBB0_9:                                 ;   in Loop: Header=BB0_10 Depth=1
	ldrsw	x8, [x20, #8]
	add	x19, x19, x8
	ldp	w9, w8, [x20]
                                        ; kill: def $w8 killed $w8 def $x8
	sxtw	x8, w8
	add	x25, x25, x8
	add	w24, w24, #1
	cmp	w24, w9
	b.ge	LBB0_4
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x21]
	mov	x1, x24
	mov	x2, x19
	mov	x3, x25
	bl	_atmel_pmecc_correct_sector
	tbz	w0, #31, LBB0_8
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	ldr	w0, [x21]
	bl	_atmel_pmecc_correct_erased_chunks
	cbz	w0, LBB0_7
LBB0_12:                                ;   in Loop: Header=BB0_10 Depth=1
	ldr	w8, [x22]
	add	w8, w8, #1
	str	w8, [x22]
	b	LBB0_9
	.loh AdrpAdd	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to read NAND page data (err = %d)\n"

	.no_dead_strip	_atmel_nand_pmecc_correct_data
.subsections_via_symbols
