	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function glk_dsi_program_esc_clock
_glk_dsi_program_esc_clock:             ## @glk_dsi_program_esc_clock
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rsi, %rbx
	callq	_to_i915
	movq	_BXT_DSI_PLL_RATIO_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	(%rbx), %eax
	movq	_BXT_REF_CLOCK_KHZ@GOTPCREL(%rip), %rcx
	imull	(%rcx), %eax
	leal	3(%rax), %edi
	testl	%eax, %eax
	cmovnsl	%eax, %edi
	sarl	$2, %edi
	movl	$20000, %esi                    ## imm = 0x4E20
	callq	_DIV_ROUND_CLOSEST
	movl	%eax, %r14d
	movl	%eax, %ebx
	cmpl	$11, %eax
	jl	LBB0_6
## %bb.1:
	movl	$2, %esi
	cmpl	$21, %r14d
	jb	LBB0_5
## %bb.2:
	movl	$4, %esi
	cmpl	$31, %r14d
	jb	LBB0_5
## %bb.3:
	movl	$6, %esi
	cmpl	$41, %r14d
	jb	LBB0_5
## %bb.4:
	movl	$10, %ebx
	movl	$8, %esi
	cmpl	$50, %r14d
	ja	LBB0_6
LBB0_5:
	movl	%r14d, %edi
	callq	_DIV_ROUND_UP
	movl	%eax, %ebx
LBB0_6:
	movl	%r14d, %edi
	movl	%ebx, %esi
	callq	_DIV_ROUND_UP
	movl	%eax, %r14d
	movq	_MIPIO_TXESC_CLK_DIV1@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	decb	%bl
	movl	$1, %esi
	movl	%ebx, %ecx
	shll	%cl, %esi
	movl	$1, %ebx
	movq	_GLK_TX_ESC_CLK_DIV1_MASK@GOTPCREL(%rip), %rax
	andl	(%rax), %esi
	callq	_I915_WRITE
	leal	-1(%r14), %ecx
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %ebx
	cmpl	$10, %r14d
	movq	_MIPIO_TXESC_CLK_DIV2@GOTPCREL(%rip), %rax
	movl	$512, %esi                      ## imm = 0x200
	cmovll	%ebx, %esi
	movl	(%rax), %edi
	movq	_GLK_TX_ESC_CLK_DIV2_MASK@GOTPCREL(%rip), %rax
	andl	(%rax), %esi
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_I915_WRITE                     ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_BXT_DSI_PLL_RATIO_MASK,4,2     ## @BXT_DSI_PLL_RATIO_MASK
	.comm	_BXT_REF_CLOCK_KHZ,4,2          ## @BXT_REF_CLOCK_KHZ
	.comm	_MIPIO_TXESC_CLK_DIV1,4,2       ## @MIPIO_TXESC_CLK_DIV1
	.comm	_GLK_TX_ESC_CLK_DIV1_MASK,4,2   ## @GLK_TX_ESC_CLK_DIV1_MASK
	.comm	_MIPIO_TXESC_CLK_DIV2,4,2       ## @MIPIO_TXESC_CLK_DIV2
	.comm	_GLK_TX_ESC_CLK_DIV2_MASK,4,2   ## @GLK_TX_ESC_CLK_DIV2_MASK
	.no_dead_strip	_glk_dsi_program_esc_clock
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function glk_dsi_program_esc_clock
_glk_dsi_program_esc_clock:             ; @glk_dsi_program_esc_clock
	.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	x19, x1
	bl	_to_i915
	ldr	w8, [x19]
Lloh0:
	adrp	x9, _BXT_DSI_PLL_RATIO_MASK@GOTPAGE
Lloh1:
	ldr	x9, [x9, _BXT_DSI_PLL_RATIO_MASK@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	and	w8, w9, w8
Lloh3:
	adrp	x9, _BXT_REF_CLOCK_KHZ@GOTPAGE
Lloh4:
	ldr	x9, [x9, _BXT_REF_CLOCK_KHZ@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	mul	w8, w9, w8
	add	w9, w8, #3
	cmp	w8, #0
	csel	w8, w9, w8, lt
	asr	w0, w8, #2
	mov	w1, #20000
	bl	_DIV_ROUND_CLOSEST
	mov	x19, x0
	mov	x20, x0
	cmp	w0, #11
	b.lt	LBB0_10
; %bb.1:
	cmp	w19, #21
	b.hs	LBB0_3
; %bb.2:
	mov	w1, #2
	b	LBB0_9
LBB0_3:
	cmp	w19, #31
	b.hs	LBB0_5
; %bb.4:
	mov	w1, #4
	b	LBB0_9
LBB0_5:
	cmp	w19, #41
	b.hs	LBB0_7
; %bb.6:
	mov	w1, #6
	b	LBB0_9
LBB0_7:
	cmp	w19, #50
	b.hi	LBB0_11
; %bb.8:
	mov	w1, #8
LBB0_9:
	mov	x0, x19
	bl	_DIV_ROUND_UP
	mov	x20, x0
LBB0_10:
	mov	x0, x19
	mov	x1, x20
	bl	_DIV_ROUND_UP
	mov	x19, x0
	sub	w21, w0, #1
Lloh6:
	adrp	x8, _MIPIO_TXESC_CLK_DIV1@GOTPAGE
Lloh7:
	ldr	x8, [x8, _MIPIO_TXESC_CLK_DIV1@GOTPAGEOFF]
Lloh8:
	ldr	w0, [x8]
	sub	w8, w20, #1
	mov	w20, #1
	lsl	w8, w20, w8
Lloh9:
	adrp	x9, _GLK_TX_ESC_CLK_DIV1_MASK@GOTPAGE
Lloh10:
	ldr	x9, [x9, _GLK_TX_ESC_CLK_DIV1_MASK@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	and	w1, w9, w8
	bl	_I915_WRITE
Lloh12:
	adrp	x8, _MIPIO_TXESC_CLK_DIV2@GOTPAGE
Lloh13:
	ldr	x8, [x8, _MIPIO_TXESC_CLK_DIV2@GOTPAGEOFF]
Lloh14:
	ldr	w0, [x8]
	lsl	w8, w20, w21
	mov	w9, #512
	cmp	w19, #9
	csel	w8, w9, w8, gt
Lloh15:
	adrp	x9, _GLK_TX_ESC_CLK_DIV2_MASK@GOTPAGE
Lloh16:
	ldr	x9, [x9, _GLK_TX_ESC_CLK_DIV2_MASK@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	and	w1, w9, w8
	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
	b	_I915_WRITE
LBB0_11:
	mov	w20, #10
	b	LBB0_10
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_BXT_DSI_PLL_RATIO_MASK,4,2     ; @BXT_DSI_PLL_RATIO_MASK
	.comm	_BXT_REF_CLOCK_KHZ,4,2          ; @BXT_REF_CLOCK_KHZ
	.comm	_MIPIO_TXESC_CLK_DIV1,4,2       ; @MIPIO_TXESC_CLK_DIV1
	.comm	_GLK_TX_ESC_CLK_DIV1_MASK,4,2   ; @GLK_TX_ESC_CLK_DIV1_MASK
	.comm	_MIPIO_TXESC_CLK_DIV2,4,2       ; @MIPIO_TXESC_CLK_DIV2
	.comm	_GLK_TX_ESC_CLK_DIV2_MASK,4,2   ; @GLK_TX_ESC_CLK_DIV2_MASK
	.no_dead_strip	_glk_dsi_program_esc_clock
.subsections_via_symbols
