	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_smu_switch_power_profile       ## -- Begin function smu_switch_power_profile
	.p2align	4, 0x90
_smu_switch_power_profile:              ## @smu_switch_power_profile
	.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	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	cmpl	$0, 28(%rdi)
	je	LBB0_1
## %bb.2:
	movl	%esi, %ebx
	movq	_PP_SMC_POWER_PROFILE_CUSTOM@GOTPCREL(%rip), %rax
	cmpl	%esi, (%rax)
	jbe	LBB0_1
## %bb.3:
	movl	%edx, %r15d
	movq	%rdi, %r12
	leaq	24(%rdi), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	movq	8(%r12), %rax
	movl	%ebx, %ecx
	movb	(%rax,%rcx,4), %cl
	movl	$1, %edi
	shll	%cl, %edi
	testl	%r15d, %r15d
	je	LBB0_4
## %bb.5:
	orl	(%r12), %edi
	movl	%edi, (%r12)
	callq	_fls
                                        ## kill: def $eax killed $eax def $rax
	movq	_WORKLOAD_POLICY_MAX@GOTPCREL(%rip), %rcx
	leal	-1(%rax), %edx
	xorl	%esi, %esi
	cmpl	(%rcx), %eax
	cmovlel	%edx, %esi
	movslq	%esi, %rcx
	jmp	LBB0_6
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_9
LBB0_4:
	notl	%edi
	andl	(%r12), %edi
	movl	%edi, (%r12)
	callq	_fls
                                        ## kill: def $eax killed $eax def $rax
	movq	_WORKLOAD_POLICY_MAX@GOTPCREL(%rip), %rdx
	leal	-1(%rax), %ecx
	xorl	%esi, %esi
	cmpl	(%rdx), %eax
	cmovgq	%rsi, %rcx
	testl	%eax, %eax
	cmovleq	%rsi, %rcx
LBB0_6:
	shlq	$3, %rcx
	addq	16(%r12), %rcx
	movq	(%rcx), %rax
	movq	%rax, -40(%rbp)
	movq	32(%r12), %rax
	movq	_AMD_DPM_FORCED_LEVEL_MANUAL@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_8
## %bb.7:
	leaq	-40(%rbp), %rsi
	movq	%r12, %rdi
	xorl	%edx, %edx
	callq	_smu_set_power_profile_mode
LBB0_8:
	movq	%r14, %rdi
	callq	_mutex_unlock
	xorl	%eax, %eax
LBB0_9:
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_PP_SMC_POWER_PROFILE_CUSTOM,4,2 ## @PP_SMC_POWER_PROFILE_CUSTOM
	.comm	_WORKLOAD_POLICY_MAX,4,2        ## @WORKLOAD_POLICY_MAX
	.comm	_AMD_DPM_FORCED_LEVEL_MANUAL,8,3 ## @AMD_DPM_FORCED_LEVEL_MANUAL
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_smu_switch_power_profile       ; -- Begin function smu_switch_power_profile
	.p2align	2
_smu_switch_power_profile:              ; @smu_switch_power_profile
	.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, #28]
	cbz	w8, LBB0_4
; %bb.1:
	mov	x22, x1
Lloh0:
	adrp	x8, _PP_SMC_POWER_PROFILE_CUSTOM@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PP_SMC_POWER_PROFILE_CUSTOM@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w1
	b.ls	LBB0_4
; %bb.2:
	mov	x21, x2
	mov	x19, x0
	add	x20, x0, #24
	mov	x0, x20
	bl	_mutex_lock
	ldr	x8, [x19, #8]
	ldr	w8, [x8, w22, uxtw #2]
	mov	w9, #1
	lsl	w8, w9, w8
	cbz	w21, LBB0_5
; %bb.3:
	ldr	w9, [x19]
	orr	w0, w9, w8
	str	w0, [x19]
	bl	_fls
Lloh3:
	adrp	x8, _WORKLOAD_POLICY_MAX@GOTPAGE
Lloh4:
	ldr	x8, [x8, _WORKLOAD_POLICY_MAX@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	sub	w9, w0, #1
	cmp	w0, w8
	csel	w8, wzr, w9, gt
	ldr	x9, [x19, #16]
	add	x8, x9, w8, sxtw #3
	b	LBB0_6
LBB0_4:
Lloh6:
	adrp	x8, _EINVAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_9
LBB0_5:
	ldr	w9, [x19]
	bic	w0, w9, w8
	str	w0, [x19]
	bl	_fls
Lloh9:
	adrp	x8, _WORKLOAD_POLICY_MAX@GOTPAGE
Lloh10:
	ldr	x8, [x8, _WORKLOAD_POLICY_MAX@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	sub	w9, w0, #1
	cmp	w0, w8
	ccmp	w0, #1, #8, le
	csel	x8, xzr, x9, lt
	ldr	x9, [x19, #16]
	add	x8, x9, x8, lsl #3
LBB0_6:
	ldr	x8, [x8]
	str	x8, [sp, #8]
	ldr	x8, [x19, #32]
Lloh12:
	adrp	x9, _AMD_DPM_FORCED_LEVEL_MANUAL@GOTPAGE
Lloh13:
	ldr	x9, [x9, _AMD_DPM_FORCED_LEVEL_MANUAL@GOTPAGEOFF]
Lloh14:
	ldr	x9, [x9]
	cmp	x8, x9
	b.eq	LBB0_8
; %bb.7:
	add	x1, sp, #8
	mov	x0, x19
	mov	w2, #0
	bl	_smu_set_power_profile_mode
LBB0_8:
	mov	x0, x20
	bl	_mutex_unlock
	mov	w0, #0
LBB0_9:
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_PP_SMC_POWER_PROFILE_CUSTOM,4,2 ; @PP_SMC_POWER_PROFILE_CUSTOM
	.comm	_WORKLOAD_POLICY_MAX,4,2        ; @WORKLOAD_POLICY_MAX
	.comm	_AMD_DPM_FORCED_LEVEL_MANUAL,8,3 ; @AMD_DPM_FORCED_LEVEL_MANUAL
.subsections_via_symbols
