	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sun4i_dma_prep_dma_memcpy
_sun4i_dma_prep_dma_memcpy:             ## @sun4i_dma_prep_dma_memcpy
	.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	%r8, -56(%rbp)                  ## 8-byte Spill
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	movl	%edx, %r14d
	movl	%esi, %r13d
	movq	%rdi, %r12
	callq	_to_sun4i_dma_vchan
	movq	%rax, %rbx
	xorl	%eax, %eax
	callq	_generate_dma_contract
	testq	%rax, %rax
	je	LBB0_6
## %bb.1:
	movq	%rax, %r15
	movq	%rbx, %r8
	addq	$16, %r8
	movq	_DMA_SLAVE_BUSWIDTH_4_BYTES@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 32(%rbx)
	movq	%rax, 24(%rbx)
	movabsq	$34359738376, %rax              ## imm = 0x800000008
	movq	%rax, 16(%rbx)
	cmpq	$0, 8(%rbx)
	je	LBB0_3
## %bb.2:
	movq	%r12, %rdi
	movl	%r14d, %esi
	movl	%r13d, %edx
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	callq	_generate_ddma_promise
	jmp	LBB0_4
LBB0_3:
	movq	_DMA_MEM_TO_MEM@GOTPCREL(%rip), %rax
	movl	(%rax), %r9d
	movq	%r12, %rdi
	movl	%r14d, %esi
	movl	%r13d, %edx
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	callq	_generate_ndma_promise
LBB0_4:
	movq	%rax, %r12
	testq	%rax, %rax
	je	LBB0_5
## %bb.7:
	cmpq	$0, 8(%rbx)
	jne	LBB0_8
## %bb.9:
	movq	_SUN4I_NDMA_DRQ_TYPE_SDRAM@GOTPCREL(%rip), %r13
	jmp	LBB0_10
LBB0_5:
	movq	%r15, %rdi
	callq	_kfree
LBB0_6:
	xorl	%eax, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movq	_SUN4I_DDMA_DRQ_TYPE_SDRAM@GOTPCREL(%rip), %r13
LBB0_10:
	movl	(%r13), %edi
	callq	_SUN4I_DMA_CFG_SRC_DRQ_TYPE
	movl	%eax, %r14d
	movl	(%r13), %edi
	callq	_SUN4I_DMA_CFG_DST_DRQ_TYPE
	orl	%r14d, %eax
	orl	%eax, (%r12)
	addq	$4, %r12
	movq	%r15, %rsi
	addq	$4, %rsi
	movq	%r12, %rdi
	callq	_list_add_tail
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_vchan_tx_prep                  ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_DMA_SLAVE_BUSWIDTH_4_BYTES,8,3 ## @DMA_SLAVE_BUSWIDTH_4_BYTES
	.comm	_DMA_MEM_TO_MEM,4,2             ## @DMA_MEM_TO_MEM
	.comm	_SUN4I_DDMA_DRQ_TYPE_SDRAM,4,2  ## @SUN4I_DDMA_DRQ_TYPE_SDRAM
	.comm	_SUN4I_NDMA_DRQ_TYPE_SDRAM,4,2  ## @SUN4I_NDMA_DRQ_TYPE_SDRAM
	.no_dead_strip	_sun4i_dma_prep_dma_memcpy
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sun4i_dma_prep_dma_memcpy
_sun4i_dma_prep_dma_memcpy:             ; @sun4i_dma_prep_dma_memcpy
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x19, x4
	mov	x22, x3
	mov	x24, x2
	mov	x23, x1
	mov	x25, x0
	bl	_to_sun4i_dma_vchan
	mov	x20, x0
	bl	_generate_dma_contract
	cbz	x0, LBB0_6
; %bb.1:
	mov	x21, x0
	add	x4, x20, #16
Lloh0:
	adrp	x8, _DMA_SLAVE_BUSWIDTH_4_BYTES@GOTPAGE
Lloh1:
	ldr	x8, [x8, _DMA_SLAVE_BUSWIDTH_4_BYTES@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stp	x8, x8, [x20, #24]
	movi.2s	v0, #8
	str	d0, [x20, #16]
	ldr	x8, [x20, #8]
	cbz	x8, LBB0_4
; %bb.2:
	mov	x0, x25
	mov	x1, x24
	mov	x2, x23
	mov	x3, x22
	bl	_generate_ddma_promise
	mov	x22, x0
	cbz	x0, LBB0_5
LBB0_3:
Lloh3:
	adrp	x8, _SUN4I_DDMA_DRQ_TYPE_SDRAM@GOTPAGE
Lloh4:
	ldr	x8, [x8, _SUN4I_DDMA_DRQ_TYPE_SDRAM@GOTPAGEOFF]
	ldr	x9, [x20, #8]
Lloh5:
	adrp	x10, _SUN4I_NDMA_DRQ_TYPE_SDRAM@GOTPAGE
Lloh6:
	ldr	x10, [x10, _SUN4I_NDMA_DRQ_TYPE_SDRAM@GOTPAGEOFF]
	cmp	x9, #0
	csel	x24, x10, x8, eq
	ldr	w0, [x24]
	bl	_SUN4I_DMA_CFG_SRC_DRQ_TYPE
	mov	x23, x0
	ldr	w0, [x24]
	bl	_SUN4I_DMA_CFG_DST_DRQ_TYPE
	orr	w8, w0, w23
	ldr	w9, [x22]
	orr	w8, w8, w9
	str	w8, [x22], #4
	add	x1, x21, #4
	mov	x0, x22
	bl	_list_add_tail
	mov	x0, x20
	mov	x1, x21
	mov	x2, x19
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	b	_vchan_tx_prep
LBB0_4:
Lloh7:
	adrp	x8, _DMA_MEM_TO_MEM@GOTPAGE
Lloh8:
	ldr	x8, [x8, _DMA_MEM_TO_MEM@GOTPAGEOFF]
Lloh9:
	ldr	w5, [x8]
	mov	x0, x25
	mov	x1, x24
	mov	x2, x23
	mov	x3, x22
	bl	_generate_ndma_promise
	mov	x22, x0
	cbnz	x0, LBB0_3
LBB0_5:
	mov	x0, x21
	bl	_kfree
LBB0_6:
	mov	x0, #0
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_DMA_SLAVE_BUSWIDTH_4_BYTES,8,3 ; @DMA_SLAVE_BUSWIDTH_4_BYTES
	.comm	_DMA_MEM_TO_MEM,4,2             ; @DMA_MEM_TO_MEM
	.comm	_SUN4I_DDMA_DRQ_TYPE_SDRAM,4,2  ; @SUN4I_DDMA_DRQ_TYPE_SDRAM
	.comm	_SUN4I_NDMA_DRQ_TYPE_SDRAM,4,2  ; @SUN4I_NDMA_DRQ_TYPE_SDRAM
	.no_dead_strip	_sun4i_dma_prep_dma_memcpy
.subsections_via_symbols
