	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_init_fq_dma
_mtk_init_fq_dma:                       ## @mtk_init_fq_dma
	.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	%rdi, %r14
	movq	_MTK_DMA_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movl	16(%rdi), %edi
	leal	(,%r13,4), %esi
	movq	_GFP_ATOMIC@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r14, %rdx
	callq	_dma_alloc_coherent
	movq	%rax, 8(%r14)
	xorl	%edi, %edi
	testq	%rax, %rax
	sete	%dil
	callq	_unlikely
	testq	%rax, %rax
	jne	LBB0_1
## %bb.2:
	movq	_MTK_QDMA_PAGE_SIZE@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	%r13d, %edi
	callq	_kcalloc
	movl	%eax, 20(%r14)
	xorl	%edi, %edi
	testl	%eax, %eax
	sete	%dil
	callq	_unlikely
	testq	%rax, %rax
	jne	LBB0_1
## %bb.3:
	movl	16(%r14), %edi
	movl	20(%r14), %esi
	movl	(%r15), %edx
	imull	%r13d, %edx
	movq	_DMA_FROM_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	callq	_dma_map_single
	movl	%eax, %ebx
	movl	16(%r14), %edi
	movl	%eax, %esi
	callq	_dma_mapping_error
	movl	%eax, %edi
	callq	_unlikely
	testq	%rax, %rax
	je	LBB0_4
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_12:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movl	(%r14), %esi
	leal	(%rsi,%r13,4), %r15d
	addl	$-4, %r15d
	testl	%r13d, %r13d
	jle	LBB0_11
## %bb.5:
	movl	%r15d, -52(%rbp)                ## 4-byte Spill
	leal	-1(%r13), %eax
	movl	%eax, %eax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	movq	8(%r14), %rcx
	xorl	%r15d, %r15d
	movq	_MTK_QDMA_PAGE_SIZE@GOTPCREL(%rip), %r12
	movq	%r13, -72(%rbp)                 ## 8-byte Spill
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_6 Depth=1
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	movslq	(%rbx), %rax
	leaq	(%rax,%r15,4), %rax
	addq	$4, %rax
	incq	%r15
	movq	%rax, 8(%rcx,%r13)
LBB0_9:                                 ##   in Loop: Header=BB0_6 Depth=1
	movl	(%r12), %edi
	callq	_TX_DMA_SDL
	movq	8(%rbx), %rcx
	movl	%eax, 4(%rcx,%r13)
	movq	-72(%rbp), %r13                 ## 8-byte Reload
	cmpq	%r13, %r15
	movl	%r14d, %ebx
	je	LBB0_10
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r12), %eax
	imull	%r15d, %eax
	movl	%ebx, %r14d
	addl	%ebx, %eax
	movq	%r15, %r13
	shlq	$4, %r13
	movl	%eax, (%rcx,%r13)
	cmpq	-64(%rbp), %r15                 ## 8-byte Folded Reload
	jl	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	incq	%r15
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	jmp	LBB0_9
LBB0_10:
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movl	(%r14), %esi
	movl	-52(%rbp), %r15d                ## 4-byte Reload
