	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_hdmi_pll_recalc_rate
_mtk_hdmi_pll_recalc_rate:              ## @mtk_hdmi_pll_recalc_rate
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	callq	_to_mtk_hdmi_phy
	movq	%rax, %r15
	movq	_HDMI_CON6@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rdi
	addq	(%rax), %rdi
	callq	_readl
	movq	_RG_HTPLL_PREDIV_MASK@GOTPCREL(%rip), %rcx
	andl	(%rcx), %eax
	movq	_RG_HTPLL_PREDIV@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	sarl	%cl, %eax
	cltq
	testq	%rax, %rax
	je	LBB0_4
## %bb.1:
	cmpq	$1, %rax
	jne	LBB0_3
## %bb.2:
	shrq	%r14
	jmp	LBB0_4
LBB0_3:
	shrq	$2, %r14
LBB0_4:
	movq	(%rbx), %rdi
	addq	(%r15), %rdi
	callq	_readl
	movq	_RG_HTPLL_FBKDIV_MASK@GOTPCREL(%rip), %rcx
	andl	(%rcx), %eax
	movq	_RG_HTPLL_FBKDIV@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	sarl	%cl, %eax
	cltq
	leaq	(%rax,%rax), %rbx
	addq	$2, %rbx
	imulq	%r14, %rbx
	movq	_HDMI_CON2@GOTPCREL(%rip), %r14
	movq	(%r14), %rdi
	addq	(%r15), %rdi
	callq	_readl
	movq	_RG_HDMITX_TX_POSDIV_MASK@GOTPCREL(%rip), %rcx
	andl	(%rcx), %eax
	cltq
	movq	_RG_HDMITX_TX_POSDIV@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shrq	%cl, %rax
	movl	%eax, %ecx
	shrq	%cl, %rbx
	movq	(%r14), %rdi
	addq	(%r15), %rdi
	callq	_readl
	movq	_RG_HDMITX_EN_TX_POSDIV@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_6
## %bb.5:
	movabsq	$-3689348814741910323, %rcx     ## imm = 0xCCCCCCCCCCCCCCCD
	movq	%rbx, %rax
	mulq	%rcx
	movq	%rdx, %rbx
	shrq	$2, %rbx
LBB0_6:
	movq	%rbx, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_HDMI_CON6,8,3                  ## @HDMI_CON6
	.comm	_RG_HTPLL_PREDIV_MASK,4,2       ## @RG_HTPLL_PREDIV_MASK
	.comm	_RG_HTPLL_PREDIV,4,2            ## @RG_HTPLL_PREDIV
	.comm	_RG_HTPLL_FBKDIV_MASK,4,2       ## @RG_HTPLL_FBKDIV_MASK
	.comm	_RG_HTPLL_FBKDIV,4,2            ## @RG_HTPLL_FBKDIV
	.comm	_HDMI_CON2,8,3                  ## @HDMI_CON2
	.comm	_RG_HDMITX_TX_POSDIV_MASK,4,2   ## @RG_HDMITX_TX_POSDIV_MASK
	.comm	_RG_HDMITX_TX_POSDIV,8,3        ## @RG_HDMITX_TX_POSDIV
	.comm	_RG_HDMITX_EN_TX_POSDIV,4,2     ## @RG_HDMITX_EN_TX_POSDIV
	.no_dead_strip	_mtk_hdmi_pll_recalc_rate
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_hdmi_pll_recalc_rate
_mtk_hdmi_pll_recalc_rate:              ; @mtk_hdmi_pll_recalc_rate
	.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, x1
	bl	_to_mtk_hdmi_phy
	mov	x19, x0
	ldr	x8, [x0]
Lloh0:
	adrp	x21, _HDMI_CON6@GOTPAGE
Lloh1:
	ldr	x21, [x21, _HDMI_CON6@GOTPAGEOFF]
	ldr	x9, [x21]
	add	x0, x9, x8
	bl	_readl
Lloh2:
	adrp	x8, _RG_HTPLL_PREDIV_MASK@GOTPAGE
