// File: /workspace/github_cpp_makefile_star2_O1/acherkaoui[P]HTOP/modules/CPU.cpp
// Function: Cpu::getStats()
std::vector<CPUData> Cpu::getStats()
{
	std::vector<CPUData> stat1;
	std::vector<CPUData> stat2;
	std::vector<CPUData> cpu;

	this->updateCpu(stat1, stat2);
	const size_t NUM_STAT = stat1.size();

	for(size_t i = 0; i < NUM_STAT; ++i) {
		const float ACTIVE_TIME	= static_cast<float>(
			GetActiveTime(stat2[i]) -
				GetActiveTime(stat1[i]));
		const float IDLE_TIME	= static_cast<float>(
			GetIdleTime(stat2[i]) - GetIdleTime(stat1[i]));
		const float TOTAL_TIME	= ACTIVE_TIME + IDLE_TIME;

		cpu.emplace_back(CPUData());
		CPUData &entry = cpu.back();

		entry.cpu = stat1[i].cpu;
		entry.active = 100.f * ACTIVE_TIME / TOTAL_TIME;
		entry.idle = 100.f * IDLE_TIME / TOTAL_TIME;
	}
	return (cpu);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
xorl %eax, %eax
leaq 0x10(%rsp), %rsi
movq %rax, 0x10(%rsi)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsi)
leaq 0x30(%rsp), %rdx
movq %rax, 0x10(%rdx)
movaps %xmm0, (%rdx)
movq %rax, 0x10(%rdi)
movups %xmm0, (%rdi)
callq 0x80ce
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
je 0x8315
sarq $0x3, %rax
movabsq $-0x1111111111111111, %r12 # imm = 0xEEEEEEEEEEEEEEEF
imulq %rax, %r12
leaq 0x60(%rsp), %r15
cmpq $0x1, %r12
adcq $0x0, %r12
xorl %r13d, %r13d
xorl %ebp, %ebp
movq 0x30(%rsp), %rax
movq 0x28(%rax,%rbp), %rdx
addq 0x20(%rax,%rbp), %rdx
addq 0x30(%rax,%rbp), %rdx
addq 0x48(%rax,%rbp), %rdx
addq 0x50(%rax,%rbp), %rdx
addq 0x58(%rax,%rbp), %rdx
addq 0x60(%rax,%rbp), %rdx
movq 0x10(%rsp), %rcx
addq 0x68(%rax,%rbp), %rdx
movq 0x20(%rcx,%rbp), %rsi
addq 0x28(%rcx,%rbp), %rsi
addq 0x30(%rcx,%rbp), %rsi
addq 0x48(%rcx,%rbp), %rsi
addq 0x50(%rcx,%rbp), %rsi
addq 0x58(%rcx,%rbp), %rsi
addq 0x60(%rcx,%rbp), %rsi
addq 0x68(%rcx,%rbp), %rsi
subq %rsi, %rdx
js 0x81f8
xorps %xmm0, %xmm0
cvtsi2ss %rdx, %xmm0
jmp 0x8210
movq %rdx, %rsi
shrq %rsi
andl $0x1, %edx
orq %rsi, %rdx
xorps %xmm0, %xmm0
cvtsi2ss %rdx, %xmm0
addss %xmm0, %xmm0
movss %xmm0, 0xc(%rsp)
movq 0x40(%rax,%rbp), %rdx
addq 0x38(%rax,%rbp), %rdx
movq 0x38(%rcx,%rbp), %rax
addq 0x40(%rcx,%rbp), %rax
subq %rax, %rdx
js 0x8239
xorps %xmm0, %xmm0
cvtsi2ss %rdx, %xmm0
jmp 0x8251
movq %rdx, %rax
shrq %rax
andl $0x1, %edx
orq %rax, %rdx
xorps %xmm0, %xmm0
cvtsi2ss %rdx, %xmm0
addss %xmm0, %xmm0
movss %xmm0, 0x8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x60(%rsp)
movq %r13, 0xc0(%rsp)
movaps %xmm0, 0xb0(%rsp)
movaps %xmm0, 0xa0(%rsp)
movaps %xmm0, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movq %r15, 0x50(%rsp)
movq %r13, 0x58(%rsp)
movb $0x0, 0x60(%rsp)
movq %rbx, %rdi
leaq 0x50(%rsp), %rsi
callq 0x8564
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x82bc
callq 0x4320
movq 0x8(%rbx), %r14
leaq -0x78(%r14), %rdi
movq 0x10(%rsp), %rsi
addq %rbp, %rsi
callq 0x4240
movss 0xc(%rsp), %xmm2
movaps %xmm2, %xmm0
movss 0x8(%rsp), %xmm3
addss %xmm3, %xmm0
movss 0x4f50(%rip), %xmm1     # 0xd23c
mulss %xmm1, %xmm2
divss %xmm0, %xmm2
movss %xmm2, -0x8(%r14)
mulss %xmm1, %xmm3
divss %xmm0, %xmm3
movss %xmm3, -0x4(%r14)
addq $0x78, %rbp
decq %r12
jne 0x818f
leaq 0x30(%rsp), %rdi
callq 0x85d4
leaq 0x10(%rsp), %rdi
callq 0x85d4
movq %rbx, %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8354
movq %rax, %r14
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x8357
callq 0x4320
jmp 0x8357
movq %rax, %r14
movq %rbx, %rdi
callq 0x85d4
leaq 0x30(%rsp), %rdi
callq 0x85d4
leaq 0x10(%rsp), %rdi
callq 0x85d4
movq %r14, %rdi
callq 0x45c0
nop