	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mtk_dither_set                 ## -- Begin function mtk_dither_set
	.p2align	4, 0x90
_mtk_dither_set:                        ## @mtk_dither_set
	.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
	testl	%esi, %esi
	je	LBB0_2
## %bb.1:
	movl	%esi, %ebx
	movq	_MTK_MIN_BPC@GOTPCREL(%rip), %rax
	cmpl	%esi, (%rax)
	ja	LBB0_2
## %bb.3:
	movq	%rdi, %r15
	movq	_DISP_DITHER_5@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%rdi), %rsi
	xorl	%edi, %edi
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	callq	_writel
	movq	_DISP_DITHER_7@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%r15), %rsi
	xorl	%edi, %edi
	callq	_writel
	movq	_MTK_MAX_BPC@GOTPCREL(%rip), %r13
	movq	(%r13), %rdi
	movl	%ebx, %r14d
	subq	%r14, %rdi
	callq	_DITHER_LSB_ERR_SHIFT_R
	movl	%eax, %ebx
	movq	(%r13), %rdi
	subq	%r14, %rdi
	callq	_DITHER_ADD_LSHIFT_R
	orl	%eax, %ebx
	movq	_DITHER_NEW_BIT_MODE@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	movq	_DISP_DITHER_15@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%r15), %rsi
	movl	%ebx, %edi
	callq	_writel
	movq	(%r13), %rdi
	subq	%r14, %rdi
	callq	_DITHER_LSB_ERR_SHIFT_B
	movl	%eax, %r12d
	movq	(%r13), %rdi
	subq	%r14, %rdi
	callq	_DITHER_ADD_LSHIFT_B
	orl	%eax, %r12d
	movq	(%r13), %rdi
	subq	%r14, %rdi
	callq	_DITHER_LSB_ERR_SHIFT_G
	movl	%eax, %ebx
	movq	(%r13), %rdi
	subq	%r14, %rdi
	callq	_DITHER_ADD_LSHIFT_G
	orl	%eax, %ebx
	orl	%r12d, %ebx
	movq	_DISP_DITHER_16@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%r15), %rsi
	movl	%ebx, %edi
	callq	_writel
	movq	_DISP_DITHERING@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	addq	(%r15), %rsi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_writel                         ## TAILCALL
LBB0_2:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MTK_MIN_BPC,4,2                ## @MTK_MIN_BPC
	.comm	_DISP_DITHER_5,8,3              ## @DISP_DITHER_5
	.comm	_DISP_DITHER_7,8,3              ## @DISP_DITHER_7
	.comm	_MTK_MAX_BPC,8,3                ## @MTK_MAX_BPC
	.comm	_DITHER_NEW_BIT_MODE,4,2        ## @DITHER_NEW_BIT_MODE
	.comm	_DISP_DITHER_15,8,3             ## @DISP_DITHER_15
	.comm	_DISP_DITHER_16,8,3             ## @DISP_DITHER_16
	.comm	_DISP_DITHERING,4,2             ## @DISP_DITHERING
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mtk_dither_set                 ; -- Begin function mtk_dither_set
	.p2align	2
_mtk_dither_set:                        ; @mtk_dither_set
	.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
	cbz	w1, LBB0_3
; %bb.1:
	mov	x21, x1
Lloh0:
	adrp	x8, _MTK_MIN_BPC@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MTK_MIN_BPC@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w1
	b.hi	LBB0_3
; %bb.2:
	mov	x19, x2
	mov	x20, x0
	ldr	x8, [x0]
Lloh3:
	adrp	x9, _DISP_DITHER_5@GOTPAGE
Lloh4:
	ldr	x9, [x9, _DISP_DITHER_5@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	w0, #0
	bl	_writel
	ldr	x8, [x20]
Lloh6:
	adrp	x9, _DISP_DITHER_7@GOTPAGE
Lloh7:
	ldr	x9, [x9, _DISP_DITHER_7@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	w0, #0
	bl	_writel
Lloh9:
	adrp	x22, _MTK_MAX_BPC@GOTPAGE
Lloh10:
	ldr	x22, [x22, _MTK_MAX_BPC@GOTPAGEOFF]
	ldr	x8, [x22]
	mov	w23, w21
	sub	x0, x8, x23
	bl	_DITHER_LSB_ERR_SHIFT_R
	mov	x21, x0
	ldr	x8, [x22]
	sub	x0, x8, x23
	bl	_DITHER_ADD_LSHIFT_R
	orr	w8, w0, w21
Lloh11:
	adrp	x9, _DITHER_NEW_BIT_MODE@GOTPAGE
Lloh12:
	ldr	x9, [x9, _DITHER_NEW_BIT_MODE@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	orr	w0, w8, w9
	ldr	x8, [x20]
Lloh14:
	adrp	x9, _DISP_DITHER_15@GOTPAGE
Lloh15:
	ldr	x9, [x9, _DISP_DITHER_15@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	ldr	x8, [x22]
	sub	x0, x8, x23
	bl	_DITHER_LSB_ERR_SHIFT_B
	mov	x21, x0
	ldr	x8, [x22]
	sub	x0, x8, x23
	bl	_DITHER_ADD_LSHIFT_B
	orr	w21, w0, w21
	ldr	x8, [x22]
	sub	x0, x8, x23
	bl	_DITHER_LSB_ERR_SHIFT_G
	orr	w21, w21, w0
	ldr	x8, [x22]
	sub	x0, x8, x23
	bl	_DITHER_ADD_LSHIFT_G
	orr	w0, w21, w0
	ldr	x8, [x20]
Lloh17:
	adrp	x9, _DISP_DITHER_16@GOTPAGE
Lloh18:
	ldr	x9, [x9, _DISP_DITHER_16@GOTPAGEOFF]
Lloh19:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
Lloh20:
	adrp	x8, _DISP_DITHERING@GOTPAGE
Lloh21:
	ldr	x8, [x8, _DISP_DITHERING@GOTPAGEOFF]
Lloh22:
	ldr	w0, [x8]
	ldr	x8, [x20]
	add	x1, x8, w19, uxtw
	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
	b	_writel
LBB0_3:
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_MTK_MIN_BPC,4,2                ; @MTK_MIN_BPC
	.comm	_DISP_DITHER_5,8,3              ; @DISP_DITHER_5
	.comm	_DISP_DITHER_7,8,3              ; @DISP_DITHER_7
	.comm	_MTK_MAX_BPC,8,3                ; @MTK_MAX_BPC
	.comm	_DITHER_NEW_BIT_MODE,4,2        ; @DITHER_NEW_BIT_MODE
	.comm	_DISP_DITHER_15,8,3             ; @DISP_DITHER_15
	.comm	_DISP_DITHER_16,8,3             ; @DISP_DITHER_16
	.comm	_DISP_DITHERING,4,2             ; @DISP_DITHERING
.subsections_via_symbols
