	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_rv6xx_dpm_set_power_state      ## -- Begin function rv6xx_dpm_set_power_state
	.p2align	4, 0x90
_rv6xx_dpm_set_power_state:             ## @rv6xx_dpm_set_power_state
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	callq	_rv6xx_get_pi
	movq	%rax, %r12
	movq	8(%rbx), %r14
	movq	16(%rbx), %r15
	movq	$0, 24(%rax)
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	_rv6xx_set_uvd_clock_before_set_eng_clock
	movq	%rbx, %rdi
	callq	_rv6xx_clear_vc
	movq	_R600_POWER_LEVEL_LOW@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	movq	%rbx, %rdi
	movl	$1, %edx
	callq	_r600_power_level_enable
	movq	%rbx, %rdi
	movl	$65535, %esi                    ## imm = 0xFFFF
	movl	$65535, %edx                    ## imm = 0xFFFF
	movl	$65535, %ecx                    ## imm = 0xFFFF
	movl	$65535, %r8d                    ## imm = 0xFFFF
	callq	_r600_set_at
	cmpq	$0, (%r12)
	je	LBB0_2
## %bb.1:
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_r600_enable_thermal_protection
LBB0_2:
	movl	(%r13), %esi
	movq	%rbx, %rdi
	callq	_r600_wait_for_power_level
	movq	_R600_POWER_LEVEL_HIGH@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_r600_power_level_enable
	movq	_R600_POWER_LEVEL_MEDIUM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_r600_power_level_enable
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	_rv6xx_generate_transition_stepping
	movq	%rbx, %rdi
	callq	_rv6xx_program_power_level_medium_for_transition
	cmpq	$0, 16(%r12)
	je	LBB0_5
## %bb.3:
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	_rv6xx_set_sw_voltage_to_safe
	movq	_ATOM_PP_PLATFORM_CAP_STEPVDDC@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rbx)
	je	LBB0_5
## %bb.4:
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_rv6xx_set_sw_voltage_to_low
LBB0_5:
	movq	_ATOM_PP_PLATFORM_CAP_BACKBIAS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rbx)
	je	LBB0_7
## %bb.6:
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	_rv6xx_set_safe_backbias
LBB0_7:
	cmpq	$0, 8(%r12)
	je	LBB0_9
## %bb.8:
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	_rv6xx_set_safe_pcie_gen2
LBB0_9:
	cmpq	$0, 16(%r12)
	je	LBB0_11
## %bb.10:
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_rv6xx_enable_dynamic_voltage_control
LBB0_11:
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	movq	_ATOM_PP_PLATFORM_CAP_BACKBIAS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rbx)
	je	LBB0_13
## %bb.12:
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_rv6xx_enable_dynamic_backbias_control
LBB0_13:
	movq	%r13, %r14
	cmpq	$0, 16(%r12)
	je	LBB0_17
## %bb.14:
	movq	_ATOM_PP_PLATFORM_CAP_STEPVDDC@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rbx)
	je	LBB0_16
## %bb.15:
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	callq	_rv6xx_step_voltage_if_increasing
LBB0_16:
	movl	$999, %eax                      ## imm = 0x3E7
	addl	4(%rbx), %eax
	cltq
	imulq	$274877907, %rax, %rdi          ## imm = 0x10624DD3
	movq	%rdi, %rax
	shrq	$63, %rax
	sarq	$38, %rdi
	addl	%eax, %edi
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_msleep
LBB0_17:
	movq	_R600_POWER_LEVEL_MEDIUM@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	movq	%rbx, %rdi
	movl	$1, %edx
	callq	_r600_power_level_enable
	movl	(%r14), %esi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_r600_power_level_enable
	movl	(%r14), %esi
	movq	%rbx, %rdi
	callq	_r600_wait_for_power_level_unequal
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_rv6xx_generate_low_step
	movq	%rbx, %rdi
	callq	_rv6xx_invalidate_intermediate_steps
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_rv6xx_calculate_stepping_parameters
	movq	%rbx, %rdi
	callq	_rv6xx_program_stepping_parameters_lowest_entry
	movq	%rbx, %rdi
	callq	_rv6xx_program_power_level_low_to_lowest_state
	movl	(%r14), %esi
	movq	%rbx, %rdi
	movl	$1, %edx
	callq	_r600_power_level_enable
	movl	(%r14), %esi
	movq	%rbx, %rdi
	callq	_r600_wait_for_power_level
	movl	(%r13), %esi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_r600_power_level_enable
	cmpq	$0, 16(%r12)
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	je	LBB0_21
## %bb.18:
	movq	_ATOM_PP_PLATFORM_CAP_STEPVDDC@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rbx)
	je	LBB0_20
