	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mmp_tdma_prep_dma_cyclic
_mmp_tdma_prep_dma_cyclic:              ## @mmp_tdma_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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r9, -64(%rbp)                  ## 8-byte Spill
	movl	%r8d, -44(%rbp)                 ## 4-byte Spill
	movq	%rcx, %r13
	movq	%rdx, %r15
	movq	%rsi, %r12
	movq	%rdi, %rbx
	callq	_to_mmp_tdma_chan
	movq	%rax, %r14
	movq	%r15, %rax
	orq	%r13, %rax
	shrq	$32, %rax
	je	LBB0_1
## %bb.2:
	movq	%r15, %rax
	xorl	%edx, %edx
	divq	%r13
	jmp	LBB0_3
LBB0_1:
	movl	%r15d, %eax
	xorl	%edx, %edx
	divl	%r13d
                                        ## kill: def $eax killed $eax def $rax
LBB0_3:
	movq	(%r14), %rdx
	movq	_DMA_COMPLETE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rdx
	jne	LBB0_7
## %bb.4:
	movq	_TDMA_MAX_XFER_BYTES@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	%r13, %rcx
	jae	LBB0_8
## %bb.5:
	movl	76(%r14), %edi
	leaq	L_.str(%rip), %rsi
	movq	%r13, %rdx
	callq	_dev_err
	jmp	LBB0_6
LBB0_8:
	movq	_DMA_IN_PROGRESS@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	%rcx, (%r14)
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movl	%eax, 8(%r14)
	movq	%r14, %rdi
	callq	_mmp_tdma_alloc_descriptor
	testq	%rax, %rax
	je	LBB0_6
## %bb.9:
	leaq	72(%r14), %rdx
	movq	%rbx, %rdi
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, %esi
	callq	_mmp_tdma_config_write
	testq	%r15, %r15
	je	LBB0_12
## %bb.10:
	movl	%ebx, %r10d
	movq	64(%r14), %rax
	movq	_DMA_MEM_TO_DEV@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r8d
	movl	-56(%rbp), %r9d                 ## 4-byte Reload
	movl	$32, %esi
	movl	$1, %edi
	xorl	%ecx, %ecx
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	cmpq	%r9, %rdi
	movl	$0, %edx
	cmovneq	%rsi, %rdx
	addq	56(%r14), %rdx
	cmpl	%r10d, %r8d
	movq	%rdx, -8(%rax,%rsi)
	movq	16(%r14), %rdx
	movq	%rdx, %rbx
	cmoveq	%r12, %rbx
	cmovneq	%r12, %rdx
	movq	%rbx, -32(%rax,%rsi)
	movq	%rdx, -24(%rax,%rsi)
	movq	%r13, -16(%rax,%rsi)
	addq	%r13, %r12
	addl	%r13d, %ecx
	movslq	%ecx, %rcx
	addq	$32, %rsi
	incq	%rdi
	cmpq	%r15, %rcx
	jb	LBB0_11
LBB0_12:
	movq	_DMA_PREP_INTERRUPT@GOTPCREL(%rip), %rax
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	testq	%rcx, (%rax)
	je	LBB0_14
## %bb.13:
	movq	%r14, %rdi
	movl	$1, %esi
	callq	_mmp_tdma_enable_irq
LBB0_14:
	movq	%r15, 24(%r14)
	movq	%r13, 32(%r14)
	movq	$0, 48(%r14)
	addq	$40, %r14
	jmp	LBB0_15
LBB0_6:
	movq	_DMA_ERROR@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%r14)
LBB0_7:
	xorl	%r14d, %r14d
LBB0_15:
	movq	%r14, %rax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DMA_COMPLETE,8,3               ## @DMA_COMPLETE
	.comm	_TDMA_MAX_XFER_BYTES,8,3        ## @TDMA_MAX_XFER_BYTES
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"maximum period size exceeded: %zu > %d\n"

	.comm	_DMA_IN_PROGRESS,8,3            ## @DMA_IN_PROGRESS
	.comm	_DMA_MEM_TO_DEV,4,2             ## @DMA_MEM_TO_DEV
	.comm	_DMA_PREP_INTERRUPT,8,3         ## @DMA_PREP_INTERRUPT
	.comm	_DMA_ERROR,8,3                  ## @DMA_ERROR
	.no_dead_strip	_mmp_tdma_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_tdma_prep_dma_cyclic
