	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function si_initialize_smc_cac_tables
_si_initialize_smc_cac_tables:          ## @si_initialize_smc_cac_tables
	.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	%rdi, %r12
	callq	_ni_get_pi
	movq	%rax, %rbx
	movq	%r12, %rdi
	callq	_si_get_pi
	movq	%rax, %r13
	movq	%r12, %rdi
	callq	_radeon_get_xclk
	xorl	%r14d, %r14d
	cmpl	$0, (%rbx)
	je	LBB0_13
## %bb.1:
	movl	%eax, %r15d
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$96, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_2
## %bb.3:
	movl	%r15d, -56(%rbp)                ## 4-byte Spill
	movq	%rax, %r15
	movq	_CG_CAC_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_RREG32
	movq	_CAC_WINDOW_MASK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r14d
	notl	%r14d
	andl	%eax, %r14d
	movq	8(%r13), %rax
	movl	16(%rax), %edi
	callq	_CAC_WINDOW
	orl	%eax, %r14d
	movq	_CG_CAC_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	%r14d, %esi
	xorl	%r14d, %r14d
	callq	_WREG32
	movl	8(%r12), %eax
	movl	%eax, 40(%r13)
	movq	8(%r13), %rax
	movq	8(%rax), %rax
	movq	_NISLANDS_DCCAC_LEVEL_0@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	(%rax,%rcx,4), %eax
	movl	%eax, 36(%r13)
	movq	%r12, %rdi
	callq	_si_calculate_cac_wintime
	movl	%eax, 16(%r13)
	movq	8(%r13), %rax
	movl	4(%rax), %eax
	movl	%eax, 28(%r13)
	movl	$80000, 20(%r13)                ## imm = 0x13880
	leaq	-48(%rbp), %rsi
	leaq	-44(%rbp), %rdx
	movq	%r12, %rdi
	callq	_si_get_cac_std_voltage_max_min
	testl	%eax, %eax
	jne	LBB0_11
## %bb.4:
	movl	-48(%rbp), %edi
	movl	-44(%rbp), %esi
	callq	_si_get_cac_std_voltage_step
	movl	-48(%rbp), %edx
	movq	_SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	decl	%esi
	imull	%eax, %esi
	movl	%edx, %ecx
	subl	%esi, %ecx
	movl	%ecx, -44(%rbp)
	cmpq	$0, 48(%r13)
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	jne	LBB0_6
## %bb.5:
	cmpq	$0, 8(%rbx)
	je	LBB0_7
LBB0_6:
	movl	$4, (%rsp)
	movq	%r12, %rdi
	movq	%r15, %rsi
	movl	%eax, %r8d
	movl	$60, %r9d
	callq	_si_init_dte_leakage_table
	testl	%eax, %eax
	jne	LBB0_11
LBB0_9:
	movl	(%r12), %eax
	movq	_SMC_SISLANDS_SCALE_R@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %eax
	cltq
	imulq	$1374389535, %rax, %rcx         ## imm = 0x51EB851F
	movq	%rcx, %rax
	shrq	$63, %rax
	sarq	$37, %rcx
	addl	%eax, %ecx
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	movl	24(%r13), %edi
	callq	_cpu_to_be32
	movq	%rax, 88(%r15)
	movl	32(%r13), %eax
	movl	%eax, 84(%r15)
	movl	28(%r13), %eax
	movl	%eax, 80(%r15)
	movl	-44(%rbp), %edi
	callq	_cpu_to_be32
	movq	%rax, 72(%r15)
	movl	-52(%rbp), %edi                 ## 4-byte Reload
	callq	_cpu_to_be32
	movq	%rax, 64(%r15)
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_cpu_to_be32
	movq	%rax, 56(%r15)
	movl	16(%r13), %edi
	callq	_cpu_to_be32
	movq	%rax, 48(%r15)
	movl	$2, %edi
	callq	_cpu_to_be32
	movq	%rax, 40(%r15)
	xorl	%edi, %edi
	callq	_cpu_to_be32
	movq	%rax, 32(%r15)
	movl	$12, (%r15)
	movq	8(%r13), %rax
	movl	(%rax), %eax
	movl	%eax, 24(%r15)
	movl	$60, %edi
	callq	_cpu_to_be32
	movq	%rax, 16(%r15)
	movl	$4, %edi
	callq	_cpu_to_be32
	movq	%rax, 8(%r15)
	movl	(%r13), %r8d
	movl	4(%r13), %esi
	movq	%r12, %rdi
	movq	%r15, %rdx
	movl	$96, %ecx
	callq	_si_copy_bytes_to_smc
	testl	%eax, %eax
	jne	LBB0_11
