	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function hsw_ddi_calculate_wrpll
_hsw_ddi_calculate_wrpll:               ## @hsw_ddi_calculate_wrpll
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, -104(%rbp)                ## 8-byte Spill
	movq	%rdx, -88(%rbp)                 ## 8-byte Spill
	movq	%rsi, -96(%rbp)                 ## 8-byte Spill
	movl	%edi, %r14d
	xorps	%xmm0, %xmm0
	movaps	%xmm0, -80(%rbp)
	movq	$0, -64(%rbp)
	callq	_hsw_wrpll_get_budget_for_freq
	movl	%eax, %r13d
	leal	-540000000(%r14), %eax
	cmpl	$100, %eax
	jae	LBB0_2
## %bb.1:
	movl	$1, %edx
	movl	$2, %r8d
	movl	$2, %ecx
	jmp	LBB0_14
LBB0_2:
	movq	_LC_FREQ@GOTPCREL(%rip), %rax
	movl	(%rax), %r10d
	leal	(%r10,%r10), %ecx
	movq	_REF_MAX@GOTPCREL(%rip), %rdi
	movl	%ecx, %eax
	cltd
	idivl	(%rdi)
	movl	%eax, %r11d
	incl	%r11d
	movq	_REF_MIN@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movl	%ecx, %eax
	cltd
	idivl	%r15d
	xorl	%r8d, %r8d
	movl	$0, %edx
	movl	$0, %ecx
	cmpl	%eax, %r11d
	ja	LBB0_14
## %bb.3:
	movslq	%r14d, %rax
	imulq	$1374389535, %rax, %r8          ## imm = 0x51EB851F
	movq	%r8, %rax
	shrq	$63, %rax
	sarq	$37, %r8
	addl	%eax, %r8d
	movq	_VCO_MAX@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movq	_VCO_MIN@GOTPCREL(%rip), %rdi
	movq	_P_MAX@GOTPCREL(%rip), %rbx
	movq	_P_MIN@GOTPCREL(%rip), %rcx
	leaq	-80(%rbp), %r9
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_6 Depth=1
	movq	_REF_MIN@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movq	_VCO_MIN@GOTPCREL(%rip), %rdi
LBB0_5:                                 ##   in Loop: Header=BB0_6 Depth=1
	incl	%r11d
	leal	(%r10,%r10), %eax
	cltd
	idivl	%r15d
	cmpl	%eax, %r11d
	ja	LBB0_13
LBB0_6:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_10 Depth 2
                                        ##       Child Loop BB0_12 Depth 3
	movl	(%rdi), %eax
	imull	%r11d, %eax
	xorl	%edx, %edx
	divl	%r10d
	movl	%eax, %r12d
	incl	%r12d
	movl	%r14d, %eax
	imull	%r11d, %eax
	xorl	%edx, %edx
	divl	%r10d
	cmpl	%eax, %r12d
	ja	LBB0_5
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movl	(%rbx), %edi
	jmp	LBB0_10
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_10 Depth=2
	incl	%r12d
	movl	%r14d, %eax
	imull	%r11d, %eax
	xorl	%edx, %edx
	divl	%r10d
	cmpl	%eax, %r12d
	ja	LBB0_4
LBB0_10:                                ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Loop Header: Depth=2
                                        ##       Child Loop BB0_12 Depth 3
	movl	(%rcx), %r15d
	cmpl	%edi, %r15d
	ja	LBB0_9
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=2
	movl	%r12d, -44(%rbp)                ## 4-byte Spill
	.p2align	4, 0x90
