	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gpmi_ecc_read_page_raw
_gpmi_ecc_read_page_raw:                ## @gpmi_ecc_read_page_raw
	.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	%ecx, %r12d
	movl	%edx, -48(%rbp)                 ## 4-byte Spill
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	movq	%rdi, %rbx
	callq	_nand_to_mtd
	movq	%rax, %r14
	movq	%rbx, %rdi
	callq	_nand_get_controller_data
	movq	%rax, %r13
	movl	16(%rax), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	24(%r13), %r15d
	imull	20(%r13), %r15d
	movq	8(%r13), %rax
	movq	(%rbx), %rcx
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	movq	8(%r14), %r8
	addq	(%r14), %r8
	movq	%rbx, %rdi
	movq	%rax, %rbx
	movl	%r12d, %esi
	xorl	%edx, %edx
	movq	%rax, %rcx
	callq	_nand_read_page_op
	movl	%eax, %r12d
	testl	%eax, %eax
	je	LBB0_1
LBB0_19:
	movl	%r12d, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movl	-48(%rbp), %r12d                ## 4-byte Reload
	cmpq	$0, (%r13)
	je	LBB0_3
## %bb.2:
	movl	(%rbx), %edi
	movq	(%r14), %rax
	movl	(%rbx,%rax,4), %esi
	callq	_swap
LBB0_3:
	testl	%r12d, %r12d
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	je	LBB0_5
## %bb.4:
	movq	32(%r13), %rdx
	movq	%rbx, %rsi
	callq	_memcpy
LBB0_5:
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	movq	%r14, -88(%rbp)                 ## 8-byte Spill
	movq	32(%r13), %r12
	shlq	$3, %r12
	movl	40(%r13), %eax
	testl	%eax, %eax
	jle	LBB0_6
## %bb.7:
	movq	%r13, -80(%rbp)                 ## 8-byte Spill
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	shll	$3, %esi
	movslq	%esi, %rcx
	movq	%rcx, -96(%rbp)                 ## 8-byte Spill
	xorl	%r13d, %r13d
	xorl	%r14d, %r14d
	movq	%r12, %rbx
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movl	%esi, -44(%rbp)                 ## 4-byte Spill
	jmp	LBB0_8
	.p2align	4, 0x90
LBB0_15:                                ##   in Loop: Header=BB0_8 Depth=1
	movslq	%r15d, %rcx
	addq	%rcx, %r12
	addq	%rcx, %rbx
	incq	%r14
	movslq	%eax, %rcx
	addl	%esi, %r13d
	cmpq	%rcx, %r14
	jge	LBB0_16
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	testq	%rdx, %rdx
	je	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	movslq	%r13d, %rsi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movq	-72(%rbp), %rdx                 ## 8-byte Reload
	movq	%r12, %rcx
	movl	-44(%rbp), %r8d                 ## 4-byte Reload
	callq	_gpmi_copy_bits
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	movl	40(%rax), %eax
LBB0_10:                                ##   in Loop: Header=BB0_8 Depth=1
	leal	-1(%rax), %ecx
	cmpq	%rcx, %r14
	jne	LBB0_13
## %bb.11:                              ##   in Loop: Header=BB0_8 Depth=1
	leal	(%rbx,%r15), %ecx
	andq	$7, %rcx
	je	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_8 Depth=1
	subl	%ecx, %r15d
	addl	$8, %r15d
