	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ni_populate_power_containment_values
_ni_populate_power_containment_values:  ## @ni_populate_power_containment_values
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, -56(%rbp)                 ## 8-byte Spill
	movq	%rsi, %r14
	movq	%rdi, %rbx
	callq	_rv770_get_pi
	movq	%rax, %r15
	movq	%rbx, %rdi
	callq	_evergreen_get_pi
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rdi
	callq	_ni_get_pi
	movq	%rax, %r13
	movq	%r14, %rdi
	callq	_ni_get_ps
	cmpl	$0, (%r13)
	je	LBB0_1
## %bb.2:
	movq	%rax, %r12
	movl	(%rax), %eax
	testl	%eax, %eax
	je	LBB0_3
## %bb.4:
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	cmpl	%eax, (%rcx)
	jne	LBB0_3
## %bb.5:
	movl	(%rbx), %edx
	leaq	-68(%rbp), %rcx
	leaq	-44(%rbp), %r8
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_ni_calculate_adjusted_tdp_limits
	testl	%eax, %eax
	jne	LBB0_23
## %bb.6:
	movl	-44(%rbp), %edx
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_ni_calculate_power_boost_limit
	movl	%eax, %r13d
	movq	8(%r15), %r14
	movq	_NISLANDS_SMC_STATETABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_dpm2Params@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_offsetof
	addq	%rax, %r14
	movq	_PP_NIslands_DPM2Parameters@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_PowerBoostLimit@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_offsetof
	addq	%rax, %r14
	movq	%rbx, %rdi
	callq	_ni_get_smc_power_scaling_factor
	movl	%r13d, %edi
	movl	%eax, %esi
	callq	_ni_scale_power_for_smc
	movl	(%r15), %ecx
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	%eax, %edx
	callq	_rv770_write_smc_sram_dword
	testl	%eax, %eax
	sete	%al
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movq	8(%rcx), %r14
	movq	$0, 24(%r14)
	movl	$0, 16(%r14)
	movq	$0, 8(%r14)
	testl	%r13d, %r13d
	movl	$0, %ecx
	setne	%r11b
	andb	%al, %r11b
	je	LBB0_8
## %bb.7:
	movq	_PPSMC_STATEFLAG_POWERBOOST@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
LBB0_8:
	orl	%ecx, (%r14)
	movl	(%r12), %edx
	movl	$0, %eax
	cmpl	$2, %edx
	jl	LBB0_23
## %bb.9:
	movq	8(%r12), %r9
	leal	-1(%rdx), %eax
	movl	(%r9), %r8d
	leaq	-4(,%rax,4), %r15
	leaq	-4(,%rdx,4), %r10
	xorl	%ebx, %ebx
	movq	_NISLANDS_DPM2_MAXPS_PERCENT_M@GOTPCREL(%rip), %rcx
	movq	_NISLANDS_DPM2_MAX_PULSE_SKIP@GOTPCREL(%rip), %rdi
	movq	_NISLANDS_DPM2_NEAR_TDP_DEC@GOTPCREL(%rip), %rsi
	movl	%r8d, %edx
	jmp	LBB0_10
	.p2align	4, 0x90
LBB0_22:                                ##   in Loop: Header=BB0_10 Depth=1
	cmpq	%rbx, %r15
	cmovel	%eax, %edx
	orl	%edx, 32(%r14,%rbx,8)
	addq	$4, %rbx
	movl	%r12d, %edx
	cmpq	%rbx, %r10
	je	LBB0_23
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movq	%rcx, %rax
	cmpq	%rbx, %r15
	jne	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=1
	movq	_NISLANDS_DPM2_MAXPS_PERCENT_H@GOTPCREL(%rip), %rax
LBB0_12:                                ##   in Loop: Header=BB0_10 Depth=1
	movl	4(%r9,%rbx), %r12d
	cmpl	%edx, %r12d
	jl	LBB0_3
## %bb.13:                              ##   in Loop: Header=BB0_10 Depth=1
	movq	(%rax), %rax
	movl	%r12d, %r13d
	testq	%rax, %rax
	je	LBB0_19
## %bb.14:                              ##   in Loop: Header=BB0_10 Depth=1
	movl	%r12d, %r13d
	cmpl	%r12d, %edx
	je	LBB0_19
