	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sun6i_dma_prep_dma_cyclic
_sun6i_dma_prep_dma_cyclic:             ## @sun6i_dma_prep_dma_cyclic
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r9, -88(%rbp)                  ## 8-byte Spill
	movl	%r8d, -44(%rbp)                 ## 4-byte Spill
	movq	%rcx, %r13
	movq	%rdx, %rbx
	movq	%rsi, %r15
	movq	%rdi, %r14
	movl	(%rdi), %edi
	callq	_to_sun6i_dma_dev
	movq	%rax, %r12
	movq	%r14, %rdi
	callq	_to_sun6i_vchan
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	leaq	16(%rax), %rsi
	movq	%rbx, %rax
	orq	%r13, %rax
	shrq	$32, %rax
	movq	%r13, -72(%rbp)                 ## 8-byte Spill
	je	LBB0_2
## %bb.1:
	movq	%rbx, %rax
	xorl	%edx, %edx
	divq	%r13
	movq	%rax, %rbx
	jmp	LBB0_3
LBB0_2:
	movl	%ebx, %eax
	xorl	%edx, %edx
	divl	%r13d
	movl	%eax, %ebx
LBB0_3:
	leaq	-80(%rbp), %rcx
	movq	%r12, %rdi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	callq	_set_config
	testl	%eax, %eax
	je	LBB0_5
## %bb.4:
	movq	%r14, %rdi
	callq	_chan2dev
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edi
	callq	_dev_err
LBB0_16:
	xorl	%eax, %eax
LBB0_17:
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movq	_GFP_NOWAIT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$16, %edi
	callq	_kzalloc
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	testq	%rax, %rax
	je	LBB0_16
## %bb.6:
	movq	%r15, %r13
	movl	%ebx, %eax
	movq	%rax, -96(%rbp)                 ## 8-byte Spill
	xorl	%eax, %eax
	xorl	%r15d, %r15d
	movq	%r12, %rbx
	movq	-72(%rbp), %r12                 ## 8-byte Reload
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_9 Depth=1
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movq	16(%rcx), %rax
	movq	%rax, 40(%r14)
	movq	%r13, 32(%r14)
	movq	-80(%rbp), %rax
	movq	%r14, %r12
	addq	$24, %r12
	movq	%rax, 24(%r14)
	movq	8(%rbx), %rax
	movl	8(%rcx), %esi
	movq	_DRQ_SDRAM@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movq	%r12, %rdi
	callq	*8(%rax)
	movq	_IO_MODE@GOTPCREL(%rip), %rdx
	movq	_LINEAR_MODE@GOTPCREL(%rip), %rcx
LBB0_8:                                 ##   in Loop: Header=BB0_9 Depth=1
	movq	8(%rbx), %rax
	movl	(%rdx), %esi
	movl	(%rcx), %edx
	movq	%r12, %rdi
	callq	*(%rax)
	movq	-112(%rbp), %rdx
	movq	%r15, %rdi
	movq	%r14, %rsi
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	callq	_sun6i_dma_lli_add
	movq	%rax, %r15
	movq	-104(%rbp), %rax                ## 8-byte Reload
	incq	%rax
	movq	-72(%rbp), %r12                 ## 8-byte Reload
	addq	%r12, %r13
	cmpq	-96(%rbp), %rax                 ## 8-byte Folded Reload
	je	LBB0_12
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rax, -104(%rbp)                ## 8-byte Spill
	movl	(%rbx), %edi
	movq	_GFP_NOWAIT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-112(%rbp), %rdx
	callq	_dma_pool_alloc
	testq	%rax, %rax
	je	LBB0_13
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=1
	movq	%rax, %r14
	movq	%r12, (%rax)
	movq	_NORMAL_WAIT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 48(%r14)
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	movq	_DMA_MEM_TO_DEV@GOTPCREL(%rip), %rcx
	cmpl	%eax, (%rcx)
	jne	LBB0_7
## %bb.11:                              ##   in Loop: Header=BB0_9 Depth=1
	movq	%r13, 40(%r14)
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movq	24(%rcx), %rax
	movq	%rax, 32(%r14)
	movq	-80(%rbp), %rax
	movq	%r14, %r12
	addq	$24, %r12
	movq	%rax, 24(%r14)
	movq	8(%rbx), %rax
	movq	_DRQ_SDRAM@GOTPCREL(%rip), %rdx
	movl	(%rdx), %esi
	movl	8(%rcx), %edx
	movq	%r12, %rdi
	callq	*8(%rax)
	movq	_LINEAR_MODE@GOTPCREL(%rip), %rdx
	movq	_IO_MODE@GOTPCREL(%rip), %rcx
	jmp	LBB0_8
