	.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_dma
_sunxi_nfc_hw_ecc_write_page_dma:       ## @sunxi_nfc_hw_ecc_write_page_dma
	.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, %r13d
	movl	%edx, %r14d
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r15
	movl	32(%rdi), %edi
	callq	_to_sunxi_nfc
	movq	%rax, %rbx
	movl	16(%r15), %esi
	movq	%r15, %rdi
	callq	_sunxi_nfc_select_chip
	movq	%rbx, %rdi
	callq	_sunxi_nfc_wait_cmd_fifo_empty
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_13
## %bb.1:
	movl	%r14d, -52(%rbp)                ## 4-byte Spill
	movl	20(%r15), %ecx
	movl	28(%r15), %edx
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	leaq	-48(%rbp), %r9
	movq	%rbx, %rdi
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rsi
	callq	_sunxi_nfc_dma_op_prepare
	testl	%eax, %eax
	je	LBB0_2
## %bb.11:
	movq	%r15, %rdi
	movq	%r14, %rsi
	movl	-52(%rbp), %edx                 ## 4-byte Reload
	movl	%r13d, %ecx
	callq	_sunxi_nfc_hw_ecc_write_page
LBB0_12:
	movl	%eax, %r12d
	jmp	LBB0_13
LBB0_2:
	movq	%rbx, %r14
	cmpl	$0, 20(%r15)
	jle	LBB0_5
## %bb.3:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movslq	24(%r15), %rsi
	addq	$4, %rsi
	movslq	%ebx, %rbx
	imulq	%rbx, %rsi
	shlq	$2, %rsi
	addq	8(%r15), %rsi
	xorl	%ecx, %ecx
	testl	%ebx, %ebx
	sete	%cl
	movq	%r15, %rdi
	movl	%ebx, %edx
	movl	%r13d, %r8d
	callq	_sunxi_nfc_hw_ecc_set_prot_oob_bytes
	incl	%ebx
	cmpl	20(%r15), %ebx
	jl	LBB0_4
LBB0_5:
	movq	%r15, %rdi
	movl	%r13d, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	callq	_nand_prog_page_begin_op
	movq	%r15, %rdi
	callq	_sunxi_nfc_hw_ecc_enable
	movq	%r15, %rdi
	movl	%r13d, %esi
	xorl	%edx, %edx
	callq	_sunxi_nfc_randomizer_config
	movq	%r15, %rdi
	callq	_sunxi_nfc_randomizer_enable
	movq	_NAND_CMD_RNDIN@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	shll	$8, %edi
	movq	_NAND_CMD_PAGEPROG@GOTPCREL(%rip), %rax
	orl	(%rax), %edi
	movq	_NFC_REG_WCMD_SET@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%r14, %rbx
	addq	8(%r14), %rsi
	callq	_writel
	movl	(%r14), %edi
	callq	_dma_async_issue_pending
	movq	_NFC_PAGE_OP@GOTPCREL(%rip), %rax
	movq	_NFC_DATA_SWAP_METHOD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	orl	(%rax), %edi
	movq	_NFC_DATA_TRANS@GOTPCREL(%rip), %rax
	orl	(%rax), %edi
	movq	_NFC_ACCESS_DIR@GOTPCREL(%rip), %rax
	orl	(%rax), %edi
	movq	_NFC_REG_CMD@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r14), %rsi
	callq	_writel
	movq	_NFC_CMD_INT_FLAG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_sunxi_nfc_wait_events
	testl	%eax, %eax
	movl	-52(%rbp), %r14d                ## 4-byte Reload
	je	LBB0_7
