	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function stm32_mdma_prep_dma_cyclic
_stm32_mdma_prep_dma_cyclic:            ## @stm32_mdma_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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r9, %rbx
	movl	%r8d, %r15d
	movq	%rcx, -80(%rbp)                 ## 8-byte Spill
	movq	%rdx, %r14
	movq	%rsi, %r12
	callq	_to_stm32_mdma_chan
	movq	%rax, %r13
	movq	%rax, %rdi
	callq	_stm32_mdma_get_dev
	movq	%rax, %rsi
	movq	8(%r13), %rax
	testq	%rax, %rax
	je	LBB0_3
## %bb.1:
	cmpq	$0, (%rax)
	je	LBB0_3
## %bb.2:
	movq	%r13, %rdi
	callq	_chan2dev
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_10
LBB0_3:
	testq	%r14, %r14
	movq	-80(%rbp), %rcx                 ## 8-byte Reload
	je	LBB0_9
## %bb.4:
	testq	%rcx, %rcx
	je	LBB0_9
## %bb.5:
	movq	_STM32_MDMA_MAX_BLOCK_LEN@GOTPCREL(%rip), %rax
	cmpq	%rcx, (%rax)
	jb	LBB0_9
## %bb.6:
	movq	%r14, %rax
	orq	%rcx, %rax
	shrq	$32, %rax
	je	LBB0_13
## %bb.7:
	movq	%r14, %rax
	xorl	%edx, %edx
	divq	%rcx
	testq	%rdx, %rdx
	je	LBB0_14
LBB0_8:
	movq	%r13, %rdi
	callq	_chan2dev
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_10
LBB0_9:
	movq	%r13, %rdi
	callq	_chan2dev
	leaq	L_.str.1(%rip), %rsi
LBB0_10:
	movl	%eax, %edi
	callq	_dev_err
LBB0_11:
	xorl	%eax, %eax
LBB0_12:
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_13:
	movl	%r14d, %eax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $edx killed $edx def $rdx
                                        ## kill: def $eax killed $eax def $rax
	testq	%rdx, %rdx
	jne	LBB0_8
LBB0_14:
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	movq	%r13, %rdi
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movl	%eax, %esi
	callq	_stm32_mdma_alloc_desc
	testq	%rax, %rax
	je	LBB0_11
## %bb.15:
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	%rbx, -96(%rbp)                 ## 8-byte Spill
	movq	_DMA_MEM_TO_DEV@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	subq	$8, %rsp
	leaq	-48(%rbp), %rdx
	leaq	-88(%rbp), %rcx
	leaq	-44(%rbp), %r8
	movq	%r13, %rdi
	movl	%r15d, %ebx
	movl	%r15d, %esi
	movq	%r12, %r9
	pushq	-80(%rbp)                       ## 8-byte Folded Reload
	callq	_stm32_mdma_set_xfer_param
	addq	$16, %rsp
	movl	%eax, -84(%rbp)                 ## 4-byte Spill
	cmpl	%r15d, %r14d
	jne	LBB0_17
## %bb.16:
	movq	_STM32_MDMA_CTBR_SBUS@GOTPCREL(%rip), %rax
	jmp	LBB0_18
LBB0_17:
	movq	_STM32_MDMA_CTBR_DBUS@GOTPCREL(%rip), %rax
LBB0_18:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	(%rax), %edx
	leaq	-44(%rbp), %rsi
	movq	%r12, %rcx
	callq	_stm32_mdma_set_bus
	cmpl	$0, -84(%rbp)                   ## 4-byte Folded Reload
	movq	-72(%rbp), %r14                 ## 8-byte Reload
	js	LBB0_26
## %bb.19:
	movq	_STM32_MDMA_CCR_IRQ_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	notl	%eax
	andl	-48(%rbp), %eax
	movq	_STM32_MDMA_CCR_TEIE@GOTPCREL(%rip), %rcx
	movq	_STM32_MDMA_CCR_CTCIE@GOTPCREL(%rip), %rdx
	movq	_STM32_MDMA_CCR_BTIE@GOTPCREL(%rip), %rsi
	orl	(%rcx), %eax
	orl	(%rdx), %eax
	orl	(%rsi), %eax
	movl	%eax, -48(%rbp)
	movl	%eax, (%r14)
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	testl	%eax, %eax
	jle	LBB0_25
