// File: /workspace/github_cpp_makefile_star2_O3/ColinHarker[P]ltsim/src/memory.cpp
// Function: RandomAccessMemory::parseMemInfo(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, flag::memType)
void RandomAccessMemory::parseMemInfo(const std::string& memInfoType,
                                      flag::memType      classVariable)
{
   std::string   token;
   std::ifstream file("/proc/meminfo");
   while(file >> token)
   {
      if(token == memInfoType + ":")
      {
         std::string mem;
         if(file >> mem)
         {
            if(classVariable == flag::memType::memTotal)
            {
               m_memTotal = std::stoul(mem);
            }
            else if(classVariable == flag::memType::memAvailable)
            {
               m_memAvailable = std::stoul(mem);
            }
            else if(classVariable == flag::memType::swapTotal)
            {
               m_swapTotal = std::stoul(mem);
            }
            else
            {
               m_swapFree = std::stoul(mem);
            }
         }
      }
      // ignore rest of the line
      file.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
   }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x268, %rsp            # imm = 0x268
movl %edx, 0x3c(%rsp)
movq %rsi, %r14
movq %rdi, 0x10(%rsp)
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x53aa(%rip), %rsi      # 0xa1a0
leaq 0x60(%rsp), %rdi
movl $0x8, %edx
callq 0x3410
leaq 0x28(%rsp), %r13
leaq 0x60(%rsp), %r12
leaq 0x18(%rsp), %rbp
movq %r12, %rdi
leaq 0x40(%rsp), %rsi
callq 0x32c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x5084
movq %r13, 0x18(%rsp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
movq %rbp, %rdi
callq 0x3c8e
movq %rbp, %rdi
leaq 0x535a(%rip), %rsi      # 0xa1ae
callq 0x3430
movq 0x48(%rsp), %rdx
cmpq 0x20(%rsp), %rdx
jne 0x4e84
movq 0x18(%rsp), %rbx
testq %rdx, %rdx
je 0x4e8e
movq 0x40(%rsp), %rdi
movq %rbx, %rsi
callq 0x3220
testl %eax, %eax
sete %r15b
jmp 0x4e91
movq 0x18(%rsp), %rbx
xorl %r15d, %r15d
jmp 0x4e91
movb $0x1, %r15b
cmpq %r13, %rbx
je 0x4ea6
movq 0x28(%rsp), %rsi
incq %rsi
movq %rbx, %rdi
callq 0x3210
testb %r15b, %r15b
je 0x4eee
movq %r13, 0x18(%rsp)
movq $0x0, 0x20(%rsp)
movb $0x0, 0x28(%rsp)
movq %r12, %rdi
movq %rbp, %rsi
callq 0x32c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
je 0x4f0a
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x4eee
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3210
movq %r12, %rdi
movabsq $0x7fffffffffffffff, %rsi # imm = 0x7FFFFFFFFFFFFFFF
movl $0xa, %edx
callq 0x3180
jmp 0x4e14
movq 0x18(%rsp), %rbx
callq 0x3040
movq %rax, %r15
movl 0x3c(%rsp), %eax
cmpl $0x2, %eax
je 0x4fb9
cmpl $0x1, %eax
je 0x4f75
testl %eax, %eax
jne 0x4ff5
movl (%r15), %eax
movl %eax, 0x4(%rsp)
movl $0x0, (%r15)
movq %rbx, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x30b0
cmpq %rbx, 0x8(%rsp)
je 0x50e0
movl (%r15), %ecx
testl %ecx, %ecx
je 0x505b
cmpl $0x22, %ecx
jne 0x5062
jmp 0x50ec
movl (%r15), %eax
movl %eax, 0x4(%rsp)
movl $0x0, (%r15)
movq %rbx, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x30b0
cmpq %rbx, 0x8(%rsp)
je 0x50bc
movl (%r15), %ecx
testl %ecx, %ecx
je 0x5031
cmpl $0x22, %ecx
jne 0x5038
jmp 0x50f8
movl (%r15), %eax
movl %eax, 0x4(%rsp)
movl $0x0, (%r15)
movq %rbx, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x30b0
cmpq %rbx, 0x8(%rsp)
je 0x50d4
movl (%r15), %ecx
testl %ecx, %ecx
je 0x5046
cmpl $0x22, %ecx
jne 0x504d
jmp 0x5104
movl (%r15), %eax
movl %eax, 0x4(%rsp)
movl $0x0, (%r15)
movq %rbx, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x30b0
cmpq %rbx, 0x8(%rsp)
je 0x50c8
movl (%r15), %ecx
testl %ecx, %ecx
je 0x506f
cmpl $0x22, %ecx
jne 0x5076
jmp 0x5110
movl 0x4(%rsp), %ecx
movl %ecx, (%r15)
movq 0x10(%rsp), %rcx
movq %rax, 0x8(%rcx)
jmp 0x4ed7
movl 0x4(%rsp), %ecx
movl %ecx, (%r15)
movq 0x10(%rsp), %rcx
movq %rax, 0x10(%rcx)
jmp 0x4ed7
movl 0x4(%rsp), %ecx
movl %ecx, (%r15)
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
jmp 0x4ed7
movl 0x4(%rsp), %ecx
movl %ecx, (%r15)
movq 0x10(%rsp), %rcx
movq %rax, 0x18(%rcx)
jmp 0x4ed7
leaq 0x60(%rsp), %rdi
callq 0x3070
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x50aa
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3210
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5116(%rip), %rdi      # 0xa1d9
callq 0x3170
leaq 0x510a(%rip), %rdi      # 0xa1d9
callq 0x3170
leaq 0x50fe(%rip), %rdi      # 0xa1d9
callq 0x3170
leaq 0x50f2(%rip), %rdi      # 0xa1d9
callq 0x3170
leaq 0x50e6(%rip), %rdi      # 0xa1d9
callq 0x3310
leaq 0x50da(%rip), %rdi      # 0xa1d9
callq 0x3310
leaq 0x50ce(%rip), %rdi      # 0xa1d9
callq 0x3310
leaq 0x50c2(%rip), %rdi      # 0xa1d9
callq 0x3310
movq %rax, %rbx
jmp 0x5166
jmp 0x5127
jmp 0x5127
jmp 0x5127
movq %rax, %rbx
cmpl $0x0, (%r15)
jne 0x513e
movl 0x4(%rsp), %eax
movl %eax, (%r15)
jmp 0x513e
jmp 0x513b
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x515c
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3210
jmp 0x515c
jmp 0x5159
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x3070
leaq 0x50(%rsp), %rax
movq 0x40(%rsp), %rdi
cmpq %rax, %rdi
je 0x5182
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3210
movq %rbx, %rdi
callq 0x33f0