	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ni_init_driver_calculated_leakage_table
_ni_init_driver_calculated_leakage_table: ## @ni_init_driver_calculated_leakage_table
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r12
	callq	_ni_get_pi
	movq	%rax, %rbx
	movq	%r12, %rdi
	callq	_evergreen_get_pi
	movq	%rax, %r15
	movl	$0, -48(%rbp)
	movl	(%rax), %r14d
	movq	_SMC_NISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	%r14d, %eax
	cmovbl	%eax, %r14d
	movq	%r12, %rdi
	callq	_ni_get_smc_power_scaling_factor
	movq	_SMC_NISLANDS_LKGE_LUT_NUM_OF_TEMP_ENTRIES@GOTPCREL(%rip), %r13
	movl	(%r13), %edi
	movl	%r14d, -44(%rbp)                ## 4-byte Spill
	movl	%r14d, %r10d
	testl	%edi, %edi
	je	LBB0_1
## %bb.9:
	movq	%rbx, %rsi
	addq	$8, %rsi
	xorl	%edx, %edx
	leaq	-48(%rbp), %r9
	xorl	%r14d, %r14d
	movq	%rbx, -88(%rbp)                 ## 8-byte Spill
	movq	%r12, -80(%rbp)                 ## 8-byte Spill
	movq	%r15, -72(%rbp)                 ## 8-byte Spill
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	jmp	LBB0_10
	.p2align	4, 0x90
LBB0_14:                                ##   in Loop: Header=BB0_10 Depth=1
	incq	%rdx
	movl	%edi, %ecx
	cmpq	%rcx, %rdx
	jae	LBB0_2
LBB0_10:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_12 Depth 2
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_14
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=1
	imull	$8000, %edx, %ecx               ## imm = 0x1F40
	addl	$8000, %ecx                     ## imm = 0x1F40
	movl	%ecx, -56(%rbp)                 ## 4-byte Spill
	xorl	%r15d, %r15d
	movq	%rdx, -96(%rbp)                 ## 8-byte Spill
	.p2align	4, 0x90
LBB0_12:                                ##   Parent Loop BB0_10 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	(%rbx), %ecx
	movl	4(%rbx), %r8d
	movl	-56(%rbp), %eax                 ## 4-byte Reload
	cmpl	%ecx, %eax
	cmovgl	%eax, %ecx
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movq	8(%rax), %rax
	movl	(%rax,%r15,4), %edx
	movq	%r12, %rdi
	movq	%r10, %r12
	movq	%rsi, %r13
	movq	%r9, %rbx
	callq	_ni_calculate_leakage_for_v_and_t
	movl	-48(%rbp), %edi
	movl	-52(%rbp), %esi                 ## 4-byte Reload
	callq	_ni_scale_power_for_smc
	cltq
	imulq	$274877907, %rax, %rdi          ## imm = 0x10624DD3
	movq	%rdi, %rax
	shrq	$63, %rax
	sarq	$38, %rdi
	addl	%eax, %edi
	cmpl	%r14d, %edi
	cmovgl	%edi, %r14d
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_cpu_to_be32
	movq	%rbx, %r9
	movq	-96(%rbp), %rdx                 ## 8-byte Reload
	movq	%r13, %rsi
	movq	%r12, %r10
	movq	-80(%rbp), %r12                 ## 8-byte Reload
	movq	-88(%rbp), %rbx                 ## 8-byte Reload
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movq	(%rcx), %rcx
	movq	(%rcx,%rdx,8), %rcx
	movq	%rax, (%rcx,%r15,8)
	incq	%r15
	cmpq	%r15, %r10
	jne	LBB0_12
## %bb.13:                              ##   in Loop: Header=BB0_10 Depth=1
	movq	_SMC_NISLANDS_LKGE_LUT_NUM_OF_TEMP_ENTRIES@GOTPCREL(%rip), %r13
	movl	(%r13), %edi
	jmp	LBB0_14
LBB0_1:
	xorl	%edi, %edi
	xorl	%r14d, %r14d
LBB0_2:
	movq	_SMC_NISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES@GOTPCREL(%rip), %r12
	movl	(%r12), %ecx
	cmpl	%ecx, -44(%rbp)                 ## 4-byte Folded Reload
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	jb	LBB0_3
LBB0_8:
	xorl	%eax, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_3 Depth=1
	incq	%r10
	movl	%ecx, %edx
	cmpq	%rdx, %r10
	jae	LBB0_8
