	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sdma_alloc_chan_resources
_sdma_alloc_chan_resources:             ## @sdma_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	callq	_to_sdma_chan
	movq	%rax, %r12
	movq	(%rbx), %rax
	testq	%rax, %rax
	je	LBB0_1
## %bb.3:
	movl	(%rax), %ecx
	movl	24(%rax), %r15d
	movups	8(%rax), %xmm0
	cmpl	$128, %ecx
	je	LBB0_4
## %bb.5:
	cmpl	$130, %ecx
	jne	LBB0_2
## %bb.6:
	movl	$3, %r14d
	jmp	LBB0_7
LBB0_1:
	movq	(%r12), %rax
	movl	8(%rax), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_dbg
	movq	_IMX_DMATYPE_MEMORY@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movq	%r12, %rdi
	movl	%r15d, %esi
	callq	_sdma_get_pc
	xorps	%xmm0, %xmm0
LBB0_2:
	movl	$1, %r14d
	jmp	LBB0_7
LBB0_4:
	movl	$2, %r14d
LBB0_7:
	movl	%r15d, 24(%r12)
	movups	%xmm0, 8(%r12)
	movq	(%r12), %rax
	movl	(%rax), %edi
	callq	_clk_enable
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_13
## %bb.8:
	movq	(%r12), %rax
	movl	4(%rax), %edi
	callq	_clk_enable
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_12
## %bb.9:
	movq	%r12, %rdi
	movl	%r14d, %esi
	callq	_sdma_set_channel_priority
	testl	%eax, %eax
	je	LBB0_10
## %bb.11:
	movl	%eax, %ebx
	movq	(%r12), %rax
	movl	4(%rax), %edi
	callq	_clk_disable
LBB0_12:
	movq	(%r12), %rax
	movl	(%rax), %edi
	callq	_clk_disable
LBB0_13:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	xorl	%ebx, %ebx
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"MEMCPY in case?\n"

	.comm	_IMX_DMATYPE_MEMORY,4,2         ## @IMX_DMATYPE_MEMORY
	.no_dead_strip	_sdma_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 sdma_alloc_chan_resources
_sdma_alloc_chan_resources:             ; @sdma_alloc_chan_resources
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x20, x0
	bl	_to_sdma_chan
	mov	x19, x0
	ldr	x8, [x20]
	cbz	x8, LBB0_4
; %bb.1:
	ldr	w9, [x8]
	ldr	w21, [x8, #24]
	ldur	q0, [x8, #8]
	cmp	w9, #128
	b.eq	LBB0_6
; %bb.2:
	cmp	w9, #130
	b.ne	LBB0_5
; %bb.3:
	mov	w20, #3
	b	LBB0_7
LBB0_4:
	ldr	x8, [x19]
	ldr	w0, [x8, #8]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
Lloh2:
	adrp	x8, _IMX_DMATYPE_MEMORY@GOTPAGE
Lloh3:
	ldr	x8, [x8, _IMX_DMATYPE_MEMORY@GOTPAGEOFF]
Lloh4:
	ldr	w21, [x8]
	mov	x0, x19
	mov	x1, x21
	bl	_sdma_get_pc
	movi.2d	v0, #0000000000000000
LBB0_5:
	mov	w20, #1
	b	LBB0_7
LBB0_6:
	mov	w20, #2
LBB0_7:
	str	w21, [x19, #24]
	stur	q0, [x19, #8]
	ldr	x8, [x19]
	ldr	w0, [x8]
	bl	_clk_enable
	mov	x21, x0
	cbnz	w0, LBB0_12
; %bb.8:
	ldr	x8, [x19]
	ldr	w0, [x8, #4]
	bl	_clk_enable
	mov	x21, x0
	cbnz	w0, LBB0_11
; %bb.9:
	mov	x0, x19
	mov	x1, x20
	bl	_sdma_set_channel_priority
	mov	x21, x0
	cbz	w0, LBB0_12
; %bb.10:
	ldr	x8, [x19]
	ldr	w0, [x8, #4]
	bl	_clk_disable
LBB0_11:
	ldr	x8, [x19]
	ldr	w0, [x8]
	bl	_clk_disable
LBB0_12:
	mov	x0, x21
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"MEMCPY in case?\n"

	.comm	_IMX_DMATYPE_MEMORY,4,2         ; @IMX_DMATYPE_MEMORY
	.no_dead_strip	_sdma_alloc_chan_resources
.subsections_via_symbols
