	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function atmel_nand_read_page
_atmel_nand_read_page:                  ## @atmel_nand_read_page
	.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	%rdx, -56(%rbp)                 ## 8-byte Spill
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movl	16(%rsi), %r13d
	movl	20(%rsi), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	32(%rsi), %rax
	movq	(%rax), %r12
	movq	48(%rsi), %r15
	xorl	%eax, %eax
	callq	_cpu_is_at32ap7000
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	40(%rbx), %rax
	movl	(%rax), %edi
	movq	_CR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_ATMEL_ECC_RST@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_ecc_writel
LBB0_2:
	movq	%r14, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movl	%r13d, %edx
	callq	*(%rbx)
	movq	(%r12), %rdx
	testq	%rdx, %rdx
	je	LBB0_3
## %bb.4:
	movq	_NAND_CMD_RNDOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	addq	(%r14), %rdx
	movq	%r14, %rdi
	movl	$-1, %ecx
	callq	*8(%rbx)
	movq	(%r12), %rax
	jmp	LBB0_5
LBB0_3:
	xorl	%eax, %eax
LBB0_5:
	leaq	(%r15,%rax,4), %rsi
	movq	%r14, %rdi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	callq	*(%rbx)
	movq	%r14, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movq	%r15, %rdx
	xorl	%ecx, %ecx
	callq	*24(%rbx)
	movl	%eax, %ecx
	shrl	$31, %ecx
	testl	%eax, %eax
	movl	$1, %edx
	cmovnsl	%eax, %edx
	addl	%edx, 12(%r14,%rcx,4)
	movq	_NAND_CMD_RNDOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	(%r14), %rdx
	movq	%r14, %rdi
	movl	$-1, %ecx
	callq	*8(%rbx)
	movl	8(%r14), %edx
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	*(%rbx)
	xorl	%eax, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CR,4,2                         ## @CR
	.comm	_ATMEL_ECC_RST,4,2              ## @ATMEL_ECC_RST
	.comm	_NAND_CMD_RNDOUT,4,2            ## @NAND_CMD_RNDOUT
	.no_dead_strip	_atmel_nand_read_page
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function atmel_nand_read_page
_atmel_nand_read_page:                  ; @atmel_nand_read_page
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x22, x2
	mov	x20, x1
	mov	x19, x0
	ldp	w24, w23, [x1, #16]
	ldr	x8, [x1, #32]
	ldr	x25, [x8]
	ldr	x21, [x1, #48]
	bl	_cpu_is_at32ap7000
	cbz	x0, LBB0_2
; %bb.1:
	ldr	x8, [x20, #40]
	ldr	w0, [x8]
Lloh0:
	adrp	x8, _CR@GOTPAGE
Lloh1:
	ldr	x8, [x8, _CR@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
Lloh3:
	adrp	x8, _ATMEL_ECC_RST@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ATMEL_ECC_RST@GOTPAGEOFF]
Lloh5:
	ldr	w2, [x8]
	bl	_ecc_writel
LBB0_2:
	ldr	x8, [x20]
	mov	x0, x19
	mov	x1, x22
	mov	x2, x24
	blr	x8
	ldr	x8, [x25]
Lloh6:
	adrp	x24, _NAND_CMD_RNDOUT@GOTPAGE
Lloh7:
	ldr	x24, [x24, _NAND_CMD_RNDOUT@GOTPAGEOFF]
	cbz	x8, LBB0_4
; %bb.3:
	ldr	x9, [x20, #8]
	ldr	w1, [x24]
	ldr	x10, [x19]
	add	x2, x10, x8
	mov	x0, x19
	mov	w3, #-1
	blr	x9
	ldr	x8, [x25]
LBB0_4:
	add	x1, x21, x8, lsl #2
	ldr	x8, [x20]
	mov	x0, x19
	mov	x2, x23
	blr	x8
	ldr	x8, [x20, #24]
	mov	x0, x19
	mov	x1, x22
	mov	x2, x21
	mov	x3, #0
	blr	x8
	cmp	w0, #0
	mov	w8, #12
	mov	w9, #16
	csel	x8, x9, x8, lt
	csinc	w9, w0, wzr, ge
	ldr	w10, [x19, x8]
	add	w9, w10, w9
	str	w9, [x19, x8]
	ldr	x8, [x20, #8]
	ldr	w1, [x24]
	ldr	x2, [x19]
	mov	x0, x19
	mov	w3, #-1
	blr	x8
	ldr	x8, [x20]
	ldr	w2, [x19, #8]
	mov	x0, x19
	mov	x1, x21
	blr	x8
	mov	w0, #0
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_CR,4,2                         ; @CR
	.comm	_ATMEL_ECC_RST,4,2              ; @ATMEL_ECC_RST
	.comm	_NAND_CMD_RNDOUT,4,2            ; @NAND_CMD_RNDOUT
	.no_dead_strip	_atmel_nand_read_page
.subsections_via_symbols
