// File: gabrielfelipeg[P]TravellingSalesman-GeneticAlgo/src/main.cpp
// Function: main
int main(int argc, char *argv[]){
    if(argc != 4){
        std::cout << "./run graphSize populationSize epochs" << std::endl;
        exit(0);
    }
    int graphSize = atoi(argv[1]);
    int populationSize = atoi(argv[2]);
    int epochs = atoi(argv[3]);
    srand(time(NULL));
    Population p;
    p.start(graphSize, populationSize);
    std::vector <long long> parcialResults;
    for(int i = 0; i < epochs; i++){
        if(i%100 == 0){
            parcialResults.emplace_back(p.currentBest);
        }
        p.nextGeneration();
    }
    parcialResults.emplace_back(p.currentBest);
    std::cout << "Epochs, bestAnswer, Size" << std::endl;
    for(int i = 1; i < parcialResults.size(); i++){
        std::cout << (i * 100) << ", " << parcialResults[i] << ", " << graphSize << std::endl;
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x4, -0x8(%rbp)
je 0x1398
movq 0x10c62(%rip), %rdi     # 0x11fd8
leaq 0x9c87(%rip), %rsi      # 0xb004
callq 0x10d0
movq %rax, %rdi
movq 0x10c3c(%rip), %rsi     # 0x11fc8
callq 0x1100
xorl %edi, %edi
callq 0x1110
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x1140
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x1140
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x1140
movl %eax, -0x1c(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x10b0
movl %eax, %edi
callq 0x10c0
leaq -0x60(%rbp), %rdi
movq %rdi, -0x98(%rbp)
callq 0x3d20
movq -0x98(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
callq 0x3dc0
jmp 0x13fc
leaq -0x88(%rbp), %rdi
callq 0x1610
movl $0x0, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x1490
movl -0x8c(%rbp), %eax
movl $0x64, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x1472
leaq -0x58(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x1630
jmp 0x1442
jmp 0x1472
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x15f6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x16f0
jmp 0x15f6
leaq -0x60(%rbp), %rdi
callq 0x5080
jmp 0x147d
jmp 0x147f
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x1412
leaq -0x58(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x1630
jmp 0x14a2
movq 0x10b2f(%rip), %rdi     # 0x11fd8
leaq 0x9b7a(%rip), %rsi      # 0xb02a
callq 0x10d0
movq %rax, -0xa0(%rbp)
jmp 0x14be
movq -0xa0(%rbp), %rdi
movq 0x10afc(%rip), %rsi     # 0x11fc8
callq 0x1100
jmp 0x14d3
movl $0x1, -0x90(%rbp)
movslq -0x90(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x16b0
movq %rax, %rcx
movq -0xa8(%rbp), %rax
cmpq %rcx, %rax
jae 0x15ce
movl -0x90(%rbp), %eax
imull $0x64, %eax, %esi
movq 0x10abe(%rip), %rdi     # 0x11fd8
callq 0x1170
movq %rax, -0xb0(%rbp)
jmp 0x1528
movq -0xb0(%rbp), %rdi
leaq 0x9b0d(%rip), %rsi      # 0xb043
callq 0x10d0
movq %rax, -0xb8(%rbp)
jmp 0x1544
movslq -0x90(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x16d0
movq -0xb8(%rbp), %rdi
movq (%rax), %rsi
callq 0x1080
movq %rax, -0xc0(%rbp)
jmp 0x156f
movq -0xc0(%rbp), %rdi
leaq 0x9ac6(%rip), %rsi      # 0xb043
callq 0x10d0
movq %rax, -0xc8(%rbp)
jmp 0x158b
movq -0xc8(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x1170
movq %rax, -0xd0(%rbp)
jmp 0x15a3
movq -0xd0(%rbp), %rdi
movq 0x10a17(%rip), %rsi     # 0x11fc8
callq 0x1100
jmp 0x15b8
jmp 0x15ba
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0x14dd
movl $0x0, -0x4(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x16f0
leaq -0x60(%rbp), %rdi
callq 0x1750
movl -0x4(%rbp), %eax
addq $0xd0, %rsp
popq %rbp
retq
leaq -0x60(%rbp), %rdi
callq 0x1750
movq -0x68(%rbp), %rdi
callq 0x1180
nopl (%rax,%rax)