## %bb.19:
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	_rv6xx_step_voltage_if_decreasing
	testl	%eax, %eax
	jne	LBB0_28
LBB0_20:
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_rv6xx_enable_dynamic_voltage_control
LBB0_21:
	movq	_ATOM_PP_PLATFORM_CAP_BACKBIAS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rbx)
	je	LBB0_23
## %bb.22:
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_rv6xx_enable_dynamic_backbias_control
LBB0_23:
	cmpq	$0, 8(%r12)
	je	LBB0_25
## %bb.24:
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movl	$1, %edx
	callq	_rv6xx_enable_dynamic_pcie_gen2
LBB0_25:
	movq	%rbx, %rdi
	callq	_rv6xx_reset_lvtm_data_sync
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_rv6xx_generate_stepping_table
	movq	%rbx, %rdi
	callq	_rv6xx_program_stepping_parameters_except_lowest_entry
	movq	%rbx, %rdi
	callq	_rv6xx_program_power_level_low
	movq	%rbx, %rdi
	callq	_rv6xx_program_power_level_medium
	movq	%rbx, %rdi
	callq	_rv6xx_program_power_level_high
	movq	%rbx, %rdi
	callq	_rv6xx_enable_medium
	movq	%rbx, %rdi
	callq	_rv6xx_enable_high
	cmpq	$0, (%r12)
	je	LBB0_27
## %bb.26:
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_rv6xx_enable_thermal_protection
LBB0_27:
	movq	%rbx, %rdi
	callq	_rv6xx_program_vc
	movq	%rbx, %rdi
	callq	_rv6xx_program_at
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	_rv6xx_set_uvd_clock_after_set_eng_clock
	xorl	%eax, %eax
LBB0_28:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_R600_POWER_LEVEL_LOW,4,2       ## @R600_POWER_LEVEL_LOW
	.comm	_R600_POWER_LEVEL_HIGH,4,2      ## @R600_POWER_LEVEL_HIGH
	.comm	_R600_POWER_LEVEL_MEDIUM,4,2    ## @R600_POWER_LEVEL_MEDIUM
	.comm	_ATOM_PP_PLATFORM_CAP_STEPVDDC,4,2 ## @ATOM_PP_PLATFORM_CAP_STEPVDDC
	.comm	_ATOM_PP_PLATFORM_CAP_BACKBIAS,4,2 ## @ATOM_PP_PLATFORM_CAP_BACKBIAS
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_rv6xx_dpm_set_power_state      ; -- Begin function rv6xx_dpm_set_power_state
	.p2align	2