LBB0_12:
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movl	12(%rsi), %eax
	movl	%eax, 16(%r15)
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movl	$1, (%rdi)
	addq	$4, %rdi
	addq	$8, %rsi
	movq	-88(%rbp), %rdx                 ## 8-byte Reload
	callq	_vchan_tx_prep
	jmp	LBB0_17
LBB0_13:
	movl	16(%rbx), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_err
	movq	%rbx, %r15
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rbx
	testq	%rbx, %rbx
	je	LBB0_15
	.p2align	4, 0x90
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	movl	(%r15), %r14d
	movq	%rbx, %rdi
	callq	_virt_to_phys
	movl	%r14d, %edi
	movq	%rbx, %rsi
	movl	%eax, %edx
	callq	_dma_pool_free
	movq	8(%rbx), %rbx
	testq	%rbx, %rbx
	jne	LBB0_14
LBB0_15:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_kfree
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Invalid DMA configuration\n"

	.comm	_GFP_NOWAIT,4,2                 ## @GFP_NOWAIT
L_.str.1:                               ## @.str.1
	.asciz	"Failed to alloc lli memory\n"

	.comm	_NORMAL_WAIT,4,2                ## @NORMAL_WAIT
	.comm	_DMA_MEM_TO_DEV,4,2             ## @DMA_MEM_TO_DEV
	.comm	_DRQ_SDRAM,4,2                  ## @DRQ_SDRAM
	.comm	_LINEAR_MODE,4,2                ## @LINEAR_MODE
	.comm	_IO_MODE,4,2                    ## @IO_MODE
	.no_dead_strip	_sun6i_dma_prep_dma_cyclic
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sun6i_dma_prep_dma_cyclic
_sun6i_dma_prep_dma_cyclic:             ; @sun6i_dma_prep_dma_cyclic
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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	x22, x4
	mov	x23, x3
	mov	x27, x2
	mov	x24, x1
	mov	x21, x0
	ldr	w0, [x0]
	bl	_to_sun6i_dma_dev
	mov	x19, x0
	mov	x0, x21
	bl	_to_sun6i_vchan
	mov	x25, x0
	add	x1, x0, #16
	add	x3, sp, #16
	mov	x0, x19
	mov	x2, x22
	bl	_set_config
	cbz	w0, LBB0_4
; %bb.1:
	mov	x0, x21
	bl	_chan2dev
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
LBB0_2:
	mov	x0, #0
LBB0_3:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_4:
Lloh2:
	adrp	x8, _GFP_NOWAIT@GOTPAGE
