// File: /workspace/github_cpp_makefile_star2_O2/acherkaoui[P]HTOP/modules/CPU.cpp
// Function: ReadStatsCpu(std::vector<CPUData_s, std::allocator<CPUData_s>>&)
void ReadStatsCpu(std::vector<CPUData> &stat)
{
	std::ifstream fileStat("/proc/stat");
	std::string line;

	const std::string STR_CPU("cpu");
	const std::size_t LEN_STR_CPU = STR_CPU.size();
	const std::string STR_TOT("tot");

	while(std::getline(fileStat, line)) {
		if(!line.compare(0, LEN_STR_CPU, STR_CPU)) {
			std::istringstream stringstream(line);

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

			stringstream >> entry.cpu;
			if (entry.cpu.size() > LEN_STR_CPU)
				entry.cpu.erase(0, LEN_STR_CPU);
			else
				entry.cpu = STR_TOT;
			for (int i = 0; i < NUM_CPU_STATES; ++i)
				stringstream >> entry.times[i];
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x468, %rsp            # imm = 0x468
movq %rdi, %rbx
leaq 0x3fd3(%rip), %rsi      # 0xb214
leaq 0x260(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0x45c0
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x46c6(%rip), %rsi      # 0xb92f
leaq 0x8(%rsp), %rdi
leaq 0xe0(%rsp), %rdx
callq 0x41a0
movq 0x10(%rsp), %r14
leaq 0x3f98(%rip), %rsi      # 0xb21f
leaq 0x48(%rsp), %rdi
leaq 0xe0(%rsp), %rdx
callq 0x41a0
leaq 0x260(%rsp), %r12
leaq 0x28(%rsp), %r15
leaq 0x8(%rsp), %r13
leaq 0xe0(%rsp), %rbp
movq %r12, %rdi
movq %r15, %rsi
callq 0x40b0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x73ad
movq %r15, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %r13, %rcx
callq 0x4470
testl %eax, %eax
jne 0x72b3
movq %rbp, %rdi
movq %r15, %rsi
pushq $0x8
popq %rdx
callq 0x4560
movq %r12, %r15
leaq 0x78(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
andq $0x0, 0x60(%rax)
movq %rax, 0x68(%rsp)
andq $0x0, 0x70(%rsp)
movq %rbx, %rdi
leaq 0x68(%rsp), %r12
movq %r12, %rsi
callq 0x7836
movq %r12, %rdi
callq 0x41f0
movq %rbx, %r12
movq 0x8(%rbx), %rbx
leaq -0x78(%rbx), %r13
movq %rbp, %rdi
movq %r13, %rsi
callq 0x4430
cmpq %r14, -0x70(%rbx)
jbe 0x7367
movq %r14, %rdx
movq %r13, %rdi
xorl %esi, %esi
callq 0x40d0
jmp 0x7374
movq %r13, %rdi
leaq 0x48(%rsp), %rsi
callq 0x4240
pushq $-0x58
popq %r13
cmpq $-0x8, %r13
je 0x7390
leaq (%rbx,%r13), %rsi
movq %rbp, %rdi
callq 0x4250
addq $0x8, %r13
jmp 0x7378
movq %rbp, %rdi
callq 0x4200
movq %r12, %rbx
movq %r15, %r12
leaq 0x28(%rsp), %r15
leaq 0x8(%rsp), %r13
jmp 0x72b3
leaq 0x48(%rsp), %rdi
callq 0x41f0
leaq 0x8(%rsp), %rdi
callq 0x41f0
leaq 0x28(%rsp), %rdi
callq 0x41f0
leaq 0x260(%rsp), %rdi
callq 0x4110
addq $0x468, %rsp            # imm = 0x468
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x7426
movq %rax, %rbx
jmp 0x7430
jmp 0x7407
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x41f0
jmp 0x740f
jmp 0x740c
movq %rax, %rbx
jmp 0x741c
movq %rax, %rbx
leaq 0xe0(%rsp), %rdi
callq 0x4200
leaq 0x48(%rsp), %rdi
callq 0x41f0
leaq 0x8(%rsp), %rdi
callq 0x41f0
leaq 0x28(%rsp), %rdi
callq 0x41f0
leaq 0x260(%rsp), %rdi
callq 0x4110
movq %rbx, %rdi
callq 0x45a0
nop