	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gen6_update_ring_freq
_gen6_update_ring_freq:                 ## @gen6_update_ring_freq
	.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
	movq	%rdi, %r15
	addq	$8, %rdi
	callq	_lockdep_assert_held
	movl	(%r15), %eax
	cmpl	4(%r15), %eax
	jbe	LBB0_8
## %bb.1:
	xorl	%edi, %edi
	callq	_cpufreq_cpu_get
	testq	%rax, %rax
	je	LBB0_3
## %bb.2:
	movl	(%rax), %ebx
	movq	%rax, %rdi
	callq	_cpufreq_cpu_put
	jmp	LBB0_4
LBB0_3:
	movq	_tsc_khz@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
LBB0_4:
	movq	_DCLK@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_I915_READ
	andl	$15, %eax
	movl	%eax, %edi
	movl	$8, %esi
	movl	$3, %edx
	callq	_mult_frac
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	(%r15), %r13d
	movl	4(%r15), %r12d
	movq	%r15, %rdi
	callq	_IS_GEN9_BC
	testq	%rax, %rax
	jne	LBB0_6
## %bb.5:
	movq	%r15, %rdi
	callq	_INTEL_GEN
	cmpl	$10, %eax
	jl	LBB0_7
LBB0_6:
	movq	_GEN9_FREQ_SCALER@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	%r12d, %eax
	xorl	%edx, %edx
	divl	%ecx
	movl	%eax, %r12d
	movl	%r13d, %eax
	xorl	%edx, %edx
	divl	%ecx
	movl	%eax, %r13d
LBB0_7:
	cmpl	%r12d, %r13d
	jae	LBB0_9
LBB0_8:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	movl	%ebx, %eax
	imulq	$274877907, %rax, %r14          ## imm = 0x10624DD3
	shrq	$38, %r14
	jmp	LBB0_12
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_12 Depth=1
	movl	%r13d, %eax
LBB0_11:                                ##   in Loop: Header=BB0_12 Depth=1
	movq	_GEN6_PCODE_FREQ_IA_RATIO_SHIFT@GOTPCREL(%rip), %rcx
	movzbl	(%rcx), %ecx
	shll	%cl, %ebx
	movq	_GEN6_PCODE_FREQ_RING_RATIO_SHIFT@GOTPCREL(%rip), %rcx
	movzbl	(%rcx), %ecx
	shll	%cl, %eax
	movq	_GEN6_PCODE_WRITE_MIN_FREQ_TABLE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	orl	%r13d, %ebx
	orl	%eax, %ebx
	movq	%r15, %rdi
	movl	%ebx, %edx
	callq	_sandybridge_pcode_write
	decl	%r13d
	addl	$-90, %r14d
	cmpl	%r12d, %r13d
	jb	LBB0_8
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	callq	_IS_GEN9_BC
	xorl	%ebx, %ebx
	testq	%rax, %rax
	jne	LBB0_10
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=1
	movq	%r15, %rdi
	callq	_INTEL_GEN
	cmpl	$9, %eax
	jg	LBB0_10
## %bb.15:                              ##   in Loop: Header=BB0_12 Depth=1
	movq	%r15, %rdi
	callq	_INTEL_GEN
	cmpl	$8, %eax
	jl	LBB0_17
## %bb.16:                              ##   in Loop: Header=BB0_12 Depth=1
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movl	%r13d, %esi
	callq	_max
	jmp	LBB0_11
LBB0_17:                                ##   in Loop: Header=BB0_12 Depth=1
	movq	%r15, %rdi
	callq	_IS_HASWELL
	testq	%rax, %rax
	je	LBB0_19
## %bb.18:                              ##   in Loop: Header=BB0_12 Depth=1
	movl	%r13d, %edi
	movl	$5, %esi
	movl	$4, %edx
	callq	_mult_frac
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movl	%eax, %esi
	callq	_max
	jmp	LBB0_11
LBB0_19:                                ##   in Loop: Header=BB0_12 Depth=1
	cmpl	$15, %r13d
	movl	%r14d, %edi
	movl	$800, %eax                      ## imm = 0x320
	cmovbl	%eax, %edi
	movl	$100, %esi
	callq	_DIV_ROUND_CLOSEST
	movl	%eax, %ebx
	xorl	%eax, %eax
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.comm	_tsc_khz,4,2                    ## @tsc_khz
	.comm	_DCLK,4,2                       ## @DCLK
	.comm	_GEN9_FREQ_SCALER,4,2           ## @GEN9_FREQ_SCALER
	.comm	_GEN6_PCODE_WRITE_MIN_FREQ_TABLE,4,2 ## @GEN6_PCODE_WRITE_MIN_FREQ_TABLE
	.comm	_GEN6_PCODE_FREQ_IA_RATIO_SHIFT,4,2 ## @GEN6_PCODE_FREQ_IA_RATIO_SHIFT
	.comm	_GEN6_PCODE_FREQ_RING_RATIO_SHIFT,4,2 ## @GEN6_PCODE_FREQ_RING_RATIO_SHIFT
	.no_dead_strip	_gen6_update_ring_freq
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gen6_update_ring_freq
_gen6_update_ring_freq:                 ; @gen6_update_ring_freq
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x0
	add	x0, x0, #8
	bl	_lockdep_assert_held
	ldp	w8, w9, [x19]
	cmp	w8, w9
	b.ls	LBB0_8
; %bb.1:
	mov	w0, #0
	bl	_cpufreq_cpu_get
	cbz	x0, LBB0_3
