	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function si_convert_power_state_to_smc
_si_convert_power_state_to_smc:         ## @si_convert_power_state_to_smc
	.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, %rbx
	movq	%rsi, %r15
	movq	%rdi, %r12
	callq	_evergreen_get_pi
	movq	%rax, %r13
	movq	%r12, %rdi
	callq	_ni_get_pi
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	%r12, %rdi
	callq	_si_get_pi
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	%r15, %rdi
	callq	_si_get_ps
	movq	%rax, %r14
	movslq	(%rax), %rax
	movq	_SISLANDS_MAX_HARDWARE_POWERLEVELS@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jle	LBB0_3
## %bb.1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_2:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	movq	8(%r14), %rcx
	movl	-4(%rcx,%rax,4), %ecx
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	cmpq	$0, 8(%r15)
	movq	%r12, -64(%rbp)                 ## 8-byte Spill
	je	LBB0_7
## %bb.4:
	cmpq	$0, (%r15)
	je	LBB0_7
## %bb.5:
	movl	$1, (%r13)
	cmpq	$0, 24(%r13)
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	je	LBB0_8
## %bb.6:
	movq	_PPSMC_SWSTATE_FLAG_UVD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	%ecx, 16(%rbx)
	jmp	LBB0_8
LBB0_7:
	movl	$0, (%r13)
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
LBB0_8:
	movq	%r15, -80(%rbp)                 ## 8-byte Spill
	cmpq	$0, 16(%r14)
	je	LBB0_10
## %bb.9:
	movq	_PPSMC_SWSTATE_FLAG_DC@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	%ecx, 16(%rbx)
LBB0_10:
	movq	$0, (%rbx)
	testl	%eax, %eax
	jle	LBB0_25
## %bb.11:
	xorl	%r15d, %r15d
	jmp	LBB0_12
	.p2align	4, 0x90
LBB0_24:                                ##   in Loop: Header=BB0_12 Depth=1
	movq	(%rdx), %rax
	movq	%rax, 8(%rcx,%r12)
	movq	8(%r13), %rax
	movq	_SISLANDS_MCREGISTERTABLE_FIRST_DRIVERSTATE_SLOT@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	addq	%r15, %rdx
	testq	%rax, %rax
	cmoveq	%rax, %rdx
	movq	%rdx, (%rcx,%r12)
	incq	(%rbx)
	incq	%r15
	movslq	(%r14), %rax
	cmpq	%rax, %r15
	jge	LBB0_25
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	cmpq	$0, 16(%r13)
	je	LBB0_18
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=1
	testq	%r15, %r15
	je	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_12 Depth=1
	cmpq	$0, (%rsi)
	je	LBB0_18
LBB0_15:                                ##   in Loop: Header=BB0_12 Depth=1
	movq	_SCLK_MIN_DEEPSLEEP_FREQ@GOTPCREL(%rip), %rax
	cmpq	$1350, (%rax)                   ## imm = 0x546
	movq	_PPSMC_STATEFLAG_DEEPSLEEP_THROTTLE@GOTPCREL(%rip), %rax
	jl	LBB0_17
## %bb.16:                              ##   in Loop: Header=BB0_12 Depth=1
	movq	_PPSMC_STATEFLAG_DEEPSLEEP_BYPASS@GOTPCREL(%rip), %rax
LBB0_17:                                ##   in Loop: Header=BB0_12 Depth=1
	movl	(%rax), %eax
	movq	8(%rbx), %rcx
	movq	%r15, %rdx
	shlq	$5, %rdx
	orl	%eax, 24(%rcx,%rdx)
LBB0_18:                                ##   in Loop: Header=BB0_12 Depth=1
	leaq	(,%r15,4), %rsi
	addq	8(%r14), %rsi
	movq	%r15, %r12
	shlq	$5, %r12
	movq	8(%rbx), %rdx
	addq	%r12, %rdx
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_si_convert_power_level_to_smc
	movq	_SISLANDS_DRIVER_STATE_ARB_INDEX@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rdx
	addq	%r15, %rdx
	movq	8(%rbx), %rcx
	movq	%rdx, 16(%rcx,%r12)
	testl	%eax, %eax
	jne	LBB0_2
## %bb.19:                              ##   in Loop: Header=BB0_12 Depth=1
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	cmpl	$0, (%rax)
	je	LBB0_21
## %bb.20:                              ##   in Loop: Header=BB0_12 Depth=1
	movq	8(%r14), %rax
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	cmpl	%edx, (%rax,%r15,4)
	setl	%al
	jmp	LBB0_22
	.p2align	4, 0x90
LBB0_21:                                ##   in Loop: Header=BB0_12 Depth=1
	cmpq	$2, %r15
	setb	%al
