	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function shdma_add_desc
_shdma_add_desc:                        ## @shdma_add_desc
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r9, %r14
	movq	%r8, %r12
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	movq	%rdx, -56(%rbp)                 ## 8-byte Spill
	movq	%rsi, %rbx
	movq	%rdi, %r13
	movl	4(%rdi), %edi
	callq	_to_shdma_dev
	movq	(%rax), %r15
	movq	(%r12), %rax
	movq	%rax, -64(%rbp)
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	movq	%r13, %rdi
	callq	_shdma_get_desc
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movq	%rax, %rbx
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rdx
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rcx
	leaq	-64(%rbp), %r8
	movq	%r13, %rdi
	movq	%rbx, %rsi
	callq	*(%r15)
	cmpq	$0, (%r14)
	je	LBB0_5
## %bb.6:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	jmp	LBB0_7
LBB0_1:
	xorl	%ebx, %ebx
	jmp	LBB0_13
LBB0_3:
	movl	(%r13), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	xorl	%ebx, %ebx
	jmp	LBB0_13
LBB0_5:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	%rbx, (%r14)
LBB0_7:
	negl	%eax
	movq	%rbx, %r10
	addq	$16, %r10
	movl	%eax, 24(%rbx)
	movl	(%r13), %edi
	movq	-64(%rbp), %rdx
	movq	(%r12), %rcx
	leaq	L_.str.1(%rip), %rsi
	movq	-48(%rbp), %r8                  ## 8-byte Reload
	movq	-56(%rbp), %r9                  ## 8-byte Reload
	pushq	%rax
	pushq	%r10
	callq	_dev_dbg
	addq	$16, %rsp
	movq	_DESC_PREPARED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 32(%rbx)
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movq	%rax, 16(%rbx)
	movl	16(%rbp), %esi
	movl	%esi, (%rbx)
	movq	$0, 8(%rbx)
	movq	-64(%rbp), %rax
	subq	%rax, (%r12)
	movq	_DMA_MEM_TO_MEM@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	cmpl	%esi, %ecx
	je	LBB0_9
## %bb.8:
	movq	_DMA_MEM_TO_DEV@GOTPCREL(%rip), %rdx
	cmpl	%esi, (%rdx)
	jne	LBB0_10
LBB0_9:
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	addq	%rax, (%rdx)
LBB0_10:
	cmpl	%esi, %ecx
	je	LBB0_12
## %bb.11:
	movq	_DMA_DEV_TO_MEM@GOTPCREL(%rip), %rcx
	cmpl	%esi, (%rcx)
	jne	LBB0_13
LBB0_12:
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	addq	%rax, (%rcx)
LBB0_13:
	movq	%rbx, %rax
	addq	$40, %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 link descriptor available\n"

	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"chaining (%zu/%zu)@%pad -> %pad with %p, cookie %d\n"

	.comm	_DESC_PREPARED,4,2              ## @DESC_PREPARED
	.comm	_DMA_MEM_TO_MEM,4,2             ## @DMA_MEM_TO_MEM
	.comm	_DMA_MEM_TO_DEV,4,2             ## @DMA_MEM_TO_DEV
	.comm	_DMA_DEV_TO_MEM,4,2             ## @DMA_DEV_TO_MEM
	.no_dead_strip	_shdma_add_desc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function shdma_add_desc
_shdma_add_desc:                        ; @shdma_add_desc
	.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	x20, x6
	mov	x26, x5
	mov	x23, x4
	mov	x22, x3
	mov	x19, x2
	mov	x24, x1
	mov	x25, x0
	ldr	w0, [x0, #4]
	bl	_to_shdma_dev
	ldr	x27, [x0]
	ldr	x8, [x23]
	str	x8, [sp, #8]
	cbz	x8, LBB0_4
; %bb.1:
	mov	x0, x25
	bl	_shdma_get_desc
	mov	x21, x0
	cbz	x0, LBB0_5
; %bb.2:
	ldr	x8, [x27]
	ldr	x2, [x22]
	ldr	x3, [x19]
	add	x4, sp, #8
	mov	x0, x25
	mov	x1, x21
	blr	x8
	ldr	x8, [x26]
	cbz	x8, LBB0_6
; %bb.3:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	b	LBB0_7
LBB0_4:
	mov	x21, #0
	b	LBB0_13
LBB0_5:
	ldr	w0, [x25]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_13
LBB0_6:
Lloh5:
	adrp	x8, _EBUSY@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	str	x21, [x26]
LBB0_7:
	neg	w7, w8
	add	x6, x21, #16
	str	w7, [x21, #24]
	ldr	w0, [x25]
	ldr	x2, [sp, #8]
	ldr	x3, [x23]
Lloh8:
	adrp	x1, l_.str.1@PAGE
Lloh9:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x4, x22
	mov	x5, x19
	bl	_dev_dbg
Lloh10:
	adrp	x8, _DESC_PREPARED@GOTPAGE
Lloh11:
	ldr	x8, [x8, _DESC_PREPARED@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	str	w8, [x21, #32]
	str	w20, [x21]
	stp	xzr, x24, [x21, #8]
	ldr	x8, [sp, #8]
	ldr	x9, [x23]
	sub	x9, x9, x8
	str	x9, [x23]
Lloh13:
	adrp	x9, _DMA_MEM_TO_MEM@GOTPAGE
Lloh14:
	ldr	x9, [x9, _DMA_MEM_TO_MEM@GOTPAGEOFF]
Lloh15:
	ldr	w9, [x9]
	cmp	w9, w20
	b.eq	LBB0_9
; %bb.8:
Lloh16:
	adrp	x10, _DMA_MEM_TO_DEV@GOTPAGE
Lloh17:
	ldr	x10, [x10, _DMA_MEM_TO_DEV@GOTPAGEOFF]
Lloh18:
	ldr	w10, [x10]
	cmp	w10, w20
	b.ne	LBB0_10
LBB0_9:
	ldr	x10, [x22]
	add	x10, x10, x8
	str	x10, [x22]
LBB0_10:
	cmp	w9, w20
	b.eq	LBB0_12
; %bb.11:
Lloh19:
	adrp	x9, _DMA_DEV_TO_MEM@GOTPAGE
Lloh20:
	ldr	x9, [x9, _DMA_DEV_TO_MEM@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
	cmp	w9, w20
	b.ne	LBB0_13
LBB0_12:
	ldr	x9, [x19]
	add	x8, x9, x8
	str	x8, [x19]
LBB0_13:
	mov	x0, x21
	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 AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"No free link descriptor available\n"

	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"chaining (%zu/%zu)@%pad -> %pad with %p, cookie %d\n"

	.comm	_DESC_PREPARED,4,2              ; @DESC_PREPARED
	.comm	_DMA_MEM_TO_MEM,4,2             ; @DMA_MEM_TO_MEM
	.comm	_DMA_MEM_TO_DEV,4,2             ; @DMA_MEM_TO_DEV
	.comm	_DMA_DEV_TO_MEM,4,2             ; @DMA_DEV_TO_MEM
	.no_dead_strip	_shdma_add_desc
.subsections_via_symbols
