	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function k3_dma_alloc_desc_resource
_k3_dma_alloc_desc_resource:            ## @k3_dma_alloc_desc_resource
	.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	%rsi, %rbx
	movl	%edi, %r15d
	movq	%rsi, %rdi
	callq	_to_k3_chan
	movq	%rax, %r14
	movq	(%rbx), %rdi
	callq	_to_k3_dma
	movq	%rax, %r13
	movq	_LLI_BLOCK_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	sarl	$2, %r8d
	cmpl	%r15d, %r8d
	jge	LBB0_2
## %bb.1:
	movq	(%rbx), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%r12d, %r12d
	movq	%r14, %rdx
	movl	%r15d, %ecx
	xorl	%eax, %eax
	callq	_dev_dbg
	jmp	LBB0_8
LBB0_2:
	movq	_GFP_NOWAIT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$12, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_7
## %bb.3:
	movq	%rax, %r12
	movl	(%r13), %edi
	movq	_GFP_NOWAIT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdx
	addq	$8, %rdx
	callq	_dma_pool_zalloc
	movl	%eax, 4(%r12)
	testl	%eax, %eax
	je	LBB0_6
## %bb.4:
	movl	%r15d, (%r12)
	jmp	LBB0_8
LBB0_6:
	movq	(%rbx), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	_dev_dbg
	movq	%r12, %rdi
	callq	_kfree
LBB0_7:
	xorl	%r12d, %r12d
LBB0_8:
	movq	%r12, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_LLI_BLOCK_SIZE,4,2             ## @LLI_BLOCK_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"vch %p: sg num %d exceed max %d\n"

	.comm	_GFP_NOWAIT,4,2                 ## @GFP_NOWAIT
L_.str.1:                               ## @.str.1
	.asciz	"vch %p: dma alloc fail\n"

	.no_dead_strip	_k3_dma_alloc_desc_resource
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function k3_dma_alloc_desc_resource
_k3_dma_alloc_desc_resource:            ; @k3_dma_alloc_desc_resource
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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, x1
	mov	x20, x0
	mov	x0, x1
	bl	_to_k3_chan
	mov	x19, x0
	ldr	x0, [x21]
	bl	_to_k3_dma
Lloh0:
	adrp	x8, _LLI_BLOCK_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _LLI_BLOCK_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	asr	w8, w8, #2
	cmp	w8, w20
	b.ge	LBB0_2
; %bb.1:
	ldr	x9, [x21]
	ldr	w0, [x9]
	stp	x20, x8, [sp]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x19
	bl	_dev_dbg
	b	LBB0_6
LBB0_2:
	mov	x23, x0
Lloh5:
	adrp	x24, _GFP_NOWAIT@GOTPAGE
Lloh6:
	ldr	x24, [x24, _GFP_NOWAIT@GOTPAGEOFF]
	ldr	w1, [x24]
	mov	w0, #12
	bl	_kzalloc
	mov	x22, x0
	cbz	x0, LBB0_7
; %bb.3:
	ldr	w0, [x23]
	ldr	w1, [x24]
	add	x2, x22, #8
	bl	_dma_pool_zalloc
	str	w0, [x22, #4]
	cbz	w0, LBB0_5
; %bb.4:
	str	w20, [x22]
	b	LBB0_7
LBB0_5:
	ldr	x8, [x21]
	ldr	w0, [x8]
Lloh7:
	adrp	x1, l_.str.1@PAGE
Lloh8:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x19
	bl	_dev_dbg
	mov	x0, x22
	bl	_kfree
LBB0_6:
	mov	x22, #0
LBB0_7:
	mov	x0, x22
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_LLI_BLOCK_SIZE,4,2             ; @LLI_BLOCK_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"vch %p: sg num %d exceed max %d\n"

	.comm	_GFP_NOWAIT,4,2                 ; @GFP_NOWAIT
l_.str.1:                               ; @.str.1
	.asciz	"vch %p: dma alloc fail\n"

	.no_dead_strip	_k3_dma_alloc_desc_resource
.subsections_via_symbols
