	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function zx_dma_prep_dma_cyclic
_zx_dma_prep_dma_cyclic:                ## @zx_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, %r12
	movl	%r8d, -44(%rbp)                 ## 4-byte Spill
	movq	%rcx, %r13
	movq	%rdx, %rbx
	movq	%rsi, -88(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r15
	callq	_to_zx_chan
	movq	%rax, %rcx
	movq	%rbx, %rax
	orq	%r13, %rax
	shrq	$32, %rax
	movq	%r12, -96(%rbp)                 ## 8-byte Spill
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	je	LBB0_1
## %bb.2:
	movq	%rbx, %rax
	xorl	%edx, %edx
	divq	%r13
	movq	%rax, %r12
	jmp	LBB0_3
LBB0_1:
	movl	%ebx, %eax
	xorl	%edx, %edx
	divl	%r13d
	movl	%eax, %r12d
LBB0_3:
	movq	_DMA_MAX_SIZE@GOTPCREL(%rip), %rax
	cmpq	%r13, (%rax)
	jae	LBB0_6
## %bb.4:
	movq	(%r15), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	jmp	LBB0_5
LBB0_6:
	movq	%rcx, -72(%rbp)                 ## 8-byte Spill
	movq	%rcx, %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	callq	_zx_pre_config
	testq	%rax, %rax
	je	LBB0_7
LBB0_5:
	xorl	%eax, %eax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movl	%r12d, %edi
	movq	%r15, %rsi
	callq	_zx_alloc_desc_resource
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	testq	%rax, %rax
	je	LBB0_5
## %bb.8:
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	movl	$1, (%rdi)
	cmpq	$0, -56(%rbp)                   ## 8-byte Folded Reload
	je	LBB0_9
## %bb.10:
	movq	%r13, -104(%rbp)                ## 8-byte Spill
	movl	$-1, %r14d
	xorl	%r15d, %r15d
	xorl	%eax, %eax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	xorl	%r13d, %r13d
	movq	-88(%rbp), %rbx                 ## 8-byte Reload
	movq	-104(%rbp), %r12                ## 8-byte Reload
	jmp	LBB0_11
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_11 Depth=1
	movq	8(%rdi), %rsi
	movq	%rbx, %rdx
LBB0_15:                                ##   in Loop: Header=BB0_11 Depth=1
	movq	_ZX_IRQ_ENABLE_ALL@GOTPCREL(%rip), %rax
	movl	(%rax), %r9d
	orl	16(%rdi), %r9d
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	%rsi, -80(%rbp)                 ## 8-byte Spill
	movq	%rdx, %r13
	movq	%r12, %rcx
	movl	%r14d, %r8d
	callq	_zx_dma_fill_desc
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	addq	%r12, %rbx
	addl	%r12d, %r15d
	movslq	%r15d, %r15
	cmpq	-56(%rbp), %r15                 ## 8-byte Folded Reload
	jae	LBB0_16
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	incl	%r14d
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	movq	_DMA_MEM_TO_DEV@GOTPCREL(%rip), %rcx
	cmpl	%eax, (%rcx)
	je	LBB0_12
## %bb.13:                              ##   in Loop: Header=BB0_11 Depth=1
	movq	_DMA_DEV_TO_MEM@GOTPCREL(%rip), %rcx
	cmpl	%eax, (%rcx)
	movq	%r13, %rdx
	movq	-80(%rbp), %rsi                 ## 8-byte Reload
	jne	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_11 Depth=1
	movq	8(%rdi), %rdx
	movq	%rbx, %rsi
	jmp	LBB0_15
LBB0_9:
	movl	$-1, %r14d
LBB0_16:
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movl	12(%rsi), %eax
	movq	16(%rsi), %rcx
	movslq	%r14d, %rdx
	movl	%eax, (%rcx,%rdx,4)
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	%rax, (%rsi)
	addq	$20, %rdi
	addq	$8, %rsi
	movq	-96(%rbp), %rdx                 ## 8-byte Reload
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_vchan_tx_prep                  ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_DMA_MAX_SIZE,8,3               ## @DMA_MAX_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"maximum period size exceeded\n"

	.comm	_DMA_MEM_TO_DEV,4,2             ## @DMA_MEM_TO_DEV
	.comm	_DMA_DEV_TO_MEM,4,2             ## @DMA_DEV_TO_MEM
	.comm	_ZX_IRQ_ENABLE_ALL,4,2          ## @ZX_IRQ_ENABLE_ALL
	.no_dead_strip	_zx_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 zx_dma_prep_dma_cyclic
_zx_dma_prep_dma_cyclic:                ; @zx_dma_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	x19, x5
	mov	x22, x4
	mov	x23, x3
	mov	x20, x2
	mov	x24, x1
	mov	x25, x0
	bl	_to_zx_chan
Lloh0:
	adrp	x8, _DMA_MAX_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _DMA_MAX_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x8, x23
	b.hs	LBB0_2
; %bb.1:
	ldr	x8, [x25]
	ldr	w0, [x8]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_3
LBB0_2:
	mov	x21, x0
	mov	x1, x22
	bl	_zx_pre_config
	cbz	x0, LBB0_4
LBB0_3:
	mov	x0, #0
	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
LBB0_4:
	udiv	x0, x20, x23
                                        ; kill: def $w0 killed $w0 killed $x0
	mov	x1, x25
	bl	_zx_alloc_desc_resource
	cbz	x0, LBB0_3
; %bb.5:
	mov	x25, x0
	str	x19, [sp, #8]                   ; 8-byte Folded Spill
	mov	w8, #1
	str	w8, [x21]
	cbz	x20, LBB0_12
; %bb.6:
	mov	x19, #0
	mov	x27, #0
	mov	x26, #0
	mov	w28, #-1
	b	LBB0_9
LBB0_7:                                 ;   in Loop: Header=BB0_9 Depth=1
	ldr	x27, [x21, #8]
	mov	x26, x24
LBB0_8:                                 ;   in Loop: Header=BB0_9 Depth=1
	add	w4, w28, #1
	ldr	w8, [x21, #16]
Lloh5:
	adrp	x9, _ZX_IRQ_ENABLE_ALL@GOTPAGE
Lloh6:
	ldr	x9, [x9, _ZX_IRQ_ENABLE_ALL@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	orr	w5, w9, w8
	mov	x0, x25
	mov	x1, x27
	mov	x2, x26
	mov	x3, x23
	bl	_zx_dma_fill_desc
	add	x24, x24, x23
	add	w8, w19, w23
	sxtw	x19, w8
	add	w28, w28, #1
	cmp	x19, x20
	b.hs	LBB0_13
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
Lloh8:
	adrp	x8, _DMA_MEM_TO_DEV@GOTPAGE
Lloh9:
	ldr	x8, [x8, _DMA_MEM_TO_DEV@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	cmp	w8, w22
	b.eq	LBB0_7
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
Lloh11:
	adrp	x8, _DMA_DEV_TO_MEM@GOTPAGE
Lloh12:
	ldr	x8, [x8, _DMA_DEV_TO_MEM@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	cmp	w8, w22
	b.ne	LBB0_8
; %bb.11:                               ;   in Loop: Header=BB0_9 Depth=1
	ldr	x26, [x21, #8]
	mov	x27, x24
	b	LBB0_8
LBB0_12:
	mov	w28, #-1
LBB0_13:
	ldr	w8, [x25, #12]
	ldr	x9, [x25, #16]
	str	w8, [x9, w28, sxtw #2]
	str	x20, [x25]
	add	x0, x21, #20
	add	x1, x25, #8
	ldr	x2, [sp, #8]                    ; 8-byte Folded Reload
	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
	b	_vchan_tx_prep
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_DMA_MAX_SIZE,8,3               ; @DMA_MAX_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"maximum period size exceeded\n"

	.comm	_DMA_MEM_TO_DEV,4,2             ; @DMA_MEM_TO_DEV
	.comm	_DMA_DEV_TO_MEM,4,2             ; @DMA_DEV_TO_MEM
	.comm	_ZX_IRQ_ENABLE_ALL,4,2          ; @ZX_IRQ_ENABLE_ALL
	.no_dead_strip	_zx_dma_prep_dma_cyclic
.subsections_via_symbols
