// File: /workspace/github_cpp_makefile_star2_O2/iPapatsoris[P]Maximum-Independent-Set/src/Graph.cpp
// Function: Graph::getOptimalDegree5Node() const
uint32_t Graph::getOptimalDegree5Node() const {
    uint32_t node = NONE;
    vector<uint32_t> nodes;
    for (uint32_t pos = 0 ; pos < nodeIndex.size() ; pos++) {
        if (nodeIndex[pos].removed || nodeIndex[pos].edges != 5) {
            continue;
        }
        uint32_t node = (!mapping ? pos : posToId->at(pos));
        nodes.push_back(node);
        if (getNumberOfDegreeNeighbors(node, 3, 1) >= 1) {
            //cout << "Branching on optimal degree-5 node: at least 1 degree 3 neighbor " << node << "\n";
            return node;
        }
    }
    for (auto node: nodes) {
        if (nodeIsEffective(node)) {
            //cout << "Branching on optimal degree-5 node: effective node " << node << "\n";
            return node;
        }
        std::unordered_set<uint32_t> extendedGrandchildren;
        GraphTraversal graphTraversal(*this, node);
        getExtendedGrandchildren(graphTraversal, extendedGrandchildren, NULL, true);
        if (extendedGrandchildren.size()) {
            //cout << "Branching on optimal degree-5 node: extended grandchildren " << node << "\n";
            return node;
        }
    }
    return node;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %r14
movaps %xmm0, (%r14)
andq $0x0, 0x10(%r14)
xorl %ebp, %ebp
pushq $0xc
popq %r12
leaq 0x40(%rsp), %r15
leaq 0xc(%rsp), %r13
movl %ebp, %esi
movq (%rbx), %rcx
movq 0x8(%rbx), %rax
subq %rcx, %rax
cqto
idivq %r12
cmpq %rsi, %rax
jbe 0x561b
imulq $0xc, %rsi, %rax
cmpb $0x0, 0x8(%rcx,%rax)
jne 0x5617
addq %rax, %rcx
cmpl $0x5, 0x4(%rcx)
jne 0x5617
cmpb $0x1, 0x3c(%rbx)
movl %ebp, %eax
jne 0x55dd
movq 0x48(%rbx), %rdi
callq 0x9e18
movl (%rax), %eax
movl %eax, 0x40(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0xa1ac
movl $0x3, 0x10(%rsp)
movl $0x1, 0xc(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
leaq 0x10(%rsp), %rdx
movq %r13, %rcx
callq 0x285e
testl %eax, %eax
jne 0x56da
incl %ebp
jmp 0x55a0
movq 0x20(%rsp), %r13
movq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0xc(%rsp), %r12
leaq 0x10(%rsp), %r15
cmpq 0x18(%rsp), %r13
je 0x56cf
movl (%r13), %eax
movl %eax, 0xc(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x5724
testl %eax, %eax
leaq 0x40(%rsp), %rbp
jne 0x56d4
leaq 0x70(%rsp), %rax
movq %rax, 0x40(%rsp)
movq $0x1, 0x48(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, 0x60(%rsp) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x9dde
movb $0x1, 0xb(%rsp)
movq %rbx, %rdi
movq %r15, %r14
movq %r15, %rsi
movq %rbp, %rdx
xorl %ecx, %ecx
leaq 0xb(%rsp), %r8
callq 0x3868
movq %rbp, %rdi
movq 0x58(%rsp), %r15
movl 0xc(%rsp), %ebp
callq 0xad26
addq $0x4, %r13
testq %r15, %r15
movq %r14, %r15
je 0x5634
jmp 0x56de
pushq $-0x1
popq %rbp
jmp 0x56de
movl 0xc(%rsp), %ebp
jmp 0x56de
movl 0x40(%rsp), %ebp
leaq 0x20(%rsp), %rdi
callq 0xb872
movl %ebp, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x570e
jmp 0x56fd
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xad26
jmp 0x5711
jmp 0x570e
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xb872
movq %rbx, %rdi
callq 0x22c0
nop