	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_dfe_dse_buf_setup
_mtk_dfe_dse_buf_setup:                 ## @mtk_dfe_dse_buf_setup
	.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	%rsi, %rbx
	movq	%rdi, %r14
	movl	4(%rsi), %edi
	callq	_MTK_HIA_DATA_WIDTH
	movq	%rax, %r12
	movl	4(%rbx), %edi
	callq	_MTK_HIA_DMA_LENGTH
	leaq	-1(%rax), %r13
	movl	(%rbx), %edi
	callq	_MTK_IN_DBUF_SIZE
	leaq	(%rax,%r12), %rdi
	addq	$2, %rdi
	movq	%r13, %rsi
	callq	_min
	movq	%rax, %r15
	movl	(%rbx), %edi
	callq	_MTK_OUT_DBUF_SIZE
	leaq	(%rax,%r12), %rdi
	addq	$2, %rdi
	movq	%r13, %rsi
	callq	_min
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movl	(%rbx), %edi
	callq	_MTK_IN_TBUF_SIZE
	leaq	(%rax,%r12), %rdi
	addq	$2, %rdi
	movq	%r13, %rsi
	callq	_min
	movq	%rax, %r12
	movq	%r15, -64(%rbp)                 ## 8-byte Spill
	leaq	-1(%r15), %rdi
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	callq	_MTK_DFSE_MIN_DATA
	movl	%eax, %r13d
	movq	%r15, %rdi
	callq	_MTK_DFSE_MAX_DATA
	orl	%eax, %r13d
	leaq	-1(%r12), %rdi
	movq	%rdi, -72(%rbp)                 ## 8-byte Spill
	callq	_MTK_DFE_MIN_CTRL
	movl	%eax, %r15d
	movq	%r12, %rdi
	callq	_MTK_DFE_MAX_CTRL
	orl	%eax, %r15d
	orl	%r13d, %r15d
	movq	_DFE_CFG@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%r14), %rsi
	movl	%r15d, %edi
	callq	_writel
	movq	-48(%rbp), %r15                 ## 8-byte Reload
	leaq	-1(%r15), %r13
	movq	%r13, %rdi
	callq	_MTK_DFSE_MIN_DATA
	movl	%eax, %ebx
	movq	%r15, %rdi
	callq	_MTK_DFSE_MAX_DATA
	orl	%eax, %ebx
	movq	_DSE_CFG@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%r14), %rsi
	movl	%ebx, %edi
	callq	_writel
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_MTK_IN_BUF_MIN_THRESH
	movl	%eax, %ebx
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_MTK_IN_BUF_MAX_THRESH
	orl	%eax, %ebx
	movq	_PE_IN_DBUF_THRESH@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%r14), %rsi
	movl	%ebx, %edi
	callq	_writel
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	callq	_MTK_IN_BUF_MIN_THRESH
	movl	%eax, %ebx
	movq	%r12, %rdi
	callq	_MTK_IN_BUF_MAX_THRESH
	orl	%eax, %ebx
	movq	_PE_IN_TBUF_THRESH@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%r14), %rsi
	movl	%ebx, %edi
	callq	_writel
	movq	%r13, %rdi
	callq	_MTK_OUT_BUF_MIN_THRESH
	movl	%eax, %ebx
	movq	%r15, %rdi
	callq	_MTK_OUT_BUF_MAX_THRESH
	orl	%eax, %ebx
	movq	_PE_OUT_DBUF_THRESH@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%r14), %rsi
	movl	%ebx, %edi
	callq	_writel
	movq	_PE_OUT_TBUF_THRESH@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%r14), %rsi
	xorl	%edi, %edi
	callq	_writel
	movq	_PE_OUT_BUF_CTRL@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%r14), %rsi
	xorl	%edi, %edi
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_writel                         ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_DFE_CFG,8,3                    ## @DFE_CFG
	.comm	_DSE_CFG,8,3                    ## @DSE_CFG
	.comm	_PE_IN_DBUF_THRESH,8,3          ## @PE_IN_DBUF_THRESH
	.comm	_PE_IN_TBUF_THRESH,8,3          ## @PE_IN_TBUF_THRESH
	.comm	_PE_OUT_DBUF_THRESH,8,3         ## @PE_OUT_DBUF_THRESH
	.comm	_PE_OUT_TBUF_THRESH,8,3         ## @PE_OUT_TBUF_THRESH
	.comm	_PE_OUT_BUF_CTRL,8,3            ## @PE_OUT_BUF_CTRL
	.no_dead_strip	_mtk_dfe_dse_buf_setup
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_dfe_dse_buf_setup
_mtk_dfe_dse_buf_setup:                 ; @mtk_dfe_dse_buf_setup
	.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	x22, x1
	mov	x19, x0
	ldr	w0, [x1, #4]
	bl	_MTK_HIA_DATA_WIDTH
	add	x24, x0, #2
	ldr	w0, [x22, #4]
	bl	_MTK_HIA_DMA_LENGTH
	sub	x23, x0, #1
	ldr	w0, [x22]
	bl	_MTK_IN_DBUF_SIZE
	add	x0, x0, x24
	mov	x1, x23
	bl	_min
	mov	x21, x0
	ldr	w0, [x22]
	bl	_MTK_OUT_DBUF_SIZE
	add	x0, x0, x24
	mov	x1, x23
	bl	_min
	mov	x20, x0
	ldr	w0, [x22]
	bl	_MTK_IN_TBUF_SIZE
	add	x0, x0, x24
	mov	x1, x23
	bl	_min
	mov	x22, x0
	sub	x25, x21, #1
	mov	x0, x25
	bl	_MTK_DFSE_MIN_DATA
	mov	x23, x0
	mov	x0, x21
	bl	_MTK_DFSE_MAX_DATA
	orr	w24, w0, w23
	sub	x23, x22, #1
	mov	x0, x23
	bl	_MTK_DFE_MIN_CTRL
	orr	w24, w24, w0
	mov	x0, x22
	bl	_MTK_DFE_MAX_CTRL
	orr	w0, w24, w0
	ldr	x8, [x19]
Lloh0:
	adrp	x9, _DFE_CFG@GOTPAGE
Lloh1:
	ldr	x9, [x9, _DFE_CFG@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	sub	x24, x20, #1
	mov	x0, x24
	bl	_MTK_DFSE_MIN_DATA
	mov	x26, x0
	mov	x0, x20
	bl	_MTK_DFSE_MAX_DATA
	orr	w0, w0, w26
	ldr	x8, [x19]
Lloh3:
	adrp	x9, _DSE_CFG@GOTPAGE
Lloh4:
	ldr	x9, [x9, _DSE_CFG@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	mov	x0, x25
	bl	_MTK_IN_BUF_MIN_THRESH
	mov	x25, x0
	mov	x0, x21
	bl	_MTK_IN_BUF_MAX_THRESH
	orr	w0, w0, w25
	ldr	x8, [x19]
Lloh6:
	adrp	x9, _PE_IN_DBUF_THRESH@GOTPAGE
Lloh7:
	ldr	x9, [x9, _PE_IN_DBUF_THRESH@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	mov	x0, x23
	bl	_MTK_IN_BUF_MIN_THRESH
	mov	x21, x0
	mov	x0, x22
	bl	_MTK_IN_BUF_MAX_THRESH
	orr	w0, w0, w21
	ldr	x8, [x19]
Lloh9:
	adrp	x9, _PE_IN_TBUF_THRESH@GOTPAGE
Lloh10:
	ldr	x9, [x9, _PE_IN_TBUF_THRESH@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	mov	x0, x24
	bl	_MTK_OUT_BUF_MIN_THRESH
	mov	x21, x0
	mov	x0, x20
	bl	_MTK_OUT_BUF_MAX_THRESH
	orr	w0, w0, w21
	ldr	x8, [x19]
Lloh12:
	adrp	x9, _PE_OUT_DBUF_THRESH@GOTPAGE
Lloh13:
	ldr	x9, [x9, _PE_OUT_DBUF_THRESH@GOTPAGEOFF]
Lloh14:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	ldr	x8, [x19]
Lloh15:
	adrp	x9, _PE_OUT_TBUF_THRESH@GOTPAGE
Lloh16:
	ldr	x9, [x9, _PE_OUT_TBUF_THRESH@GOTPAGEOFF]
Lloh17:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	w0, #0
	bl	_writel
	ldr	x8, [x19]
Lloh18:
	adrp	x9, _PE_OUT_BUF_CTRL@GOTPAGE
Lloh19:
	ldr	x9, [x9, _PE_OUT_BUF_CTRL@GOTPAGEOFF]
Lloh20:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	w0, #0
	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
	b	_writel
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_DFE_CFG,8,3                    ; @DFE_CFG
	.comm	_DSE_CFG,8,3                    ; @DSE_CFG
	.comm	_PE_IN_DBUF_THRESH,8,3          ; @PE_IN_DBUF_THRESH
	.comm	_PE_IN_TBUF_THRESH,8,3          ; @PE_IN_TBUF_THRESH
	.comm	_PE_OUT_DBUF_THRESH,8,3         ; @PE_OUT_DBUF_THRESH
	.comm	_PE_OUT_TBUF_THRESH,8,3         ; @PE_OUT_TBUF_THRESH
	.comm	_PE_OUT_BUF_CTRL,8,3            ; @PE_OUT_BUF_CTRL
	.no_dead_strip	_mtk_dfe_dse_buf_setup
.subsections_via_symbols
