	.file	"extr_therm_pm72.c_do_monitor_dimms.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"DIMM:\n"
.LC1:
	.string	"  current value: %d\n"
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC2:
	.string	"  temp: %d.%03d, target: %d.%03d\n"
	.section	.rodata.str1.1
.LC3:
	.string	"  integral: %08x\n"
.LC4:
	.string	"   integ_p: %d\n"
.LC5:
	.string	"   deriv_p: %d\n"
.LC6:
	.string	"   prop_p: %d\n"
.LC7:
	.string	"   sum: %d\n"
.LC8:
	.string	"** DIMM clamp value: %d\n"
	.section	.rodata.str1.8
	.align 8
.LC9:
	.string	" -> applying clamp to backside fan now: %d  !\n"
	.text
	.p2align 4
	.type	do_monitor_dimms, @function
do_monitor_dimms:
.LFB0:
	.cfi_startproc
	endbr64
	sub	QWORD PTR [rdi], 1
	je	.L19
	ret
	.p2align 4,,10
	.p2align 3
.L19:
	movsx	rax, DWORD PTR DIMM_PID_INTERVAL[rip]
	push	r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	push	rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	push	rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	mov	rbx, rdi
	mov	QWORD PTR [rdi], rax
	lea	rdi, .LC0[rip]
	xor	eax, eax
	call	DBG@PLT
	mov	esi, DWORD PTR 8[rbx]
	lea	rdi, .LC1[rip]
	xor	eax, eax
	call	DBG@PLT
	mov	edi, DWORD PTR 48[rbx]
	mov	esi, DWORD PTR LM87_INT_TEMP[rip]
	call	read_lm87_reg@PLT
	mov	ebp, eax
	test	eax, eax
	js	.L1
	sal	ebp, 16
	mov	edi, DWORD PTR DIMM_PID_INPUT_TARGET[rip]
	mov	DWORD PTR 12[rbx], ebp
	call	FIX32TOPRINT@PLT
	mov	edi, ebp
	mov	r12d, eax
	call	FIX32TOPRINT@PLT
	mov	edx, r12d
	lea	rdi, .LC2[rip]
	mov	esi, eax
	xor	eax, eax
	call	DBG@PLT
	mov	eax, DWORD PTR 16[rbx]
	mov	r8, QWORD PTR 24[rbx]
	mov	rcx, QWORD PTR 32[rbx]
	add	eax, 1
	cdq
	idiv	DWORD PTR DIMM_PID_HISTORY_SIZE[rip]
	movsx	rax, edx
	mov	DWORD PTR 16[rbx], edx
	mov	edx, ebp
	mov	DWORD PTR [r8+rax*4], ebp
	movsx	rax, DWORD PTR 16[rbx]
	sub	edx, DWORD PTR DIMM_PID_INPUT_TARGET[rip]
	cmp	QWORD PTR 40[rbx], 0
	mov	DWORD PTR [rcx+rax*4], edx
	mov	esi, DWORD PTR DIMM_PID_HISTORY_SIZE[rip]
	je	.L6
	cmp	esi, 1
	jle	.L7
	xor	edi, edi
	.p2align 4,,10
	.p2align 3
.L8:
	mov	eax, DWORD PTR 16[rbx]
	add	edi, 1
	add	eax, 1
	cdq
	idiv	esi
	movsx	rax, edx
	mov	DWORD PTR 16[rbx], edx
	mov	edx, ebp
	mov	DWORD PTR [r8+rax*4], ebp
	movsx	rax, DWORD PTR 16[rbx]
	sub	edx, DWORD PTR DIMM_PID_INPUT_TARGET[rip]
	mov	DWORD PTR [rcx+rax*4], edx
	mov	esi, DWORD PTR DIMM_PID_HISTORY_SIZE[rip]
	lea	eax, -1[rsi]
	cmp	eax, edi
	jg	.L8
.L7:
	mov	QWORD PTR 40[rbx], 0
.L6:
	test	esi, esi
	jle	.L11
	lea	edx, -1[rsi]
	mov	rax, rcx
	lea	rcx, 4[rcx+rdx*4]
	xor	edx, edx
	.p2align 4,,10
	.p2align 3
