// File: /workspace/github_cpp_makefile_star2_O1/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 $0x68, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq (%rdi), %rax
cmpq %rax, 0x8(%rdi)
setne %r13b
je 0x6337
movl $0x1, %r14d
xorl %esi, %esi
movabsq $-0x5555555555555555, %r12 # imm = 0xAAAAAAAAAAAAAAAB
leaq 0x30(%rsp), %r15
leaq (%rsi,%rsi,2), %rcx
cmpb $0x0, 0x8(%rax,%rcx,4)
jne 0x6310
leaq (%rax,%rcx,4), %rax
cmpl $0x5, 0x4(%rax)
jne 0x6310
cmpb $0x1, 0x3c(%rbx)
jne 0x62b3
movq 0x48(%rbx), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rsi, %rdx
jbe 0x6424
movl (%rax,%rsi,4), %eax
jmp 0x62b7
leal -0x1(%r14), %eax
movl %eax, 0x30(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x62d4
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x62e1
leaq 0x10(%rsp), %rdi
movq %r15, %rdx
callq 0xdeac
movl $0x3, 0x8(%rsp)
movl $0x1, 0x4(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
leaq 0x8(%rsp), %rdx
leaq 0x4(%rsp), %rcx
callq 0x2b5a
testl %eax, %eax
je 0x630e
movl 0x30(%rsp), %ebp
jne 0x6337
movl %r14d, %esi
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
imulq %r12, %rcx
incl %r14d
cmpq %rsi, %rcx
seta %r13b
ja 0x6270
jmp 0x6337
testb $0x1, %r13b
jne 0x6404
movq 0x10(%rsp), %r13
movq 0x18(%rsp), %r15
cmpq %r15, %r13
je 0x63ff
leaq 0x4(%rsp), %r14
leaq 0x8(%rsp), %r12
movl (%r13), %eax
movl %eax, 0x4(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6464
testl %eax, %eax
je 0x637e
movl 0x4(%rsp), %ebp
xorl %r12d, %r12d
jmp 0x63e8
leaq 0x60(%rsp), %rax
movq %rax, 0x30(%rsp)
movq $0x1, 0x38(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, 0x50(%rsp) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xc132
movb $0x1, 0x3(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
leaq 0x30(%rsp), %rdx
xorl %ecx, %ecx
leaq 0x3(%rsp), %r8
callq 0x3f60
cmpq $0x0, 0x48(%rsp)
sete %r12b
je 0x63de
movl 0x4(%rsp), %ebp
leaq 0x30(%rsp), %rdi
callq 0xcff8
testb %r12b, %r12b
je 0x6404
addq $0x4, %r13
cmpq %r15, %r13
leaq 0x8(%rsp), %r12
jne 0x635e
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x6413
callq 0x21a0
movl %ebp, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x143b3(%rip), %rdi     # 0x1a7de
xorl %eax, %eax
callq 0x22a0
jmp 0x6449
jmp 0x6436
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xcff8
jmp 0x644c
jmp 0x6449
jmp 0x6449
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x645b
callq 0x21a0
movq %rbx, %rdi
callq 0x2320
nop