Lloh3:
	ldr	x8, [x8, _GFP_NOWAIT@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	mov	w0, #16
	bl	_kzalloc
	str	x0, [sp, #8]                    ; 8-byte Folded Spill
	cbz	x0, LBB0_3
; %bb.5:
	str	x20, [sp]                       ; 8-byte Folded Spill
	mov	x20, #0
	mov	x26, #0
	udiv	x8, x27, x23
	and	x21, x8, #0xffffffff
	b	LBB0_8
LBB0_6:                                 ;   in Loop: Header=BB0_8 Depth=1
	ldr	x8, [x25, #16]
	ldr	x9, [sp, #16]
	mov	x28, x27
	str	x9, [x28, #24]!
	stp	x24, x8, [x28, #8]
	ldr	x8, [x19, #8]
	ldr	x8, [x8, #8]
	ldr	w1, [x25, #8]
Lloh5:
	adrp	x9, _DRQ_SDRAM@GOTPAGE
Lloh6:
	ldr	x9, [x9, _DRQ_SDRAM@GOTPAGEOFF]
Lloh7:
	ldr	w2, [x9]
	mov	x0, x28
	blr	x8
Lloh8:
	adrp	x8, _IO_MODE@GOTPAGE
Lloh9:
	ldr	x8, [x8, _IO_MODE@GOTPAGEOFF]
Lloh10:
	adrp	x9, _LINEAR_MODE@GOTPAGE
Lloh11:
	ldr	x9, [x9, _LINEAR_MODE@GOTPAGEOFF]
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=1
	ldr	x10, [x19, #8]
	ldr	x10, [x10]
	ldr	w1, [x8]
	ldr	w2, [x9]
	mov	x0, x28
	blr	x10
	ldr	x2, [sp, #24]
	mov	x0, x26
	mov	x1, x27
	ldr	x3, [sp, #8]                    ; 8-byte Folded Reload
	bl	_sun6i_dma_lli_add
	mov	x26, x0
	add	x20, x20, #1
	add	x24, x24, x23
	cmp	x20, x21
	b.eq	LBB0_11
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x19]
Lloh12:
	adrp	x8, _GFP_NOWAIT@GOTPAGE
Lloh13:
	ldr	x8, [x8, _GFP_NOWAIT@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	add	x2, sp, #24
	bl	_dma_pool_alloc
	cbz	x0, LBB0_12
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	mov	x27, x0
	str	x23, [x0]
Lloh15:
	adrp	x8, _NORMAL_WAIT@GOTPAGE
Lloh16:
	ldr	x8, [x8, _NORMAL_WAIT@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	str	w8, [x0, #48]
Lloh18:
	adrp	x8, _DMA_MEM_TO_DEV@GOTPAGE
Lloh19:
	ldr	x8, [x8, _DMA_MEM_TO_DEV@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	cmp	w8, w22
	b.ne	LBB0_6
; %bb.10:                               ;   in Loop: Header=BB0_8 Depth=1
	ldr	x8, [sp, #16]
	mov	x28, x27
	str	x8, [x28, #24]!
	str	x24, [x28, #16]
	ldr	x8, [x25, #24]
	str	x8, [x28, #8]
	ldr	x8, [x19, #8]
	ldr	x8, [x8, #8]
Lloh21:
	adrp	x9, _DRQ_SDRAM@GOTPAGE
Lloh22:
	ldr	x9, [x9, _DRQ_SDRAM@GOTPAGEOFF]
Lloh23:
	ldr	w1, [x9]
	ldr	w2, [x25, #8]
	mov	x0, x28
	blr	x8
Lloh24:
	adrp	x8, _LINEAR_MODE@GOTPAGE
Lloh25:
	ldr	x8, [x8, _LINEAR_MODE@GOTPAGEOFF]
Lloh26:
	adrp	x9, _IO_MODE@GOTPAGE
Lloh27:
	ldr	x9, [x9, _IO_MODE@GOTPAGEOFF]
	b	LBB0_7
LBB0_11:
	ldp	x2, x9, [sp]                    ; 16-byte Folded Reload
	ldr	w8, [x9, #12]
	str	w8, [x26, #16]
	mov	w8, #1
	str	w8, [x25], #4
	add	x1, x9, #8
	mov	x0, x25
	bl	_vchan_tx_prep
	b	LBB0_3
LBB0_12:
	ldr	w0, [x19, #16]
Lloh28:
	adrp	x1, l_.str.1@PAGE
Lloh29:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
	ldr	x8, [sp, #8]                    ; 8-byte Folded Reload
	ldr	x20, [x8]
	cbz	x20, LBB0_14
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	ldr	w22, [x19]
	mov	x0, x20
	bl	_virt_to_phys
	mov	x2, x0
	mov	x0, x22
	mov	x1, x20
	bl	_dma_pool_free
	ldr	x20, [x20, #8]
	cbnz	x20, LBB0_13
LBB0_14:
	ldr	x0, [sp, #8]                    ; 8-byte Folded Reload
	bl	_kfree
	b	LBB0_2
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Invalid DMA configuration\n"

	.comm	_GFP_NOWAIT,4,2                 ; @GFP_NOWAIT
l_.str.1:                               ; @.str.1
	.asciz	"Failed to alloc lli memory\n"

	.comm	_NORMAL_WAIT,4,2                ; @NORMAL_WAIT
	.comm	_DMA_MEM_TO_DEV,4,2             ; @DMA_MEM_TO_DEV
	.comm	_DRQ_SDRAM,4,2                  ; @DRQ_SDRAM
	.comm	_LINEAR_MODE,4,2                ; @LINEAR_MODE
	.comm	_IO_MODE,4,2                    ; @IO_MODE
	.no_dead_strip	_sun6i_dma_prep_dma_cyclic
.subsections_via_symbols