LBB0_22:                                ##   in Loop: Header=BB0_12 Depth=1
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	movq	_PPSMC_DISPLAY_WATERMARK_HIGH@GOTPCREL(%rip), %rdx
	testb	%al, %al
	je	LBB0_24
## %bb.23:                              ##   in Loop: Header=BB0_12 Depth=1
	movq	_PPSMC_DISPLAY_WATERMARK_LOW@GOTPCREL(%rip), %rdx
	jmp	LBB0_24
LBB0_25:
	movq	_SI_SMC_SOFT_REGISTER_watermark_threshold@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	leal	511(%rcx), %eax
	testl	%ecx, %ecx
	cmovnsl	%ecx, %eax
	sarl	$9, %eax
	movslq	%eax, %rdx
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	movq	%r15, %rdi
	callq	_si_write_smc_soft_register
	movq	%r15, %rdi
	movq	-80(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rsi
	movq	%rbx, %rdx
	callq	_si_populate_smc_sp
	movq	%r15, %rdi
	movq	%r14, %rsi
	movq	%rbx, %rdx
	callq	_si_populate_power_containment_values
	testl	%eax, %eax
	movq	-72(%rbp), %r12                 ## 8-byte Reload
	je	LBB0_27
## %bb.26:
	movl	$0, (%r12)
LBB0_27:
	movq	%r15, %rdi
	movq	%r14, %rsi
	movq	%rbx, %rdx
	callq	_si_populate_sq_ramping_values
	testl	%eax, %eax
	je	LBB0_29
## %bb.28:
	movl	$0, 4(%r12)
LBB0_29:
	movq	%r15, %rdi
	movq	%r14, %rsi
	movq	%rbx, %rdx
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_si_populate_smc_t              ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_SISLANDS_MAX_HARDWARE_POWERLEVELS,4,2 ## @SISLANDS_MAX_HARDWARE_POWERLEVELS
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_PPSMC_SWSTATE_FLAG_UVD,4,2     ## @PPSMC_SWSTATE_FLAG_UVD
	.comm	_PPSMC_SWSTATE_FLAG_DC,4,2      ## @PPSMC_SWSTATE_FLAG_DC
	.comm	_SCLK_MIN_DEEPSLEEP_FREQ,8,3    ## @SCLK_MIN_DEEPSLEEP_FREQ
	.comm	_PPSMC_STATEFLAG_DEEPSLEEP_BYPASS,4,2 ## @PPSMC_STATEFLAG_DEEPSLEEP_BYPASS
	.comm	_PPSMC_STATEFLAG_DEEPSLEEP_THROTTLE,4,2 ## @PPSMC_STATEFLAG_DEEPSLEEP_THROTTLE
	.comm	_SISLANDS_DRIVER_STATE_ARB_INDEX,8,3 ## @SISLANDS_DRIVER_STATE_ARB_INDEX
	.comm	_PPSMC_DISPLAY_WATERMARK_LOW,8,3 ## @PPSMC_DISPLAY_WATERMARK_LOW
	.comm	_PPSMC_DISPLAY_WATERMARK_HIGH,8,3 ## @PPSMC_DISPLAY_WATERMARK_HIGH
	.comm	_SISLANDS_MCREGISTERTABLE_FIRST_DRIVERSTATE_SLOT,8,3 ## @SISLANDS_MCREGISTERTABLE_FIRST_DRIVERSTATE_SLOT
	.comm	_SI_SMC_SOFT_REGISTER_watermark_threshold,4,2 ## @SI_SMC_SOFT_REGISTER_watermark_threshold
	.no_dead_strip	_si_convert_power_state_to_smc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function si_convert_power_state_to_smc
_si_convert_power_state_to_smc:         ; @si_convert_power_state_to_smc
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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, x2
	mov	x20, x1
	mov	x21, x0
	bl	_evergreen_get_pi
	mov	x23, x0
	mov	x0, x21
	bl	_ni_get_pi
	mov	x22, x0
	mov	x0, x21
	bl	_si_get_pi
	mov	x24, x0
	mov	x0, x20
	bl	_si_get_ps
	ldr	w8, [x0]
Lloh0:
	adrp	x9, _SISLANDS_MAX_HARDWARE_POWERLEVELS@GOTPAGE
Lloh1:
	ldr	x9, [x9, _SISLANDS_MAX_HARDWARE_POWERLEVELS@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	cmp	w8, w9
	b.le	LBB0_3
; %bb.1:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_2:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_3:
	mov	x25, x0
	ldr	x9, [x0, #8]
	sub	w10, w8, #1
	ldr	w26, [x9, w10, sxtw #2]
	ldr	x9, [x20, #8]
	cbz	x9, LBB0_7
; %bb.4:
	ldr	x9, [x20]
	cbz	x9, LBB0_7
; %bb.5:
	mov	w9, #1
	str	w9, [x23]
	ldr	x9, [x23, #24]
	cbz	x9, LBB0_8
; %bb.6:
Lloh6:
	adrp	x9, _PPSMC_SWSTATE_FLAG_UVD@GOTPAGE
Lloh7:
	ldr	x9, [x9, _PPSMC_SWSTATE_FLAG_UVD@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	ldr	w10, [x19, #16]
	orr	w9, w10, w9
	str	w9, [x19, #16]
	b	LBB0_8
LBB0_7:
	str	wzr, [x23]
LBB0_8:
	stp	x20, x24, [sp]                  ; 16-byte Folded Spill
	ldr	x9, [x25, #16]
	cbz	x9, LBB0_10
; %bb.9:
Lloh9:
	adrp	x9, _PPSMC_SWSTATE_FLAG_DC@GOTPAGE
Lloh10:
	ldr	x9, [x9, _PPSMC_SWSTATE_FLAG_DC@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	ldr	w10, [x19, #16]
	orr	w9, w10, w9
	str	w9, [x19, #16]
LBB0_10:
	str	xzr, [x19]
	cmp	w8, #1
	b.lt	LBB0_21
; %bb.11:
	mov	x27, #0
	mov	x28, #0
	mov	x24, #0
Lloh12:
	adrp	x20, _SISLANDS_DRIVER_STATE_ARB_INDEX@GOTPAGE
Lloh13:
	ldr	x20, [x20, _SISLANDS_DRIVER_STATE_ARB_INDEX@GOTPAGEOFF]
	b	LBB0_14
LBB0_12:                                ;   in Loop: Header=BB0_14 Depth=1
	cmp	x24, #2
	cset	w9, lo
LBB0_13:                                ;   in Loop: Header=BB0_14 Depth=1
	cmp	w9, #0
Lloh14:
	adrp	x9, _PPSMC_DISPLAY_WATERMARK_LOW@GOTPAGE
Lloh15:
	ldr	x9, [x9, _PPSMC_DISPLAY_WATERMARK_LOW@GOTPAGEOFF]
Lloh16:
	adrp	x10, _PPSMC_DISPLAY_WATERMARK_HIGH@GOTPAGE
Lloh17:
	ldr	x10, [x10, _PPSMC_DISPLAY_WATERMARK_HIGH@GOTPAGEOFF]
	csel	x9, x9, x10, ne
	ldr	x9, [x9]
	add	x8, x8, x28
	str	x9, [x8, #8]
	ldr	x9, [x23, #8]
Lloh18:
	adrp	x10, _SISLANDS_MCREGISTERTABLE_FIRST_DRIVERSTATE_SLOT@GOTPAGE
Lloh19:
	ldr	x10, [x10, _SISLANDS_MCREGISTERTABLE_FIRST_DRIVERSTATE_SLOT@GOTPAGEOFF]
Lloh20:
	ldr	x10, [x10]
	add	x10, x24, x10
	cmp	x9, #0
	csel	x9, xzr, x10, eq
	str	x9, [x8]
	ldr	x8, [x19]
	add	x8, x8, #1
	str	x8, [x19]
	add	x24, x24, #1
	ldrsw	x8, [x25]
	add	x28, x28, #32
	add	x27, x27, #4
	cmp	x24, x8
	b.ge	LBB0_21
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x23, #16]
	cbz	x8, LBB0_18
; %bb.15:                               ;   in Loop: Header=BB0_14 Depth=1
	cbz	x28, LBB0_17
; %bb.16:                               ;   in Loop: Header=BB0_14 Depth=1
	ldr	x8, [sp, #8]                    ; 8-byte Folded Reload
	ldr	x8, [x8]
	cbz	x8, LBB0_18
LBB0_17:                                ;   in Loop: Header=BB0_14 Depth=1
Lloh21:
	adrp	x8, _SCLK_MIN_DEEPSLEEP_FREQ@GOTPAGE
Lloh22:
	ldr	x8, [x8, _SCLK_MIN_DEEPSLEEP_FREQ@GOTPAGEOFF]
Lloh23:
	ldr	x8, [x8]
	cmp	x8, #1349
Lloh24:
	adrp	x8, _PPSMC_STATEFLAG_DEEPSLEEP_BYPASS@GOTPAGE
Lloh25:
	ldr	x8, [x8, _PPSMC_STATEFLAG_DEEPSLEEP_BYPASS@GOTPAGEOFF]
Lloh26:
	adrp	x9, _PPSMC_STATEFLAG_DEEPSLEEP_THROTTLE@GOTPAGE
Lloh27:
	ldr	x9, [x9, _PPSMC_STATEFLAG_DEEPSLEEP_THROTTLE@GOTPAGEOFF]
	csel	x8, x8, x9, gt
	ldr	w8, [x8]
	ldr	x9, [x19, #8]
	add	x9, x9, x28
	ldr	w10, [x9, #24]
	orr	w8, w10, w8
	str	w8, [x9, #24]
LBB0_18:                                ;   in Loop: Header=BB0_14 Depth=1
	ldr	x8, [x25, #8]
	add	x1, x8, x27
	ldr	x8, [x19, #8]
	add	x2, x8, x28
	mov	x0, x21
	bl	_si_convert_power_level_to_smc
	ldr	x8, [x20]
	add	x9, x24, x8
	ldr	x8, [x19, #8]
	add	x10, x8, x28
	str	x9, [x10, #16]
	cbnz	w0, LBB0_2
; %bb.19:                               ;   in Loop: Header=BB0_14 Depth=1
	ldr	w9, [x22]
	cbz	w9, LBB0_12
; %bb.20:                               ;   in Loop: Header=BB0_14 Depth=1
	ldr	x9, [x25, #8]
	ldr	w9, [x9, x24, lsl #2]
	cmp	w9, w26
	cset	w9, lt
	b	LBB0_13
LBB0_21:
Lloh28:
	adrp	x8, _SI_SMC_SOFT_REGISTER_watermark_threshold@GOTPAGE
Lloh29:
	ldr	x8, [x8, _SI_SMC_SOFT_REGISTER_watermark_threshold@GOTPAGEOFF]
Lloh30:
	ldr	w1, [x8]
	add	w8, w26, #511
	cmp	w26, #0
	csel	w8, w8, w26, lt
	sbfx	x2, x8, #9, #23
	mov	x0, x21
	bl	_si_write_smc_soft_register
	mov	x0, x21
	ldr	x20, [sp]                       ; 8-byte Folded Reload
	mov	x1, x20
	mov	x2, x19
	bl	_si_populate_smc_sp
	mov	x0, x21
	mov	x1, x20
	mov	x2, x19
	bl	_si_populate_power_containment_values
	cbz	w0, LBB0_23
; %bb.22:
	str	wzr, [x22]
LBB0_23:
	mov	x0, x21
	mov	x1, x20
	mov	x2, x19
	bl	_si_populate_sq_ramping_values
	cbz	w0, LBB0_25
; %bb.24:
	str	wzr, [x22, #4]
LBB0_25:
	mov	x0, x21
	mov	x1, x20
	mov	x2, x19
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	b	_si_populate_smc_t
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.comm	_SISLANDS_MAX_HARDWARE_POWERLEVELS,4,2 ; @SISLANDS_MAX_HARDWARE_POWERLEVELS
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_PPSMC_SWSTATE_FLAG_UVD,4,2     ; @PPSMC_SWSTATE_FLAG_UVD
	.comm	_PPSMC_SWSTATE_FLAG_DC,4,2      ; @PPSMC_SWSTATE_FLAG_DC
	.comm	_SCLK_MIN_DEEPSLEEP_FREQ,8,3    ; @SCLK_MIN_DEEPSLEEP_FREQ
	.comm	_PPSMC_STATEFLAG_DEEPSLEEP_BYPASS,4,2 ; @PPSMC_STATEFLAG_DEEPSLEEP_BYPASS
	.comm	_PPSMC_STATEFLAG_DEEPSLEEP_THROTTLE,4,2 ; @PPSMC_STATEFLAG_DEEPSLEEP_THROTTLE
	.comm	_SISLANDS_DRIVER_STATE_ARB_INDEX,8,3 ; @SISLANDS_DRIVER_STATE_ARB_INDEX
	.comm	_PPSMC_DISPLAY_WATERMARK_LOW,8,3 ; @PPSMC_DISPLAY_WATERMARK_LOW
	.comm	_PPSMC_DISPLAY_WATERMARK_HIGH,8,3 ; @PPSMC_DISPLAY_WATERMARK_HIGH
	.comm	_SISLANDS_MCREGISTERTABLE_FIRST_DRIVERSTATE_SLOT,8,3 ; @SISLANDS_MCREGISTERTABLE_FIRST_DRIVERSTATE_SLOT
	.comm	_SI_SMC_SOFT_REGISTER_watermark_threshold,4,2 ; @SI_SMC_SOFT_REGISTER_watermark_threshold
	.no_dead_strip	_si_convert_power_state_to_smc
.subsections_via_symbols
