// File: 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 %rbp
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x3, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x59e0
movq -0x18(%rbp), %rdi
callq 0x6f40
movq -0x10(%rbp), %rsi
leaq -0x90(%rbp), %rdi
movq %rdi, -0x160(%rbp)
callq 0x5a10
movq -0x160(%rbp), %rdi
callq 0x4380
movss %xmm0, -0x154(%rbp)
jmp 0x7c94
leaq -0x90(%rbp), %rdi
callq 0x3cf0
movss -0x154(%rbp), %xmm0
movss %xmm0, -0x24(%rbp)
movq -0x18(%rbp), %rdi
callq 0x7550
movss %xmm0, -0xa0(%rbp)
movq -0x18(%rbp), %rdi
callq 0x7570
movss %xmm0, -0xa4(%rbp)
movq -0x10(%rbp), %rsi
leaq -0xc0(%rbp), %rdi
callq 0x5a40
movq -0x8(%rbp), %rax
movq %rax, -0x178(%rbp)
movss -0x24(%rbp), %xmm0
movss %xmm0, -0x16c(%rbp)
leaq -0xe1(%rbp), %rdi
movq %rdi, -0x168(%rbp)
callq 0x3520
movq -0x168(%rbp), %rdx
leaq 0x645c(%rip), %rsi      # 0xe174
leaq -0xe0(%rbp), %rdi
callq 0x76e0
jmp 0x7d26
movss -0x16c(%rbp), %xmm0
movq -0x178(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
movl $0x3, %edx
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x8010
jmp 0x7d4e
leaq -0xe0(%rbp), %rdi
callq 0x31d0
leaq -0xe1(%rbp), %rdi
callq 0x3320
movq -0x8(%rbp), %rax
movq %rax, -0x190(%rbp)
movss -0xa0(%rbp), %xmm0
movss %xmm0, -0x184(%rbp)
leaq -0x109(%rbp), %rdi
movq %rdi, -0x180(%rbp)
callq 0x3520
movq -0x180(%rbp), %rdx
leaq 0x63d6(%rip), %rsi      # 0xe178
leaq -0x108(%rbp), %rdi
callq 0x76e0
jmp 0x7db0
movss -0x184(%rbp), %xmm0
movq -0x190(%rbp), %rdi
leaq -0x108(%rbp), %rsi
movl $0x4, %edx
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x8010
jmp 0x7dd8
leaq -0x108(%rbp), %rdi
callq 0x31d0
leaq -0x109(%rbp), %rdi
callq 0x3320
movq -0x8(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movss -0xa4(%rbp), %xmm0
movss %xmm0, -0x19c(%rbp)
leaq -0x131(%rbp), %rdi
movq %rdi, -0x198(%rbp)
callq 0x3520
movq -0x198(%rbp), %rdx
leaq 0x6350(%rip), %rsi      # 0xe17c
leaq -0x130(%rbp), %rdi
callq 0x76e0
jmp 0x7e3a
movss -0x19c(%rbp), %xmm0
movq -0x1a8(%rbp), %rdi
leaq -0x130(%rbp), %rsi
movl $0x5, %edx
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x8010
jmp 0x7e62
leaq -0x130(%rbp), %rdi
callq 0x31d0
leaq -0x131(%rbp), %rdi
callq 0x3320
movq -0x8(%rbp), %rax
movq %rax, -0x1b0(%rbp)
leaq -0x150(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x5b30
jmp 0x7e9a
movq -0x1b0(%rbp), %rdi
leaq -0x150(%rbp), %rsi
movl $0x7, %edx
movl $0x1, %ecx
callq 0x8500
jmp 0x7eb9
leaq -0x150(%rbp), %rdi
callq 0x3d40
leaq -0xc0(%rbp), %rdi
callq 0x3d40
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x3cf0
jmp 0x7ffe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x7f2f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x31d0
leaq -0xe1(%rbp), %rdi
callq 0x3320
jmp 0x7ff2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x7f72
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x31d0
leaq -0x109(%rbp), %rdi
callq 0x3320
jmp 0x7ff2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x7fb2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x31d0
leaq -0x131(%rbp), %rdi
callq 0x3320
jmp 0x7ff2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x7ff2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x3d40
leaq -0xc0(%rbp), %rdi
callq 0x3d40
movq -0x98(%rbp), %rdi
callq 0x3510
nopw (%rax,%rax)