	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function atc_prep_dma_cyclic
_atc_prep_dma_cyclic:                   ## @atc_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
	movl	%r8d, -44(%rbp)                 ## 4-byte Spill
	movq	%rcx, %r15
	movq	%rdx, %r14
	movq	%rdi, %r12
	movl	%esi, -48(%rbp)
	callq	_to_at_dma_chan
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	(%r12), %rbx
	movq	$0, -72(%rbp)
	movq	$0, -88(%rbp)
	movq	%r14, %rax
	orq	%r15, %rax
	shrq	$32, %rax
	je	LBB0_1
## %bb.2:
	movq	%r14, %rax
	xorl	%edx, %edx
	divq	%r15
	movq	%rax, %r13
	jmp	LBB0_3
LBB0_1:
	movl	%r14d, %eax
	xorl	%edx, %edx
	divl	%r15d
	movl	%eax, %r13d
LBB0_3:
	movq	%r12, %rdi
	callq	_chan2dev
	movq	_DMA_MEM_TO_DEV@GOTPCREL(%rip), %rdx
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	cmpl	%ecx, (%rdx)
	leaq	L_.str.1(%rip), %rcx
	leaq	L_.str.2(%rip), %rdx
	cmoveq	%rcx, %rdx
	movq	%r15, (%rsp)
	leaq	L_.str(%rip), %rsi
	leaq	-48(%rbp), %rcx
	movl	%eax, %edi
	movl	%r13d, %r8d
	movq	%r14, %r9
	callq	_dev_vdbg
	testq	%rbx, %rbx
	sete	%al
	testq	%r14, %r14
	sete	%cl
	testq	%r15, %r15
	sete	%dl
	orb	%cl, %dl
	orb	%al, %dl
	movzbl	%dl, %edi
	callq	_unlikely
	testq	%rax, %rax
	je	LBB0_6
## %bb.4:
	movq	%r12, %rdi
	callq	_chan2dev
	leaq	L_.str.3(%rip), %rsi
	jmp	LBB0_5
LBB0_6:
	movq	%r12, -56(%rbp)                 ## 8-byte Spill
	movq	%r14, -96(%rbp)                 ## 8-byte Spill
	movq	_ATC_IS_CYCLIC@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	movq	-64(%rbp), %r12                 ## 8-byte Reload
	movq	%r12, %rsi
	callq	_test_and_set_bit
	testq	%rax, %rax
	je	LBB0_8
## %bb.7:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_chan2dev
	leaq	L_.str.4(%rip), %rsi
LBB0_5:
	movl	%eax, %edi
	callq	_dev_dbg
LBB0_17:
	xorl	%eax, %eax
LBB0_18:
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movl	-44(%rbp), %r14d                ## 4-byte Reload
	movl	%r14d, %edi
	callq	_is_slave_direction
	xorl	%edi, %edi
	testl	%eax, %eax
	sete	%dil
	callq	_unlikely
	testq	%rax, %rax
	jne	LBB0_16
## %bb.9:
	xorl	%eax, %eax
	movq	_DMA_MEM_TO_DEV@GOTPCREL(%rip), %rcx
	cmpl	%r14d, (%rcx)
	sete	%al
	movl	4(%r12,%rax,4), %edi
	callq	_convert_buswidth
	movl	%eax, %r14d
	movl	-48(%rbp), %esi
	movl	%eax, %edi
	movq	%r15, %rdx
	callq	_atc_dma_cyclic_check_values
	testq	%rax, %rax
	jne	LBB0_16
## %bb.10:
	movl	%r14d, -76(%rbp)                ## 4-byte Spill
	xorl	%r12d, %r12d
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_atc_desc_get
	testq	%rax, %rax
	je	LBB0_15
