	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sunxi_nfc_hw_ecc_write_page
_sunxi_nfc_hw_ecc_write_page:           ## @sunxi_nfc_hw_ecc_write_page
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %ebx
	movl	%edx, -48(%rbp)                 ## 4-byte Spill
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r14
	callq	_nand_to_mtd
	movq	%rax, %r13
	movl	$0, -44(%rbp)
	movl	16(%r14), %esi
	movq	%r14, %rdi
	callq	_sunxi_nfc_select_chip
	xorl	%r15d, %r15d
	movq	%r14, %rdi
	movq	%rbx, %r12
	movl	%ebx, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	callq	_nand_prog_page_begin_op
	movq	%r14, %rdi
	callq	_sunxi_nfc_hw_ecc_enable
	cmpl	$0, 20(%r14)
	jle	LBB0_1
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movslq	24(%r14), %rdx
	movslq	%r15d, %rax
	imulq	%rax, %rdx
	movslq	28(%r14), %r8
	addq	$4, %r8
	imulq	%rax, %r8
	leaq	(,%r8,4), %rcx
	addq	8(%r14), %rcx
	addq	(%r13), %r8
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	leaq	(%rsi,%rdx,4), %rsi
	xorl	%ebx, %ebx
	testl	%eax, %eax
	sete	%bl
	movq	%r14, %rdi
                                        ## kill: def $edx killed $edx killed $rdx
	leaq	-44(%rbp), %r9
	pushq	%r12
	pushq	%rbx
	callq	_sunxi_nfc_hw_ecc_write_chunk
	addq	$16, %rsp
	testl	%eax, %eax
	jne	LBB0_7
## %bb.5:                               ##   in Loop: Header=BB0_6 Depth=1
	incl	%r15d
	cmpl	20(%r14), %r15d
	jl	LBB0_6
LBB0_1:
	cmpl	$0, -48(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_3
## %bb.2:
	movq	_NAND_NEED_SCRAMBLING@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r14)
	je	LBB0_4
LBB0_3:
	movq	8(%r14), %rsi
	leaq	-44(%rbp), %rdx
	movq	%r14, %rdi
	movl	%r12d, %ecx
	callq	_sunxi_nfc_hw_ecc_write_extra_oob
LBB0_4:
	movq	%r14, %rdi
	callq	_sunxi_nfc_hw_ecc_disable
	movq	%r14, %rdi
	callq	_nand_prog_page_end_op
LBB0_7:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_NAND_NEED_SCRAMBLING,4,2       ## @NAND_NEED_SCRAMBLING
	.no_dead_strip	_sunxi_nfc_hw_ecc_write_page
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sunxi_nfc_hw_ecc_write_page
_sunxi_nfc_hw_ecc_write_page:           ; @sunxi_nfc_hw_ecc_write_page
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x20, x3
	mov	x21, x2
	mov	x22, x1
	mov	x19, x0
	bl	_nand_to_mtd
	mov	x23, x0
	str	wzr, [sp, #12]
	ldr	w1, [x19, #16]
	mov	x0, x19
	bl	_sunxi_nfc_select_chip
	mov	x0, x19
	mov	x1, x20
	mov	w2, #0
	mov	x3, #0
	mov	w4, #0
	bl	_nand_prog_page_begin_op
	mov	x0, x19
	bl	_sunxi_nfc_hw_ecc_enable
	ldr	w8, [x19, #20]
	cmp	w8, #1
	b.lt	LBB0_4
; %bb.1:
	mov	w24, #0
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldp	w8, w9, [x19, #24]
                                        ; kill: def $w9 killed $w9 def $x9
	sxtw	x9, w9
	mul	w2, w8, w24
	add	x8, x9, #4
	sxtw	x9, w24
	mul	x8, x8, x9
	add	x1, x22, w2, sxtw #2
	ldr	x9, [x19, #8]
	add	x3, x9, x8, lsl #2
	ldr	x9, [x23]
	add	x4, x9, x8
	cmp	w24, #0
	cset	w6, eq
	add	x5, sp, #12
	mov	x0, x19
	mov	x7, x20
	bl	_sunxi_nfc_hw_ecc_write_chunk
	cbnz	w0, LBB0_8
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	add	w24, w24, #1
	ldr	w8, [x19, #20]
	cmp	w24, w8
	b.lt	LBB0_2
LBB0_4:
	cbnz	w21, LBB0_6
; %bb.5:
	ldr	w8, [x19]
Lloh0:
	adrp	x9, _NAND_NEED_SCRAMBLING@GOTPAGE
Lloh1:
	ldr	x9, [x9, _NAND_NEED_SCRAMBLING@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_7
LBB0_6:
	ldr	x1, [x19, #8]
	add	x2, sp, #12
	mov	x0, x19
	mov	x3, x20
	bl	_sunxi_nfc_hw_ecc_write_extra_oob
LBB0_7:
	mov	x0, x19
	bl	_sunxi_nfc_hw_ecc_disable
	mov	x0, x19
	bl	_nand_prog_page_end_op
LBB0_8:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_NAND_NEED_SCRAMBLING,4,2       ; @NAND_NEED_SCRAMBLING
	.no_dead_strip	_sunxi_nfc_hw_ecc_write_page
.subsections_via_symbols