## %bb.15:                              ##   in Loop: Header=BB0_10 Depth=1
	movq	%rcx, %r13
	movq	%rsi, %rcx
	movq	%rdi, %rsi
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	cmpq	$0, (%rdi)
	movq	%rsi, %rdi
	movq	%rcx, %rsi
	movq	%r13, %rcx
	movl	%r12d, %r13d
	jne	LBB0_19
## %bb.16:                              ##   in Loop: Header=BB0_10 Depth=1
	testq	%rbx, %rbx
	je	LBB0_17
## %bb.18:                              ##   in Loop: Header=BB0_10 Depth=1
	imull	%eax, %edx
	movslq	%edx, %rax
	imulq	$1374389535, %rax, %r13         ## imm = 0x51EB851F
	movq	%r13, %rax
	shrq	$63, %rax
	sarq	$37, %r13
	addl	%eax, %r13d
	jmp	LBB0_19
LBB0_17:                                ##   in Loop: Header=BB0_10 Depth=1
	movl	%edx, %r13d
	.p2align	4, 0x90
LBB0_19:                                ##   in Loop: Header=BB0_10 Depth=1
	cmpl	%r8d, %r13d
	cmovlel	%r8d, %r13d
	testl	%r13d, %r13d
	je	LBB0_3
## %bb.20:                              ##   in Loop: Header=BB0_10 Depth=1
	movl	%r12d, %eax
	subl	%r13d, %eax
	imull	(%rdi), %eax
	cltd
	idivl	%r12d
	cltq
	movq	%rax, 56(%r14,%rbx,8)
	movl	(%rsi), %eax
	movl	%eax, 48(%r14,%rbx,8)
	movq	_NISLANDS_DPM2_ABOVE_SAFE_INC@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 44(%r14,%rbx,8)
	movq	_NISLANDS_DPM2_BELOW_SAFE_INC@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 40(%r14,%rbx,8)
	xorl	%eax, %eax
	movl	$0, %edx
	testb	%r11b, %r11b
	je	LBB0_22
## %bb.21:                              ##   in Loop: Header=BB0_10 Depth=1
	movq	_PPSMC_STATEFLAG_POWERBOOST@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	jmp	LBB0_22
LBB0_3:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_23
LBB0_1:
	xorl	%eax, %eax
LBB0_23:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_NISLANDS_SMC_STATETABLE,4,2    ## @NISLANDS_SMC_STATETABLE
	.comm	_dpm2Params,4,2                 ## @dpm2Params
	.comm	_PP_NIslands_DPM2Parameters,4,2 ## @PP_NIslands_DPM2Parameters
	.comm	_PowerBoostLimit,4,2            ## @PowerBoostLimit
	.comm	_PPSMC_STATEFLAG_POWERBOOST,4,2 ## @PPSMC_STATEFLAG_POWERBOOST
	.comm	_NISLANDS_DPM2_MAXPS_PERCENT_M,8,3 ## @NISLANDS_DPM2_MAXPS_PERCENT_M
	.comm	_NISLANDS_DPM2_MAXPS_PERCENT_H,8,3 ## @NISLANDS_DPM2_MAXPS_PERCENT_H
	.comm	_NISLANDS_DPM2_MAX_PULSE_SKIP,4,2 ## @NISLANDS_DPM2_MAX_PULSE_SKIP
	.comm	_NISLANDS_DPM2_NEAR_TDP_DEC,4,2 ## @NISLANDS_DPM2_NEAR_TDP_DEC
	.comm	_NISLANDS_DPM2_ABOVE_SAFE_INC,4,2 ## @NISLANDS_DPM2_ABOVE_SAFE_INC
	.comm	_NISLANDS_DPM2_BELOW_SAFE_INC,4,2 ## @NISLANDS_DPM2_BELOW_SAFE_INC
	.no_dead_strip	_ni_populate_power_containment_values
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ni_populate_power_containment_values
_ni_populate_power_containment_values:  ; @ni_populate_power_containment_values
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.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
	mov	x21, x2
	mov	x24, x1
	mov	x22, x0
	bl	_rv770_get_pi
	mov	x23, x0
	mov	x0, x22
	bl	_evergreen_get_pi
	mov	x19, x0
	mov	x0, x22
	bl	_ni_get_pi
	mov	x25, x0
	mov	x0, x24
	bl	_ni_get_ps
	ldr	w8, [x25]
	cbz	w8, LBB0_15
