// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
xorl %eax, %eax
movq %rax, 0x90(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
movq %rax, 0x10(%rdi)
movq %rdi, 0x10(%rsp)
movups %xmm0, (%rdi)
movq %rax, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movq 0x8(%rsi), %rax
cmpq (%rsi), %rax
je 0x86c7
movq %rsi, %r14
leaq 0x38(%rsp), %r15
leaq 0xb8(%rsp), %r13
leaq 0x20(%rsp), %r12
xorl %ebx, %ebx
movq %rsi, 0x110(%rsp)
movq 0x80(%rsp), %rsi
leaq 0x80(%rsp), %rdi
callq 0xc2fc
movq %rbx, 0x108(%rsp)
leaq (%rbx,%rbx,2), %rcx
shlq $0x5, %rcx
movq (%r14), %rbx
movq %rcx, 0x118(%rsp)
addq %rcx, %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x53b8
leaq 0x18(%rbx), %rsi
movq %r15, %rdi
callq 0x53b8
leaq 0x30(%rbx), %rsi
leaq 0x50(%rsp), %rdi
callq 0x53b8
movq 0x58(%rbx), %rax
movq %rax, 0x40(%r15)
movups 0x48(%rbx), %xmm0
movups %xmm0, 0x30(%r15)
xorl %ebx, %ebx
movl $0x0, 0x8(%rsp)
movl $0x0, 0xc(%rsp)
movq 0x28(%rsp), %rax
subq 0x20(%rsp), %rax
shrq $0x2, %rax
cltq
imulq $0x55555556, %rax, %rax # imm = 0x55555556
movq %rax, %rcx
shrq $0x3f, %rcx
shrq $0x20, %rax
addl %ecx, %eax
cmpl %eax, %ebx
jge 0x867b
leaq 0xa0(%rsp), %rdi
movq %r12, %rsi
callq 0x4fc2
movq %r13, %rdi
movq %r15, %rsi
callq 0x4fc2
leaq 0xd0(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x4fc2
movl %ebx, 0x1c(%rsp)
movq 0x40(%r15), %rax
movq %rax, 0x40(%r13)
movups 0x30(%r15), %xmm0
movups %xmm0, 0x30(%r13)
movq 0xa0(%rsp), %rbx
movq 0xa8(%rsp), %r12
movq %r12, %r14
subq %rbx, %r14
movq %r14, %rax
shrq $0x2, %rax
movl (%rbx), %ebp
testl %eax, %eax
jle 0x846e
leaq 0x4(%rbx), %rsi
movq %r14, %rdx
movabsq $0x1fffffffc, %rax      # imm = 0x1FFFFFFFC
andq %rax, %rdx
movq %rbx, %rdi
callq 0x43f0
shlq $0x1e, %r14
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
addq %rax, %r14
sarq $0x1e, %r14
movl %ebp, (%rbx,%r14)
xorps %xmm0, %xmm0
movaps %xmm0, 0xa0(%rsp)
movq 0xb0(%rsp), %rax
movq 0xb8(%rsp), %rbp
xorl %esi, %esi
movq %rsi, 0xb0(%rsp)
movq 0xc0(%rsp), %r14
movq 0xc8(%rsp), %r15
movq %rsi, 0x10(%r13)
movups %xmm0, (%r13)
movq 0xd0(%rsp), %rcx
movq %rcx, 0x128(%rsp)
movq 0xd8(%rsp), %rcx
movq %rcx, 0x120(%rsp)
movq %r13, %rdx
movq 0xe0(%rsp), %r13
leaq 0xd0(%rsp), %rcx
movq %rsi, 0x10(%rcx)
movups %xmm0, (%rcx)
movq 0x40(%rdx), %rcx
movq %rcx, 0x140(%rsp)
movups 0x30(%rdx), %xmm0
movaps %xmm0, 0x130(%rsp)
movq 0x20(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq %rbx, 0x20(%rsp)
movq %r12, 0x28(%rsp)
movq %rax, 0x30(%rsp)
testq %rdi, %rdi
je 0x853d
subq %rdi, %rsi
callq 0x4290
movq 0x38(%rsp), %rdi
movq 0x48(%rsp), %rsi
movq %rbp, 0x38(%rsp)
movq %r14, 0x40(%rsp)
movq %r15, 0x48(%rsp)
testq %rdi, %rdi
leaq 0x20(%rsp), %r12
movl 0x1c(%rsp), %ebx
je 0x856c
subq %rdi, %rsi
callq 0x4290
movq 0x50(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq 0x128(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x120(%rsp), %rax
movq %rax, 0x58(%rsp)
movq %r13, 0x60(%rsp)
testq %rdi, %rdi
movq 0x110(%rsp), %r14
leaq 0x38(%rsp), %r15
je 0x85af
subq %rdi, %rsi
callq 0x4290
movq 0x140(%rsp), %rax
movq %rax, 0x40(%r15)
movaps 0x130(%rsp), %xmm0
movups %xmm0, 0x30(%r15)
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
leaq 0xb8(%rsp), %r13
je 0x85ed
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4290
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0x860a
movq 0xc8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4290
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x8627
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4290
movq %r12, %rdi
callq 0x71ad
movq (%r14), %rax
movq 0x118(%rsp), %rcx
movss 0x50(%rax,%rcx), %xmm0
subss 0x70(%rsp), %xmm0
cvtsi2ssl 0xc(%rsp), %xmm1
andps 0x4a0d(%rip), %xmm0     # 0xd060
ucomiss %xmm1, %xmm0
jbe 0x8664
cvttss2si %xmm0, %eax
movl %eax, 0xc(%rsp)
movl %ebx, 0x8(%rsp)
incl %ebx
leaq 0x80(%rsp), %rdi
movq %r12, %rsi
callq 0x8b20
jmp 0x83c0
movslq 0x8(%rsp), %rax
leaq (%rax,%rax,2), %rsi
shlq $0x5, %rsi
addq 0x80(%rsp), %rsi
movq 0x10(%rsp), %rdi
callq 0x8b20
movq 0x8(%r14), %rax
subq (%r14), %rax
movq 0x108(%rsp), %rbx
incq %rbx
sarq $0x5, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
cmpq %rbx, %rax
ja 0x8345
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x86de
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x4290
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x86f5
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x4290
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x870c
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x4290
leaq 0x80(%rsp), %rdi
callq 0x4e76
movq 0x10(%rsp), %rax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8778
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0x8759
movq 0xc8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4290
jmp 0x8759
jmp 0x8778
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x877b
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4290
jmp 0x877b
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x4f7c
movq 0x10(%rsp), %rdi
callq 0x4e76
leaq 0x80(%rsp), %rdi
callq 0x4e76
movq %rbx, %rdi
callq 0x4450