// File: canzarlab[P]Trajan/src/BnG.cpp
// Function: DFBnBSolver::EvalOpen()
vector<BnBNode*> DFBnBSolver::EvalOpen()
{
    BnBNode* lt = Open.back(); Open.pop_back();

    if (Open.size() > 1)
    {
        BnBNode* rt = Open.back(); 
        if (lt->obj == 1 && !SolveNode(lt, PGTOL, NUMTOL)) lt->obj = 2;
        if (lt->warm == rt->warm) // TODO this is horrible.
        {
            Open.pop_back();
            if (rt->obj == 1 && !SolveNode(rt, PGTOL, NUMTOL)) rt->obj = 2;
            if (lt->obj < rt->obj) swap(lt, rt); // if (lt->obj > rt->obj) swap(lt, rt);
            if (rt->obj < 1) Open.push_back(rt);         
        }        
    }

    vector<BnBNode*> v;
    if (!(lt->obj == 2 || (lt->obj == 1 && !SolveNode(lt, PGTOL, NUMTOL))))
        v.push_back(lt);
    return v;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x50(%rbp)
movq %rdi, %rax
movq %rax, -0x48(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x40(%rbp)
addq $0x160, %rdi            # imm = 0x160
callq 0xd9560
movq -0x40(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x18(%rbp)
addq $0x160, %rdi            # imm = 0x160
callq 0xd95a0
movq -0x40(%rbp), %rdi
addq $0x160, %rdi            # imm = 0x160
callq 0xd9410
cmpq $0x1, %rax
jbe 0xd52e5
movq -0x40(%rbp), %rdi
addq $0x160, %rdi            # imm = 0x160
callq 0xd9560
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movsd 0x60(%rax), %xmm0
movsd 0x38a80(%rip), %xmm1    # 0x10dc68
ucomisd %xmm1, %xmm0
jne 0xd5223
jp 0xd5223
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq (%rdi), %rax
movsd 0x38a7d(%rip), %xmm0    # 0x10dc80
movsd 0x56c3d(%rip), %xmm1    # 0x12be48
callq *0x28(%rax)
testb $0x1, %al
jne 0xd5223
movq -0x18(%rbp), %rax
movsd 0x3618a(%rip), %xmm0    # 0x10b3a8
movsd %xmm0, 0x60(%rax)
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x48(%rcx), %rax
jne 0xd52e3
movq -0x40(%rbp), %rdi
addq $0x160, %rdi            # imm = 0x160
callq 0xd95a0
movq -0x20(%rbp), %rax
movsd 0x60(%rax), %xmm0
movsd 0x38a0e(%rip), %xmm1    # 0x10dc68
ucomisd %xmm1, %xmm0
jne 0xd5295
jp 0xd5295
movq -0x40(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq (%rdi), %rax
movsd 0x38a0b(%rip), %xmm0    # 0x10dc80
movsd 0x56bcb(%rip), %xmm1    # 0x12be48
callq *0x28(%rax)
testb $0x1, %al
jne 0xd5295
movq -0x20(%rbp), %rax
movsd 0x36118(%rip), %xmm0    # 0x10b3a8
movsd %xmm0, 0x60(%rax)
movq -0x18(%rbp), %rax
movsd 0x60(%rax), %xmm1
movq -0x20(%rbp), %rax
movsd 0x60(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xd52ba
leaq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0xd95d0
movq -0x20(%rbp), %rax
movsd 0x389a2(%rip), %xmm0    # 0x10dc68
ucomisd 0x60(%rax), %xmm0
jbe 0xd52e1
movq -0x40(%rbp), %rdi
addq $0x160, %rdi            # imm = 0x160
leaq -0x20(%rbp), %rsi
callq 0xd93a0
jmp 0xd52e3
jmp 0xd52e5
movq -0x50(%rbp), %rdi
movb $0x0, -0x21(%rbp)
callq 0xd9350
movq -0x18(%rbp), %rax
movsd 0x60(%rax), %xmm0
movsd 0x360a5(%rip), %xmm1    # 0x10b3a8
ucomisd %xmm1, %xmm0
jne 0xd530d
jp 0xd530d
jmp 0xd537d
movq -0x18(%rbp), %rax
movsd 0x60(%rax), %xmm0
movsd 0x3894a(%rip), %xmm1    # 0x10dc68
ucomisd %xmm1, %xmm0
jne 0xd5355
jp 0xd5355
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq (%rdi), %rax
movq 0x28(%rax), %rax
movsd 0x38943(%rip), %xmm0    # 0x10dc80
movsd 0x56b03(%rip), %xmm1    # 0x12be48
callq *%rax
movb %al, -0x51(%rbp)
jmp 0xd534c
movb -0x51(%rbp), %al
testb $0x1, %al
jne 0xd5355
jmp 0xd537d
movq -0x50(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0xd93a0
jmp 0xd5364
jmp 0xd537d
movq -0x50(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0xd9250
jmp 0xd539a
movb $0x1, -0x21(%rbp)
testb $0x1, -0x21(%rbp)
jne 0xd5390
movq -0x50(%rbp), %rdi
callq 0xd9250
movq -0x48(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0xa7c0
nopw %cs:(%rax,%rax)