LBB0_12:                                ##   Parent Loop BB0_6 Depth=1
                                        ##     Parent Loop BB0_10 Depth=2
                                        ## =>    This Inner Loop Header: Depth=3
	movl	%r8d, %edi
	movl	%r13d, %esi
	movl	%r11d, %edx
	movl	%r12d, %ecx
	movq	%r8, %rbx
	movl	%r15d, %r8d
	movq	%r9, %r12
	movl	%r11d, %r14d
	callq	_hsw_wrpll_update_rnp
	movq	%rbx, %r8
	movl	%r14d, %r11d
	movq	%r12, %r9
	movl	-44(%rbp), %r12d                ## 4-byte Reload
	movq	_P_INC@GOTPCREL(%rip), %rax
	movq	_P_MAX@GOTPCREL(%rip), %rbx
	addl	(%rax), %r15d
	movl	(%rbx), %edi
	cmpl	%edi, %r15d
	jbe	LBB0_12
## %bb.8:                               ##   in Loop: Header=BB0_10 Depth=2
	movq	_VCO_MAX@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movq	_LC_FREQ@GOTPCREL(%rip), %rax
	movl	(%rax), %r10d
	movq	_P_MIN@GOTPCREL(%rip), %rcx
	jmp	LBB0_9
LBB0_13:
	movl	-80(%rbp), %r8d
	movl	-76(%rbp), %edx
	movl	-72(%rbp), %ecx
