// File: cmaureir[P]strip-packing/scattersearch.cpp
// Function: solutions_improvement2(std::vector<solution, std::allocator<solution>>)
vector<solution> solutions_improvement2(vector<solution> tmp)
{
    //cout << "solutions_improvement2()" << endl;

    vector<solution> candidates, final;
    solution tmp_sol;
    for (int i = 0; i < tmp.size(); i++) {

        int j = 0, v = 0, diff = 0;
        candidates.clear();
        tmp_sol = tmp[i];
        while(j < (int)tmp_sol.items.size()/3)
        {
            tmp_sol = shift_left(tmp_sol);
            fitness_calculation_one(tmp_sol);
            if(abs(tmp[i].fitness - tmp_sol.fitness) > diff)
            {
                diff = abs(tmp[i].fitness - tmp_sol.fitness);
                v = j;
            }
            j++;
            candidates.push_back(tmp_sol);
        }
        final.push_back(candidates[v]);
    }
    return final;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rsi, -0x188(%rbp)
movq %rdi, -0x178(%rbp)
movq %rdi, %rax
movq %rax, -0x180(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xb730
movq -0x178(%rbp), %rdi
movb $0x0, -0x29(%rbp)
callq 0xb730
leaq -0x90(%rbp), %rdi
callq 0xb750
movl $0x0, -0x94(%rbp)
movq -0x188(%rbp), %rdi
movslq -0x94(%rbp), %rax
movq %rax, -0x190(%rbp)
callq 0x5bd0
movq %rax, %rcx
movq -0x190(%rbp), %rax
cmpq %rcx, %rax
jae 0xb3d7
movl $0x0, -0x98(%rbp)
movl $0x0, -0x9c(%rbp)
movl $0x0, -0xa0(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xbd70
movq -0x188(%rbp), %rdi
movslq -0x94(%rbp), %rsi
callq 0xbd00
movq %rax, %rsi
leaq -0x90(%rbp), %rdi
callq 0x6960
jmp 0xb202
jmp 0xb204
movl -0x98(%rbp), %eax
movl %eax, -0x194(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x53e0
movl $0x3, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x194(%rbp), %eax
cmpl %ecx, %eax
jge 0xb3a0
leaq -0x170(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x5190
jmp 0xb249
leaq -0x110(%rbp), %rdi
movq %rdi, -0x1b0(%rbp)
leaq -0x170(%rbp), %rsi
movq %rsi, -0x1a8(%rbp)
callq 0xb070
movq -0x1b0(%rbp), %rsi
leaq -0x90(%rbp), %rdi
movq %rdi, -0x1a0(%rbp)
callq 0xbff0
movq -0x1b0(%rbp), %rdi
callq 0x5250
movq -0x1a8(%rbp), %rdi
callq 0x5250
movq -0x1a0(%rbp), %rdi
callq 0x9ed0
jmp 0xb2aa
movq -0x188(%rbp), %rdi
movslq -0x94(%rbp), %rsi
callq 0xbd00
movss 0x50(%rax), %xmm0
movss -0x40(%rbp), %xmm1
subss %xmm1, %xmm0
callq 0xc070
movss %xmm0, -0x1b4(%rbp)
jmp 0xb2da
movss -0x1b4(%rbp), %xmm0
cvtsi2ssl -0xa0(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0xb37b
movq -0x188(%rbp), %rdi
movslq -0x94(%rbp), %rsi
callq 0xbd00
movss 0x50(%rax), %xmm0
movss -0x40(%rbp), %xmm1
subss %xmm1, %xmm0
callq 0xc070
movss %xmm0, -0x1b8(%rbp)
jmp 0xb323
movss -0x1b8(%rbp), %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0xa0(%rbp)
movl -0x98(%rbp), %eax
movl %eax, -0x9c(%rbp)
jmp 0xb37b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x5250
movq -0x178(%rbp), %rdi
callq 0x4eb0
leaq -0x28(%rbp), %rdi
callq 0x4eb0
jmp 0xb412
movl -0x98(%rbp), %eax
incl %eax
movl %eax, -0x98(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0xbe30
jmp 0xb39b
jmp 0xb204
movslq -0x9c(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0xbd00
movq -0x178(%rbp), %rdi
movq %rax, %rsi
callq 0xbe30
jmp 0xb3c1
jmp 0xb3c3
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0xb18a
movb $0x1, -0x29(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x5250
testb $0x1, -0x29(%rbp)
jne 0xb3f9
movq -0x178(%rbp), %rdi
callq 0x4eb0
leaq -0x28(%rbp), %rdi
callq 0x4eb0
movq -0x180(%rbp), %rax
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq
movq -0xa8(%rbp), %rdi
callq 0x4550
nop