	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_kv_dpm_set_power_state         ## -- Begin function kv_dpm_set_power_state
	.p2align	4, 0x90
_kv_dpm_set_power_state:                ## @kv_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	_kv_get_pi
	movq	%rax, %r15
	cmpq	$0, 8(%rax)
	je	LBB0_3
## %bb.1:
	movl	8(%rbx), %esi
	movq	%rbx, %rdi
	callq	_kv_smc_bapm_enable
	testl	%eax, %eax
	je	LBB0_3
## %bb.2:
	movl	%eax, %r14d
	leaq	L_.str(%rip), %rdi
	callq	_DRM_ERROR
	jmp	LBB0_18
LBB0_3:
	movq	%r15, %rax
	leaq	20(%r15), %r12
	addq	$16, %r15
	movq	(%rbx), %rcx
	movq	_CHIP_KABINI@GOTPCREL(%rip), %rdx
	movq	_CHIP_MULLINS@GOTPCREL(%rip), %rsi
	movq	(%rax), %rax
	cmpq	(%rdx), %rcx
	je	LBB0_5
## %bb.4:
	cmpq	(%rsi), %rcx
	je	LBB0_5
## %bb.11:
	testq	%rax, %rax
	je	LBB0_12
## %bb.13:
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_kv_set_valid_clock_range
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_kv_update_dfs_bypass_settings
	movq	%rbx, %rdi
	callq	_kv_calculate_ds_divider
	testl	%eax, %eax
	je	LBB0_15
## %bb.14:
	movl	%eax, %r14d
	leaq	L_.str.1(%rip), %rdi
	callq	_DRM_ERROR
	jmp	LBB0_18
LBB0_5:
	xorl	%r14d, %r14d
	testq	%rax, %rax
	je	LBB0_18
## %bb.6:
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_kv_set_valid_clock_range
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_kv_update_dfs_bypass_settings
	movq	%rbx, %rdi
	callq	_kv_calculate_ds_divider
	testl	%eax, %eax
	je	LBB0_8
## %bb.7:
	movl	%eax, %r13d
	leaq	L_.str.1(%rip), %rdi
	callq	_DRM_ERROR
	movl	%r13d, %r14d
	jmp	LBB0_18
LBB0_12:
	xorl	%r14d, %r14d
	jmp	LBB0_18
LBB0_15:
	movq	%rbx, %rdi
	callq	_kv_calculate_nbps_level_settings
	movq	%rbx, %rdi
	callq	_kv_calculate_dpm_settings
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_kv_freeze_sclk_dpm
	movq	%rbx, %rdi
	callq	_kv_upload_dpm_settings
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_kv_program_nbps_index_settings
	xorl	%r14d, %r14d
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_kv_freeze_sclk_dpm
	movq	%rbx, %rdi
	callq	_kv_set_enabled_levels
	movq	%rbx, %rdi
	movq	%r12, %rsi
	movq	%r15, %rdx
	callq	_kv_update_vce_dpm
	testl	%eax, %eax
	jne	LBB0_9
## %bb.16:
	movq	%rbx, %rdi
	callq	_kv_update_acp_boot_level
	movq	%rbx, %rdi
	callq	_kv_update_sclk_t
	jmp	LBB0_17
LBB0_8:
	movq	%rbx, %rdi
	callq	_kv_calculate_nbps_level_settings
	movq	%rbx, %rdi
	callq	_kv_calculate_dpm_settings
	movq	%rbx, %rdi
	callq	_kv_force_lowest_valid
	movq	%rbx, %rdi
	callq	_kv_enable_new_levels
	movq	%rbx, %rdi
	callq	_kv_upload_dpm_settings
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_kv_program_nbps_index_settings
	movq	%rbx, %rdi
	callq	_kv_unforce_levels
	movq	%rbx, %rdi
	callq	_kv_set_enabled_levels
	movq	%rbx, %rdi
	callq	_kv_force_lowest_valid
	movq	%rbx, %rdi
	callq	_kv_unforce_levels
	movq	%rbx, %rdi
	movq	%r12, %rsi
	movq	%r15, %rdx
	callq	_kv_update_vce_dpm
	testl	%eax, %eax
	je	LBB0_10
LBB0_9:
	movl	%eax, %r15d
	leaq	L_.str.2(%rip), %rdi
	callq	_DRM_ERROR
	movl	%r15d, %r14d
	jmp	LBB0_18
LBB0_10:
	movq	%rbx, %rdi
	callq	_kv_update_sclk_t
	movq	(%rbx), %rax
	movq	_CHIP_MULLINS@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_18
LBB0_17:
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_kv_enable_nb_dpm
LBB0_18:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"kv_smc_bapm_enable failed\n"

	.comm	_CHIP_KABINI,8,3                ## @CHIP_KABINI
	.comm	_CHIP_MULLINS,8,3               ## @CHIP_MULLINS
L_.str.1:                               ## @.str.1
	.asciz	"kv_calculate_ds_divider failed\n"

L_.str.2:                               ## @.str.2
	.asciz	"kv_update_vce_dpm failed\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_kv_dpm_set_power_state         ; -- Begin function kv_dpm_set_power_state
	.p2align	2
