	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function edma_alloc_chan_resources
_edma_alloc_chan_resources:             ## @edma_alloc_chan_resources
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	callq	_to_edma_chan
	movq	%rax, %r13
	movq	32(%rax), %rax
	movq	40(%r13), %r12
	movq	16(%r12), %r14
	testq	%rax, %rax
	jne	LBB0_4
## %bb.1:
	movq	8(%r12), %rax
	testq	%rax, %rax
	je	LBB0_2
## %bb.3:
	movq	(%r12), %rcx
	movq	(%rcx), %rcx
	leaq	(%rax,%rcx,4), %rax
	movq	%rax, 32(%r13)
	jmp	LBB0_4
LBB0_2:
	movq	_EVENTQ_DEFAULT@GOTPCREL(%rip), %rax
LBB0_4:
	movl	(%rax), %esi
	movq	%r13, %rdi
	callq	_edma_alloc_channel
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_8
## %bb.5:
	movl	24(%r13), %esi
	movq	%r12, %rdi
	callq	_edma_alloc_slot
	movq	(%r13), %rcx
	movl	%eax, (%rcx)
	testl	%eax, %eax
	js	LBB0_6
## %bb.7:
	movq	%r13, %rdi
	movl	%eax, %esi
	callq	_edma_set_chmap
	movl	$1, 8(%r13)
	movl	24(%r13), %edi
	callq	_EDMA_CHAN_SLOT
	movl	(%r15), %ecx
	cmpq	$0, 16(%r13)
	leaq	L_.str.3(%rip), %rdx
	leaq	L_.str.2(%rip), %r8
	cmoveq	%rdx, %r8
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdi
	movl	%eax, %edx
	callq	_dev_dbg
	xorl	%ebx, %ebx
	jmp	LBB0_8
LBB0_6:
	movl	24(%r13), %edi
	callq	_EDMA_CHAN_SLOT
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	movl	%eax, %edx
	callq	_dev_err
	movq	(%r13), %rax
	movl	(%rax), %ebx
	movq	%r13, %rdi
	callq	_edma_free_channel
LBB0_8:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EVENTQ_DEFAULT,4,2             ## @EVENTQ_DEFAULT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Entry slot allocation failed for channel %u\n"

L_.str.1:                               ## @.str.1
	.asciz	"Got eDMA channel %d for virt channel %d (%s trigger)\n"

L_.str.2:                               ## @.str.2
	.asciz	"HW"

L_.str.3:                               ## @.str.3
	.asciz	"SW"

	.no_dead_strip	_edma_alloc_chan_resources
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function edma_alloc_chan_resources
_edma_alloc_chan_resources:             ; @edma_alloc_chan_resources
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x21, x0
	bl	_to_edma_chan
	mov	x19, x0
	ldp	x8, x22, [x0, #32]
	ldr	x20, [x22, #16]
	cbnz	x8, LBB0_4
; %bb.1:
	ldr	x8, [x22, #8]
	cbz	x8, LBB0_3
; %bb.2:
	ldr	x9, [x22]
	ldr	x9, [x9]
	add	x8, x8, x9, lsl #2
	str	x8, [x19, #32]
	b	LBB0_4
LBB0_3:
Lloh0:
	adrp	x8, _EVENTQ_DEFAULT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EVENTQ_DEFAULT@GOTPAGEOFF]
LBB0_4:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_edma_alloc_channel
	mov	x23, x0
	cbnz	w0, LBB0_8
; %bb.5:
	ldr	w1, [x19, #24]
	mov	x0, x22
	bl	_edma_alloc_slot
	ldr	x8, [x19]
	str	w0, [x8]
	tbnz	w0, #31, LBB0_7
; %bb.6:
	mov	x1, x0
	mov	x0, x19
	bl	_edma_set_chmap
	mov	w8, #1
	str	w8, [x19, #8]
	ldr	w0, [x19, #24]
	bl	_EDMA_CHAN_SLOT
	mov	x2, x0
	ldr	w3, [x21]
	ldr	x8, [x19, #16]
Lloh2:
	adrp	x9, l_.str.2@PAGE
Lloh3:
	add	x9, x9, l_.str.2@PAGEOFF
Lloh4:
	adrp	x10, l_.str.3@PAGE
Lloh5:
	add	x10, x10, l_.str.3@PAGEOFF
	cmp	x8, #0
	csel	x4, x10, x9, eq
Lloh6:
	adrp	x1, l_.str.1@PAGE
Lloh7:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x20
	bl	_dev_dbg
	mov	w23, #0
	b	LBB0_8
LBB0_7:
	ldr	w0, [x19, #24]
	bl	_EDMA_CHAN_SLOT
	mov	x2, x0
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	bl	_dev_err
	ldr	x8, [x19]
	ldr	w23, [x8]
	mov	x0, x19
	bl	_edma_free_channel
LBB0_8:
	mov	x0, x23
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_EVENTQ_DEFAULT,4,2             ; @EVENTQ_DEFAULT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Entry slot allocation failed for channel %u\n"

l_.str.1:                               ; @.str.1
	.asciz	"Got eDMA channel %d for virt channel %d (%s trigger)\n"

l_.str.2:                               ; @.str.2
	.asciz	"HW"

l_.str.3:                               ; @.str.3
	.asciz	"SW"

	.no_dead_strip	_edma_alloc_chan_resources
.subsections_via_symbols
