// File: GAStudyGroup[P]GPX2/src/base/sources/GAUtils.cpp
// Function: GAUtils::crossAllxAll(Population&)
Population GAUtils::crossAllxAll(Population &pop) {
    Population newPop;
    vector<int> currentTour;

    for (unsigned i = 0; i < Config::POP_SIZE; i++) {
        currentTour = pop.getPopulation()[i];
        for (unsigned j = 0; j < Config::POP_SIZE; j++) {
            if (i != j) {
                vector<int> t = GPX2::crossover(pop.getPopulation()[j], currentTour);
                if (getFitness(t) < getFitness(currentTour)) {
                    currentTour = t;
                }
            }
        }

        newPop.getPopulation().push_back(currentTour);
    }

    return newPop;
}

// Assembly:
subq $0xc8, %rsp
movq %rdi, 0x28(%rsp)
movq %rdi, %rax
movq %rax, 0x30(%rsp)
movq %rdi, 0xc0(%rsp)
movq %rsi, 0xb8(%rsp)
movb $0x0, 0xb7(%rsp)
callq 0x19220
leaq 0x98(%rsp), %rdi
callq 0xfdf0
movl $0x0, 0x94(%rsp)
movl 0x94(%rsp), %eax
leaq 0x90509(%rip), %rcx     # 0x9ca00
cmpl (%rcx), %eax
jae 0xc708
movq 0xb8(%rsp), %rdi
callq 0x19230
movq %rax, 0x20(%rsp)
jmp 0xc513
movq 0x20(%rsp), %rdi
movl 0x94(%rsp), %eax
movl %eax, %esi
callq 0x10230
movq %rax, %rsi
leaq 0x98(%rsp), %rdi
callq 0x10250
jmp 0xc538
movl $0x0, 0x80(%rsp)
movl 0x80(%rsp), %eax
leaq 0x904af(%rip), %rcx     # 0x9ca00
cmpl (%rcx), %eax
jae 0xc6cb
movl 0x94(%rsp), %eax
cmpl 0x80(%rsp), %eax
je 0xc6b3
movq 0xb8(%rsp), %rdi
callq 0x19230
movq %rax, 0x18(%rsp)
jmp 0xc581
movq 0x18(%rsp), %rdi
movl 0x80(%rsp), %eax
movl %eax, %esi
callq 0x10230
movq %rax, %rsi
leaq 0x50(%rsp), %rdi
callq 0xfcd0
jmp 0xc5a3
leaq 0x38(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xfcd0
jmp 0xc5b7
leaq 0x68(%rsp), %rdi
leaq 0x50(%rsp), %rsi
leaq 0x38(%rsp), %rdx
callq 0x5dd80
jmp 0xc5cd
leaq 0x38(%rsp), %rdi
callq 0x9af0
leaq 0x50(%rsp), %rdi
callq 0x9af0
leaq 0x68(%rsp), %rdi
callq 0x1b240
movl %eax, 0x14(%rsp)
jmp 0xc5f1
leaq 0x98(%rsp), %rdi
callq 0x1b240
movl %eax, 0x10(%rsp)
jmp 0xc604
movl 0x14(%rsp), %eax
movl 0x10(%rsp), %ecx
cmpl %ecx, %eax
jge 0xc6a9
leaq 0x98(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x10250
jmp 0xc628
jmp 0xc6a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0xc729
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0xc677
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x9af0
leaq 0x50(%rsp), %rdi
callq 0x9af0
jmp 0xc729
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x68(%rsp), %rdi
callq 0x9af0
jmp 0xc729
leaq 0x68(%rsp), %rdi
callq 0x9af0
jmp 0xc6b5
movl 0x80(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x80(%rsp)
jmp 0xc543
movq 0x28(%rsp), %rdi
callq 0x19230
movq %rax, 0x8(%rsp)
jmp 0xc6dc
movq 0x8(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x10190
jmp 0xc6f0
jmp 0xc6f2
movl 0x94(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x94(%rsp)
jmp 0xc4e9
movb $0x1, 0xb7(%rsp)
leaq 0x98(%rsp), %rdi
callq 0x9af0
testb $0x1, 0xb7(%rsp)
jne 0xc74c
jmp 0xc742
leaq 0x98(%rsp), %rdi
callq 0x9af0
movq 0x28(%rsp), %rdi
callq 0x9440
jmp 0xc759
movq 0x28(%rsp), %rdi
callq 0x9440
movq 0x30(%rsp), %rax
addq $0xc8, %rsp
retq
movq 0x88(%rsp), %rdi
callq 0x6850
nopw %cs:(%rax,%rax)