LBB0_13:                                ##   in Loop: Header=BB0_8 Depth=1
	addq	-96(%rbp), %r12                 ## 8-byte Folded Reload
	cmpl	$0, -48(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	%rbx, %rsi
	movq	-72(%rbp), %rdx                 ## 8-byte Reload
	movq	%r12, %rcx
	movl	%r15d, %r8d
	callq	_gpmi_copy_bits
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	movl	40(%rax), %eax
	jmp	LBB0_15
LBB0_6:
	movq	%r12, %rbx
LBB0_16:
	xorl	%r12d, %r12d
	cmpl	$0, -48(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_19
## %bb.17:
	shrq	$3, %rbx
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	movq	8(%rax), %rdx
	subq	%rbx, %rdx
	jbe	LBB0_19
## %bb.18:
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	leaq	(%rcx,%rbx,4), %rdi
	movq	(%rax), %rax
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	leaq	(%rcx,%rax,4), %rax
	leaq	(%rax,%rbx,4), %rsi
	callq	_memcpy
	jmp	LBB0_19
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_gpmi_ecc_read_page_raw
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gpmi_ecc_read_page_raw
_gpmi_ecc_read_page_raw:                ; @gpmi_ecc_read_page_raw
	.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	x25, x3
	mov	x20, x2
	mov	x22, x1
	mov	x26, x0
	bl	_nand_to_mtd
	mov	x19, x0
	mov	x0, x26
	bl	_nand_get_controller_data
	mov	x24, x0
	ldp	w8, w27, [x0, #16]
	str	w8, [sp, #20]                   ; 4-byte Folded Spill
	ldr	w28, [x0, #24]
	ldr	x21, [x0, #8]
	ldr	x23, [x26]
	ldp	x8, x9, [x19]
	add	x4, x9, x8
	mov	x0, x26
	mov	x1, x25
	mov	w2, #0
	mov	x3, x21
	bl	_nand_read_page_op
	cbnz	w0, LBB0_20
; %bb.1:
	ldr	w26, [sp, #20]                  ; 4-byte Folded Reload
	ldr	x8, [x24]
	cbz	x8, LBB0_3
; %bb.2:
	ldr	w0, [x21]
	ldr	x8, [x19]
	ldr	w1, [x21, x8, lsl #2]
	bl	_swap
LBB0_3:
	mov	x25, x27
	mov	x27, x28
	cbz	w20, LBB0_5
; %bb.4:
	ldr	x2, [x24, #32]
	mov	x0, x23
	mov	x1, x21
	bl	_memcpy
LBB0_5:
	str	x23, [sp, #24]                  ; 8-byte Folded Spill
	str	x19, [sp, #8]                   ; 8-byte Folded Spill
	ldr	x8, [x24, #32]
	lsl	x28, x8, #3
	ldr	w8, [x24, #40]
	cmp	w8, #1
	b.lt	LBB0_15
; %bb.6:
	mov	w19, #0
	mov	x23, #0
	mul	w25, w27, w25
	lsl	w9, w26, #3
	sxtw	x26, w9
	mov	x27, x28
	b	LBB0_8
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=1
	sxtw	x9, w25
	add	x28, x28, x9
	add	x27, x27, x9
	add	x23, x23, #1
	add	w19, w19, w26
	cmp	x23, w8, sxtw
	b.ge	LBB0_16
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	cbz	x22, LBB0_10
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	sxtw	x1, w19
	mov	x0, x22
	mov	x2, x21
	mov	x3, x28
	mov	x4, x26
	bl	_gpmi_copy_bits
	ldr	w8, [x24, #40]
LBB0_10:                                ;   in Loop: Header=BB0_8 Depth=1
	sub	w9, w8, #1
	cmp	x23, x9
	b.ne	LBB0_13
; %bb.11:                               ;   in Loop: Header=BB0_8 Depth=1
	add	w9, w27, w25
	ands	x9, x9, #0x7
	b.eq	LBB0_13
; %bb.12:                               ;   in Loop: Header=BB0_8 Depth=1
	sub	w9, w25, w9
	add	w25, w9, #8
LBB0_13:                                ;   in Loop: Header=BB0_8 Depth=1
	add	x28, x28, x26
	cbz	w20, LBB0_7
; %bb.14:                               ;   in Loop: Header=BB0_8 Depth=1
	ldr	x0, [sp, #24]                   ; 8-byte Folded Reload
	mov	x1, x27
	mov	x2, x21
	mov	x3, x28
	mov	x4, x25
	bl	_gpmi_copy_bits
	ldr	w8, [x24, #40]
	b	LBB0_7
LBB0_15:
	mov	x27, x28
LBB0_16:
	cbz	w20, LBB0_19
; %bb.17:
	lsr	x8, x27, #3
	ldr	x10, [sp, #8]                   ; 8-byte Folded Reload
	ldr	x9, [x10, #8]
	subs	x2, x9, x8
	b.ls	LBB0_19
; %bb.18:
	lsl	x8, x8, #2
	ldr	x9, [sp, #24]                   ; 8-byte Folded Reload
	add	x0, x9, x8
	ldr	x9, [x10]
	add	x9, x21, x9, lsl #2
	add	x1, x9, x8
	bl	_memcpy
LBB0_19:
	mov	w0, #0
LBB0_20:
	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
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_gpmi_ecc_read_page_raw
.subsections_via_symbols
