// File: canzarlab[P]Trajan/src/BnB.cpp
// Function: BnB::Solve(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void BnB::Solve(string filename, string outScoreFile)
{
#if DEBUG == 1
    Timer T;
    T.start();
#endif

    G.Solve(""); 
    sys_lb = -G.GetSolution();

    x = Vector::Zero(nr_cols);
    sys_lo.conservativeResizeLike(Vector::Zero(nr_cols));
    sys_hi.conservativeResizeLike(Vector::Ones(nr_cols));
    sys_x.resize(nr_cols);    
    sys_x.assign(nr_cols, false);

    if (SolveLP())    
    {
        x = sys_s;
        for (size_t i = 0; i < x.size(); ++i)
            x(i) = round(x(i));
        WriteSolution(filename);
    }    
    else
        G.WriteSolution(filename);

#if DEBUG == 1
    T.stop();
    cout << endl;
    cout << "total geno calls: " << geno_calls << endl;
    cout << "total geno time: " << geno_time << endl;
    cout << "total time: " << T.secs() << endl;    
    double f = 0;
    for (size_t i = 0; i < x.size(); ++i)
        f += x(i) * c(i);
    cout << "sol: " << f << endl;    
    cout << gap_amount << ' ' << gap_count << endl;
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1e0, %rsp            # imm = 0x1E0
movq %rsi, -0x188(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x178(%rbp)
leaq -0x58(%rbp), %rdi
movq %rdi, -0x180(%rbp)
callq 0xeb30
movq -0x180(%rbp), %rdi
callq 0xeb50
movq -0x178(%rbp), %rax
addq $0x118, %rax            # imm = 0x118
movq %rax, -0x170(%rbp)
leaq -0x79(%rbp), %rdi
movq %rdi, -0x168(%rbp)
callq 0xa7d0
movq -0x168(%rbp), %rdx
leaq 0x5e593(%rip), %rsi     # 0x12a1da
leaq -0x78(%rbp), %rdi
callq 0xe9b0
jmp 0xcbc52
leaq -0xb1(%rbp), %rdi
movq %rdi, -0x190(%rbp)
callq 0xa7d0
movq -0x190(%rbp), %rdx
leaq 0x3f5d1(%rip), %rsi     # 0x10b244
leaq -0xb0(%rbp), %rdi
callq 0xe9b0
jmp 0xcbc81
movq -0x170(%rbp), %rdi
leaq -0x78(%rbp), %rsi
leaq -0xb0(%rbp), %rdx
callq 0xa5eb0
jmp 0xcbc9a
leaq -0xb0(%rbp), %rdi
callq 0xa8d8
leaq -0xb1(%rbp), %rdi
callq 0xa4c0
leaq -0x78(%rbp), %rdi
callq 0xa8d8
leaq -0x79(%rbp), %rdi
callq 0xa4c0
movq -0x178(%rbp), %rdi
addq $0x118, %rdi            # imm = 0x118
callq 0xa63c0
movq -0x178(%rbp), %rax
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
movsd %xmm0, 0x1e8(%rax)
movslq 0x10c(%rax), %rsi
leaq -0xd0(%rbp), %rdi
callq 0x13c30
movq -0x178(%rbp), %rdi
addq $0xc0, %rdi
leaq -0xd0(%rbp), %rsi
callq 0x28100
movq -0x178(%rbp), %rax
movq %rax, %rcx
addq $0x228, %rcx            # imm = 0x228
movq %rcx, -0x1a0(%rbp)
movslq 0x10c(%rax), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x13c30
movq -0x1a0(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0xcec20
movq -0x178(%rbp), %rax
movq %rax, %rcx
addq $0x238, %rcx            # imm = 0x238
movq %rcx, -0x198(%rbp)
movslq 0x10c(%rax), %rsi
leaq -0x100(%rbp), %rdi
callq 0xaf2b0
movq -0x198(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0xcec20
movq -0x178(%rbp), %rax
movq %rax, %rdi
addq $0x1f0, %rdi            # imm = 0x1F0
movslq 0x10c(%rax), %rsi
xorl %edx, %edx
callq 0xcec50
movq -0x178(%rbp), %rax
movq %rax, %rdi
addq $0x1f0, %rdi            # imm = 0x1F0
movslq 0x10c(%rax), %rsi
movb $0x0, -0x101(%rbp)
leaq -0x101(%rbp), %rdx
callq 0xced70
movq -0x178(%rbp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
testb $0x1, %al
jne 0xcbe06
jmp 0xcbf9a
movq -0x178(%rbp), %rdi
movq %rdi, %rsi
addq $0x218, %rsi            # imm = 0x218
addq $0xc0, %rdi
callq 0x145a0
movq $0x0, -0x110(%rbp)
movq -0x178(%rbp), %rdi
movq -0x110(%rbp), %rax
movq %rax, -0x1a8(%rbp)
addq $0xc0, %rdi
callq 0x14700
movq %rax, %rcx
movq -0x1a8(%rbp), %rax
cmpq %rcx, %rax
jae 0xcbf33
movq -0x178(%rbp), %rdi
addq $0xc0, %rdi
movq -0x110(%rbp), %rsi
callq 0x145f0
movsd (%rax), %xmm0
callq 0xa180
movq -0x178(%rbp), %rdi
movsd %xmm0, -0x1b0(%rbp)
addq $0xc0, %rdi
movq -0x110(%rbp), %rsi
callq 0x145f0
movsd -0x1b0(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x110(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x110(%rbp)
jmp 0xcbe2e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0xcbf25
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0xcbf10
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0xa8d8
leaq -0xb1(%rbp), %rdi
callq 0xa4c0
leaq -0x78(%rbp), %rdi
callq 0xa8d8
leaq -0x79(%rbp), %rdi
callq 0xa4c0
jmp 0xcc204
movq -0x188(%rbp), %rsi
leaq -0x130(%rbp), %rdi
movq %rdi, -0x1b8(%rbp)
callq 0xa190
movq -0x178(%rbp), %rdi
movq -0x1b8(%rbp), %rsi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
jmp 0xcbf66
leaq -0x130(%rbp), %rdi
callq 0xa8d8
jmp 0xcc00e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x130(%rbp), %rdi
callq 0xa8d8
jmp 0xcc204
movq -0x188(%rbp), %rsi
movq -0x178(%rbp), %rax
addq $0x118, %rax            # imm = 0x118
movq %rax, -0x1c8(%rbp)
leaq -0x150(%rbp), %rdi
movq %rdi, -0x1c0(%rbp)
callq 0xa190
movq -0x1c8(%rbp), %rdi
movq -0x1c0(%rbp), %rsi
callq 0xa6160
jmp 0xcbfdd
leaq -0x150(%rbp), %rdi
callq 0xa8d8
jmp 0xcc00e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x150(%rbp), %rdi
callq 0xa8d8
jmp 0xcc204
leaq -0x58(%rbp), %rdi
callq 0xf350
movq 0xd4f92(%rip), %rdi     # 0x1a0fb0
movq 0xd4f3b(%rip), %rsi     # 0x1a0f60
callq 0xa4a0
movq 0xd4f7f(%rip), %rdi     # 0x1a0fb0
leaq 0x5fa88(%rip), %rsi     # 0x12bac0
callq 0xa440
movq %rax, %rdi
movl 0xd54ce(%rip), %esi     # 0x1a1514
callq 0xa790
movq %rax, %rdi
movq 0xd4f0b(%rip), %rsi     # 0x1a0f60
callq 0xa4a0
movq 0xd4f4f(%rip), %rdi     # 0x1a0fb0
leaq 0x5fa6b(%rip), %rsi     # 0x12bad3
callq 0xa440
movq %rax, %rdi
movsd 0xd54a0(%rip), %xmm0    # 0x1a1518
callq 0xa870
movq %rax, %rdi
movq 0xd4ed9(%rip), %rsi     # 0x1a0f60
callq 0xa4a0
movq 0xd4f1d(%rip), %rdi     # 0x1a0fb0
leaq 0x5fa4b(%rip), %rsi     # 0x12bae5
callq 0xa440
movq %rax, -0x1d0(%rbp)
leaq -0x58(%rbp), %rdi
callq 0xf3b0
movq -0x1d0(%rbp), %rdi
callq 0xa340
movq %rax, %rdi
movq 0xd4e9b(%rip), %rsi     # 0x1a0f60
callq 0xa4a0
xorps %xmm0, %xmm0
movsd %xmm0, -0x158(%rbp)
movq $0x0, -0x160(%rbp)
movq -0x178(%rbp), %rdi
movq -0x160(%rbp), %rax
movq %rax, -0x1d8(%rbp)
addq $0xc0, %rdi
callq 0x14700
movq %rax, %rcx
movq -0x1d8(%rbp), %rax
cmpq %rcx, %rax
jae 0xcc18b
movq -0x178(%rbp), %rdi
addq $0xc0, %rdi
movq -0x160(%rbp), %rsi
callq 0x145f0
movq -0x178(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x1e0(%rbp)
addq $0xf8, %rdi
movq -0x160(%rbp), %rsi
callq 0x145f0
movsd -0x1e0(%rbp), %xmm0
movsd (%rax), %xmm2
movsd -0x158(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x158(%rbp)
movq -0x160(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x160(%rbp)
jmp 0xcc0e0
movq 0xd4e1e(%rip), %rdi     # 0x1a0fb0
leaq 0x5f959(%rip), %rsi     # 0x12baf2
callq 0xa440
movq %rax, %rdi
movsd -0x158(%rbp), %xmm0
callq 0xa870
movq %rax, %rdi
movq 0xd4da8(%rip), %rsi     # 0x1a0f60
callq 0xa4a0
movsd 0xd5363(%rip), %xmm0    # 0x1a1528
movq 0xd4de4(%rip), %rdi     # 0x1a0fb0
callq 0xa870
movq %rax, %rdi
movl $0x20, %esi
callq 0xa520
movq %rax, %rdi
movl 0xd5339(%rip), %esi     # 0x1a1520
callq 0xa790
movq %rax, %rdi
movq 0xd4d6a(%rip), %rsi     # 0x1a0f60
callq 0xa4a0
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbp
retq
movq -0x88(%rbp), %rdi
callq 0xa7c0