// File: /workspace/github_cpp_makefile_star2_O1/JenTus[P]TCEM/src_TCEM/utils.cc
// Function: getCurrentMemoryUsage()
float getCurrentMemoryUsage() { //megabyte verii
	string pid = intToStr(unsigned(getpid()));
	string outfile = "temp/tmp_" + pid + ".txt";
	string command = "pmap " + pid + " | grep -i Total | awk '{print $2}' > " + outfile;	
	system(command.c_str());
	
	string mem_str;
	ifstream ifs(outfile.c_str());
	std::getline(ifs, mem_str);
	ifs.close();
	
	mem_str = mem_str.substr(0, mem_str.size()-1);
	float mem = (float)strToInt(mem_str);
	
	return mem/1024; // in MB
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2c8, %rsp            # imm = 0x2C8
callq 0x3470
movl %eax, %ebp
leaq 0xc0(%rsp), %rdi
callq 0x3200
leaq 0xd0(%rsp), %rbx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x3580
leaq 0xd8(%rsp), %rsi
leaq 0x80(%rsp), %rdi
callq 0x34f0
movq 0xaa61(%rip), %rsi      # 0x17fa8
leaq 0xc0(%rsp), %rdi
callq 0x3220
leaq 0x140(%rsp), %rdi
callq 0x30e0
leaq 0x5178(%rip), %rsi      # 0x126e0
leaq 0xc0(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0xdd7c
leaq 0x4ef3(%rip), %rsi      # 0x12477
leaq 0xc0(%rsp), %rdi
callq 0x3620
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xd5b8
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0xd5bf
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x28(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0xc0(%rsp), %rdi
cmpq %rbx, %rdi
je 0xd5e9
callq 0x32c0
leaq 0x50fa(%rip), %rsi      # 0x126ea
movq %rsp, %rdi
leaq 0x80(%rsp), %rdx
callq 0xdd7c
leaq 0x50e9(%rip), %rsi      # 0x126f0
movq %rsp, %rdi
callq 0x3620
movq %rbx, 0xc0(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xd63b
movq %rdx, 0xc0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xd0(%rsp)
jmp 0xd641
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
movq 0x8(%rax), %rdx
leaq 0xc0(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
callq 0x30d0
leaq 0x50(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xd697
movq %rdx, 0x40(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x50(%rsp)
jmp 0xd69f
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, 0x48(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0xc0(%rsp), %rdi
cmpq %rbx, %rdi
je 0xd6c9
callq 0x32c0
leaq 0x10(%rsp), %r13
movq -0x10(%r13), %rdi
cmpq %r13, %rdi
je 0xd6dc
callq 0x32c0
movq 0x40(%rsp), %rdi
callq 0x3270
movq %r13, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movq 0x20(%rsp), %rsi
leaq 0xc0(%rsp), %rbx
movq %rbx, %rdi
movl $0x8, %edx
callq 0x35f0
movq 0xc0(%rsp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x32d0
movsbl %al, %edx
leaq 0xc0(%rsp), %rdi
movq %rsp, %rsi
callq 0x3600
leaq 0xc0(%rsp), %rdi
callq 0x3090
movq %rsp, %rsi
movq 0x8(%rsi), %rcx
decq %rcx
leaq 0xa0(%rsp), %rdi
xorl %edx, %edx
callq 0x3300
movq %rsp, %rdi
leaq 0xa0(%rsp), %rbx
movq %rbx, %rsi
callq 0x33b0
movq (%rbx), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0xd78c
callq 0x32c0
leaq 0x70(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %rdi
callq 0xb732
leaq 0x60(%rsp), %rdi
callq 0xb2f9
movl %eax, %ebx
movq 0x60(%rsp), %rdi
cmpq %rbp, %rdi
je 0xd7c6
callq 0x32c0
leaq 0xc0(%rsp), %rdi
callq 0x30b0
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0xd7e1
callq 0x32c0
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0xd7f0
callq 0x32c0
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0xd7ff
callq 0x32c0
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xd815
callq 0x32c0
movl %ebx, %eax
cvtsi2ss %rax, %xmm0
mulss 0x4eb8(%rip), %xmm0     # 0x126dc
addq $0x2c8, %rsp            # imm = 0x2C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq 0x60(%rsp), %rdi
cmpq %rbp, %rdi
je 0xd8d4
callq 0x32c0
jmp 0xd8d4
jmp 0xd8d1
jmp 0xd8d1
movq %rax, %r14
jmp 0xd8e1
movq %rax, %r14
jmp 0xd8ef
movq %rax, %r14
movq 0xc0(%rsp), %rdi
cmpq %rbx, %rdi
je 0xd87f
callq 0x32c0
jmp 0xd87f
movq %rax, %r14
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0xd8f9
jmp 0xd8fe
movq %rax, %r14
jmp 0xd8fe
movq %rax, %r14
movq 0xc0(%rsp), %rdi
cmpq %rbx, %rdi
jne 0xd908
jmp 0xd90d
movq %rax, %r14
jmp 0xd90d
movq %rax, %r14
movq 0xa6f3(%rip), %rsi      # 0x17fa8
leaq 0xc0(%rsp), %rdi
callq 0x3220
leaq 0x140(%rsp), %rdi
callq 0x30e0
jmp 0xd923
movq %rax, %r14
leaq 0xc0(%rsp), %rdi
callq 0x30b0
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0xd8ef
callq 0x32c0
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0xd8fe
callq 0x32c0
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0xd90d
callq 0x32c0
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xd923
callq 0x32c0
movq %r14, %rdi
callq 0x35c0