	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sunxi_nfc_dma_op_prepare
_sunxi_nfc_dma_op_prepare:              ## @sunxi_nfc_dma_op_prepare
	.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
	movq	%r9, %r15
	movl	%r8d, %r14d
	movl	%ecx, %ebx
	movq	%rdi, %r12
	movq	_DMA_FROM_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	_DMA_DEV_TO_MEM@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -56(%rbp)                 ## 4-byte Spill
	movq	_DMA_MEM_TO_DEV@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movl	%ecx, -48(%rbp)                 ## 4-byte Spill
	movl	%edx, -52(%rbp)                 ## 4-byte Spill
	imull	%edx, %ebx
	movq	%r9, %rdi
	movl	%ebx, %edx
	callq	_sg_init_one
	movl	(%r12), %edi
	movq	%r15, %rsi
	movl	$1, %edx
	movl	%r14d, %ecx
	callq	_dma_map_sg
	testl	%eax, %eax
	je	LBB0_1
## %bb.2:
	cmpl	%r14d, -44(%rbp)                ## 4-byte Folded Reload
	cmovel	-56(%rbp), %r13d                ## 4-byte Folded Reload
	movl	24(%r12), %edi
	movq	_DMA_CTRL_ACK@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	%r15, %rsi
	movl	$1, %edx
	movl	%r13d, %ecx
	callq	_dmaengine_prep_slave_sg
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movl	%r14d, -44(%rbp)                ## 4-byte Spill
	movq	%rax, %r13
	movq	_NFC_REG_CTL@GOTPCREL(%rip), %r14
	movq	(%r14), %rdi
	addq	8(%r12), %rdi
	callq	_readl
	movq	_NFC_RAM_METHOD@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movq	(%r14), %rsi
	addq	8(%r12), %rsi
	movl	%eax, %edi
	callq	_writel
	movq	_NFC_REG_SECTOR_NUM@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r12), %rsi
	movl	-48(%rbp), %edi                 ## 4-byte Reload
	callq	_writel
	movq	_NFC_REG_CNT@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r12), %rsi
	movl	-52(%rbp), %edi                 ## 4-byte Reload
	callq	_writel
	movq	16(%r12), %rax
	cmpq	$0, (%rax)
	je	LBB0_6
## %bb.5:
	movq	_NFC_REG_MDMA_CNT@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r12), %rsi
	movl	%ebx, %edi
	callq	_writel
LBB0_6:
	movq	%r13, %rdi
	callq	_dmaengine_submit
	movl	%eax, %edi
	callq	_dma_submit_error
	testl	%eax, %eax
	je	LBB0_7
## %bb.8:
	movl	%eax, %ebx
	movq	_NFC_REG_CTL@GOTPCREL(%rip), %r14
	movq	(%r14), %rdi
	addq	8(%r12), %rdi
	callq	_readl
	movq	_NFC_RAM_METHOD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	notl	%edi
	andl	%eax, %edi
	movq	(%r14), %rsi
	addq	8(%r12), %rsi
	callq	_writel
	movl	-44(%rbp), %r14d                ## 4-byte Reload
	jmp	LBB0_9
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_10
LBB0_3:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_9:
	movl	(%r12), %edi
	movq	%r15, %rsi
	movl	$1, %edx
	movl	%r14d, %ecx
	callq	_dma_unmap_sg
	jmp	LBB0_10
LBB0_7:
	xorl	%ebx, %ebx
LBB0_10:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DMA_FROM_DEVICE,4,2            ## @DMA_FROM_DEVICE
	.comm	_DMA_DEV_TO_MEM,4,2             ## @DMA_DEV_TO_MEM
	.comm	_DMA_MEM_TO_DEV,4,2             ## @DMA_MEM_TO_DEV
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_DMA_CTRL_ACK,4,2               ## @DMA_CTRL_ACK
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_NFC_REG_CTL,8,3                ## @NFC_REG_CTL
	.comm	_NFC_RAM_METHOD,4,2             ## @NFC_RAM_METHOD
	.comm	_NFC_REG_SECTOR_NUM,8,3         ## @NFC_REG_SECTOR_NUM
	.comm	_NFC_REG_CNT,8,3                ## @NFC_REG_CNT
	.comm	_NFC_REG_MDMA_CNT,8,3           ## @NFC_REG_MDMA_CNT
	.no_dead_strip	_sunxi_nfc_dma_op_prepare
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sunxi_nfc_dma_op_prepare
_sunxi_nfc_dma_op_prepare:              ; @sunxi_nfc_dma_op_prepare
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x5
	mov	x19, x4
	mov	x24, x3
	mov	x23, x2
	mov	x21, x0
Lloh0:
	adrp	x8, _DMA_FROM_DEVICE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _DMA_FROM_DEVICE@GOTPAGEOFF]
Lloh2:
	adrp	x9, _DMA_DEV_TO_MEM@GOTPAGE
Lloh3:
	ldr	x9, [x9, _DMA_DEV_TO_MEM@GOTPAGEOFF]