Lloh3:
	ldr	x8, [x8, _RG_HTPLL_PREDIV_MASK@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	and	w8, w8, w0
Lloh5:
	adrp	x9, _RG_HTPLL_PREDIV@GOTPAGE
Lloh6:
	ldr	x9, [x9, _RG_HTPLL_PREDIV@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	asr	w8, w8, w9
	sxtw	x8, w8
	lsr	x9, x20, #2
	lsr	x10, x20, #1
	cmp	x8, #1
	csel	x9, x9, x10, ne
	cmp	x8, #0
	csel	x20, x20, x9, eq
	ldr	x8, [x19]
	ldr	x9, [x21]
	add	x0, x9, x8
	bl	_readl
Lloh8:
	adrp	x8, _RG_HTPLL_FBKDIV_MASK@GOTPAGE
Lloh9:
	ldr	x8, [x8, _RG_HTPLL_FBKDIV_MASK@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	and	w8, w8, w0
Lloh11:
	adrp	x9, _RG_HTPLL_FBKDIV@GOTPAGE
Lloh12:
	ldr	x9, [x9, _RG_HTPLL_FBKDIV@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	asr	w8, w8, w9
	sbfiz	x8, x8, #1, #32
	add	x8, x8, #2
	mul	x20, x8, x20
	ldr	x8, [x19]
Lloh14:
	adrp	x21, _HDMI_CON2@GOTPAGE
Lloh15:
	ldr	x21, [x21, _HDMI_CON2@GOTPAGEOFF]
	ldr	x9, [x21]
	add	x0, x9, x8
	bl	_readl
Lloh16:
	adrp	x8, _RG_HDMITX_TX_POSDIV_MASK@GOTPAGE
Lloh17:
	ldr	x8, [x8, _RG_HDMITX_TX_POSDIV_MASK@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	and	w8, w8, w0
	sxtw	x8, w8
Lloh19:
	adrp	x9, _RG_HDMITX_TX_POSDIV@GOTPAGE
Lloh20:
	ldr	x9, [x9, _RG_HDMITX_TX_POSDIV@GOTPAGEOFF]
Lloh21:
	ldr	x9, [x9]
	lsr	x8, x8, x9
	lsr	x20, x20, x8
	ldr	x8, [x19]
	ldr	x9, [x21]
	add	x0, x9, x8
	bl	_readl
Lloh22:
	adrp	x8, _RG_HDMITX_EN_TX_POSDIV@GOTPAGE
Lloh23:
	ldr	x8, [x8, _RG_HDMITX_EN_TX_POSDIV@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	mov	x9, #-3689348814741910324
	movk	x9, #52429
	umulh	x9, x20, x9
	lsr	x9, x9, #2
	tst	w8, w0
	csel	x0, x20, x9, eq
	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	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_HDMI_CON6,8,3                  ; @HDMI_CON6
	.comm	_RG_HTPLL_PREDIV_MASK,4,2       ; @RG_HTPLL_PREDIV_MASK
	.comm	_RG_HTPLL_PREDIV,4,2            ; @RG_HTPLL_PREDIV
	.comm	_RG_HTPLL_FBKDIV_MASK,4,2       ; @RG_HTPLL_FBKDIV_MASK
	.comm	_RG_HTPLL_FBKDIV,4,2            ; @RG_HTPLL_FBKDIV
	.comm	_HDMI_CON2,8,3                  ; @HDMI_CON2
	.comm	_RG_HDMITX_TX_POSDIV_MASK,4,2   ; @RG_HDMITX_TX_POSDIV_MASK
	.comm	_RG_HDMITX_TX_POSDIV,8,3        ; @RG_HDMITX_TX_POSDIV
	.comm	_RG_HDMITX_EN_TX_POSDIV,4,2     ; @RG_HDMITX_EN_TX_POSDIV
	.no_dead_strip	_mtk_hdmi_pll_recalc_rate
.subsections_via_symbols