## %bb.10:
	movslq	-56(%rbp), %rax                 ## 4-byte Folded Reload
	imulq	$1374389535, %rax, %rdx         ## imm = 0x51EB851F
	movq	%rdx, %rax
	shrq	$63, %rax
	sarq	$37, %rdx
	addl	%eax, %edx
	movq	_SI_SMC_SOFT_REGISTER_ticks_per_us@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_si_write_smc_soft_register
	testl	%eax, %eax
	jne	LBB0_11
	jmp	LBB0_12
LBB0_2:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_13
LBB0_7:
	movq	%r12, %rdi
	movq	%r15, %rsi
	movl	%eax, %r8d
	callq	_si_init_simplified_leakage_table
	testl	%eax, %eax
	je	LBB0_9
LBB0_11:
	movq	$0, (%rbx)
LBB0_12:
	movq	%r15, %rdi
	callq	_kfree
LBB0_13:
	movl	%r14d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_CG_CAC_CTRL,4,2                ## @CG_CAC_CTRL
	.comm	_CAC_WINDOW_MASK,4,2            ## @CAC_WINDOW_MASK
	.comm	_NISLANDS_DCCAC_LEVEL_0,8,3     ## @NISLANDS_DCCAC_LEVEL_0
	.comm	_SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES,4,2 ## @SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES
	.comm	_SMC_SISLANDS_SCALE_R,4,2       ## @SMC_SISLANDS_SCALE_R
	.comm	_SI_SMC_SOFT_REGISTER_ticks_per_us,4,2 ## @SI_SMC_SOFT_REGISTER_ticks_per_us
	.no_dead_strip	_si_initialize_smc_cac_tables
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function si_initialize_smc_cac_tables
_si_initialize_smc_cac_tables:          ; @si_initialize_smc_cac_tables
	.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	x20, x0
	bl	_ni_get_pi
	mov	x19, x0
	mov	x0, x20
	bl	_si_get_pi
	mov	x23, x0
	mov	x0, x20
	bl	_radeon_get_xclk
	ldr	w8, [x19]
	cbz	w8, LBB0_12
; %bb.1:
	mov	x22, x0
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w0, #96
	bl	_kzalloc
	cbz	x0, LBB0_8
; %bb.2:
	mov	x21, x0
Lloh3:
	adrp	x24, _CG_CAC_CTRL@GOTPAGE
Lloh4:
	ldr	x24, [x24, _CG_CAC_CTRL@GOTPAGEOFF]
	ldr	w0, [x24]
	bl	_RREG32
Lloh5:
	adrp	x8, _CAC_WINDOW_MASK@GOTPAGE
