	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function p4tcc_set
_p4tcc_set:                             ## @p4tcc_set
	.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
	testq	%rsi, %rsi
	je	LBB0_1
## %bb.2:
	movq	%rsi, %rbx
	callq	_device_get_softc
	movq	%rax, %r14
	movq	_TCC_NUM_SETTINGS@GOTPCREL(%rip), %r15
	movl	(%r15), %eax
	movl	(%rbx), %ecx
	imull	%eax, %ecx
	movslq	%ecx, %rcx
	imulq	$1759218605, %rcx, %rbx         ## imm = 0x68DB8BAD
	movq	%rbx, %rdx
	shrq	$63, %rdx
	sarq	$44, %rbx
	addl	%edx, %ebx
	imull	$10000, %ebx, %edx              ## imm = 0x2710
	cmpl	%ecx, %edx
	jne	LBB0_1
## %bb.3:
	cmpl	(%r14), %ebx
	jl	LBB0_1
## %bb.4:
	cmpl	%eax, %ebx
	jg	LBB0_1
## %bb.5:
	movq	_MSR_THERM_CONTROL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_rdmsr
	movl	(%r15), %edx
	leal	-1(%rdx), %esi
	movq	_TCC_REG_OFFSET@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %esi
	movq	_TCC_ENABLE_ONDEMAND@GOTPCREL(%rip), %r13
	movl	(%r13), %edi
	orl	%edi, %esi
	notl	%esi
	movl	%ebx, %r12d
	shll	%cl, %r12d
	andl	%eax, %esi
	orl	%edi, %r12d
	xorl	%r15d, %r15d
	cmpl	%edx, %ebx
	cmovgel	%r15d, %r12d
	orl	%esi, %r12d
	movq	_MSR_THERM_CONTROL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	%r12d, %esi
	callq	_wrmsr
	testl	%r12d, (%r13)
	je	LBB0_7
## %bb.6:
	movq	_FALSE@GOTPCREL(%rip), %rax
	jmp	LBB0_8
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
LBB0_9:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movq	_TRUE@GOTPCREL(%rip), %rax
LBB0_8:
	movl	(%rax), %eax
	movl	%eax, 4(%r14)
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_TCC_NUM_SETTINGS,4,2           ## @TCC_NUM_SETTINGS
	.comm	_MSR_THERM_CONTROL,4,2          ## @MSR_THERM_CONTROL
	.comm	_TCC_REG_OFFSET,4,2             ## @TCC_REG_OFFSET
	.comm	_TCC_ENABLE_ONDEMAND,4,2        ## @TCC_ENABLE_ONDEMAND
	.comm	_FALSE,4,2                      ## @FALSE
	.comm	_TRUE,4,2                       ## @TRUE
	.no_dead_strip	_p4tcc_set
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function p4tcc_set
_p4tcc_set:                             ; @p4tcc_set
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	cbz	x1, LBB0_3
; %bb.1:
	mov	x20, x1
	bl	_device_get_softc
	ldr	w9, [x20]
Lloh0:
	adrp	x21, _TCC_NUM_SETTINGS@GOTPAGE
Lloh1:
	ldr	x21, [x21, _TCC_NUM_SETTINGS@GOTPAGEOFF]
	ldr	w8, [x21]
	mul	w9, w8, w9
	mov	w10, #35757
	movk	w10, #26843, lsl #16
	smull	x10, w9, w10
	lsr	x11, x10, #63
	asr	x10, x10, #44
	add	w20, w10, w11
	mov	w10, #10000
	mul	w10, w20, w10
	cmp	w10, w9
	b.ne	LBB0_3
; %bb.2:
	mov	x19, x0
	ldr	w9, [x0]
	cmp	w20, w9
	ccmp	w20, w8, #0, ge
	b.le	LBB0_5
LBB0_3:
Lloh2:
	adrp	x8, _EINVAL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh4:
	ldr	w0, [x8]
LBB0_4:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_5:
Lloh5:
	adrp	x22, _MSR_THERM_CONTROL@GOTPAGE
Lloh6:
	ldr	x22, [x22, _MSR_THERM_CONTROL@GOTPAGEOFF]
	ldr	w0, [x22]
	bl	_rdmsr
	ldr	w8, [x21]
	sub	w9, w8, #1
Lloh7:
	adrp	x10, _TCC_REG_OFFSET@GOTPAGE
Lloh8:
	ldr	x10, [x10, _TCC_REG_OFFSET@GOTPAGEOFF]
Lloh9:
	ldr	w10, [x10]
	lsl	w9, w9, w10
Lloh10:
	adrp	x21, _TCC_ENABLE_ONDEMAND@GOTPAGE
Lloh11:
	ldr	x21, [x21, _TCC_ENABLE_ONDEMAND@GOTPAGEOFF]
	ldr	w11, [x21]
	orr	w9, w9, w11
	bic	w9, w0, w9
	lsl	w10, w20, w10
	orr	w10, w10, w11
	cmp	w20, w8
	csel	w8, w10, wzr, lt
	orr	w20, w9, w8
	ldr	w0, [x22]
	mov	x1, x20
	bl	_wrmsr
	ldr	w8, [x21]
	tst	w20, w8
	b.eq	LBB0_7
; %bb.6:
	mov	w0, #0
Lloh12:
	adrp	x8, _FALSE@GOTPAGE
Lloh13:
	ldr	x8, [x8, _FALSE@GOTPAGEOFF]
	b	LBB0_8
LBB0_7:
	mov	w0, #0
Lloh14:
	adrp	x8, _TRUE@GOTPAGE
Lloh15:
	ldr	x8, [x8, _TRUE@GOTPAGEOFF]
LBB0_8:
	ldr	w8, [x8]
	str	w8, [x19, #4]
	b	LBB0_4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_TCC_NUM_SETTINGS,4,2           ; @TCC_NUM_SETTINGS
	.comm	_MSR_THERM_CONTROL,4,2          ; @MSR_THERM_CONTROL
	.comm	_TCC_REG_OFFSET,4,2             ; @TCC_REG_OFFSET
	.comm	_TCC_ENABLE_ONDEMAND,4,2        ; @TCC_ENABLE_ONDEMAND
	.comm	_FALSE,4,2                      ; @FALSE
	.comm	_TRUE,4,2                       ; @TRUE
	.no_dead_strip	_p4tcc_set
.subsections_via_symbols
