// File: /workspace/github_cpp_makefile_star2_O3/ColinHarker[P]ltsim/src/runtime.cpp
// Function: updateCpuWindow(WindowWrap&, Cpu&, RandomAccessMemory&)
void updateCpuWindow(WindowWrap& disp, Cpu& cpuContainer, RandomAccessMemory& memory)
{
   constexpr int k_StartColumn = 0;
   constexpr int k_StartRow    = 3;

   cpuContainer.run();
   memory.run();

   float util = cpuContainer.getCpu().getUtilization();
   float mem  = memory.getMemUsage();
   float swap = memory.getSwapUsage();

   std::vector<CpuReader> core = cpuContainer.getCores();

   displayUtilizationLevel(disp, util, "CPU", k_StartRow, k_StartColumn, flag::displayLength::standard);
   displayUtilizationLevel(disp, mem, "MEM", k_StartRow + 1, k_StartColumn, flag::displayLength::standard);
   displayUtilizationLevel(disp, swap, "SWAP", k_StartRow + 2, k_StartColumn, flag::displayLength::standard);

   displayCpuCores(disp, core, k_StartRow + 4, flag::displayLength::small);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x45c8
movq %r15, %rdi
callq 0x4bd4
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x4604
movq %r12, %rdi
callq 0x3d82
movss %xmm0, 0xc(%rsp)
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5320
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3210
leaq 0x20(%rsp), %r12
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0x533c
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3210
movq %r15, %rdi
callq 0x521e
movss %xmm0, 0x8(%rsp)
movq %r15, %rdi
callq 0x5224
movss %xmm0, 0x4(%rsp)
leaq 0x90(%rsp), %rdi
movq %r14, %rsi
callq 0x4682
leaq 0x10(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x4e71(%rip), %rsi      # 0xa1e8
leaq 0x4e6d(%rip), %rdx      # 0xa1eb
callq 0x522a
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
movss 0xc(%rsp), %xmm0
movl $0x3, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5500
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x53b7
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3210
leaq 0x10(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x4e26(%rip), %rsi      # 0xa1ec
leaq 0x4e22(%rip), %rdx      # 0xa1ef
callq 0x522a
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
movss 0x8(%rsp), %xmm0
movl $0x4, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5500
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x5406
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3210
leaq 0x10(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x4ddb(%rip), %rsi      # 0xa1f0
leaq 0x4dd8(%rip), %rdx      # 0xa1f4
callq 0x522a
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
movss 0x4(%rsp), %xmm0
movl $0x5, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5500
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x5455
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3210
leaq 0x78(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x46da
leaq 0x78(%rsp), %rsi
movq %rbx, %rdi
movl $0x7, %edx
movl $0x1, %ecx
callq 0x5910
leaq 0x78(%rsp), %rdi
callq 0x3a90
leaq 0x90(%rsp), %rdi
callq 0x3a90
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x3a90
jmp 0x54dc
jmp 0x54d9
jmp 0x54bd
jmp 0x54d9
jmp 0x54bd
jmp 0x54d9
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x54dc
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3210
jmp 0x54dc
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x3a90
movq %rbx, %rdi
callq 0x33f0
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3a5a
jmp 0x54e9