	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_smu_adjust_power_state_dynamic ## -- Begin function smu_adjust_power_state_dynamic
	.p2align	4, 0x90
_smu_adjust_power_state_dynamic:        ## @smu_adjust_power_state_dynamic
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	cmpl	$0, 20(%rdi)
	je	LBB0_1
## %bb.2:
	movl	%esi, %r15d
	movq	%rdi, %r14
	testl	%edx, %edx
	je	LBB0_3
## %bb.5:
	callq	_smu_apply_clocks_adjust_rules
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_10
LBB0_6:
	leaq	L_.str.1(%rip), %rdi
	callq	_pr_err
	jmp	LBB0_18
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_18
LBB0_3:
	callq	_smu_display_config_changed
	testl	%eax, %eax
	je	LBB0_7
## %bb.4:
	movl	%eax, %ebx
	leaq	L_.str(%rip), %rdi
	callq	_pr_err
	jmp	LBB0_18
LBB0_7:
	movq	%r14, %rdi
	callq	_smu_apply_clocks_adjust_rules
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_6
## %bb.8:
	movq	%r14, %rdi
	callq	_smu_notify_smc_dispaly_config
	testl	%eax, %eax
	je	LBB0_10
## %bb.9:
	movl	%eax, %ebx
	leaq	L_.str.2(%rip), %rdi
	callq	_pr_err
	jmp	LBB0_18
LBB0_10:
	cmpl	%r15d, 24(%r14)
	je	LBB0_15
## %bb.11:
	movq	%r14, %rdi
	movl	%r15d, %esi
	callq	_smu_asic_set_performance_level
	testl	%eax, %eax
	je	LBB0_14
## %bb.12:
	movq	%r14, %rdi
	movl	%r15d, %esi
	callq	_smu_default_set_performance_level
	testl	%eax, %eax
	je	LBB0_14
## %bb.13:
	movl	%eax, %ebx
	leaq	L_.str.3(%rip), %rdi
	callq	_pr_err
	jmp	LBB0_18
LBB0_14:
	movl	%r15d, 24(%r14)
LBB0_15:
	movslq	%r15d, %rax
	movq	_AMD_DPM_FORCED_LEVEL_MANUAL@GOTPCREL(%rip), %rcx
	xorl	%ebx, %ebx
	cmpq	%rax, (%rcx)
	je	LBB0_18
## %bb.16:
	movl	16(%r14), %edi
	callq	_fls
                                        ## kill: def $eax killed $eax def $rax
	movq	_WORKLOAD_POLICY_MAX@GOTPCREL(%rip), %rcx
	leal	-1(%rax), %edx
	xorl	%ebx, %ebx
	cmpl	(%rcx), %eax
	cmovgq	%rbx, %rdx
	testl	%eax, %eax
	cmovleq	%rbx, %rdx
	movq	(%r14), %rax
	movq	(%rax,%rdx,8), %rax
	movq	%rax, -32(%rbp)
	cmpq	%rax, 8(%r14)
	je	LBB0_18
## %bb.17:
	leaq	-32(%rbp), %rsi
	xorl	%ebx, %ebx
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_smu_set_power_profile_mode
LBB0_18:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to change display config!"

L_.str.1:                               ## @.str.1
	.asciz	"Failed to apply clocks adjust rules!"

L_.str.2:                               ## @.str.2
	.asciz	"Failed to notify smc display config!"

L_.str.3:                               ## @.str.3
	.asciz	"Failed to set performance level!"

	.comm	_AMD_DPM_FORCED_LEVEL_MANUAL,8,3 ## @AMD_DPM_FORCED_LEVEL_MANUAL
	.comm	_WORKLOAD_POLICY_MAX,4,2        ## @WORKLOAD_POLICY_MAX
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_smu_adjust_power_state_dynamic ; -- Begin function smu_adjust_power_state_dynamic
	.p2align	2
