// File: GAStudyGroup[P]GPX2/src/base/sources/ImportData.cpp
// Function: ImportData::importFirstPopulation(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned int)
Population ImportData::importFirstPopulation(string name, unsigned popSize)
{
    ifstream file;
    string word{ "" };
    Population pop;
    for (unsigned i = 1; i <= popSize; i++) {
        string fileName{ name + "_exec_1_sol_" + to_string(i) + "_" + to_string(popSize) + ".dat" };
        /* string fileName{ name + to_string(i) + ".dat2" }; */
        file.open(fileName);
        if (!file.is_open()) {
            cout << "error reading file" << endl;
            exit(EXIT_FAILURE);
        }

        vector<int> newT;
        newT.reserve(popSize);
        auto ss = ostringstream{};
        ss <<file.rdbuf();
        auto cities = explode(ss.str(),'\n');
        //while (file >> word) {
        for(auto wordaux : cities){
            newT.push_back(stoi(wordaux));
        }
        //}
        file.close();
        pop.getPopulation().push_back(newT);
    }
    return (pop);
}

// Assembly:
subq $0x5a8, %rsp            # imm = 0x5A8
movq %rdx, 0x30(%rsp)
movq %rdi, 0x38(%rsp)
movq %rdi, %rax
movq %rax, 0x40(%rsp)
movq %rdi, 0x5a0(%rsp)
movq %rsi, 0x598(%rsp)
movq %rdx, 0x590(%rsp)
movl %ecx, 0x58c(%rsp)
movq 0x598(%rsp), %rax
movq %rax, 0x48(%rsp)
leaq 0x380(%rsp), %rdi
callq 0x6580
leaq 0x35f(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x6860
movq 0x50(%rsp), %rdx
leaq 0x58224(%rip), %rsi     # 0x759f4
leaq 0x360(%rsp), %rdi
callq 0x92b0
jmp 0x1d7df
leaq 0x35f(%rsp), %rdi
callq 0x6520
movq 0x38(%rsp), %rdi
movb $0x0, 0x34b(%rsp)
callq 0x19220
jmp 0x1d800
movl $0x1, 0x344(%rsp)
movl 0x344(%rsp), %eax
cmpl 0x58c(%rsp), %eax
ja 0x1dd99
movq 0x30(%rsp), %rsi
leaq 0x571b8(%rip), %rdx     # 0x749e3
leaq 0x2a0(%rsp), %rdi
callq 0x18b20
jmp 0x1d83a
movl 0x344(%rsp), %esi
leaq 0x280(%rsp), %rdi
callq 0x188a0
jmp 0x1d850
leaq 0x2c0(%rsp), %rdi
leaq 0x2a0(%rsp), %rsi
leaq 0x280(%rsp), %rdx
callq 0x18710
jmp 0x1d86f
leaq 0x56b83(%rip), %rdx     # 0x743f9
leaq 0x2e0(%rsp), %rdi
leaq 0x2c0(%rsp), %rsi
callq 0x186c0
jmp 0x1d88d
movl 0x58c(%rsp), %esi
leaq 0x260(%rsp), %rdi
callq 0x188a0
jmp 0x1d8a3
leaq 0x300(%rsp), %rdi
leaq 0x2e0(%rsp), %rsi
leaq 0x260(%rsp), %rdx
callq 0x18710
jmp 0x1d8c2
leaq 0x57127(%rip), %rdx     # 0x749f0
leaq 0x320(%rsp), %rdi
leaq 0x300(%rsp), %rsi
callq 0x186c0
jmp 0x1d8e0
leaq 0x300(%rsp), %rdi
callq 0x6988
leaq 0x260(%rsp), %rdi
callq 0x6988
leaq 0x2e0(%rsp), %rdi
callq 0x6988
leaq 0x2c0(%rsp), %rdi
callq 0x6988
leaq 0x280(%rsp), %rdi
callq 0x6988
leaq 0x2a0(%rsp), %rdi
callq 0x6988
leaq 0x380(%rsp), %rdi
leaq 0x320(%rsp), %rsi
movl $0x8, %edx
callq 0x6410
jmp 0x1d94a
leaq 0x380(%rsp), %rdi
callq 0x6760
movb %al, 0x2f(%rsp)
jmp 0x1d95d
movb 0x2f(%rsp), %al
testb $0x1, %al
jne 0x1daee
jmp 0x1d96b
movq 0x7e626(%rip), %rdi     # 0x9bf98
leaq 0x5707c(%rip), %rsi     # 0x749f5
callq 0x64a0
movq %rax, 0x20(%rsp)
jmp 0x1d985
movq 0x20(%rsp), %rdi
movq 0x7e5bf(%rip), %rsi     # 0x9bf50
callq 0x6500
jmp 0x1d998
movl $0x1, %edi
callq 0x65c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
leaq 0x35f(%rsp), %rdi
callq 0x6520
jmp 0x1ddf3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
jmp 0x1dde6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
jmp 0x1dddc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
jmp 0x1dac3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
jmp 0x1dab6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
jmp 0x1daa9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
jmp 0x1da9c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
jmp 0x1da8f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
leaq 0x300(%rsp), %rdi
callq 0x6988
leaq 0x260(%rsp), %rdi
callq 0x6988
leaq 0x2e0(%rsp), %rdi
callq 0x6988
leaq 0x2c0(%rsp), %rdi
callq 0x6988
leaq 0x280(%rsp), %rdi
callq 0x6988
leaq 0x2a0(%rsp), %rdi
callq 0x6988
jmp 0x1dddc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
jmp 0x1dd8a
leaq 0x248(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0xfdf0
movq 0x18(%rsp), %rdi
movl 0x58c(%rsp), %eax
movl %eax, %esi
callq 0x1e200
jmp 0x1db15
leaq 0xd0(%rsp), %rdi
callq 0x6670
jmp 0x1db24
leaq 0x380(%rsp), %rdi
callq 0x6730
movq %rax, 0x10(%rsp)
jmp 0x1db38
movq 0x10(%rsp), %rsi
leaq 0xd0(%rsp), %rdi
callq 0x60e0
jmp 0x1db4c
leaq 0x98(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x64e0
jmp 0x1db63
movq 0x48(%rsp), %rsi
leaq 0xb8(%rsp), %rdi
leaq 0x98(%rsp), %rdx
movl $0xa, %ecx
callq 0x1de10
jmp 0x1db84
leaq 0x98(%rsp), %rdi
callq 0x6988
leaq 0xb8(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x90(%rsp), %rdi
callq 0x1e310
movq %rax, 0x88(%rsp)
movq 0x90(%rsp), %rdi
callq 0x1e340
movq %rax, 0x80(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x1e370
testb $0x1, %al
jne 0x1dbe9
jmp 0x1dce7
leaq 0x88(%rsp), %rdi
callq 0x1e3b0
movq %rax, %rsi
leaq 0x60(%rsp), %rdi
callq 0x6200
jmp 0x1dc05
xorl %eax, %eax
movl %eax, %esi
leaq 0x60(%rsp), %rdi
movl $0xa, %edx
callq 0x9460
movl %eax, 0xc(%rsp)
jmp 0x1dc1e
movl 0xc(%rsp), %eax
movl %eax, 0x5c(%rsp)
leaq 0x248(%rsp), %rdi
leaq 0x5c(%rsp), %rsi
callq 0x1a720
jmp 0x1dc3a
leaq 0x60(%rsp), %rdi
callq 0x6988
leaq 0x88(%rsp), %rdi
callq 0x1e3c0
jmp 0x1dbcb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
jmp 0x1dd7d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
jmp 0x1dd70
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
leaq 0x98(%rsp), %rdi
callq 0x6988
jmp 0x1dd70
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
jmp 0x1dd63
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x6988
jmp 0x1dd63
leaq 0x380(%rsp), %rdi
callq 0x60d0
jmp 0x1dcf6
movq 0x38(%rsp), %rdi
callq 0x19230
movq %rax, (%rsp)
jmp 0x1dd06
movq (%rsp), %rdi
leaq 0x248(%rsp), %rsi
callq 0x10190
jmp 0x1dd19
leaq 0xb8(%rsp), %rdi
callq 0xa2c0
leaq 0xd0(%rsp), %rdi
callq 0x6110
leaq 0x248(%rsp), %rdi
callq 0x9af0
leaq 0x320(%rsp), %rdi
callq 0x6988
movl 0x344(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x344(%rsp)
jmp 0x1d80b
leaq 0xb8(%rsp), %rdi
callq 0xa2c0
leaq 0xd0(%rsp), %rdi
callq 0x6110
leaq 0x248(%rsp), %rdi
callq 0x9af0
leaq 0x320(%rsp), %rdi
callq 0x6988
jmp 0x1dddc
movb $0x1, 0x34b(%rsp)
testb $0x1, 0x34b(%rsp)
jne 0x1ddb5
movq 0x38(%rsp), %rdi
callq 0x9440
leaq 0x360(%rsp), %rdi
callq 0x6988
leaq 0x380(%rsp), %rdi
callq 0x6130
movq 0x40(%rsp), %rax
addq $0x5a8, %rsp            # imm = 0x5A8
retq
movq 0x38(%rsp), %rdi
callq 0x9440
leaq 0x360(%rsp), %rdi
callq 0x6988
leaq 0x380(%rsp), %rdi
callq 0x6130
movq 0x350(%rsp), %rdi
callq 0x6850
nopl (%rax)