// File: cmaureir[P]strip-packing/scattersearch.cpp
// Function: solutions_combination()
void solutions_combination()
{
    //cout << "solutions_combination()" << endl;
    int begin, end;
    int N = (int)bs.size();
    int j, tmp_value, new_sols;
    bool new_sol = false;
    vector<int> numbers(N);
    solution p1, p2;
    new_set.clear();
    for (int i = 0; i < (int)refset.size() - 1; i=i+2) {
        p1 = refset[i];
        p2 = refset[i+1];
        new_sol = false;
        new_sols = 0;
        while(!new_sol || new_sols <= b/2){
            begin = (rand() % (N-2));
            end = begin + 2 + (rand() % (N-(begin+2)));

            for (j = begin; j <= end; j++) {
                tmp_value   = p1.items[j];
                p1.items[j] = p2.items[j];
                p2.items[j] = tmp_value;
            }

            fill(numbers.begin(), numbers.end(),0);
            for (j = 0; j < N; j++) {
                if(numbers[p1.items[j]-1] == 0){
                    numbers[p1.items[j]-1] = 1;
                }
                else{
                    p1.items[j] = 0;
                }
            }
            fill(numbers.begin(), numbers.end(),0);
            for (j = 0; j < N; j++) {
                if(numbers[p2.items[j]-1] == 0){
                    numbers[p2.items[j]-1] = 1;
                }
                else{
                    p2.items[j] = 0;
                }
            }

            fill(numbers.begin(), numbers.end(),0);
            for (j = 0; j < N; j++) {
                if(p1.items[j] != 0){
                    numbers[p1.items[j]-1] = 1;
                }
            }
            for (j = 0; j < N; j++) {
                if(numbers[j] == 0){
                    for (int k = 0; k < N; k++) {
                        if(p1.items[k] == 0){
                            p1.items[k] = j + 1;
                            break;
                        }
                    }
                }
            }

            fill(numbers.begin(), numbers.end(),0);
            for (j = 0; j < N; j++) {
                if(p2.items[j] != 0){
                    numbers[p2.items[j]-1] = 1;
                }
            }
            for (j = 0; j < N; j++) {
                if(numbers[j] == 0){
                    for (int k = 0; k < N; k++) {
                        if(p2.items[k] == 0){
                            p2.items[k] = j + 1;
                            break;
                        }
                    }
                }
            }

            // Check if the new solutions are in the RefSet.
            if(!is_in(p1,refset) || !is_in(p2,refset)){
                new_sol = true;
            }

            new_set.push_back(p1);
            new_set.push_back(p2);

            new_sols += 1;
        }
    }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2d0, %rsp            # imm = 0x2D0
leaq 0x17d3e(%rip), %rdi     # 0x22400
callq 0xbc50
movl %eax, -0xc(%rbp)
movb $0x0, -0x19(%rbp)
movslq -0xc(%rbp), %rax
movq %rax, -0x288(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0x280(%rbp)
callq 0xbea0
movq -0x288(%rbp), %rsi
movq -0x280(%rbp), %rdx
leaq -0x38(%rbp), %rdi
callq 0xbec0
jmp 0xa702
leaq -0x39(%rbp), %rdi
callq 0x54a0
leaq -0xb0(%rbp), %rdi
callq 0xb750
leaq -0x110(%rbp), %rdi
callq 0xb750
leaq 0x17c5e(%rip), %rdi     # 0x22388
callq 0xbd70
movl $0x0, -0x114(%rbp)
movl -0x114(%rbp), %eax
movl %eax, -0x28c(%rbp)
leaq 0x17c0c(%rip), %rdi     # 0x22358
callq 0x5bd0
movq %rax, %rcx
movl -0x28c(%rbp), %eax
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0xaeda
movslq -0x114(%rbp), %rsi
leaq 0x17be5(%rip), %rdi     # 0x22358
callq 0xbd00
movq %rax, %rsi
leaq -0xb0(%rbp), %rdi
callq 0x6960
jmp 0xa789
movl -0x114(%rbp), %eax
incl %eax
movslq %eax, %rsi
leaq 0x17bbd(%rip), %rdi     # 0x22358
callq 0xbd00
movq %rax, %rsi
leaq -0x110(%rbp), %rdi
callq 0x6960
jmp 0xa7b1
movb $0x0, -0x19(%rbp)
movl $0x0, -0x18(%rbp)
movb $0x1, %al
testb $0x1, -0x19(%rbp)
movb %al, -0x28d(%rbp)
je 0xa7f4
movl -0x18(%rbp), %eax
movl %eax, -0x294(%rbp)
movl 0x17b4f(%rip), %eax     # 0x22328
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x294(%rbp), %eax
cmpl %ecx, %eax
setle %al
movb %al, -0x28d(%rbp)
movb -0x28d(%rbp), %al
testb $0x1, %al
jne 0xa803
jmp 0xaec4
callq 0x40b0
movl -0xc(%rbp), %ecx
subl $0x2, %ecx
cltd
idivl %ecx
movl %edx, -0x4(%rbp)
movl -0x4(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x298(%rbp)
callq 0x40b0
movl -0xc(%rbp), %ecx
movl -0x4(%rbp), %edx
addl $0x2, %edx
subl %edx, %ecx
cltd
idivl %ecx
movl -0x298(%rbp), %eax
addl %edx, %eax
movl %eax, -0x8(%rbp)
movl -0x4(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0x8(%rbp), %eax
jg 0xa8ec
leaq -0xb0(%rbp), %rdi
movslq -0x10(%rbp), %rsi
callq 0xbcc0
movl (%rax), %eax
movl %eax, -0x14(%rbp)
leaq -0x110(%rbp), %rdi
movslq -0x10(%rbp), %rsi
callq 0xbcc0
movl (%rax), %eax
movl %eax, -0x2a0(%rbp)
leaq -0xb0(%rbp), %rdi
movslq -0x10(%rbp), %rsi
callq 0xbcc0
movl -0x2a0(%rbp), %ecx
movl %ecx, (%rax)
movl -0x14(%rbp), %eax
movl %eax, -0x29c(%rbp)
leaq -0x110(%rbp), %rdi
movslq -0x10(%rbp), %rsi
callq 0xbcc0
movl -0x29c(%rbp), %ecx
movl %ecx, (%rax)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xa844
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x39(%rbp), %rdi
callq 0x54a0
jmp 0xaf25
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xaf04
leaq -0x38(%rbp), %rdi
movq %rdi, -0x2a8(%rbp)
callq 0x6dd0
movq -0x2a8(%rbp), %rdi
movq %rax, -0x120(%rbp)
callq 0x6e00
movq %rax, -0x128(%rbp)
movl $0x0, -0x12c(%rbp)
movq -0x120(%rbp), %rdi
movq -0x128(%rbp), %rsi
leaq -0x12c(%rbp), %rdx
callq 0xbf30
jmp 0xa93c
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xa9bd
leaq -0xb0(%rbp), %rdi
movslq -0x10(%rbp), %rsi
callq 0xbcc0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq -0x38(%rbp), %rdi
callq 0xbcc0
cmpl $0x0, (%rax)
jne 0xa99a
leaq -0xb0(%rbp), %rdi
movslq -0x10(%rbp), %rsi
callq 0xbcc0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq -0x38(%rbp), %rdi
callq 0xbcc0
movl $0x1, (%rax)
jmp 0xa9b0
leaq -0xb0(%rbp), %rdi
movslq -0x10(%rbp), %rsi
callq 0xbcc0
movl $0x0, (%rax)
jmp 0xa9b2
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xa943
leaq -0x38(%rbp), %rdi
movq %rdi, -0x2b0(%rbp)
callq 0x6dd0
movq -0x2b0(%rbp), %rdi
movq %rax, -0x138(%rbp)
callq 0x6e00
movq %rax, -0x140(%rbp)
movl $0x0, -0x144(%rbp)
movq -0x138(%rbp), %rdi
movq -0x140(%rbp), %rsi
leaq -0x144(%rbp), %rdx
callq 0xbf30
jmp 0xaa0d
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xaa8e
leaq -0x110(%rbp), %rdi
movslq -0x10(%rbp), %rsi
callq 0xbcc0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq -0x38(%rbp), %rdi
callq 0xbcc0
cmpl $0x0, (%rax)
jne 0xaa6b
leaq -0x110(%rbp), %rdi
movslq -0x10(%rbp), %rsi
callq 0xbcc0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq -0x38(%rbp), %rdi
callq 0xbcc0
movl $0x1, (%rax)
jmp 0xaa81
leaq -0x110(%rbp), %rdi
movslq -0x10(%rbp), %rsi
callq 0xbcc0
movl $0x0, (%rax)
jmp 0xaa83
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xaa14
leaq -0x38(%rbp), %rdi
movq %rdi, -0x2b8(%rbp)
callq 0x6dd0
movq -0x2b8(%rbp), %rdi
movq %rax, -0x150(%rbp)
callq 0x6e00
movq %rax, -0x158(%rbp)
movl $0x0, -0x15c(%rbp)
movq -0x150(%rbp), %rdi
movq -0x158(%rbp), %rsi
leaq -0x15c(%rbp), %rdx
callq 0xbf30
jmp 0xaade
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xab36
leaq -0xb0(%rbp), %rdi
movslq -0x10(%rbp), %rsi
callq 0xbcc0
cmpl $0x0, (%rax)
je 0xab29
leaq -0xb0(%rbp), %rdi
movslq -0x10(%rbp), %rsi
callq 0xbcc0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq -0x38(%rbp), %rdi
callq 0xbcc0
movl $0x1, (%rax)
jmp 0xab2b
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xaae5
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xabd6
movslq -0x10(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0xbcc0
cmpl $0x0, (%rax)
jne 0xabc6
movl $0x0, -0x160(%rbp)
movl -0x160(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xabc4
leaq -0xb0(%rbp), %rdi
movslq -0x160(%rbp), %rsi
callq 0xbcc0
cmpl $0x0, (%rax)
jne 0xabb1
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2bc(%rbp)
leaq -0xb0(%rbp), %rdi
movslq -0x160(%rbp), %rsi
callq 0xbcc0
movl -0x2bc(%rbp), %ecx
movl %ecx, (%rax)
jmp 0xabc4
jmp 0xabb3
movl -0x160(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x160(%rbp)
jmp 0xab65
jmp 0xabc6
jmp 0xabc8
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xab3d
leaq -0x38(%rbp), %rdi
movq %rdi, -0x2c8(%rbp)
callq 0x6dd0
movq -0x2c8(%rbp), %rdi
movq %rax, -0x168(%rbp)
callq 0x6e00
movq %rax, -0x170(%rbp)
movl $0x0, -0x174(%rbp)
movq -0x168(%rbp), %rdi
movq -0x170(%rbp), %rsi
leaq -0x174(%rbp), %rdx
callq 0xbf30
jmp 0xac26
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xac7e
leaq -0x110(%rbp), %rdi
movslq -0x10(%rbp), %rsi
callq 0xbcc0
cmpl $0x0, (%rax)
je 0xac71
leaq -0x110(%rbp), %rdi
movslq -0x10(%rbp), %rsi
callq 0xbcc0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq -0x38(%rbp), %rdi
callq 0xbcc0
movl $0x1, (%rax)
jmp 0xac73
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xac2d
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xad1e
movslq -0x10(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0xbcc0
cmpl $0x0, (%rax)
jne 0xad0e
movl $0x0, -0x178(%rbp)
movl -0x178(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xad0c
leaq -0x110(%rbp), %rdi
movslq -0x178(%rbp), %rsi
callq 0xbcc0
cmpl $0x0, (%rax)
jne 0xacf9
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2cc(%rbp)
leaq -0x110(%rbp), %rdi
movslq -0x178(%rbp), %rsi
callq 0xbcc0
movl -0x2cc(%rbp), %ecx
movl %ecx, (%rax)
jmp 0xad0c
jmp 0xacfb
movl -0x178(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x178(%rbp)
jmp 0xacad
jmp 0xad0e
jmp 0xad10
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xac85
movb $0x0, -0x251(%rbp)
movb $0x0, -0x271(%rbp)
leaq -0x1d8(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x5190
jmp 0xad41
leaq 0x17610(%rip), %rsi     # 0x22358
leaq -0x1f0(%rbp), %rdi
callq 0x4dc0
jmp 0xad56
leaq -0x1d8(%rbp), %rdi
leaq -0x1f0(%rbp), %rsi
callq 0x9d90
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0x2cd(%rbp)
jne 0xad7a
jmp 0xadcd
leaq -0x250(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x5190
jmp 0xad8f
movb $0x1, -0x251(%rbp)
leaq 0x175bb(%rip), %rsi     # 0x22358
leaq -0x270(%rbp), %rdi
callq 0x4dc0
jmp 0xadab
movb $0x1, -0x271(%rbp)
leaq -0x250(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0x9d90
xorb $-0x1, %al
movb %al, -0x2cd(%rbp)
movb -0x2cd(%rbp), %al
movb %al, -0x2ce(%rbp)
testb $0x1, -0x271(%rbp)
jne 0xade4
jmp 0xadf0
leaq -0x270(%rbp), %rdi
callq 0x4eb0
testb $0x1, -0x251(%rbp)
jne 0xadfb
jmp 0xae07
leaq -0x250(%rbp), %rdi
callq 0x5250
leaq -0x1f0(%rbp), %rdi
callq 0x4eb0
leaq -0x1d8(%rbp), %rdi
callq 0x5250
movb -0x2ce(%rbp), %al
testb $0x1, %al
jne 0xae2b
jmp 0xae8c
movb $0x1, -0x19(%rbp)
jmp 0xae8c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xae7e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xae72
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
testb $0x1, -0x251(%rbp)
jne 0xae64
jmp 0xae70
leaq -0x250(%rbp), %rdi
callq 0x5250
jmp 0xae72
leaq -0x1f0(%rbp), %rdi
callq 0x4eb0
leaq -0x1d8(%rbp), %rdi
callq 0x5250
jmp 0xaf04
leaq 0x174f5(%rip), %rdi     # 0x22388
leaq -0xb0(%rbp), %rsi
callq 0xbe30
jmp 0xaea1
leaq 0x174e0(%rip), %rdi     # 0x22388
leaq -0x110(%rbp), %rsi
callq 0xbe30
jmp 0xaeb6
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xa7bc
jmp 0xaec6
movl -0x114(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x114(%rbp)
jmp 0xa739
leaq -0x110(%rbp), %rdi
callq 0x5250
leaq -0xb0(%rbp), %rdi
callq 0x5250
leaq -0x38(%rbp), %rdi
callq 0x5380
addq $0x2d0, %rsp            # imm = 0x2D0
popq %rbp
retq
leaq -0x110(%rbp), %rdi
callq 0x5250
leaq -0xb0(%rbp), %rdi
callq 0x5250
leaq -0x38(%rbp), %rdi
callq 0x5380
movq -0x48(%rbp), %rdi
callq 0x4550
nop