LBB0_11:
	movq	_MTK_QDMA_FQ_HEAD@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_mtk_w32
	movq	_MTK_QDMA_FQ_TAIL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	movl	%r15d, %esi
	callq	_mtk_w32
	movl	%r13d, %esi
	shll	$16, %esi
	orl	%r13d, %esi
	movq	_MTK_QDMA_FQ_CNT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	callq	_mtk_w32
	movq	_MTK_QDMA_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	shll	$16, %esi
	movq	_MTK_QDMA_FQ_BLEN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	callq	_mtk_w32
	xorl	%eax, %eax
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_MTK_DMA_SIZE,4,2               ## @MTK_DMA_SIZE
	.comm	_GFP_ATOMIC,4,2                 ## @GFP_ATOMIC
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_MTK_QDMA_PAGE_SIZE,4,2         ## @MTK_QDMA_PAGE_SIZE
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_DMA_FROM_DEVICE,4,2            ## @DMA_FROM_DEVICE
	.comm	_MTK_QDMA_FQ_HEAD,4,2           ## @MTK_QDMA_FQ_HEAD
	.comm	_MTK_QDMA_FQ_TAIL,4,2           ## @MTK_QDMA_FQ_TAIL
	.comm	_MTK_QDMA_FQ_CNT,4,2            ## @MTK_QDMA_FQ_CNT
	.comm	_MTK_QDMA_FQ_BLEN,4,2           ## @MTK_QDMA_FQ_BLEN
	.no_dead_strip	_mtk_init_fq_dma
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_init_fq_dma
_mtk_init_fq_dma:                       ; @mtk_init_fq_dma
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x19, x0
Lloh0:
	adrp	x8, _MTK_DMA_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MTK_DMA_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	w20, [x8]
	ldr	w0, [x0, #16]
	lsl	w1, w20, #2
Lloh3:
	adrp	x8, _GFP_ATOMIC@GOTPAGE
Lloh4:
	ldr	x8, [x8, _GFP_ATOMIC@GOTPAGEOFF]
Lloh5:
	ldr	w3, [x8]
	mov	x2, x19
	bl	_dma_alloc_coherent
	str	x0, [x19, #8]
	cmp	x0, #0
	cset	w0, eq
	bl	_unlikely
	cbnz	x0, LBB0_3
; %bb.1:
Lloh6:
	adrp	x23, _MTK_QDMA_PAGE_SIZE@GOTPAGE
Lloh7:
	ldr	x23, [x23, _MTK_QDMA_PAGE_SIZE@GOTPAGEOFF]
	ldr	w1, [x23]
Lloh8:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh10:
	ldr	w2, [x8]
	mov	x0, x20
	bl	_kcalloc
	str	w0, [x19, #20]
	cmp	w0, #0
	cset	w0, eq
	bl	_unlikely
	cbnz	x0, LBB0_3
; %bb.2:
	ldp	w0, w1, [x19, #16]
	ldr	w8, [x23]
	mul	w2, w8, w20
Lloh11:
	adrp	x8, _DMA_FROM_DEVICE@GOTPAGE
Lloh12:
	ldr	x8, [x8, _DMA_FROM_DEVICE@GOTPAGEOFF]
Lloh13:
	ldr	w3, [x8]
	bl	_dma_map_single
	mov	x22, x0
	ldr	w0, [x19, #16]
	mov	x1, x22
	bl	_dma_mapping_error
	bl	_unlikely
	cbz	x0, LBB0_5
LBB0_3:
Lloh14:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh15:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_4:
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_5:
	ldr	w1, [x19]
	subs	w24, w20, #1
	add	w21, w1, w24, lsl #2
	b.lt	LBB0_12
; %bb.6:
	mov	x25, #0
	ldr	x8, [x19, #8]
	b	LBB0_9
LBB0_7:                                 ;   in Loop: Header=BB0_9 Depth=1
	ldrsw	x9, [x19]
	add	x26, x25, #1
	add	x9, x9, x26, lsl #2
	add	x8, x8, x25, lsl #4
	str	x9, [x8, #8]
LBB0_8:                                 ;   in Loop: Header=BB0_9 Depth=1
	ldr	w0, [x23]
	bl	_TX_DMA_SDL
	ldr	x8, [x19, #8]
	add	x9, x8, x25, lsl #4
	str	w0, [x9, #4]
	mov	x25, x26
	cmp	x26, x20
	b.eq	LBB0_11
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w9, [x23]
	madd	w9, w9, w25, w22
	lsl	x10, x25, #4
	str	w9, [x8, x10]
	cmp	x25, x24
	b.lt	LBB0_7
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
	add	x26, x25, #1
	b	LBB0_8
LBB0_11:
	ldr	w1, [x19]
LBB0_12:
Lloh17:
	adrp	x8, _MTK_QDMA_FQ_HEAD@GOTPAGE
Lloh18:
	ldr	x8, [x8, _MTK_QDMA_FQ_HEAD@GOTPAGEOFF]
Lloh19:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_mtk_w32
Lloh20:
	adrp	x8, _MTK_QDMA_FQ_TAIL@GOTPAGE
Lloh21:
	ldr	x8, [x8, _MTK_QDMA_FQ_TAIL@GOTPAGEOFF]
Lloh22:
	ldr	w2, [x8]
	mov	x0, x19
	mov	x1, x21
	bl	_mtk_w32
	orr	w1, w20, w20, lsl #16
Lloh23:
	adrp	x8, _MTK_QDMA_FQ_CNT@GOTPAGE
Lloh24:
	ldr	x8, [x8, _MTK_QDMA_FQ_CNT@GOTPAGEOFF]
Lloh25:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_mtk_w32
	ldr	w8, [x23]
	lsl	w1, w8, #16
Lloh26:
	adrp	x8, _MTK_QDMA_FQ_BLEN@GOTPAGE
Lloh27:
	ldr	x8, [x8, _MTK_QDMA_FQ_BLEN@GOTPAGEOFF]
Lloh28:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_mtk_w32
	mov	w0, #0
	b	LBB0_4
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_MTK_DMA_SIZE,4,2               ; @MTK_DMA_SIZE
	.comm	_GFP_ATOMIC,4,2                 ; @GFP_ATOMIC
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_MTK_QDMA_PAGE_SIZE,4,2         ; @MTK_QDMA_PAGE_SIZE
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_DMA_FROM_DEVICE,4,2            ; @DMA_FROM_DEVICE
	.comm	_MTK_QDMA_FQ_HEAD,4,2           ; @MTK_QDMA_FQ_HEAD
	.comm	_MTK_QDMA_FQ_TAIL,4,2           ; @MTK_QDMA_FQ_TAIL
	.comm	_MTK_QDMA_FQ_CNT,4,2            ; @MTK_QDMA_FQ_CNT
	.comm	_MTK_QDMA_FQ_BLEN,4,2           ; @MTK_QDMA_FQ_BLEN
	.no_dead_strip	_mtk_init_fq_dma
.subsections_via_symbols