_mmp_tdma_prep_dma_cyclic:              ; @mmp_tdma_prep_dma_cyclic
	.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	x22, x5
	mov	x23, x4
	mov	x20, x3
	mov	x21, x2
	mov	x24, x1
	mov	x25, x0
	bl	_to_mmp_tdma_chan
	ldr	x8, [x0]
Lloh0:
	adrp	x9, _DMA_COMPLETE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _DMA_COMPLETE@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_3
; %bb.1:
	mov	x19, x0
Lloh3:
	adrp	x8, _TDMA_MAX_XFER_BYTES@GOTPAGE
Lloh4:
	ldr	x8, [x8, _TDMA_MAX_XFER_BYTES@GOTPAGEOFF]
Lloh5:
	ldr	x3, [x8]
	cmp	x3, x20
	b.hs	LBB0_4
; %bb.2:
	ldr	w0, [x19, #76]
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x20
	bl	_dev_err
	b	LBB0_11
LBB0_3:
	mov	x0, #0
	b	LBB0_12
LBB0_4:
Lloh8:
	adrp	x8, _DMA_IN_PROGRESS@GOTPAGE
Lloh9:
	ldr	x8, [x8, _DMA_IN_PROGRESS@GOTPAGEOFF]
Lloh10:
	ldr	x8, [x8]
	udiv	x26, x21, x20
	str	x8, [x19]
	str	w26, [x19, #8]
	mov	x0, x19
	bl	_mmp_tdma_alloc_descriptor
	cbz	x0, LBB0_11
; %bb.5:
	add	x2, x19, #72
	mov	x0, x25
	mov	x1, x23
	bl	_mmp_tdma_config_write
	cbz	x21, LBB0_8
; %bb.6:
	mov	x13, #0
	mov	x9, #0
	ldr	x8, [x19, #64]
Lloh11:
	adrp	x10, _DMA_MEM_TO_DEV@GOTPAGE
Lloh12:
	ldr	x10, [x10, _DMA_MEM_TO_DEV@GOTPAGEOFF]
Lloh13:
	ldr	w10, [x10]
	and	x11, x26, #0xffffffff
	mov	w12, #1
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x14, [x19, #56]
	add	x15, x8, x13
	add	x13, x13, #32
	cmp	x12, x11
	csel	x16, xzr, x13, eq
	add	x14, x14, x16
	str	x14, [x15, #24]
	ldr	x14, [x19, #16]
	cmp	w10, w23
	csel	x16, x24, x14, eq
	csel	x14, x14, x24, eq
	stp	x16, x14, [x15]
	str	x20, [x15, #16]
	add	x24, x24, x20
	add	w9, w9, w20
	sxtw	x9, w9
	add	x12, x12, #1
	cmp	x9, x21
	b.lo	LBB0_7
LBB0_8:
Lloh14:
	adrp	x8, _DMA_PREP_INTERRUPT@GOTPAGE
Lloh15:
	ldr	x8, [x8, _DMA_PREP_INTERRUPT@GOTPAGEOFF]
Lloh16:
	ldr	x8, [x8]
	tst	x8, x22
	b.eq	LBB0_10
; %bb.9:
	mov	x0, x19
	mov	w1, #1
	bl	_mmp_tdma_enable_irq
LBB0_10:
	stp	x21, x20, [x19, #24]
	add	x0, x19, #40
	str	xzr, [x19, #48]
	b	LBB0_12
LBB0_11:
	mov	x0, #0
Lloh17:
	adrp	x8, _DMA_ERROR@GOTPAGE
Lloh18:
	ldr	x8, [x8, _DMA_ERROR@GOTPAGEOFF]
Lloh19:
	ldr	x8, [x8]
	str	x8, [x19]
LBB0_12:
	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 AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_DMA_COMPLETE,8,3               ; @DMA_COMPLETE
	.comm	_TDMA_MAX_XFER_BYTES,8,3        ; @TDMA_MAX_XFER_BYTES
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"maximum period size exceeded: %zu > %d\n"

	.comm	_DMA_IN_PROGRESS,8,3            ; @DMA_IN_PROGRESS
	.comm	_DMA_MEM_TO_DEV,4,2             ; @DMA_MEM_TO_DEV
	.comm	_DMA_PREP_INTERRUPT,8,3         ; @DMA_PREP_INTERRUPT
	.comm	_DMA_ERROR,8,3                  ; @DMA_ERROR
	.no_dead_strip	_mmp_tdma_prep_dma_cyclic
.subsections_via_symbols
