	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gpmi_ecc_read_subpage
_gpmi_ecc_read_subpage:                 ## @gpmi_ecc_read_subpage
	.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	%r8d, -48(%rbp)                 ## 4-byte Spill
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	movl	%edx, %r15d
	movl	%esi, %r13d
	movq	%rdi, %rbx
	callq	_nand_get_controller_data
	movq	%rax, %r12
	movl	28(%rax), %esi
	movl	24(%rax), %eax
	imull	%esi, %eax
	leal	7(%rax), %r14d
	testl	%eax, %eax
	cmovnsl	%eax, %r14d
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movl	(%rbx), %ecx
	movl	%r13d, %eax
	cltd
	idivl	%ecx
	movl	%eax, %r9d
	movq	%r13, -112(%rbp)                ## 8-byte Spill
	leal	(%r15,%r13), %eax
	decl	%eax
	cltd
	idivl	%ecx
	movl	%eax, %r8d
	cmpq	$0, 16(%r12)
	je	LBB0_3
## %bb.1:
	movl	32(%r12), %eax
	cltd
	idivl	%ecx
	cmpl	%eax, %r8d
	jl	LBB0_3
## %bb.2:
	cmpl	%eax, %r9d
	jg	LBB0_3
## %bb.5:
	movl	12(%r12), %edi
	leaq	L_.str(%rip), %rsi
	movl	-48(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, %edx
	movl	%r9d, %ecx
	movl	%eax, %r9d
	xorl	%eax, %eax
	callq	_dev_dbg
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	xorl	%edx, %edx
	movl	%ebx, %ecx
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_gpmi_ecc_read_page             ## TAILCALL
LBB0_3:
	movq	%r15, -104(%rbp)                ## 8-byte Spill
	sarl	$3, %r14d
	movl	36(%r12), %eax
	addl	%ecx, %r14d
	movl	%r14d, %r15d
	imull	%r9d, %r15d
	addl	%eax, %r15d
	imull	%r9d, %ecx
	xorl	%ebx, %ebx
	testl	%r9d, %r9d
	cmovel	%eax, %ebx
	movslq	%ecx, %rax
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	leaq	(%rcx,%rax,4), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	cmovel	%r9d, %r15d
	movl	%r8d, %edi
	subl	%r9d, %edi
	leal	1(%rdi), %eax
	movq	%rax, -96(%rbp)                 ## 8-byte Spill
	imull	%eax, %r14d
	addl	%ebx, %r14d
	sarl	%esi
                                        ## kill: def $edi killed $edi killed $rdi
	movq	%r9, -88(%rbp)                  ## 8-byte Spill
	movl	%r8d, -68(%rbp)                 ## 4-byte Spill
	movl	%esi, %r13d
	movl	%esi, -80(%rbp)                 ## 4-byte Spill
	callq	_BF_BCH_FLASH0LAYOUT0_NBLOCKS
	movl	%eax, -76(%rbp)                 ## 4-byte Spill
	movl	%ebx, -72(%rbp)                 ## 4-byte Spill
	movl	%ebx, %edi
	callq	_BF_BCH_FLASH0LAYOUT0_META_SIZE
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	%r13d, %edi
	movq	%r12, %rsi
	callq	_BF_BCH_FLASH0LAYOUT0_ECC0
	movl	%eax, %r13d
	orl	-76(%rbp), %r13d                ## 4-byte Folded Reload
	movl	24(%r12), %edi
	movq	%r12, %rsi
	callq	_BF_BCH_FLASH0LAYOUT0_GF
	movl	%eax, %ebx
	orl	%r13d, %ebx
	orl	-44(%rbp), %ebx                 ## 4-byte Folded Reload
	movl	40(%r12), %edi
	movq	%r12, %rsi
	callq	_BF_BCH_FLASH0LAYOUT0_DATA0_SIZE
	orl	%ebx, %eax
	movl	%eax, (%r12)
	movl	%r14d, %edi
	callq	_BF_BCH_FLASH0LAYOUT1_PAGE_SIZE
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	-80(%rbp), %edi                 ## 4-byte Reload
	movq	%r12, %rsi
	callq	_BF_BCH_FLASH0LAYOUT1_ECCN
	movl	%eax, %ebx
	movl	24(%r12), %edi
	movq	%r12, %rsi
	callq	_BF_BCH_FLASH0LAYOUT1_GF
	movl	%eax, %r13d
	orl	%ebx, %r13d
	movl	40(%r12), %edi
	movq	%r12, %rsi
	callq	_BF_BCH_FLASH0LAYOUT1_DATAN_SIZE
	orl	%r13d, %eax
	movq	-56(%rbp), %r13                 ## 8-byte Reload
	movl	-48(%rbp), %ebx                 ## 4-byte Reload
	orl	-44(%rbp), %eax                 ## 4-byte Folded Reload
	movl	%eax, 4(%r12)
	movl	$1, 8(%r12)
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movl	%ebx, %esi
	movl	%r15d, %edx
	movq	%r13, %rcx
	movl	%r14d, %r8d
	callq	_nand_read_page_op
	testl	%eax, %eax
	je	LBB0_6
## %bb.4:
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movl	12(%r12), %edi
	subq	$8, %rsp
	leaq	L_.str.1(%rip), %rsi
	movl	%ebx, %edx
	movq	-112(%rbp), %rcx                ## 8-byte Reload
                                        ## kill: def $ecx killed $ecx killed $rcx
	movq	-104(%rbp), %r8                 ## 8-byte Reload
                                        ## kill: def $r8d killed $r8d killed $r8
	movl	%r15d, %r9d
	xorl	%eax, %eax
	pushq	%r14
	pushq	-96(%rbp)                       ## 8-byte Folded Reload
	movq	-88(%rbp), %rbx                 ## 8-byte Reload
	pushq	%rbx
	callq	_dev_dbg
	addq	$32, %rsp
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	%r13, %rsi
	movl	%ebx, %edx
	movl	-68(%rbp), %ecx                 ## 4-byte Reload
	movl	-72(%rbp), %r8d                 ## 4-byte Reload
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_gpmi_count_bitflips            ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"page:%d, first:%d, last:%d, marker at:%d\n"

L_.str.1:                               ## @.str.1
	.asciz	"page:%d(%d:%d)%d, chunk:(%d:%d), BCH PG size:%d\n"

	.no_dead_strip	_gpmi_ecc_read_subpage
.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_subpage
_gpmi_ecc_read_subpage:                 ; @gpmi_ecc_read_subpage
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #160
	.cfi_def_cfa_offset 160
	stp	x28, x27, [sp, #64]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #80]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #96]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #112]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #128]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #144]            ; 16-byte Folded Spill
	add	x29, sp, #144
	.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	x21, x4
	mov	x27, x3
	mov	x19, x2
	mov	x23, x1
	mov	x20, x0
	bl	_nand_get_controller_data
	mov	x25, x0
	ldr	w9, [x20]
	ldp	w10, w8, [x0, #24]
	mul	w10, w8, w10
	add	w11, w10, #7
	cmp	w10, #0
	csel	w10, w11, w10, lt
	sdiv	w22, w23, w9
	add	w11, w23, w19
	sub	w11, w11, #1
	ldr	x12, [x0, #16]
	sdiv	w24, w11, w9
	cbz	x12, LBB0_4
; %bb.1:
	ldr	w11, [x25, #32]
	sdiv	w5, w11, w9
	cmp	w24, w5
	b.lt	LBB0_4
; %bb.2:
	cmp	w22, w5
	b.gt	LBB0_4
; %bb.3:
	ldr	w0, [x25, #12]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x21
	mov	x3, x22
	mov	x4, x24
	bl	_dev_dbg
	mov	x0, x20
	mov	x1, x27
	mov	w2, #0
	mov	x3, x21
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #80]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #160
	b	_gpmi_ecc_read_page
LBB0_4:
	str	w19, [sp, #44]                  ; 4-byte Folded Spill
	asr	w10, w10, #3
	ldr	w11, [x25, #36]
	add	w10, w10, w9
	madd	w12, w10, w22, w11
	mul	w9, w22, w9
	cmp	w22, #0
	csel	w26, w11, wzr, eq
	add	x9, x27, w9, sxtw #2
	str	x9, [sp, #48]                   ; 8-byte Folded Spill
	csel	w19, wzr, w12, eq
	sub	w0, w24, w22
	add	w9, w0, #1
	str	x9, [sp, #32]                   ; 8-byte Folded Spill
	madd	w27, w9, w10, w26
	asr	w28, w8, #1
	bl	_BF_BCH_FLASH0LAYOUT0_NBLOCKS
	str	w21, [sp, #60]                  ; 4-byte Folded Spill
	mov	x21, x0
	mov	x0, x26
	bl	_BF_BCH_FLASH0LAYOUT0_META_SIZE
	orr	w21, w0, w21
	mov	x0, x28
	mov	x1, x25
	bl	_BF_BCH_FLASH0LAYOUT0_ECC0
	orr	w21, w21, w0
	ldr	w0, [x25, #24]
	mov	x1, x25
	bl	_BF_BCH_FLASH0LAYOUT0_GF
	orr	w21, w21, w0
	ldr	w0, [x25, #40]
	mov	x1, x25
	bl	_BF_BCH_FLASH0LAYOUT0_DATA0_SIZE
	orr	w8, w21, w0
	str	w8, [x25]
	mov	x0, x27
	bl	_BF_BCH_FLASH0LAYOUT1_PAGE_SIZE
	mov	x21, x0
	mov	x0, x28
	mov	x28, x19
	mov	x1, x25
	bl	_BF_BCH_FLASH0LAYOUT1_ECCN
	orr	w21, w0, w21
	ldr	w0, [x25, #24]
	mov	x1, x25
	bl	_BF_BCH_FLASH0LAYOUT1_GF
	orr	w21, w21, w0
	ldr	w0, [x25, #40]
	mov	x1, x25
	bl	_BF_BCH_FLASH0LAYOUT1_DATAN_SIZE
	orr	w8, w21, w0
	ldr	w21, [sp, #60]                  ; 4-byte Folded Reload
	ldr	x19, [sp, #48]                  ; 8-byte Folded Reload
	mov	w9, #1
	stp	w8, w9, [x25, #4]
	mov	x0, x20
	mov	x1, x21
	mov	x2, x28
	mov	x3, x19
	mov	x4, x27
	bl	_nand_read_page_op
	cbz	w0, LBB0_6
; %bb.5:
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #80]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #160
	ret
LBB0_6:
	ldr	w0, [x25, #12]
	ldr	x8, [sp, #32]                   ; 8-byte Folded Reload
	stp	x8, x27, [sp, #8]
	str	x22, [sp]
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x21
	mov	x3, x23
	ldr	w4, [sp, #44]                   ; 4-byte Folded Reload
	mov	x5, x28
	bl	_dev_dbg
	mov	x0, x20
	mov	x1, x19
	mov	x2, x22
	mov	x3, x24
	mov	x4, x26
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #80]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #160
	b	_gpmi_count_bitflips
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"page:%d, first:%d, last:%d, marker at:%d\n"

l_.str.1:                               ; @.str.1
	.asciz	"page:%d(%d:%d)%d, chunk:(%d:%d), BCH PG size:%d\n"

	.no_dead_strip	_gpmi_ecc_read_subpage
.subsections_via_symbols
