// File: /workspace/github_cpp_makefile_star2_O1/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 0x238d3(%rip), %rdx     # 0x6f2b6
leaq 0x28(%rsp), %rdi
movq %rdx, %rsi
callq 0xdb24
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x10864(%rip), %rsi     # 0x5c264
leaq 0x10866(%rip), %rdx     # 0x5c26d
leaq 0x8(%rsp), %rdi
callq 0xdb24
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 0x4ba3b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x9340
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x4ba52
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x9340
cmpb $0x0, 0x151(%rbx)
jne 0x4bbd6
leaq 0x23850(%rip), %rsi     # 0x6f2b6
movq %r12, %rdi
callq 0x90e0
testl %eax, %eax
je 0x4bbd6
movq %rbp, (%rsp)
leaq 0x28(%rbx), %r13
movq %r13, %rdi
callq 0x94e0
testl %eax, %eax
jne 0x4bbf4
movb $0x1, 0x151(%rbx)
callq 0x92e0
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 0x3c4f9(%rip), %r15     # 0x87fc0
movq %r15, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x93a0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x9320
movsbl %al, %esi
movq %r15, %rdi
callq 0x9040
movq %rax, %rdi
callq 0x9220
movq %r13, %rdi
callq 0x9270
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 0xda94
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
callq *0x18(%rax)
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
movq (%rsp), %r12
je 0x4bb4d
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x9340
leaq 0x68(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
movl $0x10, %edx
callq 0x9700
movsd 0x20(%r14), %xmm0
movq %r15, %rdi
callq 0x9560
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x9320
movsbl %al, %esi
movq %r14, %rdi
callq 0x9040
movq %rax, %rdi
callq 0x9220
leaq 0x68(%rsp), %rdi
callq 0x94a0
movq 0x3c3f5(%rip), %rax     # 0x87fa0
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 0x92c0
leaq 0x160(%rsp), %rdi
callq 0x9110
addq $0x50, %rbx
movq %rbx, %rdi
callq 0x9610
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x9210
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x4bc54
movq 0x58(%rsp), %rsi
jmp 0x4bc3d
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x4bc2e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x9340
jmp 0x4bc2e
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x4bc54
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x9340
jmp 0x4bc54
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x9500
movq %rbx, %rdi
callq 0x9670