	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function jz4780_dma_prep_slave_sg
_jz4780_dma_prep_slave_sg:              ## @jz4780_dma_prep_slave_sg
	.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	%r8, %r14
	movl	%ecx, -60(%rbp)                 ## 4-byte Spill
	movl	%edx, %r13d
	movq	%rsi, %rbx
	callq	_to_jz4780_dma_chan
	movq	%rax, %r15
	movq	%rax, %rdi
	callq	_jz4780_dma_chan_parent
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	movq	_DMA_SLAVE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	movq	%r15, %rdi
	movl	%r13d, %esi
	callq	_jz4780_dma_desc_alloc
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	testq	%rax, %rax
	je	LBB0_5
## %bb.1:
	movq	%r14, -72(%rbp)                 ## 8-byte Spill
	testl	%r13d, %r13d
	je	LBB0_10
## %bb.2:
	leal	-1(%r13), %ecx
	movl	%r13d, %edx
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	8(%rax), %r13
	shlq	$3, %rcx
	movq	%rcx, -96(%rbp)                 ## 8-byte Spill
	shlq	$3, %rdx
	movq	%rdx, -88(%rbp)                 ## 8-byte Spill
	movl	$8388608, %r12d                 ## imm = 0x800000
	xorl	%r14d, %r14d
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_3 Depth=1
	addl	$8388608, %r12d                 ## imm = 0x800000
	addq	$8, %r14
	addq	$4, %rbx
	cmpq	%r14, -88(%rbp)                 ## 8-byte Folded Reload
	je	LBB0_10
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	addq	%r14, %r13
	movq	%rbx, %rdi
	callq	_sg_dma_address
	movl	%eax, %r15d
	movq	%rbx, %rdi
	callq	_sg_dma_len
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movq	%r13, %rsi
	movl	%r15d, %edx
	movl	%eax, %ecx
	movl	-60(%rbp), %r8d                 ## 4-byte Reload
	callq	_jz4780_dma_setup_hwdesc
	testl	%eax, %eax
	js	LBB0_4
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	8(%rax), %r13
	movl	4(%r13,%r14), %eax
	movq	_JZ_DMA_DCM_TIE@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%eax, 4(%r13,%r14)
	cmpq	%r14, -96(%rbp)                 ## 8-byte Folded Reload
	je	LBB0_9
## %bb.7:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	-80(%rbp), %rcx                 ## 8-byte Reload
	movq	(%rcx), %rcx
	movq	_JZ_SOC_DATA_BREAK_LINKS@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	testl	%edx, (%rcx)
	jne	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	_JZ_DMA_DCM_LINK@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%eax, 4(%r13,%r14)
	movl	%r12d, %eax
	andl	$-16777216, %eax                ## imm = 0xFF000000
	orl	%eax, (%r13,%r14)
	jmp	LBB0_9
LBB0_10:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	movq	-72(%rbp), %rdx                 ## 8-byte Reload
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_vchan_tx_prep                  ## TAILCALL
LBB0_4:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	8(%rax), %rdi
	callq	_jz4780_dma_desc_free
LBB0_5:
	xorl	%eax, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DMA_SLAVE,4,2                  ## @DMA_SLAVE
	.comm	_JZ_DMA_DCM_TIE,4,2             ## @JZ_DMA_DCM_TIE
	.comm	_JZ_SOC_DATA_BREAK_LINKS,4,2    ## @JZ_SOC_DATA_BREAK_LINKS
	.comm	_JZ_DMA_DCM_LINK,4,2            ## @JZ_DMA_DCM_LINK
	.no_dead_strip	_jz4780_dma_prep_slave_sg
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function jz4780_dma_prep_slave_sg
_jz4780_dma_prep_slave_sg:              ; @jz4780_dma_prep_slave_sg
	.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, x4
	mov	x20, x3
	mov	x25, x2
	mov	x21, x1
	bl	_to_jz4780_dma_chan
	mov	x22, x0
	bl	_jz4780_dma_chan_parent
	str	x0, [sp, #8]                    ; 8-byte Folded Spill
Lloh0:
	adrp	x8, _DMA_SLAVE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _DMA_SLAVE@GOTPAGEOFF]
Lloh2:
	ldr	w2, [x8]
	mov	x0, x22
	mov	x1, x25
	bl	_jz4780_dma_desc_alloc
	cbz	x0, LBB0_10
; %bb.1:
	mov	x24, x0
	str	x19, [sp]                       ; 8-byte Folded Spill
	cbz	w25, LBB0_8
; %bb.2:
	mov	x27, #0
	sub	w9, w25, #1
	mov	w10, w25
	ldr	x8, [x24, #8]
	lsl	x28, x9, #3
	lsl	x19, x10, #3
	mov	w23, #8388608
	b	LBB0_4
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	w23, w23, #2048, lsl #12        ; =8388608
	add	x27, x27, #8
	add	x21, x21, #4
	cmp	x19, x27
	b.eq	LBB0_8
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	add	x25, x8, x27
	mov	x0, x21
	bl	_sg_dma_address
	mov	x26, x0
	mov	x0, x21
	bl	_sg_dma_len
	mov	x3, x0
	mov	x0, x22
	mov	x1, x25
	mov	x2, x26
	mov	x4, x20
	bl	_jz4780_dma_setup_hwdesc
	tbnz	w0, #31, LBB0_9
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
Lloh3:
	adrp	x8, _JZ_DMA_DCM_TIE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _JZ_DMA_DCM_TIE@GOTPAGEOFF]
Lloh5:
	ldr	w10, [x8]
	ldr	x8, [x24, #8]
	add	x9, x8, x27
	ldr	w11, [x9, #4]
	orr	w10, w11, w10
	str	w10, [x9, #4]
	cmp	x28, x27
	b.eq	LBB0_3
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	x11, [sp, #8]                   ; 8-byte Folded Reload
	ldr	x11, [x11]
	ldr	w11, [x11]
Lloh6:
	adrp	x12, _JZ_SOC_DATA_BREAK_LINKS@GOTPAGE
Lloh7:
	ldr	x12, [x12, _JZ_SOC_DATA_BREAK_LINKS@GOTPAGEOFF]
Lloh8:
	ldr	w12, [x12]
	tst	w12, w11
	b.ne	LBB0_3
; %bb.7:                                ;   in Loop: Header=BB0_4 Depth=1
Lloh9:
	adrp	x11, _JZ_DMA_DCM_LINK@GOTPAGE
Lloh10:
	ldr	x11, [x11, _JZ_DMA_DCM_LINK@GOTPAGEOFF]
Lloh11:
	ldr	w11, [x11]
	orr	w10, w11, w10
	str	w10, [x9, #4]
	and	w9, w23, #0xff000000
	ldr	w10, [x8, x27]
	orr	w9, w10, w9
	str	w9, [x8, x27]
	b	LBB0_3
LBB0_8:
	mov	x0, x22
	mov	x1, x24
	ldr	x2, [sp]                        ; 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
LBB0_9:
	ldr	x0, [x22, #8]
	bl	_jz4780_dma_desc_free
LBB0_10:
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_DMA_SLAVE,4,2                  ; @DMA_SLAVE
	.comm	_JZ_DMA_DCM_TIE,4,2             ; @JZ_DMA_DCM_TIE
	.comm	_JZ_SOC_DATA_BREAK_LINKS,4,2    ; @JZ_SOC_DATA_BREAK_LINKS
	.comm	_JZ_DMA_DCM_LINK,4,2            ; @JZ_DMA_DCM_LINK
	.no_dead_strip	_jz4780_dma_prep_slave_sg
.subsections_via_symbols
