	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sh_dmae_prep_memcpy
_sh_dmae_prep_memcpy:                   ## @sh_dmae_prep_memcpy
	.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
	xorl	%eax, %eax
	testq	%rdi, %rdi
	je	LBB0_7
## %bb.1:
	movq	%rcx, %rbx
	testq	%rcx, %rcx
	je	LBB0_7
## %bb.2:
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	movq	%rdx, -72(%rbp)                 ## 8-byte Spill
	movq	%r8, -88(%rbp)                  ## 8-byte Spill
	callq	_to_sh_chan
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	xorl	%eax, %eax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_sh_dmae_get_desc
	testq	%rax, %rax
	je	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%rax, %r14
	movq	_SH_DMA_TCR_MAX@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%rbx, %rdi
	callq	_min
	movq	%rbx, -80(%rbp)                 ## 8-byte Spill
	movq	%rax, %rbx
	movq	-72(%rbp), %r13                 ## 8-byte Reload
	movq	%r13, 32(%r14)
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	movq	%r15, 40(%r14)
	movq	%rax, 48(%r14)
	movq	-48(%rbp), %r12                 ## 8-byte Reload
	testq	%r12, %r12
	cmoveq	%r14, %r12
	movq	_DESC_NCOMP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 24(%r14)
	movq	%r14, %rdi
	callq	_async_tx_ack
	addq	%rbx, %r13
	movq	%r13, -72(%rbp)                 ## 8-byte Spill
	addq	%rbx, %r15
	movq	%r15, -64(%rbp)                 ## 8-byte Spill
	movq	%r14, %rdi
	addq	$20, %rdi
	movq	%r12, -48(%rbp)                 ## 8-byte Spill
	leaq	16(%r12), %rsi
	callq	_list_add_tail
	subq	%rbx, -80(%rbp)                 ## 8-byte Folded Spill
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
	jne	LBB0_3
## %bb.6:
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	movq	%rax, (%r14)
	movq	_EBUSY@GOTPCREL(%rip), %rax
	xorl	%ecx, %ecx
	subl	(%rax), %ecx
	movl	%ecx, 8(%r14)
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	jmp	LBB0_7
LBB0_4:
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movl	(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	movq	%rbx, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	callq	_sh_dmae_put_desc
	xorl	%eax, %eax
LBB0_7:
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"No free memory for link descriptor\n"

	.comm	_SH_DMA_TCR_MAX,8,3             ## @SH_DMA_TCR_MAX
	.comm	_DESC_NCOMP,4,2                 ## @DESC_NCOMP
	.comm	_EBUSY,4,2                      ## @EBUSY
	.no_dead_strip	_sh_dmae_prep_memcpy
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sh_dmae_prep_memcpy
_sh_dmae_prep_memcpy:                   ; @sh_dmae_prep_memcpy
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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, #0
	cbz	x0, LBB0_7
; %bb.1:
	mov	x21, x3
	cbz	x3, LBB0_7
; %bb.2:
	mov	x20, x4
	mov	x22, x2
	mov	x23, x1
	bl	_to_sh_chan
	mov	x24, x0
	mov	x19, #0
Lloh0:
	adrp	x27, _SH_DMA_TCR_MAX@GOTPAGE
Lloh1:
	ldr	x27, [x27, _SH_DMA_TCR_MAX@GOTPAGEOFF]
Lloh2:
	adrp	x28, _DESC_NCOMP@GOTPAGE
Lloh3:
	ldr	x28, [x28, _DESC_NCOMP@GOTPAGEOFF]
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x24
	bl	_sh_dmae_get_desc
	cbz	x0, LBB0_6
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x25, x0
	ldr	x1, [x27]
	mov	x0, x21
	bl	_min
	mov	x26, x0
	stp	x22, x23, [x25, #32]
	str	x0, [x25, #48]
	cmp	x19, #0
	csel	x19, x25, x19, eq
	ldr	w8, [x28]
	str	w8, [x25, #24]
	mov	x0, x25
	bl	_async_tx_ack
	sub	x21, x21, x26
	add	x22, x26, x22
	add	x23, x26, x23
	add	x0, x25, #20
	add	x1, x19, #16
	bl	_list_add_tail
	cbnz	x21, LBB0_3
; %bb.5:
	str	x20, [x25]
Lloh4:
	adrp	x8, _EBUSY@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w8, w8
	str	w8, [x25, #8]
	b	LBB0_7
LBB0_6:
	ldr	w0, [x24]
Lloh7:
	adrp	x1, l_.str@PAGE
Lloh8:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	mov	x0, x24
	mov	x1, x19
	bl	_sh_dmae_put_desc
	mov	x19, #0
LBB0_7:
	mov	x0, x19
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"No free memory for link descriptor\n"

	.comm	_SH_DMA_TCR_MAX,8,3             ; @SH_DMA_TCR_MAX
	.comm	_DESC_NCOMP,4,2                 ; @DESC_NCOMP
	.comm	_EBUSY,4,2                      ; @EBUSY
	.no_dead_strip	_sh_dmae_prep_memcpy
.subsections_via_symbols