_rv6xx_dpm_set_power_state:             ; @rv6xx_dpm_set_power_state
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x19, x0
	bl	_rv6xx_get_pi
	mov	x22, x0
	ldp	x21, x20, [x19, #8]
	str	xzr, [x0, #24]
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_rv6xx_set_uvd_clock_before_set_eng_clock
	mov	x0, x19
	bl	_rv6xx_clear_vc
Lloh0:
	adrp	x23, _R600_POWER_LEVEL_LOW@GOTPAGE
Lloh1:
	ldr	x23, [x23, _R600_POWER_LEVEL_LOW@GOTPAGEOFF]
	ldr	w1, [x23]
	mov	x0, x19
	mov	w2, #1
	bl	_r600_power_level_enable
	mov	x0, x19
	mov	w1, #65535
	mov	w2, #65535
	mov	w3, #65535
	mov	w4, #65535
	bl	_r600_set_at
	ldr	x8, [x22]
	cbz	x8, LBB0_2
; %bb.1:
	mov	x0, x19
	mov	w1, #0
	bl	_r600_enable_thermal_protection
LBB0_2:
	ldr	w1, [x23]
	mov	x0, x19
	bl	_r600_wait_for_power_level
Lloh2:
	adrp	x8, _R600_POWER_LEVEL_HIGH@GOTPAGE
Lloh3:
	ldr	x8, [x8, _R600_POWER_LEVEL_HIGH@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_r600_power_level_enable
Lloh5:
	adrp	x24, _R600_POWER_LEVEL_MEDIUM@GOTPAGE
Lloh6:
	ldr	x24, [x24, _R600_POWER_LEVEL_MEDIUM@GOTPAGEOFF]
	ldr	w1, [x24]
	mov	x0, x19
	mov	w2, #0
	bl	_r600_power_level_enable
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_rv6xx_generate_transition_stepping
	mov	x0, x19
	bl	_rv6xx_program_power_level_medium_for_transition
	ldr	x8, [x22, #16]
Lloh7:
	adrp	x26, _ATOM_PP_PLATFORM_CAP_STEPVDDC@GOTPAGE
Lloh8:
	ldr	x26, [x26, _ATOM_PP_PLATFORM_CAP_STEPVDDC@GOTPAGEOFF]
	cbz	x8, LBB0_5
; %bb.3:
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_rv6xx_set_sw_voltage_to_safe
	ldr	w8, [x19]
	ldr	w9, [x26]
	tst	w9, w8
	b.eq	LBB0_5
; %bb.4:
	mov	x0, x19
	mov	x1, x21
	bl	_rv6xx_set_sw_voltage_to_low
LBB0_5:
	ldr	w8, [x19]
Lloh9:
	adrp	x25, _ATOM_PP_PLATFORM_CAP_BACKBIAS@GOTPAGE
Lloh10:
	ldr	x25, [x25, _ATOM_PP_PLATFORM_CAP_BACKBIAS@GOTPAGEOFF]
	ldr	w9, [x25]
	tst	w9, w8
	b.eq	LBB0_7
; %bb.6:
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_rv6xx_set_safe_backbias
LBB0_7:
	ldr	x8, [x22, #8]
	cbz	x8, LBB0_9
; %bb.8:
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_rv6xx_set_safe_pcie_gen2
LBB0_9:
	ldr	x8, [x22, #16]
	cbz	x8, LBB0_11
; %bb.10:
	mov	x0, x19
	mov	w1, #0
	bl	_rv6xx_enable_dynamic_voltage_control
LBB0_11:
	ldr	w8, [x19]
	ldr	w9, [x25]
	tst	w9, w8
	b.eq	LBB0_13
; %bb.12:
	mov	x0, x19
	mov	w1, #0
	bl	_rv6xx_enable_dynamic_backbias_control
LBB0_13:
	ldr	x8, [x22, #16]
	cbz	x8, LBB0_17
; %bb.14:
	ldr	w8, [x19]
	ldr	w9, [x26]
	tst	w9, w8
	b.eq	LBB0_16
; %bb.15:
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_rv6xx_step_voltage_if_increasing
LBB0_16:
	ldr	w8, [x19, #4]
	add	w8, w8, #999
	mov	w9, #19923
	movk	w9, #4194, lsl #16
	smull	x8, w8, w9
	lsr	x9, x8, #63
	asr	x8, x8, #38
	add	w0, w8, w9
	bl	_msleep
LBB0_17:
	ldr	w1, [x24]
	mov	x0, x19
	mov	w2, #1
	bl	_r600_power_level_enable
	ldr	w1, [x23]
	mov	x0, x19
	mov	w2, #0
	bl	_r600_power_level_enable
	ldr	w1, [x23]
	mov	x0, x19
	bl	_r600_wait_for_power_level_unequal
	mov	x0, x19
	mov	x1, x20
	bl	_rv6xx_generate_low_step
	mov	x0, x19
	bl	_rv6xx_invalidate_intermediate_steps
	mov	x0, x19
	mov	x1, x20
	bl	_rv6xx_calculate_stepping_parameters
	mov	x0, x19
	bl	_rv6xx_program_stepping_parameters_lowest_entry
	mov	x0, x19
	bl	_rv6xx_program_power_level_low_to_lowest_state
	ldr	w1, [x23]
	mov	x0, x19
	mov	w2, #1
	bl	_r600_power_level_enable
	ldr	w1, [x23]
	mov	x0, x19
	bl	_r600_wait_for_power_level
	ldr	w1, [x24]
	mov	x0, x19
	mov	w2, #0
	bl	_r600_power_level_enable
	ldr	x8, [x22, #16]
	cbz	x8, LBB0_21
; %bb.18:
	ldr	w8, [x19]
	ldr	w9, [x26]
	tst	w9, w8
	b.eq	LBB0_20
; %bb.19:
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_rv6xx_step_voltage_if_decreasing
	cbnz	w0, LBB0_28
LBB0_20:
	mov	x0, x19
	mov	w1, #1
	bl	_rv6xx_enable_dynamic_voltage_control
LBB0_21:
	ldr	w8, [x19]
	ldr	w9, [x25]
	tst	w9, w8
	b.eq	LBB0_23
; %bb.22:
	mov	x0, x19
	mov	w1, #1
	bl	_rv6xx_enable_dynamic_backbias_control
LBB0_23:
	ldr	x8, [x22, #8]
	cbz	x8, LBB0_25
; %bb.24:
	mov	x0, x19
	mov	x1, x20
	mov	w2, #1
	bl	_rv6xx_enable_dynamic_pcie_gen2
LBB0_25:
	mov	x0, x19
	bl	_rv6xx_reset_lvtm_data_sync
	mov	x0, x19
	mov	x1, x20
	bl	_rv6xx_generate_stepping_table
	mov	x0, x19
	bl	_rv6xx_program_stepping_parameters_except_lowest_entry
	mov	x0, x19
	bl	_rv6xx_program_power_level_low
	mov	x0, x19
	bl	_rv6xx_program_power_level_medium
	mov	x0, x19
	bl	_rv6xx_program_power_level_high
	mov	x0, x19
	bl	_rv6xx_enable_medium
	mov	x0, x19
	bl	_rv6xx_enable_high
	ldr	x8, [x22]
	cbz	x8, LBB0_27
; %bb.26:
	mov	x0, x19
	mov	w1, #1
	bl	_rv6xx_enable_thermal_protection
LBB0_27:
	mov	x0, x19
	bl	_rv6xx_program_vc
	mov	x0, x19
	bl	_rv6xx_program_at
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_rv6xx_set_uvd_clock_after_set_eng_clock
	mov	w0, #0
LBB0_28:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_R600_POWER_LEVEL_LOW,4,2       ; @R600_POWER_LEVEL_LOW
	.comm	_R600_POWER_LEVEL_HIGH,4,2      ; @R600_POWER_LEVEL_HIGH
	.comm	_R600_POWER_LEVEL_MEDIUM,4,2    ; @R600_POWER_LEVEL_MEDIUM
	.comm	_ATOM_PP_PLATFORM_CAP_STEPVDDC,4,2 ; @ATOM_PP_PLATFORM_CAP_STEPVDDC
	.comm	_ATOM_PP_PLATFORM_CAP_BACKBIAS,4,2 ; @ATOM_PP_PLATFORM_CAP_BACKBIAS
.subsections_via_symbols