LBB0_3:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_5 Depth 2
	testl	%edi, %edi
	movl	$0, %edi
	je	LBB0_7
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_5:                                 ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	%r14d, %edi
	movq	%r10, %r12
	callq	_cpu_to_be32
	movq	%r12, %r10
	movq	(%r15), %rcx
	movq	(%rcx,%rbx,8), %rcx
	movq	%rax, (%rcx,%r12,8)
	incq	%rbx
	movl	(%r13), %edi
	cmpq	%rdi, %rbx
	jb	LBB0_5
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	_SMC_NISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	jmp	LBB0_7
	.cfi_endproc
                                        ## -- End function
	.comm	_SMC_NISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES,4,2 ## @SMC_NISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES
	.comm	_SMC_NISLANDS_LKGE_LUT_NUM_OF_TEMP_ENTRIES,4,2 ## @SMC_NISLANDS_LKGE_LUT_NUM_OF_TEMP_ENTRIES
	.no_dead_strip	_ni_init_driver_calculated_leakage_table
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ni_init_driver_calculated_leakage_table
_ni_init_driver_calculated_leakage_table: ; @ni_init_driver_calculated_leakage_table
	.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
	str	x1, [sp, #24]                   ; 8-byte Folded Spill
	mov	x20, x0
	bl	_ni_get_pi
	mov	x22, x0
	mov	x0, x20
	bl	_evergreen_get_pi
	mov	x21, x0
	str	wzr, [sp, #44]
	ldr	w8, [x0]
Lloh0:
	adrp	x9, _SMC_NISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES@GOTPAGE
Lloh1:
	ldr	x9, [x9, _SMC_NISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	cmp	w9, w8
	csel	w23, w9, w8, lo
	mov	x0, x20
	bl	_ni_get_smc_power_scaling_factor
Lloh3:
	adrp	x28, _SMC_NISLANDS_LKGE_LUT_NUM_OF_TEMP_ENTRIES@GOTPAGE
Lloh4:
	ldr	x28, [x28, _SMC_NISLANDS_LKGE_LUT_NUM_OF_TEMP_ENTRIES@GOTPAGEOFF]
	ldr	w8, [x28]
	cbz	w8, LBB0_7
; %bb.1:
	str	w0, [sp, #4]                    ; 4-byte Folded Spill
	stp	x21, x20, [sp, #8]              ; 16-byte Folded Spill
	mov	x26, #0
	mov	w20, #0
	add	x27, x22, #8
	str	x23, [sp, #32]                  ; 8-byte Folded Spill
	mov	x24, x21
	mov	w19, w0
	ldr	x25, [sp, #24]                  ; 8-byte Folded Reload
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x26, x26, #1
	cmp	x26, w8, uxtw
	b.hs	LBB0_8
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_5 Depth 2
	cbz	w23, LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x28, #0
	mov	w8, #8000
	madd	w21, w26, w8, w8
	ldr	x23, [sp, #16]                  ; 8-byte Folded Reload
LBB0_5:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldp	w8, w4, [x22]
	cmp	w21, w8
	csel	w3, w21, w8, gt
	ldr	x8, [x24, #8]
	ldr	w2, [x8, x28, lsl #2]
	add	x5, sp, #44
	mov	x0, x23
	mov	x1, x27
	bl	_ni_calculate_leakage_for_v_and_t
	ldr	w0, [sp, #44]
	mov	x1, x19
	bl	_ni_scale_power_for_smc
	mov	w8, #19923
	movk	w8, #4194, lsl #16
	smull	x8, w0, w8
	lsr	x9, x8, #63
	asr	x8, x8, #38
	add	w0, w8, w9
	cmp	w0, w20
	csel	w20, w0, w20, gt
	bl	_cpu_to_be32
	ldr	x8, [x25]
	ldr	x8, [x8, x26, lsl #3]
	str	x0, [x8, x28, lsl #3]
	add	x28, x28, #1
	ldr	x8, [sp, #32]                   ; 8-byte Folded Reload
	cmp	x8, x28
	b.ne	LBB0_5
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
Lloh5:
	adrp	x28, _SMC_NISLANDS_LKGE_LUT_NUM_OF_TEMP_ENTRIES@GOTPAGE
Lloh6:
	ldr	x28, [x28, _SMC_NISLANDS_LKGE_LUT_NUM_OF_TEMP_ENTRIES@GOTPAGEOFF]
	ldr	w8, [x28]
	ldr	x23, [sp, #32]                  ; 8-byte Folded Reload
	b	LBB0_2
LBB0_7:
	mov	w20, #0
LBB0_8:
Lloh7:
	adrp	x22, _SMC_NISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES@GOTPAGE
Lloh8:
	ldr	x22, [x22, _SMC_NISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES@GOTPAGEOFF]
	ldr	w9, [x22]
	cmp	w23, w9
	ldr	x19, [sp, #24]                  ; 8-byte Folded Reload
	b.lo	LBB0_11
LBB0_9:
	mov	w0, #0
	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
LBB0_10:                                ;   in Loop: Header=BB0_11 Depth=1
	add	x23, x23, #1
	cmp	x23, w9, uxtw
	b.hs	LBB0_9
LBB0_11:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_13 Depth 2
	cbz	w8, LBB0_10
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	mov	x21, #0
LBB0_13:                                ;   Parent Loop BB0_11 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	mov	x0, x20
	bl	_cpu_to_be32
	ldr	x8, [x19]
	ldr	x8, [x8, x21, lsl #3]
	str	x0, [x8, x23, lsl #3]
	add	x21, x21, #1
	ldr	w8, [x28]
	cmp	x21, x8
	b.lo	LBB0_13
; %bb.14:                               ;   in Loop: Header=BB0_11 Depth=1
	ldr	w9, [x22]
	b	LBB0_10
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_SMC_NISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES,4,2 ; @SMC_NISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES
	.comm	_SMC_NISLANDS_LKGE_LUT_NUM_OF_TEMP_ENTRIES,4,2 ; @SMC_NISLANDS_LKGE_LUT_NUM_OF_TEMP_ENTRIES
	.no_dead_strip	_ni_init_driver_calculated_leakage_table
.subsections_via_symbols
