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

    sort(pop.getPopulation().begin(), pop.getPopulation().end(),sortPopulation);

    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);
                currentTour = t;
            }
        }

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

    sort(tmpPop.getPopulation().begin(), tmpPop.getPopulation().end(),sortPopulation);
    
    newPop.getPopulation().insert(newPop.getPopulation().end(),tmpPop.getPopulation().begin(),tmpPop.getPopulation().begin()+Config::N_BEST);

    tmpPop = AntColony().run(Config::POP_SIZE-(newPop.getPopulation().size()));

    newPop.getPopulation().insert(newPop.getPopulation().end(),tmpPop.getPopulation().begin(),tmpPop.getPopulation().end());

    return newPop;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, %r13
movq %rdi, (%rsp)
callq 0xeaac
leaq 0x10(%rsp), %rdi
callq 0xeaac
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movq %r13, %rdi
callq 0xeabc
movq (%rax), %r15
movq %r13, %rdi
callq 0xeabc
movq 0x8(%rax), %rbx
cmpq %rbx, %r15
je 0x9402
movq %rbx, %r14
subq %r15, %r14
movq %r14, %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0xa2e6
cmpq $0x181, %r14            # imm = 0x181
jl 0x93f7
leaq 0x180(%r15), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0xa85f
cmpq %rbx, %r12
je 0x9402
movq %r12, %rdi
callq 0xa960
addq $0x18, %r12
jmp 0x93e4
movq %r15, %rdi
movq %rbx, %rsi
callq 0xa85f
leaq 0x394c7(%rip), %rax     # 0x428d0
cmpl $0x0, (%rax)
je 0x953e
xorl %r12d, %r12d
leaq 0x88(%rsp), %r15
movq %r13, %rbp
movq %r13, %rdi
callq 0xeabc
leaq (%r12,%r12,2), %rsi
shlq $0x3, %rsi
addq (%rax), %rsi
leaq 0x30(%rsp), %rdi
callq 0xb296
leaq 0x3948c(%rip), %rax     # 0x428d0
movl (%rax), %eax
testl %eax, %eax
je 0x950f
xorl %r14d, %r14d
xorl %r13d, %r13d
cmpq %r13, %r12
je 0x94fd
movq %rbp, %rdi
callq 0xeabc
movq (%rax), %rsi
addq %r14, %rsi
leaq 0x70(%rsp), %rdi
callq 0xb078
movq %r15, %rbx
movq %r15, %rdi
leaq 0x30(%rsp), %rsi
callq 0xb078
leaq 0x50(%rsp), %rdi
leaq 0x70(%rsp), %rsi
movq %rbx, %rdx
callq 0x26bf4
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x94b4
movq 0x98(%rsp), %rsi
subq %rdi, %rsi
callq 0x53b0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x94ce
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x53b0
leaq 0x30(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0xb296
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x94f4
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x53b0
leaq 0x393d5(%rip), %rax     # 0x428d0
movl (%rax), %eax
incq %r13
movl %eax, %ecx
addq $0x18, %r14
cmpq %rcx, %r13
jb 0x9454
leaq 0x10(%rsp), %rdi
callq 0xeabc
movq %rax, %rdi
leaq 0x30(%rsp), %rsi
callq 0xb26a
incq %r12
leaq 0x393a0(%rip), %rax     # 0x428d0
movl (%rax), %eax
cmpq %rax, %r12
movq %rbp, %r13
jb 0x941d
leaq 0x10(%rsp), %rdi
callq 0xeabc
movq (%rax), %r14
leaq 0x10(%rsp), %rdi
callq 0xeabc
movq 0x8(%rax), %rbx
cmpq %rbx, %r14
je 0x95ca
movq %rbx, %r15
subq %r14, %r15
movq %r15, %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0xa2e6
cmpq $0x181, %r15            # imm = 0x181
jl 0x95bf
leaq 0x180(%r14), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0xa85f
cmpq %rbx, %r15
je 0x95ca
movq %r15, %rdi
callq 0xa960
addq $0x18, %r15
jmp 0x95ac
movq %r14, %rdi
movq %rbx, %rsi
callq 0xa85f
movq (%rsp), %rdi
callq 0xeabc
movq %rax, %rbx
movq (%rsp), %rdi
callq 0xeabc
movq 0x8(%rax), %r14
leaq 0x10(%rsp), %rdi
callq 0xeabc
movq (%rax), %r15
leaq 0x10(%rsp), %rdi
callq 0xeabc
leaq 0x391af(%rip), %rcx     # 0x427b0
movl (%rcx), %ecx
leaq (%rcx,%rcx,2), %rcx
shlq $0x3, %rcx
addq (%rax), %rcx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xbb22
leaq 0x392ad(%rip), %rax     # 0x428d0
movl (%rax), %ebx
movq (%rsp), %rdi
callq 0xeabc
movq 0x8(%rax), %rcx
subq (%rax), %rcx
shrq $0x3, %rcx
imull $0x55555555, %ecx, %eax # imm = 0x55555555
addl %eax, %ebx
leaq 0xa0(%rsp), %rdi
leaq 0xf(%rsp), %rsi
movl %ebx, %edx
callq 0x22f1c
movq 0x20(%rsp), %rax
leaq 0xa0(%rsp), %rbx
movaps (%rbx), %xmm0
movq 0x10(%rbx), %rcx
movq %rcx, 0x20(%rsp)
movaps 0x10(%rsp), %xmm1
movaps %xmm0, 0x10(%rsp)
leaq 0x50(%rsp), %rdi
movaps %xmm1, (%rdi)
movq %rax, 0x10(%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
callq 0x8122
movq %rbx, %rdi
callq 0x8122
movq (%rsp), %rdi
callq 0xeabc
movq %rax, %rbx
movq (%rsp), %rdi
callq 0xeabc
movq 0x8(%rax), %r14
leaq 0x10(%rsp), %rdi
callq 0xeabc
movq (%rax), %r15
leaq 0x10(%rsp), %rdi
callq 0xeabc
movq 0x8(%rax), %rcx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xbb22
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x96f8
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x53b0
leaq 0x10(%rsp), %rdi
callq 0x8122
movq (%rsp), %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x97a9
jmp 0x9785
jmp 0x9785
jmp 0x9785
jmp 0x9785
jmp 0x9785
jmp 0x9785
jmp 0x9785
jmp 0x9785
movq %rax, %rbx
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x9755
movq 0x98(%rsp), %rsi
subq %rdi, %rsi
callq 0x53b0
jmp 0x9755
movq %rax, %rbx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x9788
movq 0x80(%rsp), %rsi
jmp 0x977b
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x9788
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x53b0
jmp 0x9788
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x979f
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x53b0
leaq 0x10(%rsp), %rdi
callq 0x8122
movq (%rsp), %rdi
callq 0x8122
movq %rbx, %rdi
callq 0x5660