	.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_subpage
_sunxi_nfc_hw_ecc_write_subpage:        ## @sunxi_nfc_hw_ecc_write_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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%r9d, %r14d
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	movl	%edx, %r12d
	movl	%esi, %ebx
	movq	%rdi, %r13
	callq	_nand_to_mtd
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movl	$0, -44(%rbp)
	movl	8(%r13), %esi
	movq	%r13, %rdi
	callq	_sunxi_nfc_select_chip
	movq	%r13, %rdi
	movl	%r14d, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	callq	_nand_prog_page_begin_op
	movq	%r13, %rdi
	callq	_sunxi_nfc_hw_ecc_enable
	movl	12(%r13), %esi
	movl	%ebx, %eax
	cltd
	idivl	%esi
	movl	%eax, %r15d
	addl	%ebx, %r12d
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movl	%r12d, %edi
	callq	_DIV_ROUND_UP
	cmpl	%eax, %r15d
	jge	LBB0_2
## %bb.4:                               ##   in Loop: Header=BB0_1 Depth=1
	movslq	12(%r13), %rdx
	movslq	%r15d, %rax
	imulq	%rax, %rdx
	movslq	16(%r13), %r8
	addq	$4, %r8
	imulq	%rax, %r8
	leaq	(,%r8,4), %rcx
	addq	(%r13), %rcx
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	addq	(%rsi), %r8
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	leaq	(%rsi,%rdx,4), %rsi
	xorl	%ebx, %ebx
	testl	%eax, %eax
	sete	%bl
	movq	%r13, %rdi
                                        ## kill: def $edx killed $edx killed $rdx
	leaq	-44(%rbp), %r9
	pushq	%r14
	pushq	%rbx
	callq	_sunxi_nfc_hw_ecc_write_chunk
	addq	$16, %rsp
	testl	%eax, %eax
	jne	LBB0_5
## %bb.3:                               ##   in Loop: Header=BB0_1 Depth=1
	incl	%r15d
	movl	12(%r13), %esi
	jmp	LBB0_1
LBB0_2:
	movq	%r13, %rdi
	callq	_sunxi_nfc_hw_ecc_disable
	movq	%r13, %rdi
	callq	_nand_prog_page_end_op
LBB0_5:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_sunxi_nfc_hw_ecc_write_subpage
.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_subpage
_sunxi_nfc_hw_ecc_write_subpage:        ; @sunxi_nfc_hw_ecc_write_subpage
	.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, x5
	mov	x21, x3
	mov	x23, x2
	mov	x24, x1
	mov	x19, x0
	bl	_nand_to_mtd
	mov	x22, x0
	str	wzr, [sp, #12]
	ldr	w1, [x19, #8]
	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	w1, [x19, #12]
	add	w23, w23, w24
	sdiv	w24, w24, w1
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x23
	bl	_DIV_ROUND_UP
	cmp	w24, w0
	b.ge	LBB0_4
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	ldp	w8, w9, [x19, #12]
                                        ; 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, x21, w2, sxtw #2
	ldr	x9, [x19]
	add	x3, x9, x8, lsl #2
	ldr	x9, [x22]
	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_5
; %bb.3:                                ;   in Loop: Header=BB0_1 Depth=1
	add	w24, w24, #1
	ldr	w1, [x19, #12]
	b	LBB0_1
LBB0_4:
	mov	x0, x19
	bl	_sunxi_nfc_hw_ecc_disable
	mov	x0, x19
	bl	_nand_prog_page_end_op
LBB0_5:
	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
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_sunxi_nfc_hw_ecc_write_subpage
.subsections_via_symbols
