	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## -- Begin function trinity_apply_state_adjust_rules
LCPI0_0:
	.long	1                               ## 0x1
	.long	0                               ## 0x0
	.long	2                               ## 0x2
	.long	1                               ## 0x1
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	4, 0x90
_trinity_apply_state_adjust_rules:      ## @trinity_apply_state_adjust_rules
	.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
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movq	%rsi, %rdi
	callq	_trinity_get_ps
	movq	%rax, %r12
	movq	%r14, %rdi
	callq	_trinity_get_ps
	movq	%rax, %r14
	movq	%rbx, %rdi
	callq	_trinity_get_pi
	movq	%r15, %rsi
	movq	%rax, %r15
	movq	_ATOM_PPLIB_CLASSIFICATION_THERMAL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rsi)
	je	LBB0_1
## %bb.30:
	movq	%rbx, %rdi
	movq	%r12, %rsi
	movq	%r14, %rdx
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_trinity_patch_thermal_state    ## TAILCALL
LBB0_1:
	movq	(%r15), %r13
	movq	(%rbx), %r14
	movq	%rbx, %rdi
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	callq	_trinity_adjust_uvd_state
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	cmpq	$0, 24(%rdi)
	je	LBB0_2
## %bb.3:
	movq	8(%rbx), %rax
	movq	16(%rbx), %rcx
	leaq	(%rax,%rax,2), %rax
	movups	8(%rcx,%rax,8), %xmm0
	jmp	LBB0_4
LBB0_2:
	xorps	%xmm0, %xmm0
LBB0_4:
	movups	%xmm0, 8(%rdi)
	cmpq	$0, (%r12)
	je	LBB0_5
## %bb.6:
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	movq	24(%r12), %rcx
	xorl	%r15d, %r15d
	xorl	%r14d, %r14d
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_14:                                ##   in Loop: Header=BB0_7 Depth=1
	movq	8(%rcx,%r15), %rsi
	movq	%rbx, %rdi
	movq	%r13, %rdx
	callq	_sumo_get_sleep_divider_id_from_clock
	movq	24(%r12), %rcx
	movl	%eax, 40(%rcx,%r15)
	movl	%eax, 44(%rcx,%r15)
	movl	$1, 16(%rcx,%r15)
	movq	$0, 32(%rcx,%r15)
	movq	%rbx, %rdi
	movq	%r12, %rsi
	movq	%r14, %rdx
	callq	_trinity_calculate_display_wm
	movq	24(%r12), %rcx
	movl	%eax, 24(%rcx,%r15)
	movq	8(%rcx), %rsi
	movq	%rbx, %rdi
	callq	_trinity_calculate_vce_wm
	movq	24(%r12), %rcx
	movl	%eax, 20(%rcx,%r15)
	incq	%r14
	movq	(%r12), %rax
	addq	$48, %r15
	cmpq	%rax, %r14
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	jae	LBB0_15
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	8(%rcx,%r15), %rax
	cmpq	%r13, %rax
	jae	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	movq	%rbx, %rdi
	movq	%r13, %rsi
	callq	_trinity_get_valid_engine_clock
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	24(%r12), %rcx
	movq	%rax, 8(%rcx,%r15)
LBB0_9:                                 ##   in Loop: Header=BB0_7 Depth=1
	cmpq	$0, 24(%rdi)
	je	LBB0_14
## %bb.10:                              ##   in Loop: Header=BB0_7 Depth=1
	movq	8(%rbx), %rdx
	movq	16(%rbx), %rsi
	leaq	(%rdx,%rdx,2), %rdx
	movq	(%rsi,%rdx,8), %rdx
	cmpq	%rdx, %rax
	jae	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_7 Depth=1
	movq	%rdx, 8(%rcx,%r15)
LBB0_12:                                ##   in Loop: Header=BB0_7 Depth=1
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rsi
	movq	%rbx, %rdi
	leaq	-72(%rbp), %rcx
	callq	_trinity_get_vce_clock_voltage
	movq	24(%r12), %rcx
	movq	-72(%rbp), %rax
	cmpq	%rax, (%rcx,%r15)
	jae	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_7 Depth=1
	movq	%rax, (%rcx,%r15)
	jmp	LBB0_14
LBB0_15:
	decq	%rax
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	jmp	LBB0_16
LBB0_5:
	movq	$-1, %rax
LBB0_16:
	movl	(%rdi), %ecx
	movq	_ATOM_PPLIB_CLASSIFICATION_HDSTATE@GOTPCREL(%rip), %rdx
	movl	(%rdx), %esi
	movq	_ATOM_PPLIB_CLASSIFICATION_SDSTATE@GOTPCREL(%rip), %rdx
	movl	(%rdx), %r8d
	movl	%r8d, %edx
	orl	%esi, %edx
	testl	%ecx, %edx
	jne	LBB0_18