## %bb.12:                              ##   in Loop: Header=BB0_11 Depth=1
	movq	%rax, %r14
	movl	-48(%rbp), %ecx
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, (%rsp)
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movq	%r14, %rsi
	movl	%r12d, %edx
	movl	-76(%rbp), %r8d                 ## 4-byte Reload
	movq	%r15, %r9
	callq	_atc_dma_cyclic_fill_desc
	testq	%rax, %rax
	jne	LBB0_15
## %bb.13:                              ##   in Loop: Header=BB0_11 Depth=1
	leaq	-72(%rbp), %rdi
	leaq	-88(%rbp), %rsi
	movq	%r14, %rdx
	callq	_atc_desc_chain
	incl	%r12d
	cmpl	%r13d, %r12d
	jne	LBB0_11
## %bb.14:
	movq	-72(%rbp), %rcx
	movq	-88(%rbp), %rdx
	leaq	8(%rcx), %rax
	movl	12(%rcx), %esi
	movl	%esi, 16(%rdx)
	movq	_EBUSY@GOTPCREL(%rip), %rdx
	xorl	%esi, %esi
	subl	(%rdx), %esi
	movl	%esi, 8(%rcx)
	movq	-96(%rbp), %rdx                 ## 8-byte Reload
	movq	%rdx, (%rcx)
	jmp	LBB0_18
LBB0_15:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_chan2dev
	leaq	L_.str.5(%rip), %rsi
	movl	%eax, %edi
	callq	_dev_err
	movq	-72(%rbp), %rsi
	movq	-64(%rbp), %r12                 ## 8-byte Reload
	movq	%r12, %rdi
	callq	_atc_desc_put
LBB0_16:
	movl	(%rbx), %edi
	movq	%r12, %rsi
	callq	_clear_bit
	jmp	LBB0_17
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"prep_dma_cyclic: %s buf@%pad - %d (%d/%d)\n"

	.comm	_DMA_MEM_TO_DEV,4,2             ## @DMA_MEM_TO_DEV
L_.str.1:                               ## @.str.1
	.asciz	"TO DEVICE"

L_.str.2:                               ## @.str.2
	.asciz	"FROM DEVICE"

L_.str.3:                               ## @.str.3
	.asciz	"prep_dma_cyclic: length is zero!\n"

	.comm	_ATC_IS_CYCLIC,4,2              ## @ATC_IS_CYCLIC
L_.str.4:                               ## @.str.4
	.asciz	"prep_dma_cyclic: channel in use!\n"

	.comm	_EBUSY,4,2                      ## @EBUSY
L_.str.5:                               ## @.str.5
	.asciz	"not enough descriptors available\n"

	.no_dead_strip	_atc_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 atc_prep_dma_cyclic
