// File: gabryatfendor[P]SocietySimulator/src/configuration.cpp
// Function: Configuration::valueForKey(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int Configuration::valueForKey(string key)
{
    int value = 0;
    vector<string> file = this->configFile;
    vector<string>::iterator it;
    for(it = file.begin();it < file.end();it++)
    {
        string fileKey;
        //check where's =
        string::size_type pos = (*it).find('=');
        //takes what's before =
        if (pos != string::npos)
        {
            fileKey =  (*it).substr(0, pos);
        }
        //trim eventual spaces
        fileKey.erase(remove(fileKey.begin(),fileKey.end(),' '),fileKey.end());
        //if key from file is equal to key inputted
        if(fileKey == key)
        {
            //take the value
            string extracted = (*it).substr((*it).find("=")+1);
            //trim eventual blank spaces
            extracted.erase(remove(extracted.begin(),extracted.end(),' '),extracted.end());
            //convert string to int
            value = stoi(extracted);
        }
    }
    
    return value;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rsi, -0x150(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rsi
movl $0x0, -0x14(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x31c0
leaq -0x38(%rbp), %rdi
callq 0x32b0
leaq -0x30(%rbp), %rdi
callq 0x32d0
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x38(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3340
movq %rax, -0x48(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x3300
testb $0x1, %al
jne 0x2c6f
jmp 0x2f93
leaq -0x68(%rbp), %rdi
callq 0x2320
leaq -0x38(%rbp), %rdi
callq 0x3370
movq %rax, %rdi
movl $0x3d, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x2310
movq %rax, -0x70(%rbp)
cmpq $-0x1, -0x70(%rbp)
je 0x2cf4
leaq -0x38(%rbp), %rdi
callq 0x3370
movq %rax, %rsi
movq -0x70(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x90(%rbp), %rdi
callq 0x2250
jmp 0x2cbf
leaq -0x68(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x22d0
leaq -0x90(%rbp), %rdi
callq 0x2140
jmp 0x2cf4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x2f7f
leaq -0x68(%rbp), %rdi
movq %rdi, -0x160(%rbp)
callq 0x21d0
movq -0x160(%rbp), %rdi
movq %rax, -0xb8(%rbp)
callq 0x2110
movq %rax, -0xc0(%rbp)
movb $0x20, -0xc1(%rbp)
movq -0xb8(%rbp), %rdi
movq -0xc0(%rbp), %rsi
leaq -0xc1(%rbp), %rdx
callq 0x2fe0
movq %rax, -0x158(%rbp)
jmp 0x2d48
movq -0x158(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq -0xa8(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x3030
leaq -0x68(%rbp), %rdi
movq %rdi, -0x170(%rbp)
callq 0x2110
movq %rax, -0xd8(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x3030
movq -0x170(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movq -0xd0(%rbp), %rdx
callq 0x2060
movq %rax, -0x168(%rbp)
jmp 0x2db6
movq -0x150(%rbp), %rsi
movq -0x168(%rbp), %rax
movq %rax, -0xe0(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x3390
testb $0x1, %al
jne 0x2ddd
jmp 0x2f5f
leaq -0x38(%rbp), %rdi
movq %rdi, -0x180(%rbp)
callq 0x3370
movq -0x180(%rbp), %rdi
movq %rax, -0x178(%rbp)
callq 0x3370
movq %rax, %rdi
leaq 0x6229(%rip), %rsi      # 0x9033
xorl %eax, %eax
movl %eax, %edx
callq 0x23f0
movq -0x178(%rbp), %rsi
movq %rax, %rdx
incq %rdx
leaq -0x100(%rbp), %rdi
movq $-0x1, %rcx
callq 0x2250
jmp 0x2e35
leaq -0x100(%rbp), %rdi
movq %rdi, -0x190(%rbp)
callq 0x21d0
movq -0x190(%rbp), %rdi
movq %rax, -0x118(%rbp)
callq 0x2110
movq %rax, -0x120(%rbp)
movb $0x20, -0x121(%rbp)
movq -0x118(%rbp), %rdi
movq -0x120(%rbp), %rsi
leaq -0x121(%rbp), %rdx
callq 0x2fe0
movq %rax, -0x188(%rbp)
jmp 0x2e8c
movq -0x188(%rbp), %rax
movq %rax, -0x110(%rbp)
leaq -0x108(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x3030
leaq -0x100(%rbp), %rdi
movq %rdi, -0x1a0(%rbp)
callq 0x2110
movq %rax, -0x138(%rbp)
leaq -0x130(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x3030
movq -0x1a0(%rbp), %rdi
movq -0x108(%rbp), %rsi
movq -0x130(%rbp), %rdx
callq 0x2060
movq %rax, -0x198(%rbp)
jmp 0x2efd
movq -0x198(%rbp), %rax
movq %rax, -0x140(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0x100(%rbp), %rdi
movl $0xa, %edx
callq 0x3420
movl %eax, -0x1a4(%rbp)
jmp 0x2f28
movl -0x1a4(%rbp), %eax
movl %eax, -0x14(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x2140
jmp 0x2f5f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x2140
jmp 0x2f7f
leaq -0x68(%rbp), %rdi
callq 0x2140
leaq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0x3460
movq %rax, -0x148(%rbp)
jmp 0x2c4c
leaq -0x68(%rbp), %rdi
callq 0x2140
leaq -0x30(%rbp), %rdi
callq 0x3160
jmp 0x2fb4
movl -0x14(%rbp), %eax
movl %eax, -0x1a8(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3160
movl -0x1a8(%rbp), %eax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
movq -0x98(%rbp), %rdi
callq 0x23b0