; %bb.1:
	mov	x20, x0
	ldr	w8, [x0]
	cbz	w8, LBB0_14
; %bb.2:
	ldr	w9, [x21]
	cmp	w9, w8
	b.ne	LBB0_14
; %bb.3:
	ldr	w2, [x22]
	add	x3, sp, #12
	add	x4, sp, #8
	mov	x0, x22
	mov	w1, #0
	bl	_ni_calculate_adjusted_tdp_limits
	cbnz	w0, LBB0_16
; %bb.4:
	ldr	w2, [sp, #8]
	mov	x0, x22
	mov	x1, x24
	bl	_ni_calculate_power_boost_limit
	mov	x24, x0
	ldr	x25, [x23, #8]
Lloh0:
	adrp	x8, _NISLANDS_SMC_STATETABLE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _NISLANDS_SMC_STATETABLE@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
Lloh3:
	adrp	x8, _dpm2Params@GOTPAGE
Lloh4:
	ldr	x8, [x8, _dpm2Params@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	bl	_offsetof
	add	x25, x0, x25
Lloh6:
	adrp	x8, _PP_NIslands_DPM2Parameters@GOTPAGE
Lloh7:
	ldr	x8, [x8, _PP_NIslands_DPM2Parameters@GOTPAGEOFF]
Lloh8:
	ldr	w0, [x8]
Lloh9:
	adrp	x8, _PowerBoostLimit@GOTPAGE
Lloh10:
	ldr	x8, [x8, _PowerBoostLimit@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	bl	_offsetof
	add	x25, x25, x0
	mov	x0, x22
	bl	_ni_get_smc_power_scaling_factor
	mov	x1, x0
	mov	x0, x24
	bl	_ni_scale_power_for_smc
	mov	x2, x0
	ldr	w3, [x23]
	mov	x0, x22
	mov	x1, x25
	bl	_rv770_write_smc_sram_dword
	mov	x8, x0
	mov	w0, #0
	cmp	w8, #0
	cset	w10, eq
	ldr	x8, [x21, #8]
	cmp	w24, #0
	cset	w11, ne
Lloh12:
	adrp	x9, _PPSMC_STATEFLAG_POWERBOOST@GOTPAGE
Lloh13:
	ldr	x9, [x9, _PPSMC_STATEFLAG_POWERBOOST@GOTPAGEOFF]
	ands	w10, w10, w11
	ldr	w11, [x9]
	csel	w11, w11, wzr, ne
	ldr	w12, [x8]
	orr	w11, w12, w11
	str	xzr, [x8, #24]
	str	wzr, [x8, #16]
	str	xzr, [x8, #8]
	str	w11, [x8]
	ldr	w15, [x20]
	cmp	w15, #2
	b.lt	LBB0_16
; %bb.5:
	mov	x11, #0
	ldr	x12, [x20, #8]
	sub	w14, w15, #1
	ldr	w13, [x12], #4
	lsl	x14, x14, #2
	sub	x14, x14, #4
	lsl	x15, x15, #2
	sub	x15, x15, #4
	mov	w16, #32
Lloh14:
	adrp	x17, _NISLANDS_DPM2_MAXPS_PERCENT_M@GOTPAGE
Lloh15:
	ldr	x17, [x17, _NISLANDS_DPM2_MAXPS_PERCENT_M@GOTPAGEOFF]
Lloh16:
	adrp	x1, _NISLANDS_DPM2_MAXPS_PERCENT_H@GOTPAGE
Lloh17:
	ldr	x1, [x1, _NISLANDS_DPM2_MAXPS_PERCENT_H@GOTPAGEOFF]
Lloh18:
	adrp	x2, _NISLANDS_DPM2_MAX_PULSE_SKIP@GOTPAGE
Lloh19:
	ldr	x2, [x2, _NISLANDS_DPM2_MAX_PULSE_SKIP@GOTPAGEOFF]
Lloh20:
	adrp	x3, _NISLANDS_DPM2_NEAR_TDP_DEC@GOTPAGE
Lloh21:
	ldr	x3, [x3, _NISLANDS_DPM2_NEAR_TDP_DEC@GOTPAGEOFF]
Lloh22:
	adrp	x4, _NISLANDS_DPM2_ABOVE_SAFE_INC@GOTPAGE
Lloh23:
	ldr	x4, [x4, _NISLANDS_DPM2_ABOVE_SAFE_INC@GOTPAGEOFF]
Lloh24:
	adrp	x5, _NISLANDS_DPM2_BELOW_SAFE_INC@GOTPAGE
Lloh25:
	ldr	x5, [x5, _NISLANDS_DPM2_BELOW_SAFE_INC@GOTPAGEOFF]
	mov	w6, #34079
	movk	w6, #20971, lsl #16
	mov	x20, x13
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w7, [x12, x11]
	cmp	x14, x11
	csel	x0, x1, x17, eq
	cmp	w7, w20
	b.lt	LBB0_14
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	x0, [x0]
	cmp	x0, #0
	ccmp	w20, w7, #4, ne
	mov	x21, x7
	b.eq	LBB0_12
; %bb.8:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	x22, [x19]
	mov	x21, x7
	cbnz	x22, LBB0_12
; %bb.9:                                ;   in Loop: Header=BB0_6 Depth=1
	cbz	x11, LBB0_11
; %bb.10:                               ;   in Loop: Header=BB0_6 Depth=1
	mul	w0, w20, w0
	smull	x0, w0, w6
	lsr	x20, x0, #63
	asr	x0, x0, #37
	add	w21, w0, w20
	b	LBB0_12
LBB0_11:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	x21, x20
LBB0_12:                                ;   in Loop: Header=BB0_6 Depth=1
	cmp	w21, w13
	csel	w20, w21, w13, gt
	cbz	w20, LBB0_14
; %bb.13:                               ;   in Loop: Header=BB0_6 Depth=1
	mov	w0, #0
	ldr	w21, [x2]
	sub	w20, w7, w20
	mul	w20, w21, w20
	sdiv	w20, w20, w7
	sxtw	x20, w20
	add	x21, x8, x11, lsl #3
	str	x20, [x21, #56]
	ldr	w20, [x3]
	add	x21, x8, x16
	str	w20, [x21, #16]
	ldr	w20, [x4]
	str	w20, [x21, #12]
	ldr	w20, [x5]
	str	w20, [x21, #8]
	cmp	x14, x11
	cset	w20, ne
	ldr	w22, [x9]
	tst	w20, w10
	csel	w20, w22, wzr, ne
	ldr	w22, [x21]
	orr	w20, w22, w20
	str	w20, [x21]
	add	x11, x11, #4
	add	x16, x16, #32
	mov	x20, x7
	cmp	x15, x11
	b.ne	LBB0_6
	b	LBB0_16
LBB0_14:
Lloh26:
	adrp	x8, _EINVAL@GOTPAGE
Lloh27:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh28:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_16
LBB0_15:
	mov	w0, #0
LBB0_16:
	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
	add	sp, sp, #96
	ret
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_NISLANDS_SMC_STATETABLE,4,2    ; @NISLANDS_SMC_STATETABLE
	.comm	_dpm2Params,4,2                 ; @dpm2Params
	.comm	_PP_NIslands_DPM2Parameters,4,2 ; @PP_NIslands_DPM2Parameters
	.comm	_PowerBoostLimit,4,2            ; @PowerBoostLimit
	.comm	_PPSMC_STATEFLAG_POWERBOOST,4,2 ; @PPSMC_STATEFLAG_POWERBOOST
	.comm	_NISLANDS_DPM2_MAXPS_PERCENT_M,8,3 ; @NISLANDS_DPM2_MAXPS_PERCENT_M
	.comm	_NISLANDS_DPM2_MAXPS_PERCENT_H,8,3 ; @NISLANDS_DPM2_MAXPS_PERCENT_H
	.comm	_NISLANDS_DPM2_MAX_PULSE_SKIP,4,2 ; @NISLANDS_DPM2_MAX_PULSE_SKIP
	.comm	_NISLANDS_DPM2_NEAR_TDP_DEC,4,2 ; @NISLANDS_DPM2_NEAR_TDP_DEC
	.comm	_NISLANDS_DPM2_ABOVE_SAFE_INC,4,2 ; @NISLANDS_DPM2_ABOVE_SAFE_INC
	.comm	_NISLANDS_DPM2_BELOW_SAFE_INC,4,2 ; @NISLANDS_DPM2_BELOW_SAFE_INC
	.no_dead_strip	_ni_populate_power_containment_values
.subsections_via_symbols