_atc_prep_dma_cyclic:                   ; @atc_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	x22, x4
	mov	x23, x3
	mov	x20, x2
	mov	x21, x0
	str	w1, [sp, #28]
	bl	_to_at_dma_chan
	mov	x19, x0
	ldr	x26, [x21]
	stp	xzr, xzr, [sp, #8]
	udiv	x24, x20, x23
	mov	x0, x21
	bl	_chan2dev
Lloh0:
	adrp	x25, _DMA_MEM_TO_DEV@GOTPAGE
Lloh1:
	ldr	x25, [x25, _DMA_MEM_TO_DEV@GOTPAGEOFF]
	ldr	w8, [x25]
Lloh2:
	adrp	x9, l_.str.2@PAGE
Lloh3:
	add	x9, x9, l_.str.2@PAGEOFF
Lloh4:
	adrp	x10, l_.str.1@PAGE
Lloh5:
	add	x10, x10, l_.str.1@PAGEOFF
	cmp	w8, w22
	csel	x2, x10, x9, eq
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	add	x3, sp, #28
	mov	x4, x24
	mov	x5, x20
	mov	x6, x23
	bl	_dev_vdbg
	cmp	x20, #0
	ccmp	x26, #0, #4, ne
	ccmp	x23, #0, #4, ne
	cset	w0, eq
	bl	_unlikely
	cbz	x0, LBB0_2
; %bb.1:
	mov	x0, x21
	bl	_chan2dev
Lloh8:
	adrp	x1, l_.str.3@PAGE
Lloh9:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_dbg
	b	LBB0_13
LBB0_2:
Lloh10:
	adrp	x28, _ATC_IS_CYCLIC@GOTPAGE
Lloh11:
	ldr	x28, [x28, _ATC_IS_CYCLIC@GOTPAGEOFF]
	ldr	w0, [x28]
	mov	x1, x19
	bl	_test_and_set_bit
	cbz	x0, LBB0_4
; %bb.3:
	mov	x0, x21
	bl	_chan2dev
Lloh12:
	adrp	x1, l_.str.4@PAGE
Lloh13:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_dev_dbg
	b	LBB0_13
LBB0_4:
	mov	x0, x22
	bl	_is_slave_direction
	cmp	w0, #0
	cset	w0, eq
	bl	_unlikely
	cbnz	x0, LBB0_12
; %bb.5:
	ldr	w8, [x25]
	cmp	w8, w22
	mov	w8, #4
	mov	w9, #8
	csel	x8, x9, x8, eq
	ldr	w0, [x19, x8]
	bl	_convert_buswidth
	mov	x25, x0
	ldr	w1, [sp, #28]
	mov	x2, x23
	bl	_atc_dma_cyclic_check_values
	cbnz	x0, LBB0_12
; %bb.6:
	mov	w26, #0
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	bl	_atc_desc_get
	cbz	x0, LBB0_11
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	mov	x27, x0
	ldr	w3, [sp, #28]
	mov	x0, x21
	mov	x1, x27
	mov	x2, x26
	mov	x4, x25
	mov	x5, x23
	mov	x6, x22
	bl	_atc_dma_cyclic_fill_desc
	cbnz	x0, LBB0_11
; %bb.9:                                ;   in Loop: Header=BB0_7 Depth=1
	add	x0, sp, #16
	add	x1, sp, #8
	mov	x2, x27
	bl	_atc_desc_chain
	add	w26, w26, #1
	cmp	w26, w24
	b.ne	LBB0_7
; %bb.10:
	ldp	x8, x0, [sp, #8]
	ldr	w9, [x0, #12]
	str	w9, [x8, #16]
Lloh14:
	adrp	x8, _EBUSY@GOTPAGE
Lloh15:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	neg	w8, w8
	str	x20, [x0]
	str	w8, [x0, #8]!
	b	LBB0_14
LBB0_11:
	mov	x0, x21
	bl	_chan2dev
Lloh17:
	adrp	x1, l_.str.5@PAGE
Lloh18:
	add	x1, x1, l_.str.5@PAGEOFF
	bl	_dev_err
	ldr	x1, [sp, #16]
	mov	x0, x19
	bl	_atc_desc_put
LBB0_12:
	ldr	w0, [x28]
	mov	x1, x19
	bl	_clear_bit
LBB0_13:
	mov	x0, #0
LBB0_14:
	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
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"prep_dma_cyclic: %s buf@%pad - %d (%d/%d)\n"

	.comm	_DMA_MEM_TO_DEV,4,2             ; @DMA_MEM_TO_DEV
l_.str.1:                               ; @.str.1
	.asciz	"TO DEVICE"

l_.str.2:                               ; @.str.2
	.asciz	"FROM DEVICE"

l_.str.3:                               ; @.str.3
	.asciz	"prep_dma_cyclic: length is zero!\n"

	.comm	_ATC_IS_CYCLIC,4,2              ; @ATC_IS_CYCLIC
l_.str.4:                               ; @.str.4
	.asciz	"prep_dma_cyclic: channel in use!\n"

	.comm	_EBUSY,4,2                      ; @EBUSY
l_.str.5:                               ; @.str.5
	.asciz	"not enough descriptors available\n"

	.no_dead_strip	_atc_prep_dma_cyclic
.subsections_via_symbols