_smu_adjust_power_state_dynamic:        ; @smu_adjust_power_state_dynamic
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	ldr	w8, [x0, #20]
	cbz	w8, LBB0_4
; %bb.1:
	mov	x20, x1
	mov	x19, x0
	cbz	w2, LBB0_5
; %bb.2:
	bl	_smu_apply_clocks_adjust_rules
	mov	x21, x0
	cbz	w0, LBB0_10
LBB0_3:
Lloh0:
	adrp	x0, l_.str.1@PAGE
Lloh1:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_pr_err
	b	LBB0_19
LBB0_4:
Lloh2:
	adrp	x8, _EINVAL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_19
LBB0_5:
	bl	_smu_display_config_changed
	cbz	w0, LBB0_7
; %bb.6:
	mov	x21, x0
Lloh5:
	adrp	x0, l_.str@PAGE
Lloh6:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_err
	b	LBB0_19
LBB0_7:
	mov	x0, x19
	bl	_smu_apply_clocks_adjust_rules
	mov	x21, x0
	cbnz	w0, LBB0_3
; %bb.8:
	mov	x0, x19
	bl	_smu_notify_smc_dispaly_config
	cbz	w0, LBB0_10
; %bb.9:
	mov	x21, x0
Lloh7:
	adrp	x0, l_.str.2@PAGE
Lloh8:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_pr_err
	b	LBB0_19
LBB0_10:
	ldr	w8, [x19, #24]
	cmp	w8, w20
	b.eq	LBB0_15
; %bb.11:
	mov	x0, x19
	mov	x1, x20
	bl	_smu_asic_set_performance_level
	cbz	w0, LBB0_14
; %bb.12:
	mov	x0, x19
	mov	x1, x20
	bl	_smu_default_set_performance_level
	cbz	w0, LBB0_14
; %bb.13:
	mov	x21, x0
Lloh9:
	adrp	x0, l_.str.3@PAGE
Lloh10:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_pr_err
	b	LBB0_19
LBB0_14:
	str	w20, [x19, #24]
LBB0_15:
Lloh11:
	adrp	x8, _AMD_DPM_FORCED_LEVEL_MANUAL@GOTPAGE
Lloh12:
	ldr	x8, [x8, _AMD_DPM_FORCED_LEVEL_MANUAL@GOTPAGEOFF]
Lloh13:
	ldr	x8, [x8]
	cmp	x8, w20, sxtw
	b.eq	LBB0_18
; %bb.16:
	ldr	w0, [x19, #16]
	bl	_fls
Lloh14:
	adrp	x8, _WORKLOAD_POLICY_MAX@GOTPAGE
Lloh15:
	ldr	x8, [x8, _WORKLOAD_POLICY_MAX@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	sub	w9, w0, #1
	cmp	w0, w8
	ccmp	w0, #1, #8, le
	csel	x8, xzr, x9, lt
	ldp	x9, x10, [x19]
	ldr	x8, [x9, x8, lsl #3]
	str	x8, [sp, #8]
	cmp	x10, x8
	b.eq	LBB0_18
; %bb.17:
	add	x1, sp, #8
	mov	x0, x19
	mov	w2, #0
	bl	_smu_set_power_profile_mode
LBB0_18:
	mov	w21, #0
LBB0_19:
	mov	x0, x21
	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
	add	sp, sp, #64
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to change display config!"

l_.str.1:                               ; @.str.1
	.asciz	"Failed to apply clocks adjust rules!"

l_.str.2:                               ; @.str.2
	.asciz	"Failed to notify smc display config!"

l_.str.3:                               ; @.str.3
	.asciz	"Failed to set performance level!"

	.comm	_AMD_DPM_FORCED_LEVEL_MANUAL,8,3 ; @AMD_DPM_FORCED_LEVEL_MANUAL
	.comm	_WORKLOAD_POLICY_MAX,4,2        ; @WORKLOAD_POLICY_MAX
.subsections_via_symbols
