	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mmp_pdma_prep_dma_cyclic
_mmp_pdma_prep_dma_cyclic:              ## @mmp_pdma_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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	xorl	%eax, %eax
	testq	%rdi, %rdi
	je	LBB0_22
## %bb.1:
	movq	%rdx, %r14
	testq	%rdx, %rdx
	je	LBB0_22
## %bb.2:
	movq	%rcx, %rbx
	testq	%rcx, %rcx
	je	LBB0_22
## %bb.3:
	movq	%r9, %r12
	movl	%r8d, %r13d
	movq	%rdi, %r15
	movq	%r14, %rax
	orq	%rbx, %rax
	shrq	$32, %rax
	je	LBB0_5
## %bb.4:
	movq	%r14, %rax
	xorl	%edx, %edx
	divq	%rbx
	jmp	LBB0_6
LBB0_5:
	movl	%r14d, %eax
	xorl	%edx, %edx
	divl	%ebx
                                        ## kill: def $edx killed $edx def $rdx
LBB0_6:
	xorl	%eax, %eax
	testq	%rdx, %rdx
	jne	LBB0_22
## %bb.7:
	movq	_PDMA_MAX_DESC_BYTES@GOTPCREL(%rip), %rcx
	cmpq	%rbx, (%rcx)
	jb	LBB0_22
## %bb.8:
	movq	%r15, %rdi
	callq	_to_mmp_pdma_chan
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	leaq	36(%rax), %rsi
	movq	%r15, %rdi
	movl	%r13d, %edx
	callq	_mmp_pdma_config_write
	cmpl	$129, %r13d
	je	LBB0_11
## %bb.9:
	cmpl	$128, %r13d
	jne	LBB0_17
## %bb.10:
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movq	%r12, -72(%rbp)                 ## 8-byte Spill
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	movq	(%rsi), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	jmp	LBB0_12
LBB0_11:
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movq	%r12, -72(%rbp)                 ## 8-byte Spill
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	movq	(%rsi), %r12
LBB0_12:
	movl	%r13d, 8(%rsi)
	negq	%r14
	movq	%r14, -80(%rbp)                 ## 8-byte Spill
	xorl	%eax, %eax
	xorl	%r14d, %r14d
	jmp	LBB0_14
	.p2align	4, 0x90
LBB0_13:                                ##   in Loop: Header=BB0_14 Depth=1
	leaq	8(%rbx), %rdi
	movq	$0, 24(%rbx)
	callq	_async_tx_ack
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	cmpl	$128, 8(%rax)
	movl	$0, %eax
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	cmoveq	%r15, %rax
	movl	$0, %ecx
	cmovneq	%r15, %rcx
	addq	%rax, %r12
	addq	%rcx, -56(%rbp)                 ## 8-byte Folded Spill
	movq	%rbx, %rdi
	addq	$64, %rdi
	movq	%r13, %rsi
	callq	_list_add_tail
	movq	%r13, %rax
	movq	%rbx, %r14
	addq	%r15, -80(%rbp)                 ## 8-byte Folded Spill
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	je	LBB0_18
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	movq	%rax, %r15
	movq	%rsi, %r13
	movq	%rsi, %rdi
	callq	_mmp_pdma_alloc_descriptor
	testq	%rax, %rax
	je	LBB0_19
## %bb.15:                              ##   in Loop: Header=BB0_14 Depth=1
	movq	%rax, %rbx
	movq	_DCMD_ENDIRQEN@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	orq	16(%r13), %rax
	movq	_DCMD_LENGTH@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	andq	-64(%rbp), %rcx                 ## 8-byte Folded Reload
	orq	%rax, %rcx
	movq	%rcx, 32(%rbx)
	movq	%r12, 40(%rbx)
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	%rax, 48(%rbx)
	movq	%rbx, %r13
	testq	%r15, %r15
	je	LBB0_13
## %bb.16:                              ##   in Loop: Header=BB0_14 Depth=1
	movl	16(%rbx), %eax
	movl	%eax, 56(%r14)
	movq	%r15, %r13
	jmp	LBB0_13
LBB0_17:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	32(%rax), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	jmp	LBB0_21
LBB0_18:
	leaq	8(%r13), %rax
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	movq	%rcx, 8(%r13)
	movq	_EBUSY@GOTPCREL(%rip), %rcx
	xorl	%edx, %edx
	subq	(%rcx), %rdx
	movq	%rdx, 24(%r13)
	movl	16(%r13), %ecx
	movl	%ecx, 56(%rbx)
	movq	%r13, 24(%rsi)
	jmp	LBB0_22
LBB0_19:
	movl	32(%r13), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_err
	testq	%r15, %r15
	je	LBB0_21
## %bb.20:
	movq	%r13, %rdi
	movq	%r15, %rsi
	callq	_mmp_pdma_free_desc_list
LBB0_21:
	xorl	%eax, %eax
LBB0_22:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PDMA_MAX_DESC_BYTES,8,3        ## @PDMA_MAX_DESC_BYTES
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Unsupported direction for cyclic DMA\n"

