// File: /workspace/github_cpp_makefile_star2_O3/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 0xab3d(%rip), %rsi      # 0x17fa8
leaq 0xc0(%rsp), %rdi
callq 0x3220
leaq 0x140(%rsp), %rdi
callq 0x30e0
leaq 0x5254(%rip), %rsi      # 0x126e0
leaq 0xc0(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0xdca6
leaq 0x4fc7(%rip), %rsi      # 0x1246f
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 0xd4dc
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0xd4e3
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 0xd50d
callq 0x32c0
leaq 0x51d6(%rip), %rsi      # 0x126ea
movq %rsp, %rdi
leaq 0x80(%rsp), %rdx
callq 0xdca6
leaq 0x51c5(%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 0xd55f
movq %rdx, 0xc0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xd0(%rsp)
jmp 0xd565
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 0xd5bb
movq %rdx, 0x40(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x50(%rsp)
jmp 0xd5c3
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 0xd5ed
callq 0x32c0
leaq 0x10(%rsp), %r13
movq -0x10(%r13), %rdi
cmpq %r13, %rdi
je 0xd600
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 0xd6b0
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 0xb6e0
leaq 0x60(%rsp), %rdi
callq 0xb29b
movl %eax, %ebx
movq 0x60(%rsp), %rdi
cmpq %rbp, %rdi
je 0xd6ea
callq 0x32c0
leaq 0xc0(%rsp), %rdi
callq 0x30b0
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0xd705
callq 0x32c0
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0xd714
callq 0x32c0
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0xd723
callq 0x32c0
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xd739
callq 0x32c0
movl %ebx, %eax
cvtsi2ss %rax, %xmm0
mulss 0x4f94(%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 0xd7f8
callq 0x32c0
jmp 0xd7f8
jmp 0xd7f5
jmp 0xd7f5
movq %rax, %r14
jmp 0xd805
movq %rax, %r14
jmp 0xd813
movq %rax, %r14
movq 0xc0(%rsp), %rdi
cmpq %rbx, %rdi
je 0xd7a3
callq 0x32c0
jmp 0xd7a3
movq %rax, %r14
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0xd81d
jmp 0xd822
movq %rax, %r14
jmp 0xd822
movq %rax, %r14
movq 0xc0(%rsp), %rdi
cmpq %rbx, %rdi
jne 0xd82c
jmp 0xd831
movq %rax, %r14
jmp 0xd831
movq %rax, %r14
movq 0xa7cf(%rip), %rsi      # 0x17fa8
leaq 0xc0(%rsp), %rdi
callq 0x3220
leaq 0x140(%rsp), %rdi
callq 0x30e0
jmp 0xd847
movq %rax, %r14
leaq 0xc0(%rsp), %rdi
callq 0x30b0
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0xd813
callq 0x32c0
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0xd822
callq 0x32c0
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0xd831
callq 0x32c0
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xd847
callq 0x32c0
movq %r14, %rdi
callq 0x35c0