// File: /workspace/github_cpp_makefile_star2_O1/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 0x533a(%rip), %rsi      # 0xa150
leaq 0x60(%rsp), %rdi
movl $0x8, %edx
callq 0x3410
leaq 0x28(%rsp), %r13
leaq 0x60(%rsp), %r12
leaq 0x40(%rsp), %r15
leaq 0x18(%rsp), %rbp
movq %r12, %rdi
movq %r15, %rsi
callq 0x32c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x509c
movq %r13, 0x18(%rsp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
movq %rbp, %rdi
callq 0x3c88
movq %rbp, %rdi
leaq 0x52e7(%rip), %rsi      # 0xa15e
callq 0x3430
movq 0x48(%rsp), %rdx
cmpq 0x20(%rsp), %rdx
jne 0x4ea3
testq %rdx, %rdx
je 0x4ea7
movq 0x18(%rsp), %rsi
movq 0x40(%rsp), %rdi
callq 0x3220
testl %eax, %eax
sete %bl
jmp 0x4ea9
xorl %ebx, %ebx
jmp 0x4ea9
movb $0x1, %bl
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x4ec0
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3210
testb %bl, %bl
je 0x5080
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)
jne 0x5069
movq 0x18(%rsp), %rbx
callq 0x3040
movq %rax, %r15
movl 0x3c(%rsp), %eax
cmpl $0x2, %eax
je 0x4fa7
cmpl $0x1, %eax
je 0x4f63
testl %eax, %eax
jne 0x4fe3
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 0x50f8
movl (%r15), %ecx
testl %ecx, %ecx
je 0x5043
cmpl $0x22, %ecx
jne 0x504a
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 0x50d4
movl (%r15), %ecx
testl %ecx, %ecx
je 0x501f
cmpl $0x22, %ecx
jne 0x5026
jmp 0x5110
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 0x50ec
movl (%r15), %ecx
testl %ecx, %ecx
je 0x5031
cmpl $0x22, %ecx
jne 0x5038
jmp 0x511c
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 0x5054
cmpl $0x22, %ecx
jne 0x505b
jmp 0x5128
movl 0x4(%rsp), %ecx
movl %ecx, (%r15)
movq 0x10(%rsp), %rcx
movq %rax, 0x8(%rcx)
jmp 0x5064
movl 0x4(%rsp), %ecx
movl %ecx, (%r15)
movq 0x10(%rsp), %rcx
movq %rax, 0x10(%rcx)
jmp 0x5064
movl 0x4(%rsp), %ecx
movl %ecx, (%r15)
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
jmp 0x5064
movl 0x4(%rsp), %ecx
movl %ecx, (%r15)
movq 0x10(%rsp), %rcx
movq %rax, 0x18(%rcx)
leaq 0x40(%rsp), %r15
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x5080
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3210
movq %r12, %rdi
movabsq $0x7fffffffffffffff, %rsi # imm = 0x7FFFFFFFFFFFFFFF
movl $0xa, %edx
callq 0x3180
jmp 0x4e39
leaq 0x60(%rsp), %rdi
callq 0x3070
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x50c2
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 0x50ae(%rip), %rdi      # 0xa189
callq 0x3170
leaq 0x50a2(%rip), %rdi      # 0xa189
callq 0x3170
leaq 0x5096(%rip), %rdi      # 0xa189
callq 0x3170
leaq 0x508a(%rip), %rdi      # 0xa189
callq 0x3170
leaq 0x507e(%rip), %rdi      # 0xa189
callq 0x3310
leaq 0x5072(%rip), %rdi      # 0xa189
callq 0x3310
leaq 0x5066(%rip), %rdi      # 0xa189
callq 0x3310
leaq 0x505a(%rip), %rdi      # 0xa189
callq 0x3310
movq %rax, %rbx
jmp 0x517e
jmp 0x513f
jmp 0x513f
jmp 0x513f
movq %rax, %rbx
cmpl $0x0, (%r15)
jne 0x5156
movl 0x4(%rsp), %eax
movl %eax, (%r15)
jmp 0x5156
jmp 0x5153
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x5174
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3210
jmp 0x5174
jmp 0x5171
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x3070
leaq 0x50(%rsp), %rax
movq 0x40(%rsp), %rdi
cmpq %rax, %rdi
je 0x519a
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3210
movq %rbx, %rdi
callq 0x33f0