// File: canzarlab[P]Trajan/src/Parallel.cpp
// Function: ParallelSolver::Callback(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, GenericBnBSolver*)
void ParallelSolver::Callback(string filename,string outScoreFile, GenericBnBSolver* solver)
{
#if DEBUG == 1
    solver->debug_file = filename + '_' + typeid(*solver).name();
#endif

    solver->Solve("");    

    if (!sol && filename != "") 
    {
        thr_slock.lock(); 
        sol = 1; 
        thr_val = this_thread::get_id();
        cout << typeid(*solver).name() << endl;
        thr_slock.unlock();
        solver->WriteSolution(filename);    
        // write the objective function 
        ofstream score(outScoreFile);
        score << solver->moptVal << endl;
        // cout << "my score: "  << solver->moptVal << endl;
        score.close();
    }
    thr_cond.notify_all();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x310, %rsp            # imm = 0x310
movq %rsi, -0x2d8(%rbp)
movq %rdx, -0x2d0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x2c8(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x2c0(%rbp)
leaq -0x41(%rbp), %rdi
movq %rdi, -0x2b8(%rbp)
callq 0xa7d0
movq -0x2b8(%rbp), %rdx
leaq 0x3dfbd(%rip), %rsi     # 0x12a1da
leaq -0x40(%rbp), %rdi
callq 0xe9b0
jmp 0xec228
leaq -0x79(%rbp), %rdi
movq %rdi, -0x2e0(%rbp)
callq 0xa7d0
movq -0x2e0(%rbp), %rdx
leaq 0x1effe(%rip), %rsi     # 0x10b244
leaq -0x78(%rbp), %rdi
callq 0xe9b0
jmp 0xec251
movq -0x2c0(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
leaq -0x40(%rbp), %rsi
leaq -0x78(%rbp), %rdx
callq *%rax
jmp 0xec26b
leaq -0x78(%rbp), %rdi
callq 0xa8d8
leaq -0x79(%rbp), %rdi
callq 0xa4c0
leaq -0x40(%rbp), %rdi
callq 0xa8d8
leaq -0x41(%rbp), %rdi
callq 0xa4c0
movq -0x2c8(%rbp), %rax
testb $0x1, 0x151(%rax)
jne 0xec49e
movq -0x2d8(%rbp), %rdi
leaq 0x3df29(%rip), %rsi     # 0x12a1da
callq 0xa91e0
testb $0x1, %al
jne 0xec2bf
jmp 0xec49e
movq -0x2c8(%rbp), %rdi
addq $0x28, %rdi
callq 0xbec90
movq -0x2c8(%rbp), %rax
movb $0x1, 0x151(%rax)
callq 0xedeb0
movq -0x2c8(%rbp), %rdi
movq %rax, -0x88(%rbp)
addq $0x80, %rdi
movq -0x88(%rbp), %rsi
callq 0xedee0
movq %rax, -0x90(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x2e8(%rbp)
cmpq $0x0, %rax
jne 0xec320
callq 0xa4e0
movq -0x2e8(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rax), %rdi
callq 0xedf20
movq %rax, %rsi
movq 0xb4c73(%rip), %rdi     # 0x1a0fb0
callq 0xa440
movq %rax, %rdi
movq 0xb4c14(%rip), %rsi     # 0x1a0f60
callq 0xa4a0
movq -0x2c8(%rbp), %rdi
addq $0x28, %rdi
callq 0xbecc0
movq -0x2d8(%rbp), %rsi
movq -0x20(%rbp), %rax
movq %rax, -0x2f8(%rbp)
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
callq 0xa190
movq -0x2f8(%rbp), %rdi
movq -0x2f0(%rbp), %rsi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
jmp 0xec39f
leaq -0xb0(%rbp), %rdi
callq 0xa8d8
movq -0x2d0(%rbp), %rsi
leaq -0x2b0(%rbp), %rdi
movq %rdi, -0x308(%rbp)
movl $0x10, %edx
callq 0xa890
movq -0x308(%rbp), %rdi
movq -0x20(%rbp), %rax
movsd 0x20(%rax), %xmm0
callq 0xa870
movq %rax, -0x300(%rbp)
jmp 0xec3e8
movq -0x300(%rbp), %rdi
movq 0xb4b6a(%rip), %rsi     # 0x1a0f60
callq 0xa4a0
jmp 0xec3fd
leaq -0x2b0(%rbp), %rdi
callq 0xa620
jmp 0xec40b
leaq -0x2b0(%rbp), %rdi
callq 0xa670
jmp 0xec49e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xec45f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xec44d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x78(%rbp), %rdi
callq 0xa8d8
leaq -0x79(%rbp), %rdi
callq 0xa4c0
leaq -0x40(%rbp), %rdi
callq 0xa8d8
leaq -0x41(%rbp), %rdi
callq 0xa4c0
jmp 0xec4b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0xa8d8
jmp 0xec4b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x2b0(%rbp), %rdi
callq 0xa670
jmp 0xec4b7
movq -0x2c8(%rbp), %rdi
addq $0x50, %rdi
callq 0xa760
addq $0x310, %rsp            # imm = 0x310
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0xa7c0