// File: /workspace/github_cpp_makefile_star2_O2/ratulSharker[P]Havec/src/common.cpp
// Function: process_mem_usage(double&, double&)
void process_mem_usage(double& vm_usage, double& resident_set)
{
   using std::ios_base;
   using std::ifstream;
   using std::string;

   vm_usage     = 0.0;
   resident_set = 0.0;

   // 'file' stat seems to give the most reliable results
   //
   ifstream stat_stream("/proc/self/stat",ios_base::in);

   // dummy vars for leading entries in stat that we don't care about
   //
   string pid, comm, state, ppid, pgrp, session, tty_nr;
   string tpgid, flags, minflt, cminflt, majflt, cmajflt;
   string utime, stime, cutime, cstime, priority, nice;
   string O, itrealvalue, starttime;

   // the two fields we want
   //
   unsigned long vsize;
   long rss;

   stat_stream >> pid >> comm >> state >> ppid >> pgrp >> session >> tty_nr
               >> tpgid >> flags >> minflt >> cminflt >> majflt >> cmajflt
               >> utime >> stime >> cutime >> cstime >> priority >> nice
               >> O >> itrealvalue >> starttime >> vsize >> rss; // don't care about the rest

   stat_stream.close();

   long page_size_kb = sysconf(_SC_PAGE_SIZE) / 1024; // in case x86-64 is configured to use 2MB pages
   vm_usage     = vsize / 1024.0;
   resident_set = rss * page_size_kb;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x4e0, %rsp            # imm = 0x4E0
movq %rdi, %r14
andq $0x0, (%rdi)
movq %rsi, %rbx
andq $0x0, (%rsi)
leaq 0x1733(%rip), %rsi      # 0x86a8
leaq 0x2d8(%rsp), %r15
pushq $0x8
popq %rdx
movq %r15, %rdi
callq 0x2420
leaq 0x2c8(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
xorl %eax, %eax
movb %al, (%rcx)
leaq 0x2a8(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
leaq 0x288(%rsp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %al, (%rcx)
movb %al, (%rdx)
leaq 0x268(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
leaq 0x248(%rsp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %al, (%rcx)
movb %al, (%rdx)
leaq 0x228(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
leaq 0x208(%rsp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %al, (%rcx)
movb %al, (%rdx)
leaq 0x1e8(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
leaq 0x1c8(%rsp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %al, (%rcx)
movb %al, (%rdx)
leaq 0x1a8(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
leaq 0x188(%rsp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %al, (%rcx)
movb %al, (%rdx)
leaq 0x168(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
leaq 0x148(%rsp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %al, (%rcx)
movb %al, (%rdx)
leaq 0x128(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
leaq 0x108(%rsp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %al, (%rcx)
movb %al, (%rdx)
leaq 0xe8(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
leaq 0xc8(%rsp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %al, (%rcx)
movb %al, (%rdx)
leaq 0xa8(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
leaq 0x88(%rsp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %al, (%rcx)
movb %al, (%rdx)
leaq 0x68(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
leaq 0x48(%rsp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %al, (%rcx)
movb %al, (%rdx)
leaq 0x28(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x2b8(%rsp), %rsi
movq %r15, %rdi
callq 0x2310
leaq 0x298(%rsp), %rsi
movq %rax, %rdi
callq 0x2310
leaq 0x278(%rsp), %rsi
movq %rax, %rdi
callq 0x2310
leaq 0x258(%rsp), %rsi
movq %rax, %rdi
callq 0x2310
leaq 0x238(%rsp), %rsi
movq %rax, %rdi
callq 0x2310
leaq 0x218(%rsp), %rsi
movq %rax, %rdi
callq 0x2310
leaq 0x1f8(%rsp), %rsi
movq %rax, %rdi
callq 0x2310
leaq 0x1d8(%rsp), %rsi
movq %rax, %rdi
callq 0x2310
leaq 0x1b8(%rsp), %rsi
movq %rax, %rdi
callq 0x2310
leaq 0x198(%rsp), %rsi
movq %rax, %rdi
callq 0x2310
leaq 0x178(%rsp), %rsi
movq %rax, %rdi
callq 0x2310
leaq 0x158(%rsp), %rsi
movq %rax, %rdi
callq 0x2310
leaq 0x138(%rsp), %rsi
movq %rax, %rdi
callq 0x2310
leaq 0x118(%rsp), %rsi
movq %rax, %rdi
callq 0x2310
leaq 0xf8(%rsp), %rsi
movq %rax, %rdi
callq 0x2310
leaq 0xd8(%rsp), %rsi
movq %rax, %rdi
callq 0x2310
leaq 0xb8(%rsp), %rsi
movq %rax, %rdi
callq 0x2310
leaq 0x98(%rsp), %rsi
movq %rax, %rdi
callq 0x2310
leaq 0x78(%rsp), %rsi
movq %rax, %rdi
callq 0x2310
leaq 0x58(%rsp), %rsi
movq %rax, %rdi
callq 0x2310
leaq 0x38(%rsp), %rsi
movq %rax, %rdi
callq 0x2310
leaq 0x18(%rsp), %rsi
movq %rax, %rdi
callq 0x2310
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x2110
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x2260
leaq 0x2d8(%rsp), %rdi
callq 0x2060
pushq $0x1e
popq %rdi
callq 0x2150
movl $0x400, %ecx            # imm = 0x400
cqto
idivq %rcx
movsd 0x10(%rsp), %xmm0
unpcklps 0xdb3(%rip), %xmm0      # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0xdbb(%rip), %xmm0      # 0x8080
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0xd37(%rip), %xmm1      # 0x8010
movsd %xmm1, (%r14)
imulq 0x8(%rsp), %rax
cvtsi2sd %rax, %xmm0
movsd %xmm0, (%rbx)
leaq 0x18(%rsp), %rdi
callq 0x20c0
leaq 0x38(%rsp), %rdi
callq 0x20c0
leaq 0x58(%rsp), %rdi
callq 0x20c0
leaq 0x78(%rsp), %rdi
callq 0x20c0
leaq 0x98(%rsp), %rdi
callq 0x20c0
leaq 0xb8(%rsp), %rdi
callq 0x20c0
leaq 0xd8(%rsp), %rdi
callq 0x20c0
leaq 0xf8(%rsp), %rdi
callq 0x20c0
leaq 0x118(%rsp), %rdi
callq 0x20c0
leaq 0x138(%rsp), %rdi
callq 0x20c0
leaq 0x158(%rsp), %rdi
callq 0x20c0
leaq 0x178(%rsp), %rdi
callq 0x20c0
leaq 0x198(%rsp), %rdi
callq 0x20c0
leaq 0x1b8(%rsp), %rdi
callq 0x20c0
leaq 0x1d8(%rsp), %rdi
callq 0x20c0
leaq 0x1f8(%rsp), %rdi
callq 0x20c0
leaq 0x218(%rsp), %rdi
callq 0x20c0
leaq 0x238(%rsp), %rdi
callq 0x20c0
leaq 0x258(%rsp), %rdi
callq 0x20c0
leaq 0x278(%rsp), %rdi
callq 0x20c0
leaq 0x298(%rsp), %rdi
callq 0x20c0
leaq 0x2b8(%rsp), %rdi
callq 0x20c0
leaq 0x2d8(%rsp), %rdi
callq 0x2070
addq $0x4e0, %rsp            # imm = 0x4E0
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x20c0
leaq 0x38(%rsp), %rdi
callq 0x20c0
leaq 0x58(%rsp), %rdi
callq 0x20c0
leaq 0x78(%rsp), %rdi
callq 0x20c0
leaq 0x98(%rsp), %rdi
callq 0x20c0
leaq 0xb8(%rsp), %rdi
callq 0x20c0
leaq 0xd8(%rsp), %rdi
callq 0x20c0
leaq 0xf8(%rsp), %rdi
callq 0x20c0
leaq 0x118(%rsp), %rdi
callq 0x20c0
leaq 0x138(%rsp), %rdi
callq 0x20c0
leaq 0x158(%rsp), %rdi
callq 0x20c0
leaq 0x178(%rsp), %rdi
callq 0x20c0
leaq 0x198(%rsp), %rdi
callq 0x20c0
leaq 0x1b8(%rsp), %rdi
callq 0x20c0
leaq 0x1d8(%rsp), %rdi
callq 0x20c0
leaq 0x1f8(%rsp), %rdi
callq 0x20c0
leaq 0x218(%rsp), %rdi
callq 0x20c0
leaq 0x238(%rsp), %rdi
callq 0x20c0
leaq 0x258(%rsp), %rdi
callq 0x20c0
leaq 0x278(%rsp), %rdi
callq 0x20c0
leaq 0x298(%rsp), %rdi
callq 0x20c0
leaq 0x2b8(%rsp), %rdi
callq 0x20c0
leaq 0x2d8(%rsp), %rdi
callq 0x2070
movq %rbx, %rdi
callq 0x2400