; %bb.2:
	ldr	w23, [x0]
	bl	_cpufreq_cpu_put
	b	LBB0_4
LBB0_3:
Lloh0:
	adrp	x8, _tsc_khz@GOTPAGE
Lloh1:
	ldr	x8, [x8, _tsc_khz@GOTPAGEOFF]
Lloh2:
	ldr	w23, [x8]
LBB0_4:
Lloh3:
	adrp	x8, _DCLK@GOTPAGE
Lloh4:
	ldr	x8, [x8, _DCLK@GOTPAGEOFF]
Lloh5:
	ldr	w0, [x8]
	bl	_I915_READ
	and	w0, w0, #0xf
	mov	w1, #8
	mov	w2, #3
	bl	_mult_frac
	mov	x20, x0
	ldp	w21, w22, [x19]
	mov	x0, x19
	bl	_IS_GEN9_BC
	cbnz	x0, LBB0_6
; %bb.5:
	mov	x0, x19
	bl	_INTEL_GEN
	cmp	w0, #10
	b.lt	LBB0_7
LBB0_6:
Lloh6:
	adrp	x8, _GEN9_FREQ_SCALER@GOTPAGE
Lloh7:
	ldr	x8, [x8, _GEN9_FREQ_SCALER@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	udiv	w22, w22, w8
	udiv	w21, w21, w8
LBB0_7:
	cmp	w21, w22
	b.hs	LBB0_9
LBB0_8:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_9:
	mov	w8, #19923
	movk	w8, #4194, lsl #16
	umull	x8, w23, w8
	lsr	x23, x8, #38
	mov	w24, #800
Lloh9:
	adrp	x25, _GEN6_PCODE_WRITE_MIN_FREQ_TABLE@GOTPAGE
Lloh10:
	ldr	x25, [x25, _GEN6_PCODE_WRITE_MIN_FREQ_TABLE@GOTPAGEOFF]
Lloh11:
	adrp	x26, _GEN6_PCODE_FREQ_IA_RATIO_SHIFT@GOTPAGE
Lloh12:
	ldr	x26, [x26, _GEN6_PCODE_FREQ_IA_RATIO_SHIFT@GOTPAGEOFF]
Lloh13:
	adrp	x27, _GEN6_PCODE_FREQ_RING_RATIO_SHIFT@GOTPAGE
Lloh14:
	ldr	x27, [x27, _GEN6_PCODE_FREQ_RING_RATIO_SHIFT@GOTPAGEOFF]
	b	LBB0_12
LBB0_10:                                ;   in Loop: Header=BB0_12 Depth=1
	mov	w8, #0
	mov	x0, x21
LBB0_11:                                ;   in Loop: Header=BB0_12 Depth=1
	ldr	w1, [x25]
	ldr	w9, [x26]
	lsl	w8, w8, w9
	ldr	w9, [x27]
	lsl	w9, w0, w9
	orr	w8, w8, w21
	orr	w2, w8, w9
	mov	x0, x19
	bl	_sandybridge_pcode_write
	sub	w21, w21, #1
	sub	w23, w23, #90
	cmp	w21, w22
	b.lo	LBB0_8
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	bl	_IS_GEN9_BC
	cbnz	x0, LBB0_10
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=1
	mov	x0, x19
	bl	_INTEL_GEN
	cmp	w0, #9
	b.gt	LBB0_10
; %bb.14:                               ;   in Loop: Header=BB0_12 Depth=1
	mov	x0, x19
	bl	_INTEL_GEN
	cmp	w0, #8
	b.lt	LBB0_16
; %bb.15:                               ;   in Loop: Header=BB0_12 Depth=1
	mov	x0, x20
	mov	x1, x21
	b	LBB0_18
LBB0_16:                                ;   in Loop: Header=BB0_12 Depth=1
	mov	x0, x19
	bl	_IS_HASWELL
	cbz	x0, LBB0_19
; %bb.17:                               ;   in Loop: Header=BB0_12 Depth=1
	mov	x0, x21
	mov	w1, #5
	mov	w2, #4
	bl	_mult_frac
	mov	x1, x0
	mov	x0, x20
LBB0_18:                                ;   in Loop: Header=BB0_12 Depth=1
	bl	_max
	mov	w8, #0
	b	LBB0_11
LBB0_19:                                ;   in Loop: Header=BB0_12 Depth=1
	cmp	w21, #15
	csel	w0, w24, w23, lo
	mov	w1, #100
	bl	_DIV_ROUND_CLOSEST
	mov	x8, x0
	mov	w0, #0
	b	LBB0_11
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_tsc_khz,4,2                    ; @tsc_khz
	.comm	_DCLK,4,2                       ; @DCLK
	.comm	_GEN9_FREQ_SCALER,4,2           ; @GEN9_FREQ_SCALER
	.comm	_GEN6_PCODE_WRITE_MIN_FREQ_TABLE,4,2 ; @GEN6_PCODE_WRITE_MIN_FREQ_TABLE
	.comm	_GEN6_PCODE_FREQ_IA_RATIO_SHIFT,4,2 ; @GEN6_PCODE_FREQ_IA_RATIO_SHIFT
	.comm	_GEN6_PCODE_FREQ_RING_RATIO_SHIFT,4,2 ; @GEN6_PCODE_FREQ_RING_RATIO_SHIFT
	.no_dead_strip	_gen6_update_ring_freq
.subsections_via_symbols
