// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x268, %rsp            # imm = 0x268
movq %rcx, %r14
movq %rdx, %rbp
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x22ac3(%rip), %rdx     # 0x6de66
leaq 0x28(%rsp), %rdi
movq %rdx, %rsi
callq 0xdadc
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x10ea4(%rip), %rsi     # 0x5c264
leaq 0x10ea6(%rip), %rdx     # 0x5c26d
leaq 0x8(%rsp), %rdi
callq 0xdadc
movq (%r14), %rax
leaq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
callq *0x10(%rax)
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x4b3fb
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x9350
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x4b412
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x9350
cmpb $0x0, 0x151(%rbx)
jne 0x4b596
leaq 0x22a40(%rip), %rsi     # 0x6de66
movq %r12, %rdi
callq 0x90e0
testl %eax, %eax
je 0x4b596
movq %rbp, (%rsp)
leaq 0x28(%rbx), %r13
movq %r13, %rdi
callq 0x94f0
testl %eax, %eax
jne 0x4b5b4
movb $0x1, 0x151(%rbx)
callq 0x92f0
xchgq %rax, 0x80(%rbx)
movq (%r14), %rax
movq -0x8(%rax), %rax
movq 0x8(%rax), %rax
xorl %ebp, %ebp
cmpb $0x2a, (%rax)
sete %bpl
addq %rax, %rbp
movq %rbp, %rdi
callq 0x9150
movq 0x3ab39(%rip), %r15     # 0x85fc0
movq %r15, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x93b0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x9330
movsbl %al, %esi
movq %r15, %rdi
callq 0x9040
movq %rax, %rdi
callq 0x9230
movq %r13, %rdi
callq 0x9280
leaq 0x58(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
leaq 0x48(%rsp), %r15
movq %r15, %rdi
callq 0xda46
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
callq *0x18(%rax)
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
movq (%rsp), %r12
je 0x4b50d
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x9350
leaq 0x68(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
movl $0x10, %edx
callq 0x9710
movsd 0x20(%r14), %xmm0
movq %r15, %rdi
callq 0x9570
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x9330
movsbl %al, %esi
movq %r14, %rdi
callq 0x9040
movq %rax, %rdi
callq 0x9230
leaq 0x68(%rsp), %rdi
callq 0x94b0
movq 0x3aa35(%rip), %rax     # 0x85fa0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x70(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x68(%rsp,%rcx)
callq 0x92d0
leaq 0x160(%rsp), %rdi
callq 0x9110
addq $0x50, %rbx
movq %rbx, %rdi
callq 0x9620
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x9220
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x4b614
movq 0x58(%rsp), %rsi
jmp 0x4b5fd
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x4b5ee
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x9350
jmp 0x4b5ee
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x4b614
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x9350
jmp 0x4b614
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x9510
movq %rbx, %rdi
callq 0x9680