LBB0_14:
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	movl	%r8d, (%rax)
	movq	-104(%rbp), %rax                ## 8-byte Reload
	movl	%edx, (%rax)
	movq	-96(%rbp), %rax                 ## 8-byte Reload
	movl	%ecx, (%rax)
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_LC_FREQ,4,2                    ## @LC_FREQ
	.comm	_REF_MAX,4,2                    ## @REF_MAX
	.comm	_REF_MIN,4,2                    ## @REF_MIN
	.comm	_VCO_MIN,4,2                    ## @VCO_MIN
	.comm	_VCO_MAX,4,2                    ## @VCO_MAX
	.comm	_P_MIN,4,2                      ## @P_MIN
	.comm	_P_MAX,4,2                      ## @P_MAX
	.comm	_P_INC,8,3                      ## @P_INC
	.no_dead_strip	_hsw_ddi_calculate_wrpll
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function hsw_ddi_calculate_wrpll
_hsw_ddi_calculate_wrpll:               ; @hsw_ddi_calculate_wrpll
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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, x3
	mov	x21, x2
	mov	x20, x1
	mov	x24, x0
	stp	xzr, xzr, [sp, #24]
	str	xzr, [sp, #40]
	bl	_hsw_wrpll_get_budget_for_freq
	mov	w8, #16640
	movk	w8, #57296, lsl #16
	add	w8, w24, w8
	cmp	w8, #100
	b.hs	LBB0_2
; %bb.1:
	mov	w9, #1
	mov	w8, #2
	mov	w10, #2
	b	LBB0_14
LBB0_2:
Lloh0:
	adrp	x27, _LC_FREQ@GOTPAGE
Lloh1:
	ldr	x27, [x27, _LC_FREQ@GOTPAGEOFF]
	ldr	w8, [x27]
	lsl	w9, w8, #1
Lloh2:
	adrp	x10, _REF_MAX@GOTPAGE
Lloh3:
	ldr	x10, [x10, _REF_MAX@GOTPAGEOFF]
Lloh4:
	ldr	w10, [x10]
	sdiv	w10, w9, w10
	add	w23, w10, #1
Lloh5:
	adrp	x10, _REF_MIN@GOTPAGE
Lloh6:
	ldr	x10, [x10, _REF_MIN@GOTPAGEOFF]
Lloh7:
	ldr	w10, [x10]
	sdiv	w9, w9, w10
	cmp	w23, w9
	b.ls	LBB0_4
; %bb.3:
	mov	w8, #0
	mov	w9, #0
	mov	w10, #0
	b	LBB0_14
LBB0_4:
	mov	x22, x0
	stp	x21, x20, [sp]                  ; 16-byte Folded Spill
	str	x19, [sp, #16]                  ; 8-byte Folded Spill
	mov	w9, #34079
	movk	w9, #20971, lsl #16
	smull	x9, w24, w9
	lsr	x11, x9, #63
	asr	x9, x9, #37
	add	w24, w9, w11
Lloh8:
	adrp	x19, _VCO_MAX@GOTPAGE
Lloh9:
	ldr	x19, [x19, _VCO_MAX@GOTPAGEOFF]
	ldr	w9, [x19]
Lloh10:
	adrp	x12, _VCO_MIN@GOTPAGE
Lloh11:
	ldr	x12, [x12, _VCO_MIN@GOTPAGEOFF]
Lloh12:
	adrp	x21, _P_MAX@GOTPAGE
Lloh13:
	ldr	x21, [x21, _P_MAX@GOTPAGEOFF]
Lloh14:
	adrp	x28, _P_MIN@GOTPAGE
Lloh15:
	ldr	x28, [x28, _P_MIN@GOTPAGEOFF]
Lloh16:
	adrp	x20, _P_INC@GOTPAGE
Lloh17:
	ldr	x20, [x20, _P_INC@GOTPAGEOFF]
	b	LBB0_7
LBB0_5:                                 ;   in Loop: Header=BB0_7 Depth=1
Lloh18:
	adrp	x10, _REF_MIN@GOTPAGE
Lloh19:
	ldr	x10, [x10, _REF_MIN@GOTPAGEOFF]
Lloh20:
	ldr	w10, [x10]
Lloh21:
	adrp	x12, _VCO_MIN@GOTPAGE
Lloh22:
	ldr	x12, [x12, _VCO_MIN@GOTPAGEOFF]
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	add	w23, w23, #1
	lsl	w11, w8, #1
	sdiv	w11, w11, w10
	cmp	w23, w11
	b.hi	LBB0_13
LBB0_7:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_10 Depth 2
                                        ;       Child Loop BB0_11 Depth 3
	ldr	w11, [x12]
	mul	w11, w11, w23
	udiv	w11, w11, w8
	add	w25, w11, #1
	mul	w11, w9, w23
	udiv	w11, w11, w8
	cmp	w25, w11
	b.hi	LBB0_6
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	ldr	w10, [x21]
	b	LBB0_10
LBB0_9:                                 ;   in Loop: Header=BB0_10 Depth=2
	add	w25, w25, #1
	mul	w11, w9, w23
	udiv	w11, w11, w8
	cmp	w25, w11
	b.hi	LBB0_5
LBB0_10:                                ;   Parent Loop BB0_7 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_11 Depth 3
	ldr	w26, [x28]
	cmp	w26, w10
	b.hi	LBB0_9
LBB0_11:                                ;   Parent Loop BB0_7 Depth=1
                                        ;     Parent Loop BB0_10 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	add	x5, sp, #24
	mov	x0, x24
	mov	x1, x22
	mov	x2, x23
	mov	x3, x25
	mov	x4, x26
	bl	_hsw_wrpll_update_rnp
	ldr	w8, [x20]
	ldr	w10, [x21]
	add	w26, w26, w8
	cmp	w26, w10
	b.ls	LBB0_11
; %bb.12:                               ;   in Loop: Header=BB0_10 Depth=2
	ldr	w9, [x19]
	ldr	w8, [x27]
	b	LBB0_9
LBB0_13:
	ldp	w8, w9, [sp, #24]
	ldr	w10, [sp, #32]
	ldp	x20, x19, [sp, #8]              ; 16-byte Folded Reload
	ldr	x21, [sp]                       ; 8-byte Folded Reload
LBB0_14:
	str	w8, [x21]
	str	w9, [x19]
	str	w10, [x20]
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_LC_FREQ,4,2                    ; @LC_FREQ
	.comm	_REF_MAX,4,2                    ; @REF_MAX
	.comm	_REF_MIN,4,2                    ; @REF_MIN
	.comm	_VCO_MIN,4,2                    ; @VCO_MIN
	.comm	_VCO_MAX,4,2                    ; @VCO_MAX
	.comm	_P_MIN,4,2                      ; @P_MIN
	.comm	_P_MAX,4,2                      ; @P_MAX
	.comm	_P_INC,8,3                      ; @P_INC
	.no_dead_strip	_hsw_ddi_calculate_wrpll
.subsections_via_symbols