Lloh4:
	ldr	w26, [x8]
Lloh5:
	ldr	w25, [x9]
Lloh6:
	adrp	x8, _DMA_MEM_TO_DEV@GOTPAGE
Lloh7:
	ldr	x8, [x8, _DMA_MEM_TO_DEV@GOTPAGEOFF]
Lloh8:
	ldr	w27, [x8]
	mul	w22, w3, w2
	mov	x0, x5
	mov	x2, x22
	bl	_sg_init_one
	ldr	w0, [x21]
	mov	x1, x20
	mov	w2, #1
	mov	x3, x19
	bl	_dma_map_sg
	cbz	w0, LBB0_6
; %bb.1:
	cmp	w26, w19
	csel	w3, w25, w27, eq
	ldr	w0, [x21, #24]
Lloh9:
	adrp	x8, _DMA_CTRL_ACK@GOTPAGE
Lloh10:
	ldr	x8, [x8, _DMA_CTRL_ACK@GOTPAGEOFF]
Lloh11:
	ldr	w4, [x8]
	mov	x1, x20
	mov	w2, #1
	bl	_dmaengine_prep_slave_sg
	cbz	x0, LBB0_7
; %bb.2:
	mov	x25, x0
	ldr	x8, [x21, #8]
Lloh12:
	adrp	x26, _NFC_REG_CTL@GOTPAGE
Lloh13:
	ldr	x26, [x26, _NFC_REG_CTL@GOTPAGEOFF]
	ldr	x9, [x26]
	add	x0, x9, x8
	bl	_readl
Lloh14:
	adrp	x27, _NFC_RAM_METHOD@GOTPAGE
Lloh15:
	ldr	x27, [x27, _NFC_RAM_METHOD@GOTPAGEOFF]
	ldr	w8, [x27]
	orr	w0, w8, w0
	ldr	x8, [x21, #8]
	ldr	x9, [x26]
	add	x1, x9, x8
	bl	_writel
	ldr	x8, [x21, #8]
Lloh16:
	adrp	x9, _NFC_REG_SECTOR_NUM@GOTPAGE
Lloh17:
	ldr	x9, [x9, _NFC_REG_SECTOR_NUM@GOTPAGEOFF]
Lloh18:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	x0, x24
	bl	_writel
	ldr	x8, [x21, #8]
Lloh19:
	adrp	x9, _NFC_REG_CNT@GOTPAGE
Lloh20:
	ldr	x9, [x9, _NFC_REG_CNT@GOTPAGEOFF]
Lloh21:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	x0, x23
	bl	_writel
	ldr	x8, [x21, #16]
	ldr	x8, [x8]
	cbz	x8, LBB0_4
; %bb.3:
	ldr	x8, [x21, #8]
Lloh22:
	adrp	x9, _NFC_REG_MDMA_CNT@GOTPAGE
Lloh23:
	ldr	x9, [x9, _NFC_REG_MDMA_CNT@GOTPAGEOFF]
Lloh24:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	x0, x22
	bl	_writel
LBB0_4:
	mov	x0, x25
	bl	_dmaengine_submit
	bl	_dma_submit_error
	mov	x22, x0
	cbz	w0, LBB0_9
; %bb.5:
	ldr	x8, [x21, #8]
	ldr	x9, [x26]
	add	x0, x9, x8
	bl	_readl
	ldr	w8, [x27]
	bic	w0, w0, w8
	ldr	x8, [x21, #8]
	ldr	x9, [x26]
	add	x1, x9, x8
	bl	_writel
	b	LBB0_8
LBB0_6:
Lloh25:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh26:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh27:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_9
LBB0_7:
Lloh28:
	adrp	x8, _EINVAL@GOTPAGE
Lloh29:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh30:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_8:
	ldr	w0, [x21]
	mov	x1, x20
	mov	w2, #1
	mov	x3, x19
	bl	_dma_unmap_sg
LBB0_9:
	mov	x0, x22
	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
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh4
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.comm	_DMA_FROM_DEVICE,4,2            ; @DMA_FROM_DEVICE
	.comm	_DMA_DEV_TO_MEM,4,2             ; @DMA_DEV_TO_MEM
	.comm	_DMA_MEM_TO_DEV,4,2             ; @DMA_MEM_TO_DEV
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_DMA_CTRL_ACK,4,2               ; @DMA_CTRL_ACK
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_NFC_REG_CTL,8,3                ; @NFC_REG_CTL
	.comm	_NFC_RAM_METHOD,4,2             ; @NFC_RAM_METHOD
	.comm	_NFC_REG_SECTOR_NUM,8,3         ; @NFC_REG_SECTOR_NUM
	.comm	_NFC_REG_CNT,8,3                ; @NFC_REG_CNT
	.comm	_NFC_REG_MDMA_CNT,8,3           ; @NFC_REG_MDMA_CNT
	.no_dead_strip	_sunxi_nfc_dma_op_prepare
.subsections_via_symbols