## %bb.6:
	movl	%eax, %r12d
	movl	(%rbx), %edi
	callq	_dmaengine_terminate_all
	movq	%r15, %rdi
	callq	_sunxi_nfc_randomizer_disable
	movq	%r15, %rdi
	callq	_sunxi_nfc_hw_ecc_disable
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-48(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_sunxi_nfc_dma_op_cleanup
LBB0_13:
	movl	%r12d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movq	%r15, %rdi
	callq	_sunxi_nfc_randomizer_disable
	movq	%r15, %rdi
	callq	_sunxi_nfc_hw_ecc_disable
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-48(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_sunxi_nfc_dma_op_cleanup
	testl	%r14d, %r14d
	jne	LBB0_9
## %bb.8:
	movq	_NAND_NEED_SCRAMBLING@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r15)
	je	LBB0_10
LBB0_9:
	movq	8(%r15), %rsi
	movq	%r15, %rdi
	xorl	%edx, %edx
	movl	%r13d, %ecx
	callq	_sunxi_nfc_hw_ecc_write_extra_oob
LBB0_10:
	movq	%r15, %rdi
	callq	_nand_prog_page_end_op
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_DMA_TO_DEVICE,4,2              ## @DMA_TO_DEVICE
	.comm	_NAND_CMD_RNDIN,4,2             ## @NAND_CMD_RNDIN
	.comm	_NAND_CMD_PAGEPROG,4,2          ## @NAND_CMD_PAGEPROG
	.comm	_NFC_REG_WCMD_SET,8,3           ## @NFC_REG_WCMD_SET
	.comm	_NFC_PAGE_OP,4,2                ## @NFC_PAGE_OP
	.comm	_NFC_DATA_SWAP_METHOD,4,2       ## @NFC_DATA_SWAP_METHOD
	.comm	_NFC_DATA_TRANS,4,2             ## @NFC_DATA_TRANS
	.comm	_NFC_ACCESS_DIR,4,2             ## @NFC_ACCESS_DIR
	.comm	_NFC_REG_CMD,8,3                ## @NFC_REG_CMD
	.comm	_NFC_CMD_INT_FLAG,4,2           ## @NFC_CMD_INT_FLAG
	.comm	_NAND_NEED_SCRAMBLING,4,2       ## @NAND_NEED_SCRAMBLING
	.no_dead_strip	_sunxi_nfc_hw_ecc_write_page_dma
.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_dma
_sunxi_nfc_hw_ecc_write_page_dma:       ; @sunxi_nfc_hw_ecc_write_page_dma
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	mov	x20, x3
	mov	x22, x2
	mov	x23, x1
	mov	x19, x0
	ldr	w0, [x0, #32]
	bl	_to_sunxi_nfc
	mov	x21, x0
	ldr	w1, [x19, #16]
	mov	x0, x19
	bl	_sunxi_nfc_select_chip
	mov	x0, x21
	bl	_sunxi_nfc_wait_cmd_fifo_empty
	mov	x24, x0
	cbnz	w0, LBB0_9
; %bb.1:
	ldr	w2, [x19, #28]
	ldr	w3, [x19, #20]
Lloh0:
	adrp	x25, _DMA_TO_DEVICE@GOTPAGE
Lloh1:
	ldr	x25, [x25, _DMA_TO_DEVICE@GOTPAGEOFF]
	ldr	w4, [x25]
	add	x5, sp, #8
	mov	x0, x21
	mov	x1, x23
	bl	_sunxi_nfc_dma_op_prepare
	cbz	w0, LBB0_4
; %bb.2:
	mov	x0, x19
	mov	x1, x23
	mov	x2, x22
	mov	x3, x20
	bl	_sunxi_nfc_hw_ecc_write_page
LBB0_3:
	mov	x24, x0
	b	LBB0_9
LBB0_4:
	ldr	w8, [x19, #20]
	cmp	w8, #1
	b.lt	LBB0_7
; %bb.5:
	mov	w23, #0
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19, #8]
	ldr	w9, [x19, #24]
	add	w9, w9, #4
	mul	w9, w9, w23
	add	x1, x8, w9, sxtw #2
	cmp	w23, #0
	cset	w3, eq
	mov	x0, x19
	mov	x2, x23
	mov	x4, x20
	bl	_sunxi_nfc_hw_ecc_set_prot_oob_bytes
	add	w23, w23, #1
	ldr	w8, [x19, #20]
	cmp	w23, w8
	b.lt	LBB0_6
LBB0_7:
	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
	mov	x0, x19
	mov	x1, x20
	mov	w2, #0
	bl	_sunxi_nfc_randomizer_config
	mov	x0, x19
	bl	_sunxi_nfc_randomizer_enable
Lloh2:
	adrp	x8, _NAND_CMD_RNDIN@GOTPAGE
Lloh3:
	ldr	x8, [x8, _NAND_CMD_RNDIN@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
Lloh5:
	adrp	x9, _NAND_CMD_PAGEPROG@GOTPAGE
Lloh6:
	ldr	x9, [x9, _NAND_CMD_PAGEPROG@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	orr	w0, w9, w8, lsl #8
	ldr	x8, [x21, #8]
Lloh8:
	adrp	x9, _NFC_REG_WCMD_SET@GOTPAGE
Lloh9:
	ldr	x9, [x9, _NFC_REG_WCMD_SET@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	ldr	w0, [x21]
	bl	_dma_async_issue_pending
Lloh11:
	adrp	x8, _NFC_PAGE_OP@GOTPAGE
Lloh12:
	ldr	x8, [x8, _NFC_PAGE_OP@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
Lloh14:
	adrp	x9, _NFC_DATA_SWAP_METHOD@GOTPAGE
Lloh15:
	ldr	x9, [x9, _NFC_DATA_SWAP_METHOD@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
Lloh17:
	adrp	x10, _NFC_DATA_TRANS@GOTPAGE
Lloh18:
	ldr	x10, [x10, _NFC_DATA_TRANS@GOTPAGEOFF]
	orr	w8, w9, w8
Lloh19:
	ldr	w9, [x10]
	orr	w8, w8, w9
Lloh20:
	adrp	x9, _NFC_ACCESS_DIR@GOTPAGE
Lloh21:
	ldr	x9, [x9, _NFC_ACCESS_DIR@GOTPAGEOFF]
Lloh22:
	ldr	w9, [x9]
	orr	w0, w8, w9
	ldr	x8, [x21, #8]
Lloh23:
	adrp	x9, _NFC_REG_CMD@GOTPAGE
Lloh24:
	ldr	x9, [x9, _NFC_REG_CMD@GOTPAGEOFF]
Lloh25:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
Lloh26:
	adrp	x8, _NFC_CMD_INT_FLAG@GOTPAGE
Lloh27:
	ldr	x8, [x8, _NFC_CMD_INT_FLAG@GOTPAGEOFF]
Lloh28:
	ldr	w1, [x8]
	mov	x0, x21
	mov	w2, #0
	mov	w3, #0
	bl	_sunxi_nfc_wait_events
	cbz	w0, LBB0_10
; %bb.8:
	mov	x24, x0
	ldr	w0, [x21]
	bl	_dmaengine_terminate_all
	mov	x0, x19
	bl	_sunxi_nfc_randomizer_disable
	mov	x0, x19
	bl	_sunxi_nfc_hw_ecc_disable
	ldr	w1, [x25]
	add	x2, sp, #8
	mov	x0, x21
	bl	_sunxi_nfc_dma_op_cleanup
LBB0_9:
	mov	x0, x24
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_10:
	mov	x0, x19
	bl	_sunxi_nfc_randomizer_disable
	mov	x0, x19
	bl	_sunxi_nfc_hw_ecc_disable
	ldr	w1, [x25]
	add	x2, sp, #8
	mov	x0, x21
	bl	_sunxi_nfc_dma_op_cleanup
	cbnz	w22, LBB0_12
; %bb.11:
	ldr	w8, [x19]
Lloh29:
	adrp	x9, _NAND_NEED_SCRAMBLING@GOTPAGE
Lloh30:
	ldr	x9, [x9, _NAND_NEED_SCRAMBLING@GOTPAGEOFF]
Lloh31:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_13
LBB0_12:
	ldr	x1, [x19, #8]
	mov	x0, x19
	mov	x2, #0
	mov	x3, x20
	bl	_sunxi_nfc_hw_ecc_write_extra_oob
LBB0_13:
	mov	x0, x19
	bl	_nand_prog_page_end_op
	b	LBB0_3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.cfi_endproc
                                        ; -- End function
	.comm	_DMA_TO_DEVICE,4,2              ; @DMA_TO_DEVICE
	.comm	_NAND_CMD_RNDIN,4,2             ; @NAND_CMD_RNDIN
	.comm	_NAND_CMD_PAGEPROG,4,2          ; @NAND_CMD_PAGEPROG
	.comm	_NFC_REG_WCMD_SET,8,3           ; @NFC_REG_WCMD_SET
	.comm	_NFC_PAGE_OP,4,2                ; @NFC_PAGE_OP
	.comm	_NFC_DATA_SWAP_METHOD,4,2       ; @NFC_DATA_SWAP_METHOD
	.comm	_NFC_DATA_TRANS,4,2             ; @NFC_DATA_TRANS
	.comm	_NFC_ACCESS_DIR,4,2             ; @NFC_ACCESS_DIR
	.comm	_NFC_REG_CMD,8,3                ; @NFC_REG_CMD
	.comm	_NFC_CMD_INT_FLAG,4,2           ; @NFC_CMD_INT_FLAG
	.comm	_NAND_NEED_SCRAMBLING,4,2       ; @NAND_NEED_SCRAMBLING
	.no_dead_strip	_sunxi_nfc_hw_ecc_write_page_dma
.subsections_via_symbols