## %bb.17:
	movq	_ATOM_PPLIB_CLASSIFICATION_UI_MASK@GOTPCREL(%rip), %rdi
	movl	(%rdi), %edi
	andl	%ecx, %edi
	movq	_ATOM_PPLIB_CLASSIFICATION_UI_BATTERY@GOTPCREL(%rip), %rbx
	movl	(%rbx), %ebx
	cmpl	%ebx, %edi
	jne	LBB0_21
LBB0_18:
	movq	_TRINITY_POWERSTATE_FLAGS_BAPM_DISABLE@GOTPCREL(%rip), %rdi
	movl	(%rdi), %edi
	orl	%edi, 32(%r12)
	cmpq	$0, 16(%r15)
	je	LBB0_29
## %bb.19:
	movaps	LCPI0_0(%rip), %xmm0            ## xmm0 = [1,0,2,1]
	movups	%xmm0, 8(%r12)
	testl	%ecx, %edx
	jne	LBB0_24
## %bb.20:
	movq	_ATOM_PPLIB_CLASSIFICATION_UI_MASK@GOTPCREL(%rip), %rdx
	movq	_ATOM_PPLIB_CLASSIFICATION_UI_BATTERY@GOTPCREL(%rip), %rdi
	movl	(%rdi), %ebx
	movl	(%rdx), %edi
	andl	%ecx, %edi
	cmpl	%ebx, %edi
	je	LBB0_24
	jmp	LBB0_29
LBB0_21:
	cmpq	$0, 16(%r15)
	je	LBB0_29
## %bb.22:
	movaps	LCPI0_0(%rip), %xmm0            ## xmm0 = [1,0,2,1]
	movups	%xmm0, 8(%r12)
	cmpl	%ebx, %edi
	jne	LBB0_29
LBB0_24:
	movb	$1, %dl
	testl	%ecx, %esi
	jne	LBB0_28
## %bb.25:
	testl	%ecx, %r8d
	je	LBB0_26
## %bb.27:
	cmpl	$1, 8(%r15)
	sete	%dl
	jmp	LBB0_28
LBB0_26:
	xorl	%edx, %edx
LBB0_28:
	cmpq	$3, %r14
	setae	%cl
	orb	%dl, %cl
	movzbl	%cl, %ecx
	xorl	$3, %ecx
	movl	%ecx, 8(%r12)
	movl	$1, 12(%r12)
	movl	%ecx, 16(%r12)
	movl	$2, 20(%r12)
	movq	24(%r12), %rcx
	leaq	(%rax,%rax,2), %rax
	shlq	$4, %rax
	movl	$0, 16(%rcx,%rax)
LBB0_29:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ATOM_PPLIB_CLASSIFICATION_THERMAL,4,2 ## @ATOM_PPLIB_CLASSIFICATION_THERMAL
	.comm	_ATOM_PPLIB_CLASSIFICATION_HDSTATE,4,2 ## @ATOM_PPLIB_CLASSIFICATION_HDSTATE
	.comm	_ATOM_PPLIB_CLASSIFICATION_SDSTATE,4,2 ## @ATOM_PPLIB_CLASSIFICATION_SDSTATE
	.comm	_ATOM_PPLIB_CLASSIFICATION_UI_MASK,4,2 ## @ATOM_PPLIB_CLASSIFICATION_UI_MASK
	.comm	_ATOM_PPLIB_CLASSIFICATION_UI_BATTERY,4,2 ## @ATOM_PPLIB_CLASSIFICATION_UI_BATTERY
	.comm	_TRINITY_POWERSTATE_FLAGS_BAPM_DISABLE,4,2 ## @TRINITY_POWERSTATE_FLAGS_BAPM_DISABLE
	.no_dead_strip	_trinity_apply_state_adjust_rules
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ; -- Begin function trinity_apply_state_adjust_rules
lCPI0_0:
	.long	1                               ; 0x1
	.long	0                               ; 0x0
	.long	2                               ; 0x2
	.long	1                               ; 0x1
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	2
_trinity_apply_state_adjust_rules:      ; @trinity_apply_state_adjust_rules
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x2
	mov	x21, x1
	mov	x22, x0
	mov	x0, x1
	bl	_trinity_get_ps
	mov	x19, x0
	mov	x0, x20
	bl	_trinity_get_ps
	mov	x23, x0
	mov	x0, x22
	bl	_trinity_get_pi
	ldr	w8, [x21]
Lloh0:
	adrp	x9, _ATOM_PPLIB_CLASSIFICATION_THERMAL@GOTPAGE