.L10:
	add	edx, DWORD PTR [rax]
	add	rax, 4
	cmp	rcx, rax
	jne	.L10
.L9:
	imul	edx, DWORD PTR DIMM_PID_INTERVAL[rip]
	lea	rdi, .LC3[rip]
	xor	eax, eax
	mov	esi, edx
	mov	ebp, edx
	call	DBG@PLT
	imul	ebp, DWORD PTR DIMM_PID_G_r[rip]
	mov	ecx, 36
	xor	eax, eax
	lea	rdi, .LC4[rip]
	mov	esi, ebp
	sar	esi, cl
	call	DBG@PLT
	movsx	rdi, DWORD PTR 16[rbx]
	mov	ecx, DWORD PTR DIMM_PID_HISTORY_SIZE[rip]
	mov	rsi, QWORD PTR 32[rbx]
	lea	eax, -1[rdi+rcx]
	cdq
	idiv	ecx
	mov	eax, DWORD PTR [rsi+rdi*4]
	mov	ecx, 36
	lea	rdi, .LC5[rip]
	movsx	rdx, edx
	sub	eax, DWORD PTR [rsi+rdx*4]
	cdq
	idiv	DWORD PTR DIMM_PID_INTERVAL[rip]
	imul	eax, DWORD PTR DIMM_PID_G_d[rip]
	mov	esi, eax
	mov	r12d, eax
	xor	eax, eax
	sar	esi, cl
	add	r12d, ebp
	call	DBG@PLT
	movsx	rdx, DWORD PTR 16[rbx]
	mov	rax, QWORD PTR 32[rbx]
	mov	ecx, 36
	lea	rdi, .LC6[rip]
	mov	ebp, DWORD PTR [rax+rdx*4]
	imul	ebp, DWORD PTR DIMM_PID_G_p[rip]
	xor	eax, eax
	mov	esi, ebp
	add	ebp, r12d
	sar	esi, cl
	call	DBG@PLT
	mov	ecx, 36
	lea	rdi, .LC7[rip]
	xor	eax, eax
	sar	ebp, cl
	mov	esi, ebp
	call	DBG@PLT
	mov	DWORD PTR 8[rbx], ebp
	mov	esi, DWORD PTR DIMM_PID_OUTPUT_MIN[rip]
	mov	edi, ebp
	call	max@PLT
	mov	esi, DWORD PTR DIMM_PID_OUTPUT_MAX[rip]
	mov	DWORD PTR 8[rbx], eax
	mov	rdi, rax
	call	min@PLT
	lea	rdi, .LC8[rip]
	mov	DWORD PTR 8[rbx], eax
	mov	esi, eax
	mov	DWORD PTR dimm_output_clamp[rip], eax
	xor	eax, eax
	call	DBG@PLT
	movsx	rdi, DWORD PTR dimm_output_clamp[rip]
	mov	esi, DWORD PTR backside_params[rip]
	mov	rax, rdi
	imul	rdi, rdi, -368140053
	shr	rdi, 32
	add	edi, eax
	sar	edi, 7
	sar	eax, 31
	sub	edi, eax
	call	max@PLT
	cmp	DWORD PTR backside_state[rip], eax
	mov	rbx, rax
	jl	.L20
.L1:
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L20:
	.cfi_restore_state
	mov	esi, eax
	mov	DWORD PTR backside_state[rip], eax
	lea	rdi, .LC9[rip]
	xor	eax, eax
	call	DBG@PLT
	mov	edi, DWORD PTR BACKSIDE_FAN_PWM_INDEX[rip]
	mov	esi, ebx
	pop	rbx
	.cfi_remember_state
	.cfi_restore 3
	.cfi_def_cfa_offset 24
	pop	rbp
	.cfi_restore 6
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_restore 12
	.cfi_def_cfa_offset 8
	jmp	set_pwm_fan@PLT
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore_state
	xor	edx, edx
	jmp	.L9
	.cfi_endproc