Lloh6:
	ldr	x8, [x8, _CAC_WINDOW_MASK@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	bic	w25, w0, w8
	ldr	x8, [x23, #8]
	ldr	w0, [x8, #16]
	bl	_CAC_WINDOW
	orr	w1, w0, w25
	ldr	w0, [x24]
	bl	_WREG32
	ldr	w8, [x20, #8]
	str	w8, [x23, #40]
	ldr	x8, [x23, #8]
	ldr	x8, [x8, #8]
Lloh8:
	adrp	x9, _NISLANDS_DCCAC_LEVEL_0@GOTPAGE
Lloh9:
	ldr	x9, [x9, _NISLANDS_DCCAC_LEVEL_0@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x9]
	ldr	w8, [x8, x9, lsl #2]
	str	w8, [x23, #36]
	mov	x0, x20
	bl	_si_calculate_cac_wintime
	ldr	x8, [x23, #8]
	ldr	w8, [x8, #4]
	str	w8, [x23, #28]
	mov	w8, #14464
	movk	w8, #1, lsl #16
	stp	w0, w8, [x23, #16]
	add	x1, sp, #12
	add	x2, sp, #8
	mov	x0, x20
	bl	_si_get_cac_std_voltage_max_min
	cbnz	w0, LBB0_10
; %bb.3:
	ldp	w1, w0, [sp, #8]
	bl	_si_get_cac_std_voltage_step
	mov	x24, x0
Lloh11:
	adrp	x8, _SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES@GOTPAGE
Lloh12:
	ldr	x8, [x8, _SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES@GOTPAGEOFF]
	ldr	w2, [sp, #12]
Lloh13:
	ldr	w8, [x8]
	sub	w8, w8, #1
	msub	w3, w8, w0, w2
	str	w3, [sp, #8]
	ldr	x8, [x23, #48]
	cbnz	x8, LBB0_5
; %bb.4:
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_9
LBB0_5:
	mov	x0, x20
	mov	x1, x21
	mov	x4, x24
	mov	w5, #60
	mov	w6, #4
	bl	_si_init_dte_leakage_table
	cbnz	w0, LBB0_10
LBB0_6:
	ldr	w8, [x20]
Lloh14:
	adrp	x9, _SMC_SISLANDS_SCALE_R@GOTPAGE
Lloh15:
	ldr	x9, [x9, _SMC_SISLANDS_SCALE_R@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	lsl	w8, w8, w9
	mov	w9, #34079
	movk	w9, #20971, lsl #16
	smull	x8, w8, w9
	lsr	x9, x8, #32
	lsr	x8, x8, #63
	add	w25, w8, w9, asr #5
	ldr	w0, [x23, #24]
	bl	_cpu_to_be32
	str	x0, [x21, #88]
	ldur	d0, [x23, #28]
	str	d0, [x21, #80]
	ldr	w0, [sp, #8]
	bl	_cpu_to_be32
	str	x0, [x21, #72]
	mov	x0, x24
	bl	_cpu_to_be32
	str	x0, [x21, #64]
	mov	x0, x25
	bl	_cpu_to_be32
	str	x0, [x21, #56]
	ldr	w0, [x23, #16]
	bl	_cpu_to_be32
	str	x0, [x21, #48]
	mov	w0, #2
	bl	_cpu_to_be32
	str	x0, [x21, #40]
	mov	w0, #0
	bl	_cpu_to_be32
	str	x0, [x21, #32]
	mov	w8, #12
	str	w8, [x21]
	ldr	x8, [x23, #8]
	ldr	w8, [x8]
	str	w8, [x21, #24]
	mov	w0, #60
	bl	_cpu_to_be32
	str	x0, [x21, #16]
	mov	w0, #4
	bl	_cpu_to_be32
	str	x0, [x21, #8]
	ldp	w4, w1, [x23]
	mov	x0, x20
	mov	x2, x21
	mov	w3, #96
	bl	_si_copy_bytes_to_smc
	cbnz	w0, LBB0_10
; %bb.7:
	mov	w8, #34079
	movk	w8, #20971, lsl #16
	smull	x8, w22, w8
	lsr	x9, x8, #63
	asr	x8, x8, #37
	add	w2, w8, w9
Lloh17:
	adrp	x8, _SI_SMC_SOFT_REGISTER_ticks_per_us@GOTPAGE
Lloh18:
	ldr	x8, [x8, _SI_SMC_SOFT_REGISTER_ticks_per_us@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_si_write_smc_soft_register
	cbnz	w0, LBB0_10
	b	LBB0_11
LBB0_8:
Lloh20:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh21:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_13
LBB0_9:
	mov	x0, x20
	mov	x1, x21
	mov	x4, x24
	bl	_si_init_simplified_leakage_table
	cbz	w0, LBB0_6
LBB0_10:
	str	xzr, [x19]
LBB0_11:
	mov	x0, x21
	bl	_kfree
LBB0_12:
	mov	w0, #0
LBB0_13:
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_CG_CAC_CTRL,4,2                ; @CG_CAC_CTRL
	.comm	_CAC_WINDOW_MASK,4,2            ; @CAC_WINDOW_MASK
	.comm	_NISLANDS_DCCAC_LEVEL_0,8,3     ; @NISLANDS_DCCAC_LEVEL_0
	.comm	_SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES,4,2 ; @SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES
	.comm	_SMC_SISLANDS_SCALE_R,4,2       ; @SMC_SISLANDS_SCALE_R
	.comm	_SI_SMC_SOFT_REGISTER_ticks_per_us,4,2 ; @SI_SMC_SOFT_REGISTER_ticks_per_us
	.no_dead_strip	_si_initialize_smc_cac_tables
.subsections_via_symbols
