	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nand_write_subpage_hwecc
_nand_write_subpage_hwecc:              ## @nand_write_subpage_hwecc
	.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	$88, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%r9d, -64(%rbp)                 ## 4-byte Spill
	movl	%r8d, -72(%rbp)                 ## 4-byte Spill
	movq	%rcx, %r13
                                        ## kill: def $edx killed $edx def $rdx
	movq	%rdx, -56(%rbp)                 ## 8-byte Spill
	movl	%esi, %r12d
	movq	%rdi, %r15
	callq	_nand_to_mtd
	movq	%rax, %rcx
	movq	(%r15), %rbx
	movq	24(%r15), %r14
	movslq	8(%r15), %rsi
	movslq	12(%r15), %rax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	movl	16(%r15), %edi
	movl	%r12d, %eax
	cltd
	idivl	%esi
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	addl	%r12d, %eax
	decl	%eax
	movq	%rcx, %r12
	cltd
	movq	%rsi, -88(%rbp)                 ## 8-byte Spill
	idivl	%esi
	movl	%eax, -56(%rbp)                 ## 4-byte Spill
	movl	(%rcx), %eax
	cltd
	movl	%edi, -68(%rbp)                 ## 4-byte Spill
	idivl	%edi
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	%r15, %rdi
	movl	-64(%rbp), %esi                 ## 4-byte Reload
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	callq	_nand_prog_page_begin_op
	testl	%eax, %eax
	jne	LBB0_15
## %bb.1:
	movq	%r12, -104(%rbp)                ## 8-byte Spill
	movl	-68(%rbp), %r12d                ## 4-byte Reload
	testl	%r12d, %r12d
	movq	%r15, %rcx
	jle	LBB0_13
## %bb.2:
	movslq	-44(%rbp), %rdx                 ## 4-byte Folded Reload
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	leaq	(,%rax,4), %rax
	movq	%rax, -120(%rbp)                ## 8-byte Spill
	shlq	$2, %rdx
	movq	%rdx, -128(%rbp)                ## 8-byte Spill
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	leaq	(,%rax,4), %rax
	movq	%rax, -112(%rbp)                ## 8-byte Spill
	xorl	%r15d, %r15d
	movq	%rcx, -96(%rbp)                 ## 8-byte Spill
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	%rbx, %rdi
	movl	$255, %esi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	callq	_memset