## %bb.20:
	movl	%r15d, %r14d
	leal	-1(%rax), %ecx
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	movl	%eax, %eax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	xorl	%r15d, %r15d
	jmp	LBB0_23
	.p2align	4, 0x90
LBB0_21:                                ##   in Loop: Header=BB0_23 Depth=1
	movq	16(%r13), %r8
	movq	%r12, %r9
LBB0_22:                                ##   in Loop: Header=BB0_23 Depth=1
	movl	-88(%rbp), %r10d
	movl	-44(%rbp), %r11d
	xorl	%eax, %eax
	cmpq	-56(%rbp), %r15                 ## 8-byte Folded Reload
	sete	%al
	xorl	%ebx, %ebx
	testq	%r15, %r15
	sete	%bl
	movq	%r13, %rdi
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	movl	%r14d, %edx
	movl	%r15d, %ecx
	pushq	$1
	pushq	%rbx
	pushq	%rax
	pushq	%r11
	pushq	%r10
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
	pushq	%rbx
	callq	_stm32_mdma_setup_hwdesc
	addq	$48, %rsp
	incq	%r15
	addq	%rbx, %r12
	cmpq	-64(%rbp), %r15                 ## 8-byte Folded Reload
	je	LBB0_25
LBB0_23:                                ## =>This Inner Loop Header: Depth=1
	movq	_DMA_MEM_TO_DEV@GOTPCREL(%rip), %rax
	cmpl	%r14d, (%rax)
	jne	LBB0_21
## %bb.24:                              ##   in Loop: Header=BB0_23 Depth=1
	movq	24(%r13), %r9
	movq	%r12, %r8
	jmp	LBB0_22
LBB0_25:
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	movl	$1, 4(%rsi)
	addq	$4, %r13
	addq	$24, %rsi
	movq	%r13, %rdi
	movq	-96(%rbp), %rdx                 ## 8-byte Reload
	callq	_vchan_tx_prep
	jmp	LBB0_12
LBB0_26:
	cmpl	$0, 8(%r14)
	jle	LBB0_29
## %bb.27:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_28:                                ## =>This Inner Loop Header: Depth=1
	movl	(%r13), %edi
	movq	16(%r14), %rax
	movl	(%rax,%rbx,8), %edx
	movl	4(%rax,%rbx,8), %esi
	callq	_dma_pool_free
	incq	%rbx
	movslq	8(%r14), %rax
	cmpq	%rax, %rbx
	jl	LBB0_28
LBB0_29:
	movq	%r14, %rdi
	callq	_kfree
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Request not allowed when dma in cyclic mode\n"

	.comm	_STM32_MDMA_MAX_BLOCK_LEN,8,3   ## @STM32_MDMA_MAX_BLOCK_LEN
L_.str.1:                               ## @.str.1
	.asciz	"Invalid buffer/period len\n"

L_.str.2:                               ## @.str.2
	.asciz	"buf_len not multiple of period_len\n"

	.comm	_DMA_MEM_TO_DEV,4,2             ## @DMA_MEM_TO_DEV
	.comm	_STM32_MDMA_CTBR_SBUS,4,2       ## @STM32_MDMA_CTBR_SBUS
	.comm	_STM32_MDMA_CTBR_DBUS,4,2       ## @STM32_MDMA_CTBR_DBUS
	.comm	_STM32_MDMA_CCR_IRQ_MASK,4,2    ## @STM32_MDMA_CCR_IRQ_MASK
	.comm	_STM32_MDMA_CCR_TEIE,4,2        ## @STM32_MDMA_CCR_TEIE
	.comm	_STM32_MDMA_CCR_CTCIE,4,2       ## @STM32_MDMA_CCR_CTCIE
	.comm	_STM32_MDMA_CCR_BTIE,4,2        ## @STM32_MDMA_CCR_BTIE
	.no_dead_strip	_stm32_mdma_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 stm32_mdma_prep_dma_cyclic