L_.str.1:                               ## @.str.1
	.asciz	"no memory for desc\n"

	.comm	_DCMD_ENDIRQEN,8,3              ## @DCMD_ENDIRQEN
	.comm	_DCMD_LENGTH,8,3                ## @DCMD_LENGTH
	.comm	_EBUSY,8,3                      ## @EBUSY
	.no_dead_strip	_mmp_pdma_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 mmp_pdma_prep_dma_cyclic
_mmp_pdma_prep_dma_cyclic:              ; @mmp_pdma_prep_dma_cyclic
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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	x24, x0
	mov	x0, #0
	cbz	x24, LBB0_18
; %bb.1:
	mov	x23, x2
	cbz	x2, LBB0_18
; %bb.2:
	mov	x20, x3
	cbz	x3, LBB0_18
; %bb.3:
	udiv	x8, x23, x20
	msub	x8, x8, x20, x23
Lloh0:
	adrp	x9, _PDMA_MAX_DESC_BYTES@GOTPAGE
Lloh1:
	ldr	x9, [x9, _PDMA_MAX_DESC_BYTES@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, #0
	ccmp	x9, x20, #0, eq
	b.lo	LBB0_17
; %bb.4:
	mov	x19, x5
	mov	x25, x4
	mov	x22, x1
	mov	x0, x24
	bl	_to_mmp_pdma_chan
	mov	x21, x0
	add	x1, x0, #36
	mov	x0, x24
	mov	x2, x25
	bl	_mmp_pdma_config_write
	cmp	w25, #129
	b.eq	LBB0_7
; %bb.5:
	cmp	w25, #128
	b.ne	LBB0_13
; %bb.6:
	str	x19, [sp, #8]                   ; 8-byte Folded Spill
	mov	x26, x22
	ldr	x22, [x21]
	b	LBB0_8
LBB0_7:
	str	x19, [sp, #8]                   ; 8-byte Folded Spill
	ldr	x26, [x21]
LBB0_8:
	mov	x24, #0
	mov	x28, #0
	str	w25, [x21, #8]
	neg	x27, x23
Lloh3:
	adrp	x19, _DCMD_LENGTH@GOTPAGE
Lloh4:
	ldr	x19, [x19, _DCMD_LENGTH@GOTPAGEOFF]
	b	LBB0_10
LBB0_9:                                 ;   in Loop: Header=BB0_10 Depth=1
	add	x0, x23, #8
	str	xzr, [x23, #24]
	bl	_async_tx_ack
	ldr	w8, [x21, #8]
	cmp	w8, #128
	csel	x8, x20, xzr, eq
	add	x26, x8, x26
	csel	x8, xzr, x20, eq
	add	x22, x8, x22
	add	x0, x23, #64
	mov	x1, x25
	bl	_list_add_tail
	mov	x24, x25
	mov	x28, x23
	adds	x27, x27, x20
	b.eq	LBB0_14
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x21
	bl	_mmp_pdma_alloc_descriptor
	cbz	x0, LBB0_15
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	mov	x23, x0
	ldr	x8, [x21, #16]
Lloh5:
	adrp	x9, _DCMD_ENDIRQEN@GOTPAGE
Lloh6:
	ldr	x9, [x9, _DCMD_ENDIRQEN@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
	orr	x8, x9, x8
	ldr	x9, [x19]
	and	x9, x9, x20
	orr	x8, x8, x9
	stp	x8, x26, [x0, #32]
	str	x22, [x0, #48]
	mov	x25, x0
	cbz	x24, LBB0_9
; %bb.12:                               ;   in Loop: Header=BB0_10 Depth=1
	ldr	w8, [x23, #16]
	str	w8, [x28, #56]
	mov	x25, x24
	b	LBB0_9
LBB0_13:
	ldr	w0, [x21, #32]
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_17
LBB0_14:
	mov	x0, x25
	ldr	x8, [sp, #8]                    ; 8-byte Folded Reload
	str	x8, [x0, #8]!
Lloh10:
	adrp	x8, _EBUSY@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh12:
	ldr	x8, [x8]
	neg	x8, x8
	str	x8, [x25, #24]
	ldr	w8, [x25, #16]
	str	w8, [x23, #56]
	str	x25, [x21, #24]
	b	LBB0_18
LBB0_15:
	ldr	w0, [x21, #32]
Lloh13:
	adrp	x1, l_.str.1@PAGE
Lloh14:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
	cbz	x24, LBB0_17
; %bb.16:
	mov	x0, x21
	mov	x1, x24
	bl	_mmp_pdma_free_desc_list
LBB0_17:
	mov	x0, #0
LBB0_18:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_PDMA_MAX_DESC_BYTES,8,3        ; @PDMA_MAX_DESC_BYTES
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Unsupported direction for cyclic DMA\n"

l_.str.1:                               ; @.str.1
	.asciz	"no memory for desc\n"

	.comm	_DCMD_ENDIRQEN,8,3              ; @DCMD_ENDIRQEN
	.comm	_DCMD_LENGTH,8,3                ; @DCMD_LENGTH
	.comm	_EBUSY,8,3                      ; @EBUSY
	.no_dead_strip	_mmp_pdma_prep_dma_cyclic
.subsections_via_symbols