LBB0_12:                                ##   in Loop: Header=BB0_3 Depth=1
	incl	%r15d
	addq	-120(%rbp), %r13                ## 8-byte Folded Reload
	addq	-128(%rbp), %rbx                ## 8-byte Folded Reload
	addq	-112(%rbp), %r14                ## 8-byte Folded Reload
	cmpl	%r15d, %r12d
	movq	-96(%rbp), %rcx                 ## 8-byte Reload
	je	LBB0_13
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	movq	_NAND_ECC_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rcx, %rdi
	movq	%r13, %r14
	movq	%rcx, %r13
	callq	*40(%rcx)
	movq	%r13, %rdi
	movq	%r14, %r13
	movq	%r14, %rsi
	movq	-88(%rbp), %rdx                 ## 8-byte Reload
                                        ## kill: def $edx killed $edx killed $rdx
	xorl	%ecx, %ecx
	callq	_nand_write_data_op
	testl	%eax, %eax
	jne	LBB0_15
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	cmpl	-48(%rbp), %r15d                ## 4-byte Folded Reload
	jl	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	cmpl	-56(%rbp), %r15d                ## 4-byte Folded Reload
	jg	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	-96(%rbp), %rdi                 ## 8-byte Reload
	movq	%r13, %rsi
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rdx
	callq	*32(%rdi)
	cmpl	$0, -72(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_9
	jmp	LBB0_11
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rdi
	movl	$255, %esi
	movq	-80(%rbp), %rdx                 ## 8-byte Reload
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_memset
	cmpl	$0, -72(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_11
LBB0_9:                                 ##   in Loop: Header=BB0_3 Depth=1
	cmpl	-48(%rbp), %r15d                ## 4-byte Folded Reload
	jl	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_3 Depth=1
	cmpl	-56(%rbp), %r15d                ## 4-byte Folded Reload
	jle	LBB0_12
	jmp	LBB0_11
LBB0_13:
	movq	24(%rcx), %rsi
	movq	(%rcx), %rdx
	movl	20(%rcx), %r8d
	movq	-104(%rbp), %rbx                ## 8-byte Reload
	movq	%rbx, %rdi
	movq	%rcx, %r14
	xorl	%ecx, %ecx
	callq	_mtd_ooblayout_set_eccbytes
	testl	%eax, %eax
	jne	LBB0_15
## %bb.14:
	movq	(%r14), %rsi
	movl	(%rbx), %edx
	movq	%r14, %rdi
	xorl	%ecx, %ecx
	callq	_nand_write_data_op
	testl	%eax, %eax
	je	LBB0_16
LBB0_15:
	addq	$88, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_16:
	movq	%r14, %rdi
	addq	$88, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_nand_prog_page_end_op          ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_NAND_ECC_WRITE,4,2             ## @NAND_ECC_WRITE
	.no_dead_strip	_nand_write_subpage_hwecc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nand_write_subpage_hwecc
_nand_write_subpage_hwecc:              ; @nand_write_subpage_hwecc
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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	x20, x5
	str	w4, [sp, #44]                   ; 4-byte Folded Spill
	mov	x22, x3
	str	w2, [sp, #32]                   ; 4-byte Folded Spill
	str	w1, [sp, #24]                   ; 4-byte Folded Spill
	mov	x19, x0
	bl	_nand_to_mtd
	mov	x26, x0
	ldr	x23, [x19]
	ldr	x24, [x19, #24]
	ldpsw	x25, x28, [x19, #8]
	ldr	w27, [x19, #16]
	ldr	w21, [x0]
	mov	x0, x19
	mov	x1, x20
	mov	w2, #0
	mov	x3, #0
	mov	w4, #0
	bl	_nand_prog_page_begin_op
	cbnz	w0, LBB0_14
; %bb.1:
	mov	x9, x21
	ldr	w8, [sp, #24]                   ; 4-byte Folded Reload
	ldr	w21, [sp, #32]                  ; 4-byte Folded Reload
	str	x28, [sp, #16]                  ; 8-byte Folded Spill
	str	x26, [sp]                       ; 8-byte Folded Spill
	cmp	w27, #1
	b.lt	LBB0_12
; %bb.2:
	mov	w20, #0
	sdiv	w26, w8, w25
	add	w8, w8, w21
	sub	w8, w8, #1
	sdiv	w9, w9, w27
	lsl	x10, x25, #2
	str	x9, [sp, #8]                    ; 8-byte Folded Spill
	sbfiz	x9, x9, #2, #32
	stp	x9, x10, [sp, #24]              ; 16-byte Folded Spill
	ldr	x9, [sp, #16]                   ; 8-byte Folded Reload
	lsl	x28, x9, #2
	sdiv	w21, w8, w25
	b	LBB0_5
LBB0_3:                                 ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x23
	mov	w1, #255
	ldr	x2, [sp, #8]                    ; 8-byte Folded Reload
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_memset
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	w20, w20, #1
	ldr	x8, [sp, #32]                   ; 8-byte Folded Reload
	add	x22, x22, x8
	ldr	x8, [sp, #24]                   ; 8-byte Folded Reload
	add	x23, x23, x8
	add	x24, x24, x28
	cmp	w27, w20
	b.eq	LBB0_12
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19, #40]
Lloh0:
	adrp	x9, _NAND_ECC_WRITE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _NAND_ECC_WRITE@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x9]
	mov	x0, x19
	blr	x8
	mov	x0, x19
	mov	x1, x22
	mov	x2, x25
	mov	w3, #0
	bl	_nand_write_data_op
	cbnz	w0, LBB0_14
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	cmp	w20, w26
	b.lt	LBB0_9
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	cmp	w20, w21
	b.gt	LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [x19, #32]
	mov	x0, x19
	mov	x1, x22
	mov	x2, x24
	blr	x8
	ldr	w8, [sp, #44]                   ; 4-byte Folded Reload
	cbnz	w8, LBB0_10
	b	LBB0_3
LBB0_9:                                 ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x24
	mov	w1, #255
	ldr	x2, [sp, #16]                   ; 8-byte Folded Reload
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_memset
	ldr	w8, [sp, #44]                   ; 4-byte Folded Reload
	cbz	w8, LBB0_3
LBB0_10:                                ;   in Loop: Header=BB0_5 Depth=1
	cmp	w20, w26
	b.lt	LBB0_3
; %bb.11:                               ;   in Loop: Header=BB0_5 Depth=1
	cmp	w20, w21
	b.le	LBB0_4
	b	LBB0_3
LBB0_12:
	ldr	x1, [x19, #24]
	ldr	x2, [x19]
	ldr	w4, [x19, #20]
	ldr	x20, [sp]                       ; 8-byte Folded Reload
	mov	x0, x20
	mov	w3, #0
	bl	_mtd_ooblayout_set_eccbytes
	cbnz	w0, LBB0_14
; %bb.13:
	ldr	x1, [x19]
	ldr	w2, [x20]
	mov	x0, x19
	mov	w3, #0
	bl	_nand_write_data_op
	cbz	w0, LBB0_15
LBB0_14:
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
LBB0_15:
	mov	x0, x19
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	b	_nand_prog_page_end_op
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_NAND_ECC_WRITE,4,2             ; @NAND_ECC_WRITE
	.no_dead_strip	_nand_write_subpage_hwecc
.subsections_via_symbols
