	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mxc_nand_read_page_v1
_mxc_nand_read_page_v1:                 ## @mxc_nand_read_page_v1
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%r8d, %r15d
	movl	%ecx, %r14d
	movq	%rdx, -72(%rbp)                 ## 8-byte Spill
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r13
	callq	_nand_to_mtd
	movq	%rax, %r12
	movq	%r13, %rdi
	callq	_nand_get_controller_data
	movq	%rax, %rbx
	movq	8(%rax), %rax
	movq	%r13, %rdi
	movl	%r14d, %esi
	callq	*8(%rax)
	movq	8(%rbx), %rax
	movq	_NAND_CMD_READ0@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	*(%rax)
	movq	%r12, %rdi
	xorl	%esi, %esi
	movl	%r15d, %edx
	callq	_mxc_do_addr_cycle
	movl	(%r12), %r15d
	cmpl	$513, %r15d                     ## imm = 0x201
	jl	LBB0_2
## %bb.1:
	movq	8(%rbx), %rax
	movq	_NAND_CMD_READSTART@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movq	%rbx, %rdi
	movl	$1, %edx
	callq	*(%rax)
	movl	(%r12), %r15d
LBB0_2:
	movq	%r12, -64(%rbp)                 ## 8-byte Spill
	cmpl	$512, %r15d                     ## imm = 0x200
	jl	LBB0_11
## %bb.3:
	shrl	$9, %r15d
	cmpq	$0, -56(%rbp)                   ## 8-byte Folded Reload
	setne	%al
	testl	%r14d, %r14d
	setne	%r14b
	andb	%al, %r14b
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	leaq	8(%rax), %rcx
	movq	%rcx, -88(%rbp)                 ## 8-byte Spill
	addq	$4, %rax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	xorl	%r13d, %r13d
	movq	_NFC_V1_V2_CONFIG2@GOTPCREL(%rip), %r12
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
	jmp	LBB0_4
LBB0_6:                                 ##   in Loop: Header=BB0_4 Depth=1
	movq	-88(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
LBB0_9:                                 ##   in Loop: Header=BB0_4 Depth=1
	incl	(%rcx)
LBB0_10:                                ##   in Loop: Header=BB0_4 Depth=1
	incl	%r13d
	cmpl	%r13d, %r15d
	je	LBB0_11
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%rbx), %edi
	shll	$4, %edi
	orl	%r13d, %edi
	movq	_NFC_V1_V2_BUF_ADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_writew
	movq	_NFC_OUTPUT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	(%r12), %esi
	callq	_writew
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_wait_op_done
	movq	%rbx, %rdi
	callq	_get_ecc_status_v1
	testb	%r14b, %r14b
	je	LBB0_10
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	shrl	$2, %eax
	andl	$3, %eax
	cmpl	$1, %eax
	je	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_4 Depth=1
	cmpl	$2, %eax
	jne	LBB0_10
## %bb.8:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	-80(%rbp), %rcx                 ## 8-byte Reload
	jmp	LBB0_9
LBB0_11:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	testq	%rdi, %rdi
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	je	LBB0_13
## %bb.12:
	movl	4(%rbx), %esi
	movl	(%r14), %edx
	callq	_memcpy32_fromio
LBB0_13:
	movq	-72(%rbp), %rdx                 ## 8-byte Reload
	testq	%rdx, %rdx
	je	LBB0_15
## %bb.14:
	movq	%r14, %rdi
	movl	$1, %esi
	callq	_copy_spare