_kv_dpm_set_power_state:                ; @kv_dpm_set_power_state
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x19, x0
	bl	_kv_get_pi
	mov	x23, x0
	ldr	x8, [x0, #8]
	cbz	x8, LBB0_3
; %bb.1:
	ldr	w1, [x19, #8]
	mov	x0, x19
	bl	_kv_smc_bapm_enable
	cbz	w0, LBB0_3
; %bb.2:
	mov	x22, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_ERROR
	b	LBB0_16
LBB0_3:
	add	x20, x23, #20
	add	x21, x23, #16
	ldr	x9, [x19]
Lloh2:
	adrp	x8, _CHIP_KABINI@GOTPAGE
Lloh3:
	ldr	x8, [x8, _CHIP_KABINI@GOTPAGEOFF]
Lloh4:
	ldr	x10, [x8]
Lloh5:
	adrp	x24, _CHIP_MULLINS@GOTPAGE
Lloh6:
	ldr	x24, [x24, _CHIP_MULLINS@GOTPAGEOFF]
	ldr	x11, [x24]
	ldr	x8, [x23]
	cmp	x9, x10
	ccmp	x9, x11, #4, ne
	b.ne	LBB0_8
; %bb.4:
	cbz	x8, LBB0_15
; %bb.5:
	mov	x0, x19
	mov	x1, x20
	bl	_kv_set_valid_clock_range
	mov	x0, x19
	mov	x1, x20
	bl	_kv_update_dfs_bypass_settings
	mov	x0, x19
	bl	_kv_calculate_ds_divider
	cbnz	w0, LBB0_10
; %bb.6:
	mov	x0, x19
	bl	_kv_calculate_nbps_level_settings
	mov	x0, x19
	bl	_kv_calculate_dpm_settings
	mov	x0, x19
	bl	_kv_force_lowest_valid
	mov	x0, x19
	bl	_kv_enable_new_levels
	mov	x0, x19
	bl	_kv_upload_dpm_settings
	mov	x0, x19
	mov	x1, x20
	bl	_kv_program_nbps_index_settings
	mov	x0, x19
	bl	_kv_unforce_levels
	mov	x0, x19
	bl	_kv_set_enabled_levels
	mov	x0, x19
	bl	_kv_force_lowest_valid
	mov	x0, x19
	bl	_kv_unforce_levels
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_kv_update_vce_dpm
	cbz	w0, LBB0_13
; %bb.7:
	mov	x22, x0
	b	LBB0_12
LBB0_8:
	cbz	x8, LBB0_15
; %bb.9:
	mov	x0, x19
	mov	x1, x20
	bl	_kv_set_valid_clock_range
	mov	x0, x19
	mov	x1, x20
	bl	_kv_update_dfs_bypass_settings
	mov	x0, x19
	bl	_kv_calculate_ds_divider
	cbz	w0, LBB0_11
LBB0_10:
	mov	x22, x0
Lloh7:
	adrp	x0, l_.str.1@PAGE
Lloh8:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_DRM_ERROR
	b	LBB0_16
LBB0_11:
	mov	x0, x19
	bl	_kv_calculate_nbps_level_settings
	mov	x0, x19
	bl	_kv_calculate_dpm_settings
	mov	x0, x19
	mov	w1, #1
	bl	_kv_freeze_sclk_dpm
	mov	x0, x19
	bl	_kv_upload_dpm_settings
	mov	x0, x19
	mov	x1, x20
	bl	_kv_program_nbps_index_settings
	mov	x0, x19
	mov	w1, #0
	bl	_kv_freeze_sclk_dpm
	mov	x0, x19
	bl	_kv_set_enabled_levels
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_kv_update_vce_dpm
	mov	x22, x0
	cbz	w0, LBB0_17
LBB0_12:
Lloh9:
	adrp	x0, l_.str.2@PAGE
Lloh10:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_DRM_ERROR
	b	LBB0_16
LBB0_13:
	mov	x0, x19
	bl	_kv_update_sclk_t
	ldr	x8, [x19]
	ldr	x9, [x24]
	cmp	x8, x9
	b.ne	LBB0_15
; %bb.14:
	mov	x0, x19
	mov	w1, #1
	bl	_kv_enable_nb_dpm
LBB0_15:
	mov	w22, #0
LBB0_16:
	mov	x0, x22
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_17:
	mov	x0, x19
	bl	_kv_update_acp_boot_level
	mov	x0, x19
	bl	_kv_update_sclk_t
	mov	x0, x19
	mov	w1, #1
	bl	_kv_enable_nb_dpm
	b	LBB0_16
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"kv_smc_bapm_enable failed\n"

	.comm	_CHIP_KABINI,8,3                ; @CHIP_KABINI
	.comm	_CHIP_MULLINS,8,3               ; @CHIP_MULLINS
l_.str.1:                               ; @.str.1
	.asciz	"kv_calculate_ds_divider failed\n"

l_.str.2:                               ; @.str.2
	.asciz	"kv_update_vce_dpm failed\n"

.subsections_via_symbols