Lloh1:
	ldr	x9, [x9, _ATOM_PPLIB_CLASSIFICATION_THERMAL@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_2
; %bb.1:
	mov	x0, x22
	mov	x1, x19
	mov	x2, x23
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	b	_trinity_patch_thermal_state
LBB0_2:
	mov	x20, x0
	ldr	x23, [x0]
	ldr	x25, [x22]
	mov	x0, x22
	mov	x1, x21
	bl	_trinity_adjust_uvd_state
	ldr	x8, [x21, #24]
	cbz	x8, LBB0_4
; %bb.3:
	ldp	x9, x8, [x22, #8]
	mov	w10, #24
	madd	x8, x9, x10, x8
	ldur	q0, [x8, #8]
	b	LBB0_5
LBB0_4:
	movi.2d	v0, #0000000000000000
LBB0_5:
	stur	q0, [x21, #8]
	ldr	x8, [x19]
	cbz	x8, LBB0_16
; %bb.6:
	mov	x26, #0
	mov	x24, #0
	ldr	x8, [x19, #24]
	mov	w27, #1
	mov	w28, #24
	b	LBB0_8
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=1
	add	x8, x8, x26
	ldr	x1, [x8, #8]
	mov	x0, x22
	mov	x2, x23
	bl	_sumo_get_sleep_divider_id_from_clock
	ldr	x8, [x19, #24]
	add	x8, x8, x26
	stp	w0, w0, [x8, #40]
	str	w27, [x8, #16]
	str	xzr, [x8, #32]
	mov	x0, x22
	mov	x1, x19
	mov	x2, x24
	bl	_trinity_calculate_display_wm
	ldr	x8, [x19, #24]
	add	x9, x8, x26
	str	w0, [x9, #24]
	ldr	x1, [x8, #8]
	mov	x0, x22
	bl	_trinity_calculate_vce_wm
	ldr	x8, [x19, #24]
	add	x9, x8, x26
	str	w0, [x9, #20]
	add	x24, x24, #1
	ldr	x9, [x19]
	add	x26, x26, #48
	cmp	x24, x9
	b.hs	LBB0_15
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	add	x9, x8, x26
	ldr	x0, [x9, #8]
	cmp	x0, x23
	b.hs	LBB0_10
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	mov	x0, x22
	mov	x1, x23
	bl	_trinity_get_valid_engine_clock
	ldr	x8, [x19, #24]
	add	x9, x8, x26
	str	x0, [x9, #8]
LBB0_10:                                ;   in Loop: Header=BB0_8 Depth=1
	ldr	x9, [x21, #24]
	cbz	x9, LBB0_7
; %bb.11:                               ;   in Loop: Header=BB0_8 Depth=1
	ldp	x10, x9, [x22, #8]
	mul	x10, x10, x28
	ldr	x9, [x9, x10]
	cmp	x0, x9
	b.hs	LBB0_13
; %bb.12:                               ;   in Loop: Header=BB0_8 Depth=1
	add	x8, x8, x26
	str	x9, [x8, #8]
LBB0_13:                                ;   in Loop: Header=BB0_8 Depth=1
	ldp	x2, x1, [x21, #8]
	add	x3, sp, #8
	mov	x0, x22
	bl	_trinity_get_vce_clock_voltage
	ldr	x8, [x19, #24]
	ldr	x10, [x8, x26]
	ldr	x9, [sp, #8]
	cmp	x10, x9
	b.hs	LBB0_7
; %bb.14:                               ;   in Loop: Header=BB0_8 Depth=1
	str	x9, [x8, x26]
	b	LBB0_7
LBB0_15:
	sub	x8, x9, #1
	b	LBB0_17
LBB0_16:
	mov	x8, #-1
LBB0_17:
	ldr	w9, [x21]
Lloh3:
	adrp	x10, _ATOM_PPLIB_CLASSIFICATION_HDSTATE@GOTPAGE
Lloh4:
	ldr	x10, [x10, _ATOM_PPLIB_CLASSIFICATION_HDSTATE@GOTPAGEOFF]
Lloh5:
	ldr	w11, [x10]
Lloh6:
	adrp	x10, _ATOM_PPLIB_CLASSIFICATION_SDSTATE@GOTPAGE
Lloh7:
	ldr	x10, [x10, _ATOM_PPLIB_CLASSIFICATION_SDSTATE@GOTPAGEOFF]
Lloh8:
	ldr	w10, [x10]
	orr	w12, w10, w11
	ands	w14, w12, w9
	b.ne	LBB0_19
; %bb.18:
Lloh9:
	adrp	x12, _ATOM_PPLIB_CLASSIFICATION_UI_MASK@GOTPAGE
Lloh10:
	ldr	x12, [x12, _ATOM_PPLIB_CLASSIFICATION_UI_MASK@GOTPAGEOFF]
Lloh11:
	ldr	w12, [x12]
	and	w12, w12, w9
Lloh12:
	adrp	x13, _ATOM_PPLIB_CLASSIFICATION_UI_BATTERY@GOTPAGE
Lloh13:
	ldr	x13, [x13, _ATOM_PPLIB_CLASSIFICATION_UI_BATTERY@GOTPAGEOFF]
Lloh14:
	ldr	w13, [x13]
	cmp	w12, w13
	b.ne	LBB0_22
LBB0_19:
Lloh15:
	adrp	x12, _TRINITY_POWERSTATE_FLAGS_BAPM_DISABLE@GOTPAGE
Lloh16:
	ldr	x12, [x12, _TRINITY_POWERSTATE_FLAGS_BAPM_DISABLE@GOTPAGEOFF]
Lloh17:
	ldr	w12, [x12]
	ldr	w13, [x19, #32]
	orr	w12, w13, w12
	str	w12, [x19, #32]
	ldr	x12, [x20, #16]
	cbz	x12, LBB0_29
; %bb.20:
Lloh18:
	adrp	x12, lCPI0_0@PAGE
Lloh19:
	ldr	q0, [x12, lCPI0_0@PAGEOFF]
	stur	q0, [x19, #8]
	cbnz	w14, LBB0_24
; %bb.21:
Lloh20:
	adrp	x12, _ATOM_PPLIB_CLASSIFICATION_UI_MASK@GOTPAGE
Lloh21:
	ldr	x12, [x12, _ATOM_PPLIB_CLASSIFICATION_UI_MASK@GOTPAGEOFF]
Lloh22:
	ldr	w12, [x12]
Lloh23:
	adrp	x13, _ATOM_PPLIB_CLASSIFICATION_UI_BATTERY@GOTPAGE
Lloh24:
	ldr	x13, [x13, _ATOM_PPLIB_CLASSIFICATION_UI_BATTERY@GOTPAGEOFF]
Lloh25:
	ldr	w13, [x13]
	and	w12, w12, w9
	cmp	w12, w13
	b.eq	LBB0_24
	b	LBB0_29
LBB0_22:
	ldr	x14, [x20, #16]
	cbz	x14, LBB0_29
; %bb.23:
Lloh26:
	adrp	x14, lCPI0_0@PAGE
Lloh27:
	ldr	q0, [x14, lCPI0_0@PAGEOFF]
	stur	q0, [x19, #8]
	cmp	w12, w13
	b.ne	LBB0_29
LBB0_24:
	mov	w12, #1
	mov	w13, #1
	tst	w11, w9
	b.ne	LBB0_28
; %bb.25:
	tst	w10, w9
	b.eq	LBB0_27
; %bb.26:
	ldr	w9, [x20, #8]
	cmp	w9, #1
	cset	w13, eq
	b	LBB0_28
LBB0_27:
	mov	w13, #0
LBB0_28:
	cmp	x25, #2
	cset	w9, hi
	orr	w9, w9, w13
	cmp	w9, #0
	mov	w9, #2
	cinc	w10, w9, eq
	stp	w10, w12, [x19, #8]
	stp	w10, w9, [x19, #16]
	ldr	x9, [x19, #24]
	mov	w10, #48
	madd	x8, x8, x10, x9
	str	wzr, [x8, #16]
LBB0_29:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdr	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdr	Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_ATOM_PPLIB_CLASSIFICATION_THERMAL,4,2 ; @ATOM_PPLIB_CLASSIFICATION_THERMAL
	.comm	_ATOM_PPLIB_CLASSIFICATION_HDSTATE,4,2 ; @ATOM_PPLIB_CLASSIFICATION_HDSTATE
	.comm	_ATOM_PPLIB_CLASSIFICATION_SDSTATE,4,2 ; @ATOM_PPLIB_CLASSIFICATION_SDSTATE
	.comm	_ATOM_PPLIB_CLASSIFICATION_UI_MASK,4,2 ; @ATOM_PPLIB_CLASSIFICATION_UI_MASK
	.comm	_ATOM_PPLIB_CLASSIFICATION_UI_BATTERY,4,2 ; @ATOM_PPLIB_CLASSIFICATION_UI_BATTERY
	.comm	_TRINITY_POWERSTATE_FLAGS_BAPM_DISABLE,4,2 ; @TRINITY_POWERSTATE_FLAGS_BAPM_DISABLE
	.no_dead_strip	_trinity_apply_state_adjust_rules
.subsections_via_symbols
