	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_vega20_baco_set_state          ## -- Begin function vega20_baco_set_state
	.p2align	4, 0x90
_vega20_baco_set_state:                 ## @vega20_baco_set_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	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %ebx
	movq	%rdi, %r15
	leaq	-36(%rbp), %rsi
	callq	_vega20_baco_get_state
	xorl	%r14d, %r14d
	cmpl	%ebx, -36(%rbp)
	je	LBB0_7
## %bb.1:
	movq	_BACO_STATE_IN@GOTPCREL(%rip), %rax
	cmpl	%ebx, (%rax)
	jne	LBB0_3
## %bb.2:
	movq	_THM@GOTPCREL(%rip), %r12
	movl	(%r12), %edi
	movq	_mmTHM_BACO_CNTL@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edx
	xorl	%r14d, %r14d
	xorl	%esi, %esi
	callq	_RREG32_SOC15
	orl	$-2147483648, %eax              ## imm = 0x80000000
	movl	(%r12), %edi
	movl	(%rbx), %edx
	xorl	%esi, %esi
	movl	%eax, %ecx
	callq	_WREG32_SOC15
	movq	_PPSMC_MSG_EnterBaco@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	xorl	%edx, %edx
	callq	_smum_send_msg_to_smc_with_parameter
	testq	%rax, %rax
	jne	LBB0_6
	jmp	LBB0_7
LBB0_3:
	movq	_BACO_STATE_OUT@GOTPCREL(%rip), %rax
	cmpl	%ebx, (%rax)
	jne	LBB0_7
## %bb.4:
	movq	_PPSMC_MSG_ExitBaco@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_smum_send_msg_to_smc
	testq	%rax, %rax
	jne	LBB0_6
## %bb.5:
	movq	_clean_baco_tbl@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movl	%ebx, %edi
	callq	_ARRAY_SIZE
	movq	%r15, %rdi
	movl	%ebx, %esi
	movl	%eax, %edx
	callq	_soc15_baco_program_registers
	testl	%eax, %eax
	jne	LBB0_7
LBB0_6:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
LBB0_7:
	movl	%r14d, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BACO_STATE_IN,4,2              ## @BACO_STATE_IN
	.comm	_THM,4,2                        ## @THM
	.comm	_mmTHM_BACO_CNTL,4,2            ## @mmTHM_BACO_CNTL
	.comm	_PPSMC_MSG_EnterBaco,4,2        ## @PPSMC_MSG_EnterBaco
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_BACO_STATE_OUT,4,2             ## @BACO_STATE_OUT
	.comm	_PPSMC_MSG_ExitBaco,4,2         ## @PPSMC_MSG_ExitBaco
	.comm	_clean_baco_tbl,4,2             ## @clean_baco_tbl
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_vega20_baco_set_state          ; -- Begin function vega20_baco_set_state
	.p2align	2
_vega20_baco_set_state:                 ; @vega20_baco_set_state
	.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
	mov	x20, x1
	mov	x19, x0
	add	x1, sp, #12
	bl	_vega20_baco_get_state
	ldr	w8, [sp, #12]
	cmp	w8, w20
	b.ne	LBB0_2
LBB0_1:
	mov	w0, #0
	b	LBB0_8
LBB0_2:
Lloh0:
	adrp	x8, _BACO_STATE_IN@GOTPAGE
Lloh1:
	ldr	x8, [x8, _BACO_STATE_IN@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w20
	b.ne	LBB0_4
; %bb.3:
Lloh3:
	adrp	x20, _THM@GOTPAGE
Lloh4:
	ldr	x20, [x20, _THM@GOTPAGEOFF]
	ldr	w0, [x20]
Lloh5:
	adrp	x21, _mmTHM_BACO_CNTL@GOTPAGE
Lloh6:
	ldr	x21, [x21, _mmTHM_BACO_CNTL@GOTPAGEOFF]
	ldr	w2, [x21]
	mov	w1, #0
	bl	_RREG32_SOC15
	orr	w3, w0, #0x80000000
	ldr	w0, [x20]
	ldr	w2, [x21]
	mov	w1, #0
	bl	_WREG32_SOC15
Lloh7:
	adrp	x8, _PPSMC_MSG_EnterBaco@GOTPAGE
Lloh8:
	ldr	x8, [x8, _PPSMC_MSG_EnterBaco@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_smum_send_msg_to_smc_with_parameter
	cbnz	x0, LBB0_7
	b	LBB0_8
LBB0_4:
Lloh10:
	adrp	x8, _BACO_STATE_OUT@GOTPAGE
Lloh11:
	ldr	x8, [x8, _BACO_STATE_OUT@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	cmp	w8, w20
	b.ne	LBB0_1
; %bb.5:
Lloh13:
	adrp	x8, _PPSMC_MSG_ExitBaco@GOTPAGE
Lloh14:
	ldr	x8, [x8, _PPSMC_MSG_ExitBaco@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_smum_send_msg_to_smc
	cbnz	x0, LBB0_7
; %bb.6:
Lloh16:
	adrp	x8, _clean_baco_tbl@GOTPAGE
Lloh17:
	ldr	x8, [x8, _clean_baco_tbl@GOTPAGEOFF]
Lloh18:
	ldr	w20, [x8]
	mov	x0, x20
	bl	_ARRAY_SIZE
	mov	x2, x0
	mov	x0, x19
	mov	x1, x20
	bl	_soc15_baco_program_registers
	cbnz	w0, LBB0_1
LBB0_7:
Lloh19:
	adrp	x8, _EINVAL@GOTPAGE
Lloh20:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_8:
	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	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_BACO_STATE_IN,4,2              ; @BACO_STATE_IN
	.comm	_THM,4,2                        ; @THM
	.comm	_mmTHM_BACO_CNTL,4,2            ; @mmTHM_BACO_CNTL
	.comm	_PPSMC_MSG_EnterBaco,4,2        ; @PPSMC_MSG_EnterBaco
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_BACO_STATE_OUT,4,2             ; @BACO_STATE_OUT
	.comm	_PPSMC_MSG_ExitBaco,4,2         ; @PPSMC_MSG_ExitBaco
	.comm	_clean_baco_tbl,4,2             ; @clean_baco_tbl
.subsections_via_symbols