.LFE0:
	.size	do_monitor_dimms, .-do_monitor_dimms
	.comm	dimm_output_clamp,4,4
	.comm	backside_state,4,4
	.comm	backside_params,4,4
	.comm	LM87_INT_TEMP,4,4
	.comm	DIMM_PID_OUTPUT_MIN,4,4
	.comm	DIMM_PID_OUTPUT_MAX,4,4
	.comm	DIMM_PID_INTERVAL,4,4
	.comm	DIMM_PID_INPUT_TARGET,4,4
	.comm	DIMM_PID_HISTORY_SIZE,4,4
	.comm	DIMM_PID_G_r,8,8
	.comm	DIMM_PID_G_p,8,8
	.comm	DIMM_PID_G_d,8,8
	.comm	BACKSIDE_FAN_PWM_INDEX,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_therm_pm72.c_do_monitor_dimms.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"DIMM:\012\000"
	.align	2
.LC1:
	.ascii	"  current value: %d\012\000"
	.align	2
.LC2:
	.ascii	"  temp: %d.%03d, target: %d.%03d\012\000"
	.global	__aeabi_idivmod
	.align	2
.LC3:
	.ascii	"  integral: %08x\012\000"
	.align	2
.LC4:
	.ascii	"   integ_p: %d\012\000"
	.global	__aeabi_idiv
	.align	2
.LC5:
	.ascii	"   deriv_p: %d\012\000"
	.align	2
.LC6:
	.ascii	"   prop_p: %d\012\000"
	.align	2
.LC7:
	.ascii	"   sum: %d\012\000"
	.align	2
.LC8:
	.ascii	"** DIMM clamp value: %d\012\000"
	.align	2
.LC9:
	.ascii	" -> applying clamp to backside fan now: %d  !\012\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	do_monitor_dimms, %function
do_monitor_dimms:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	ldr	r5, [r0]
	sub	sp, sp, #12
	sub	r5, r5, #1
	cmp	r5, #0
	str	r5, [r0]
	beq	.L15