LBB0_15:
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_NAND_CMD_READ0,4,2             ## @NAND_CMD_READ0
	.comm	_NAND_CMD_READSTART,4,2         ## @NAND_CMD_READSTART
	.comm	_NFC_V1_V2_BUF_ADDR,4,2         ## @NFC_V1_V2_BUF_ADDR
	.comm	_NFC_OUTPUT,4,2                 ## @NFC_OUTPUT
	.comm	_NFC_V1_V2_CONFIG2,4,2          ## @NFC_V1_V2_CONFIG2
	.no_dead_strip	_mxc_nand_read_page_v1
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mxc_nand_read_page_v1
_mxc_nand_read_page_v1:                 ; @mxc_nand_read_page_v1
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x23, x4
	mov	x24, x3
	mov	x19, x2
	mov	x21, x1
	mov	x25, x0
	bl	_nand_to_mtd
	mov	x20, x0
	mov	x0, x25
	bl	_nand_get_controller_data
	mov	x22, x0
	ldr	x8, [x0, #8]
	ldr	x8, [x8, #8]
	mov	x0, x25
	mov	x1, x24
	blr	x8
	ldr	x8, [x22, #8]
	ldr	x8, [x8]
Lloh0:
	adrp	x9, _NAND_CMD_READ0@GOTPAGE
Lloh1:
	ldr	x9, [x9, _NAND_CMD_READ0@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x9]
	mov	x0, x22
	mov	w2, #0
	blr	x8
	mov	x0, x20
	mov	w1, #0
	mov	x2, x23
	bl	_mxc_do_addr_cycle
	ldr	w8, [x20]
	cmp	w8, #512
	b.le	LBB0_2
; %bb.1:
	ldr	x8, [x22, #8]
	ldr	x8, [x8]
Lloh3:
	adrp	x9, _NAND_CMD_READSTART@GOTPAGE
Lloh4:
	ldr	x9, [x9, _NAND_CMD_READSTART@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x9]
	mov	x0, x22
	mov	w2, #1
	blr	x8
	ldr	w8, [x20]
LBB0_2:
	stp	x21, x19, [sp, #8]              ; 16-byte Folded Spill
	cmp	w8, #512
	b.lt	LBB0_11
; %bb.3:
	mov	w25, #0
	mov	w23, #0
	lsr	w26, w8, #9
	cmp	x21, #0
	ccmp	w24, #0, #4, ne
	cset	w24, ne
	add	x8, x20, #8
	str	x8, [sp, #24]                   ; 8-byte Folded Spill
	add	x28, x20, #4
Lloh6:
	adrp	x19, _NFC_V1_V2_BUF_ADDR@GOTPAGE
Lloh7:
	ldr	x19, [x19, _NFC_V1_V2_BUF_ADDR@GOTPAGEOFF]
Lloh8:
	adrp	x21, _NFC_OUTPUT@GOTPAGE
Lloh9:
	ldr	x21, [x21, _NFC_OUTPUT@GOTPAGEOFF]
Lloh10:
	adrp	x27, _NFC_V1_V2_CONFIG2@GOTPAGE
Lloh11:
	ldr	x27, [x27, _NFC_V1_V2_CONFIG2@GOTPAGEOFF]
	b	LBB0_7
LBB0_4:                                 ;   in Loop: Header=BB0_7 Depth=1
	ldr	x8, [sp, #24]                   ; 8-byte Folded Reload
	mov	x23, x9
LBB0_5:                                 ;   in Loop: Header=BB0_7 Depth=1
	ldr	w9, [x8]
	add	w9, w9, #1
	str	w9, [x8]
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	add	w25, w25, #1
	cmp	w26, w25
	b.eq	LBB0_12
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x22]
	orr	w0, w25, w8, lsl #4
	ldr	w1, [x19]
	bl	_writew
	ldr	w0, [x21]
	ldr	w1, [x27]
	bl	_writew
	mov	x0, x22
	mov	w1, #1
	bl	_wait_op_done
	mov	x0, x22
	bl	_get_ecc_status_v1
	cbz	w24, LBB0_6
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	ubfx	w9, w0, #2, #2
	cmp	w9, #1
	b.eq	LBB0_4
; %bb.9:                                ;   in Loop: Header=BB0_7 Depth=1
	cmp	w9, #2
	b.ne	LBB0_6
; %bb.10:                               ;   in Loop: Header=BB0_7 Depth=1
	mov	x8, x28
	b	LBB0_5
LBB0_11:
	mov	w23, #0
LBB0_12:
	ldr	x0, [sp, #8]                    ; 8-byte Folded Reload
	cbz	x0, LBB0_14
; %bb.13:
	ldr	w1, [x22, #4]
	ldr	w2, [x20]
	bl	_memcpy32_fromio
LBB0_14:
	ldr	x2, [sp, #16]                   ; 8-byte Folded Reload
	cbz	x2, LBB0_16
; %bb.15:
	mov	x0, x20
	mov	w1, #1
	bl	_copy_spare
LBB0_16:
	mov	x0, x23
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_NAND_CMD_READ0,4,2             ; @NAND_CMD_READ0
	.comm	_NAND_CMD_READSTART,4,2         ; @NAND_CMD_READSTART
	.comm	_NFC_V1_V2_BUF_ADDR,4,2         ; @NFC_V1_V2_BUF_ADDR
	.comm	_NFC_OUTPUT,4,2                 ; @NFC_OUTPUT
	.comm	_NFC_V1_V2_CONFIG2,4,2          ; @NFC_V1_V2_CONFIG2
	.no_dead_strip	_mxc_nand_read_page_v1
.subsections_via_symbols
