	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gpmi_ecc_write_page_raw
_gpmi_ecc_write_page_raw:               ## @gpmi_ecc_write_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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, -84(%rbp)                 ## 4-byte Spill
	movl	%edx, -48(%rbp)                 ## 4-byte Spill
	movq	%rsi, %r13
	movq	%rdi, %rbx
	callq	_nand_to_mtd
	movq	%rax, %r14
	movq	%rbx, %rdi
	callq	_nand_get_controller_data
	movl	24(%rax), %r15d
	imull	20(%rax), %r15d
	movl	16(%rax), %ecx
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	8(%rax), %r12
	movq	%rbx, -104(%rbp)                ## 8-byte Spill
	movq	(%rbx), %rax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	%r13, -64(%rbp)                 ## 8-byte Spill
	testq	%r13, %r13
	je	LBB0_2
## %bb.1:
	cmpl	$0, -48(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_3
LBB0_2:
	movq	8(%r14), %rdx
	addq	(%r14), %rdx
	movq	%r12, %rdi
	movl	$255, %esi
	callq	_memset
LBB0_3:
	movq	%r14, -96(%rbp)                 ## 8-byte Spill
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	movq	32(%r14), %rdx
	movq	%r12, -80(%rbp)                 ## 8-byte Spill
	movq	%r12, %rdi
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	callq	_memcpy
	movq	32(%r14), %rbx
	shlq	$3, %rbx
	movl	40(%r14), %eax
	testl	%eax, %eax
	jle	LBB0_13
## %bb.4:
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	shll	$3, %ecx
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	movslq	%ecx, %rcx
	movq	%rcx, -112(%rbp)                ## 8-byte Spill
	xorl	%r12d, %r12d
	xorl	%r14d, %r14d
	movq	%rbx, %r13
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_5 Depth=1
	movslq	%r15d, %rcx
	addq	%rcx, %r13
	addq	%rcx, %rbx
	incq	%r14
	movslq	%eax, %rcx
	addl	-44(%rbp), %r12d                ## 4-byte Folded Reload
	cmpq	%rcx, %r14
	jge	LBB0_13
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	testq	%rdx, %rdx
	je	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movslq	%r12d, %rcx
	movq	-80(%rbp), %rdi                 ## 8-byte Reload
	movq	%r13, %rsi
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	movl	-44(%rbp), %r8d                 ## 4-byte Reload
	callq	_gpmi_copy_bits
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	40(%rax), %eax
LBB0_7:                                 ##   in Loop: Header=BB0_5 Depth=1
	leal	-1(%rax), %ecx
	cmpq	%rcx, %r14
	jne	LBB0_10
## %bb.8:                               ##   in Loop: Header=BB0_5 Depth=1
	leal	(%rbx,%r15), %ecx
	andq	$7, %rcx
	je	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_5 Depth=1
	subl	%ecx, %r15d
	addl	$8, %r15d
LBB0_10:                                ##   in Loop: Header=BB0_5 Depth=1
	addq	-112(%rbp), %r13                ## 8-byte Folded Reload
	cmpl	$0, -48(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_5 Depth=1
	movq	-80(%rbp), %rdi                 ## 8-byte Reload
	movq	%r13, %rsi
	movq	-72(%rbp), %rdx                 ## 8-byte Reload
	movq	%rbx, %rcx
	movl	%r15d, %r8d
	callq	_gpmi_copy_bits
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	40(%rax), %eax
	jmp	LBB0_12
LBB0_13:
	cmpl	$0, -48(%rbp)                   ## 4-byte Folded Reload
	movq	-96(%rbp), %r14                 ## 8-byte Reload
	movq	-80(%rbp), %r15                 ## 8-byte Reload
	je	LBB0_16
## %bb.14:
	shrq	$3, %rbx
	movq	8(%r14), %rdx
	subq	%rbx, %rdx
	jbe	LBB0_16
## %bb.15:
	movq	(%r14), %rax
	leaq	(%r15,%rax,4), %rax
	leaq	(%rax,%rbx,4), %rdi
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	leaq	(%rax,%rbx,4), %rsi
	callq	_memcpy
LBB0_16:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	cmpq	$0, (%rax)
	je	LBB0_18
## %bb.17:
	movl	(%r15), %edi
	movq	(%r14), %rax
	movl	(%r15,%rax,4), %esi
	callq	_swap
LBB0_18:
	movq	8(%r14), %r8
	addq	(%r14), %r8
	movq	-104(%rbp), %rdi                ## 8-byte Reload
	movl	-84(%rbp), %esi                 ## 4-byte Reload
	xorl	%edx, %edx
	movq	%r15, %rcx
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_nand_prog_page_op              ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_gpmi_ecc_write_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_write_page_raw
_gpmi_ecc_write_page_raw:               ; @gpmi_ecc_write_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
	str	w3, [sp, #20]                   ; 4-byte Folded Spill
	mov	x24, x2
	mov	x25, x1
	mov	x21, x0
	bl	_nand_to_mtd
	mov	x26, x0
	mov	x0, x21
	bl	_nand_get_controller_data
	mov	x23, x0
	ldp	w19, w20, [x0, #16]
	ldr	w28, [x0, #24]
	ldr	x22, [x0, #8]
	str	x21, [sp, #8]                   ; 8-byte Folded Spill
	ldr	x8, [x21]
	str	x8, [sp, #24]                   ; 8-byte Folded Spill
	cbz	x25, LBB0_2
; %bb.1:
	cbnz	w24, LBB0_3
LBB0_2:
	ldp	x8, x9, [x26]
	add	x2, x9, x8
	mov	x0, x22
	mov	w1, #255
	bl	_memset
LBB0_3:
	str	x26, [sp]                       ; 8-byte Folded Spill
	ldr	x2, [x23, #32]
	mov	x0, x22
	ldr	x1, [sp, #24]                   ; 8-byte Folded Reload
	bl	_memcpy
	ldr	x8, [x23, #32]
	lsl	x27, x8, #3
	ldr	w8, [x23, #40]
	cmp	w8, #1
	b.lt	LBB0_13
; %bb.4:
	mov	w21, #0
	mov	x26, #0
	mul	w28, w28, w20
	lsl	w9, w19, #3
	sxtw	x19, w9
	mov	x20, x27
	b	LBB0_6
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	sxtw	x9, w28
	add	x20, x20, x9
	add	x27, x27, x9
	add	x26, x26, #1
	add	w21, w21, w19
	cmp	x26, w8, sxtw
	b.ge	LBB0_13
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	cbz	x25, LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	sxtw	x3, w21
	mov	x0, x22
	mov	x1, x20
	mov	x2, x25
	mov	x4, x19
	bl	_gpmi_copy_bits
	ldr	w8, [x23, #40]
LBB0_8:                                 ;   in Loop: Header=BB0_6 Depth=1
	sub	w9, w8, #1
	cmp	x26, x9
	b.ne	LBB0_11
; %bb.9:                                ;   in Loop: Header=BB0_6 Depth=1
	add	w9, w27, w28
	ands	x9, x9, #0x7
	b.eq	LBB0_11
; %bb.10:                               ;   in Loop: Header=BB0_6 Depth=1
	sub	w9, w28, w9
	add	w28, w9, #8
LBB0_11:                                ;   in Loop: Header=BB0_6 Depth=1
	add	x20, x20, x19
	cbz	w24, LBB0_5
; %bb.12:                               ;   in Loop: Header=BB0_6 Depth=1
	mov	x0, x22
	mov	x1, x20
	ldr	x2, [sp, #24]                   ; 8-byte Folded Reload
	mov	x3, x27
	mov	x4, x28
	bl	_gpmi_copy_bits
	ldr	w8, [x23, #40]
	b	LBB0_5
LBB0_13:
	ldr	x19, [sp]                       ; 8-byte Folded Reload
	cbz	w24, LBB0_16
; %bb.14:
	lsr	x8, x27, #3
	ldr	x9, [x19, #8]
	subs	x2, x9, x8
	b.ls	LBB0_16
; %bb.15:
	ldr	x9, [x19]
	add	x9, x22, x9, lsl #2
	lsl	x8, x8, #2
	add	x0, x9, x8
	ldr	x9, [sp, #24]                   ; 8-byte Folded Reload
	add	x1, x9, x8
	bl	_memcpy
LBB0_16:
	ldr	x8, [x23]
	cbz	x8, LBB0_18
; %bb.17:
	ldr	w0, [x22]
	ldr	x8, [x19]
	ldr	w1, [x22, x8, lsl #2]
	bl	_swap
LBB0_18:
	ldp	x8, x9, [x19]
	add	x4, x9, x8
	ldr	x0, [sp, #8]                    ; 8-byte Folded Reload
	ldr	w1, [sp, #20]                   ; 4-byte Folded Reload
	mov	w2, #0
	mov	x3, x22
	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
	b	_nand_prog_page_op
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_gpmi_ecc_write_page_raw
.subsections_via_symbols