.L1:
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L15:
	mov	r4, r0
	ldr	r8, .L16
	ldr	r0, .L16+4
	ldr	r3, [r8]
	str	r3, [r4]
	bl	DBG
	ldr	r1, [r4, #4]
	ldr	r0, .L16+8
	bl	DBG
	ldr	r3, .L16+12
	ldr	r0, [r4, #28]
	ldr	r1, [r3]
	bl	read_lm87_reg
	cmp	r0, #0
	blt	.L1
	lsl	r9, r0, #16
	mov	r0, r9
	str	r9, [r4, #8]
	bl	FIX32TOPRINT
	ldr	fp, .L16+16
	mov	r6, r0
	ldr	r0, [fp]
	bl	FIX32TOPRINT
	mov	r1, r6
	mov	r2, r0
	ldr	r0, .L16+20
	bl	DBG
	ldr	r7, .L16+24
	ldr	r0, [r4, #12]
	ldr	r1, [r7]
	add	r0, r0, #1
	bl	__aeabi_idivmod
	ldr	r3, [r4, #16]
	str	r1, [r4, #12]
	str	r9, [r3, r1, lsl #2]
	str	r3, [sp, #4]
	ldr	r3, [fp]
	ldr	r1, [r4, #24]
	ldr	r2, [r4, #12]
	ldr	r6, [r4, #20]
	sub	r3, r9, r3
	cmp	r1, #0
	str	r3, [r6, r2, lsl #2]
	ldr	r1, [r7]
	beq	.L6
	cmp	r1, #1
	ble	.L7
	mov	r10, r5
.L8:
	ldr	r0, [r4, #12]
	add	r10, r10, #1
	add	r0, r0, #1
	bl	__aeabi_idivmod
	ldr	r3, [sp, #4]
	str	r1, [r4, #12]
	str	r9, [r3, r1, lsl #2]
	ldr	r2, [fp]
	ldr	r1, [r4, #12]
	sub	r2, r9, r2
	str	r2, [r6, r1, lsl #2]
	ldr	r1, [r7]
	sub	r2, r1, #1
	cmp	r2, r10
	bgt	.L8
.L7:
	mov	r3, #0
	str	r3, [r4, #24]
.L6:
	cmp	r1, #0
	ble	.L9
	sub	r3, r6, #4
	add	r1, r3, r1, lsl #2
.L10:
	ldr	r2, [r3, #4]!
	cmp	r1, r3
	add	r5, r5, r2
	bne	.L10
.L9:
	mov	r6, #36
	ldr	r1, [r8]
	ldr	r0, .L16+28
	mul	r5, r1, r5
	mov	r1, r5
	bl	DBG
	ldr	r3, .L16+32
	ldr	r0, .L16+36
	ldr	r1, [r3]
	ldr	r9, .L16+40
	mul	r5, r1, r5
	asr	r1, r5, r6
	bl	DBG
	ldr	r1, [r7]
	ldr	r7, [r4, #12]
	add	r0, r7, r1
	sub	r0, r0, #1
	bl	__aeabi_idivmod
	mov	r2, r1
	ldr	r3, [r4, #20]
	ldr	r1, [r8]
	ldr	r0, [r3, r7, lsl #2]
	ldr	r3, [r3, r2, lsl #2]
	sub	r0, r0, r3
	bl	__aeabi_idiv
	mov	r8, r0
	ldr	r3, .L16+44
	ldr	r0, .L16+48
	ldr	r3, [r3]
	mul	r8, r3, r8
	asr	r1, r8, r6
	bl	DBG
	ldr	r2, [r4, #20]
	ldr	r1, [r4, #12]
	ldr	r3, .L16+52
	ldr	r7, [r2, r1, lsl #2]
	ldr	r1, [r3]
	add	r5, r5, r8
	mul	r7, r1, r7
	add	r5, r5, r7
	asr	r5, r5, r6
	asr	r1, r7, r6
	ldr	r0, .L16+56
	bl	DBG
	mov	r1, r5
	ldr	r0, .L16+60
	bl	DBG
	ldr	r3, .L16+64
	str	r5, [r4, #4]
	ldr	r1, [r3]
	mov	r0, r5
	bl	max
	ldr	r3, .L16+68
	str	r0, [r4, #4]
	ldr	r1, [r3]
	bl	min
	mov	r1, r0
	ldr	r0, .L16+72
	str	r1, [r4, #4]
	str	r1, [r9]
	bl	DBG
	ldr	r2, [r9]
	ldr	r3, .L16+76
	ldr	r1, .L16+80
	smull	r0, r3, r2, r3
	asr	r0, r2, #31
	add	r3, r3, r2
	rsb	r0, r0, r3, asr #7
	ldr	r1, [r1]
	bl	max
	ldr	r3, .L16+84
	mov	r4, r0
	ldr	r2, [r3]
	cmp	r2, r0
	bge	.L1
	mov	r1, r0
	ldr	r0, .L16+88
	str	r4, [r3]
	bl	DBG
	mov	r1, r4
	ldr	r3, .L16+92
	ldr	r0, [r3]
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	b	set_pwm_fan
.L17:
	.align	2
.L16:
	.word	DIMM_PID_INTERVAL
	.word	.LC0
	.word	.LC1
	.word	LM87_INT_TEMP
	.word	DIMM_PID_INPUT_TARGET
	.word	.LC2
	.word	DIMM_PID_HISTORY_SIZE
	.word	.LC3
	.word	DIMM_PID_G_r
	.word	.LC4
	.word	dimm_output_clamp
	.word	DIMM_PID_G_d
	.word	.LC5
	.word	DIMM_PID_G_p
	.word	.LC6
	.word	.LC7
	.word	DIMM_PID_OUTPUT_MIN
	.word	DIMM_PID_OUTPUT_MAX
	.word	.LC8
	.word	-368140053
	.word	backside_params
	.word	backside_state
	.word	.LC9
	.word	BACKSIDE_FAN_PWM_INDEX
	.size	do_monitor_dimms, .-do_monitor_dimms
	.comm	dimm_output_clamp,4,4
	.comm	backside_state,4,4
	.comm	backside_params,4,4
	.comm	LM87_INT_TEMP,4,4
	.comm	DIMM_PID_OUTPUT_MIN,4,4
	.comm	DIMM_PID_OUTPUT_MAX,4,4
	.comm	DIMM_PID_INTERVAL,4,4
	.comm	DIMM_PID_INPUT_TARGET,4,4
	.comm	DIMM_PID_HISTORY_SIZE,4,4
	.comm	DIMM_PID_G_r,4,4
	.comm	DIMM_PID_G_p,4,4
	.comm	DIMM_PID_G_d,4,4
	.comm	BACKSIDE_FAN_PWM_INDEX,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
