// File: /workspace/github_cpp_makefile_star2_O2/cmaureir[P]strip-packing/main.cpp
// Function: main
int main(int argc, char *argv[]) {

    // Configuration
    string path;
    if(!check_flags(argc,argv,path)){
        return 1;
    }
    read_input_file(path);

    // Algorithm
    //int iteration = 0;
    //int loop;
    int watch_best;
    int best_fitness;

    solutions_generation(sols);
    fitness_calculation(sols);

    solutions_improvement(sols);
    refset_build();

    save_best_solution(refset);
    refset_tmp = refset;

    do {
        // number of new solutions in the RefSet
        loop = 0;
        while (get_difference(refset_tmp,refset) != 0)
        {
            refset_tmp = refset;
            solutions_combination();
            fitness_calculation(new_set);
            new_set = solutions_improvement2(new_set);
            //solutions_improvement(new_set);
            refset_modification(new_set);
            loop++;
        }
        save_best_solution(refset);

        /* A: If we find the optimal, stop */
        if(best.p == 100){
            iteration = max_iter;
        }
        /* A: end */

        refset_rebuild();
        iteration++;
        print_one_solution(best);
        //print_strip(best);
        //print_tikz(best);
    } while (iteration < max_iter);
    //print_one_solution(best);
    //print_strip(best);
    print_tikz(best);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x18(%rsp), %rdx
callq 0x51fc
testb %al, %al
je 0x4a14
leaq 0x68(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x4310
leaq 0x68(%rsp), %rdi
callq 0x54b8
leaq 0x68(%rsp), %rdi
callq 0x40f0
leaq 0xca9e(%rip), %rdi      # 0x11298
callq 0x65f1
leaq 0xca92(%rip), %rdi      # 0x11298
callq 0x65a9
leaq 0xca86(%rip), %rdi      # 0x11298
callq 0x6862
callq 0x6932
leaq 0xca8d(%rip), %rsi      # 0x112b0
movq %rsp, %rdi
callq 0x4ace
movq %rsp, %rdi
callq 0x69d2
movq %rsp, %rdi
callq 0x4b28
leaq 0xca86(%rip), %rdi      # 0x112c8
leaq 0xca67(%rip), %rsi      # 0x112b0
callq 0x4b4a
xorl %eax, %eax
leaq 0xcb25(%rip), %rcx      # 0x1137c
leaq 0xb8(%rsp), %r14
leaq 0xa0(%rsp), %r12
leaq 0xca72(%rip), %r13      # 0x112e0
movq %rcx, %rbp
movl %eax, (%rcx)
movq %r14, %rdi
leaq 0xca4b(%rip), %rsi      # 0x112c8
callq 0x4ace
movq %r12, %rdi
leaq 0xca24(%rip), %rsi      # 0x112b0
callq 0x4ace
movq %r14, %rdi
movq %r12, %rsi
callq 0x7244
movl %eax, %ebx
movq %r12, %rdi
callq 0x4b28
movq %r14, %rdi
callq 0x4b28
testl %ebx, %ebx
je 0x4946
leaq 0xca0b(%rip), %rdi      # 0x112c8
leaq 0xc9ec(%rip), %rsi      # 0x112b0
callq 0x4b4a
callq 0x69f6
movq %r13, %rdi
callq 0x65a9
leaq 0x88(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x4ace
leaq 0x130(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x6f66
movq %r13, %rdi
movq %r15, %rsi
callq 0x51aa
movq %r15, %rdi
callq 0x4b28
movq %rbx, %rdi
callq 0x4b28
leaq 0x50(%rsp), %rdi
movq %r13, %rsi
callq 0x4ace
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
callq 0x6e49
movq %rbx, %rdi
callq 0x4b28
movq %rbp, %rcx
movl (%rbp), %eax
incl %eax
jmp 0x486e
leaq 0x38(%rsp), %rdi
leaq 0xc95e(%rip), %rsi      # 0x112b0
callq 0x4ace
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
callq 0x69d2
movq %rbx, %rdi
callq 0x4b28
leaq 0xc985(%rip), %rax      # 0x112f8
movss 0x48(%rax), %xmm0
ucomiss 0x6685(%rip), %xmm0     # 0xb004
jne 0x4990
jp 0x4990
leaq 0xc9ee(%rip), %rax      # 0x11378
movl $0x64, (%rax)
callq 0x7133
leaq 0xc9dc(%rip), %rax      # 0x11378
incl (%rax)
leaq 0x148(%rsp), %rdi
leaq 0xc94b(%rip), %rsi      # 0x112f8
callq 0x4c28
leaq 0x148(%rsp), %rbx
movq %rbx, %rdi
callq 0x56e5
movq %rbx, %rdi
callq 0x4c8c
leaq 0xc9a7(%rip), %rax      # 0x11378
cmpl $0x64, (%rax)
movl $0x0, %eax
movq %rbp, %rcx
jl 0x486e
leaq 0xc90f(%rip), %rsi      # 0x112f8
leaq 0xd0(%rsp), %rdi
callq 0x4c28
leaq 0xd0(%rsp), %rdi
callq 0x5790
leaq 0xd0(%rsp), %rdi
callq 0x4c8c
xorl %ebx, %ebx
jmp 0x4a17
pushq $0x1
popq %rbx
leaq 0x18(%rsp), %rdi
callq 0x40f0
movl %ebx, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
jmp 0x4a72
movq %rax, %rbx
movq %rsp, %rdi
jmp 0x4aaf
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x40f0
jmp 0x4abb
jmp 0x4ab8
jmp 0x4ab8
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
jmp 0x4aaf
movq %rax, %rbx
leaq 0x148(%rsp), %rdi
callq 0x4c8c
jmp 0x4abb
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
jmp 0x4aaf
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
jmp 0x4aaf
jmp 0x4ab8
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x4b28
jmp 0x4aa7
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x4b28
jmp 0x4abb
jmp 0x4ab8
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x40f0
movq %rbx, %rdi
callq 0x4440
nop