_stm32_mdma_prep_dma_cyclic:            ; @stm32_mdma_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	x21, x4
	mov	x22, x3
	mov	x24, x2
	mov	x23, x1
	bl	_to_stm32_mdma_chan
	mov	x19, x0
	bl	_stm32_mdma_get_dev
	mov	x26, x0
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_3
; %bb.1:
	ldr	x8, [x8]
	cbz	x8, LBB0_3
; %bb.2:
	mov	x0, x19
	bl	_chan2dev
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_9
LBB0_3:
	cbz	x24, LBB0_8
; %bb.4:
	cbz	x22, LBB0_8
; %bb.5:
Lloh2:
	adrp	x8, _STM32_MDMA_MAX_BLOCK_LEN@GOTPAGE
Lloh3:
	ldr	x8, [x8, _STM32_MDMA_MAX_BLOCK_LEN@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	cmp	x8, x22
	b.lo	LBB0_8
; %bb.6:
	udiv	x25, x24, x22
	msub	x8, x25, x22, x24
	cbz	x8, LBB0_12
; %bb.7:
	mov	x0, x19
	bl	_chan2dev
Lloh5:
	adrp	x1, l_.str.2@PAGE
Lloh6:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_9
LBB0_8:
	mov	x0, x19
	bl	_chan2dev
Lloh7:
	adrp	x1, l_.str.1@PAGE
Lloh8:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_9:
	bl	_dev_err
LBB0_10:
	mov	x0, #0
LBB0_11:
	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_12:
	mov	x0, x19
	mov	x1, x25
	bl	_stm32_mdma_alloc_desc
	cbz	x0, LBB0_11
; %bb.13:
	mov	x24, x0
Lloh9:
	adrp	x8, _DMA_MEM_TO_DEV@GOTPAGE
Lloh10:
	ldr	x8, [x8, _DMA_MEM_TO_DEV@GOTPAGEOFF]
Lloh11:
	ldr	w28, [x8]
	add	x2, sp, #28
	add	x3, sp, #24
	add	x4, sp, #20
	mov	x0, x19
	mov	x1, x21
	mov	x5, x23
	mov	x6, x22
	bl	_stm32_mdma_set_xfer_param
	mov	x27, x0
Lloh12:
	adrp	x8, _STM32_MDMA_CTBR_SBUS@GOTPAGE
Lloh13:
	ldr	x8, [x8, _STM32_MDMA_CTBR_SBUS@GOTPAGEOFF]
Lloh14:
	adrp	x9, _STM32_MDMA_CTBR_DBUS@GOTPAGE
Lloh15:
	ldr	x9, [x9, _STM32_MDMA_CTBR_DBUS@GOTPAGEOFF]
	cmp	w28, w21
	csel	x8, x8, x9, eq
	ldr	w2, [x8]
	add	x1, sp, #20
	mov	x0, x26
	mov	x3, x23
	bl	_stm32_mdma_set_bus
	tbnz	w27, #31, LBB0_21
; %bb.14:
Lloh16:
	adrp	x8, _STM32_MDMA_CCR_IRQ_MASK@GOTPAGE
Lloh17:
	ldr	x8, [x8, _STM32_MDMA_CCR_IRQ_MASK@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	ldr	w9, [sp, #28]
	bic	w8, w9, w8
Lloh19:
	adrp	x9, _STM32_MDMA_CCR_TEIE@GOTPAGE
Lloh20:
	ldr	x9, [x9, _STM32_MDMA_CCR_TEIE@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
Lloh22:
	adrp	x10, _STM32_MDMA_CCR_CTCIE@GOTPAGE
Lloh23:
	ldr	x10, [x10, _STM32_MDMA_CCR_CTCIE@GOTPAGEOFF]
Lloh24:
	ldr	w10, [x10]
Lloh25:
	adrp	x11, _STM32_MDMA_CCR_BTIE@GOTPAGE
Lloh26:
	ldr	x11, [x11, _STM32_MDMA_CCR_BTIE@GOTPAGEOFF]
Lloh27:
	ldr	w11, [x11]
	orr	w8, w9, w8
	orr	w8, w8, w10
	orr	w8, w8, w11
	str	w8, [sp, #28]
	str	w8, [x24]
	cmp	w25, #1
	b.lt	LBB0_20
; %bb.15:
	mov	x26, #0
	sub	w27, w25, #1
	and	x25, x25, #0xffffffff
	mov	w28, #1
	b	LBB0_18
LBB0_16:                                ;   in Loop: Header=BB0_18 Depth=1
	ldr	x4, [x19, #16]
	mov	x5, x23
LBB0_17:                                ;   in Loop: Header=BB0_18 Depth=1
	ldp	w8, w7, [sp, #20]
	cmp	x26, x27
	cset	w9, eq
	cmp	x26, #0
	cset	w10, eq
	stp	w10, w28, [sp, #8]
	stp	w8, w9, [sp]
	mov	x0, x19
	mov	x1, x24
	mov	x2, x21
	mov	x3, x26
	mov	x6, x22
	bl	_stm32_mdma_setup_hwdesc
	add	x26, x26, #1
	add	x23, x23, x22
	cmp	x26, x25
	b.eq	LBB0_20
LBB0_18:                                ; =>This Inner Loop Header: Depth=1
Lloh28:
	adrp	x8, _DMA_MEM_TO_DEV@GOTPAGE
Lloh29:
	ldr	x8, [x8, _DMA_MEM_TO_DEV@GOTPAGEOFF]
Lloh30:
	ldr	w8, [x8]
	cmp	w8, w21
	b.ne	LBB0_16
; %bb.19:                               ;   in Loop: Header=BB0_18 Depth=1
	ldr	x5, [x19, #24]
	mov	x4, x23
	b	LBB0_17
LBB0_20:
	mov	w8, #1
	str	w8, [x24, #4]
	add	x0, x19, #4
	add	x1, x24, #24
	mov	x2, x20
	bl	_vchan_tx_prep
	b	LBB0_11
LBB0_21:
	ldr	w8, [x24, #8]
	cmp	w8, #1
	b.lt	LBB0_24
; %bb.22:
	mov	x20, #0
	mov	x21, #0
LBB0_23:                                ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x19]
	ldr	x8, [x24, #16]
	add	x8, x8, x20
	ldp	w2, w1, [x8]
	bl	_dma_pool_free
	add	x21, x21, #1
	ldrsw	x8, [x24, #8]
	add	x20, x20, #8
	cmp	x21, x8
	b.lt	LBB0_23
LBB0_24:
	mov	x0, x24
	bl	_kfree
	b	LBB0_10
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Request not allowed when dma in cyclic mode\n"

	.comm	_STM32_MDMA_MAX_BLOCK_LEN,8,3   ; @STM32_MDMA_MAX_BLOCK_LEN
l_.str.1:                               ; @.str.1
	.asciz	"Invalid buffer/period len\n"

l_.str.2:                               ; @.str.2
	.asciz	"buf_len not multiple of period_len\n"

	.comm	_DMA_MEM_TO_DEV,4,2             ; @DMA_MEM_TO_DEV
	.comm	_STM32_MDMA_CTBR_SBUS,4,2       ; @STM32_MDMA_CTBR_SBUS
	.comm	_STM32_MDMA_CTBR_DBUS,4,2       ; @STM32_MDMA_CTBR_DBUS
	.comm	_STM32_MDMA_CCR_IRQ_MASK,4,2    ; @STM32_MDMA_CCR_IRQ_MASK
	.comm	_STM32_MDMA_CCR_TEIE,4,2        ; @STM32_MDMA_CCR_TEIE
	.comm	_STM32_MDMA_CCR_CTCIE,4,2       ; @STM32_MDMA_CCR_CTCIE
	.comm	_STM32_MDMA_CCR_BTIE,4,2        ; @STM32_MDMA_CCR_BTIE
	.no_dead_strip	_stm32_mdma_prep_dma_cyclic
.subsections_via_symbols
