// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
cmpl $0x4, %edi
jne 0x1611
movq %rsi, %r14
movq 0x8(%rsi), %rdi
callq 0x1180
movl %eax, %ebx
movq 0x10(%r14), %rdi
callq 0x1180
movl %eax, %r15d
movq 0x18(%r14), %rdi
callq 0x1180
movl %eax, %ebp
xorl %edi, %edi
callq 0x10e0
movl %eax, %edi
callq 0x10f0
leaq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x1b0c
movq %r14, %rdi
movl %ebx, %esi
movl %r15d, %edx
callq 0x1b64
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
testl %ebp, %ebp
jle 0x14a6
xorl %r13d, %r13d
movq %rsp, %r15
leaq 0x18(%rsp), %r12
xorl %r14d, %r14d
movl %r14d, %eax
imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F
shrq $0x25, %rax
imull $0x64, %eax, %eax
addl %r13d, %eax
jne 0x1494
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x1487
movq 0x20(%rsp), %rax
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x1494
movq %r15, %rdi
leaq 0x20(%rsp), %rdx
callq 0x170e
movq %r12, %rdi
callq 0x2996
incl %r14d
decl %r13d
decl %ebp
jne 0x1452
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x14c5
movq 0x20(%rsp), %rax
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x14d2
leaq 0x20(%rsp), %rdx
movq %rsp, %rdi
callq 0x170e
movq 0x6aff(%rip), %r14      # 0x7fd8
leaq 0x3b4a(%rip), %rsi      # 0x502a
movl $0x18, %edx
movq %r14, %rdi
callq 0x1140
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x1100
movsbl %al, %esi
movq 0x6acd(%rip), %rdi      # 0x7fd8
callq 0x1030
movq %rax, %rdi
callq 0x10b0
movq (%rsp), %rdi
movq 0x8(%rsp), %rax
subq %rdi, %rax
cmpq $0x9, %rax
jb 0x15da
movl $0x1, %r13d
movl $0x64, %ebp
movq 0x6a98(%rip), %r14      # 0x7fd8
leaq 0x3afc(%rip), %r15      # 0x5043
movq %r14, %rdi
movl %ebp, %esi
callq 0x11b0
movq %rax, %r12
movl $0x2, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x1140
movq (%rsp), %rax
movq (%rax,%r13,8), %rsi
movq %r12, %rdi
callq 0x1070
movq %rax, %r12
movl $0x2, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x1140
movq %r12, %rdi
movl %ebx, %esi
callq 0x11b0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x1100
movsbl %al, %esi
movq %r12, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10b0
incq %r13
movq (%rsp), %rdi
movq 0x8(%rsp), %rax
subq %rdi, %rax
sarq $0x3, %rax
addl $0x64, %ebp
cmpq %r13, %rax
ja 0x1547
testq %rdi, %rdi
je 0x15ec
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x1130
leaq 0x40(%rsp), %rdi
callq 0x1672
leaq 0x28(%rsp), %rdi
callq 0x16c0
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x69c0(%rip), %rdi      # 0x7fd8
leaq 0x39e5(%rip), %rsi      # 0x5004
callq 0x1110
movq %rax, %rdi
callq 0x1090
xorl %edi, %edi
callq 0x1150
movq %rax, %rbx
jmp 0x1655
jmp 0x163c
jmp 0x163c
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1655
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x1130
leaq 0x40(%rsp), %rdi
callq 0x1672
leaq 0x28(%rsp), %rdi
callq 0x16c0
movq %rbx, %rdi
callq 0x11c0
nop