// File: /workspace/github_cpp_makefile_star2_O3/iPapatsoris[P]Maximum-Independent-Set/src/Graph.cpp
// Function: Graph::getGoodFunnelTheta5(unsigned int&, unsigned int&) const
bool Graph::getGoodFunnelTheta5(uint32_t &node1, uint32_t &node2) const {
    GraphTraversal graphTraversal(*this);
    while (graphTraversal.curNode != NONE) {
        uint32_t nodeV = graphTraversal.curNode;
        uint32_t vDegree = getNodeDegree(nodeV);
        if (vDegree == 3) {
            //cout << "nodeV " << nodeV << endl;
            vector<uint32_t> neighborsV;
            gatherNeighbors(nodeV, neighborsV);
            for (uint32_t i = 0 ; i < neighborsV.size() ; i++) {
                uint32_t nodeA = neighborsV[i];
                uint32_t nodeB, nodeC;
                if (i == 0) {
                    nodeB = neighborsV[1];
                    nodeC = neighborsV[2];
                } else if (i == 1) {
                    nodeB = neighborsV[0];
                    nodeC = neighborsV[2];
                } else if (i == 2) {
                    nodeB = neighborsV[0];
                    nodeC = neighborsV[1];
                } else {
                    nodeB = neighborsV[0];
                    nodeC = neighborsV[1];
                }
                if (edgeExists(nodeB, nodeC))  {
                    vector<uint32_t> neighborsA;
                    gatherNeighbors(nodeA, neighborsA);
                    for (auto neighborA: neighborsA) {
                        if (neighborA != nodeV && getNodeDegree(neighborA) == 5) {
                            vector<uint32_t> commonNeighbors;
                            getCommonNeighbors(neighborA, nodeV, commonNeighbors, 3);
                            if (commonNeighbors.size() >= 3) {
                                node1 = nodeA;
                                node2 = nodeV;
                                //cout << "branching on theta-5 good funnel " << node1 << "-" << node2 << "\n";
                                return true;
                            }
                        }
                    }
                }
            }
        }
        getNextNode(graphTraversal);
    }
    return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movq %rdi, %r15
leaq 0x18(%rsp), %rbx
movq $-0x1, (%rbx)
movq %rbx, %rsi
callq 0xb94a
movl (%rbx), %eax
cmpl $-0x1, %eax
je 0x6015
leaq 0x60(%rsp), %r14
leaq 0x14(%rsp), %rbp
leaq 0x18(%rsp), %rbx
movl %eax, (%rsp)
movq %r15, %rdi
movq %rsp, %rsi
callq 0xc2d2
cmpl $0x3, %eax
jne 0x5ffd
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
movl $0xffffffff, 0x20(%rsp) # imm = 0xFFFFFFFF
movq %r15, %rdi
movq %rsp, %rsi
leaq 0x40(%rsp), %rdx
xorl %ecx, %ecx
leaq 0x20(%rsp), %r8
callq 0xc092
movq 0x40(%rsp), %rdi
cmpq %rdi, 0x48(%rsp)
je 0x5fee
xorl %r13d, %r13d
movl (%rdi,%r13,4), %eax
movl %eax, 0xc(%rsp)
cmpl $0x2, %r13d
je 0x5ea9
cmpl $0x1, %r13d
je 0x5eb4
testl %r13d, %r13d
jne 0x5ea9
movl 0x4(%rdi), %eax
jmp 0x5eb6
movl (%rdi), %eax
movl %eax, 0x8(%rsp)
movl 0x4(%rdi), %eax
jmp 0x5ebd
movl (%rdi), %eax
movl %eax, 0x8(%rsp)
movl 0x8(%rdi), %eax
movl %eax, 0x4(%rsp)
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
leaq 0x4(%rsp), %rdx
callq 0xbf3a
cmpl $-0x1, %eax
je 0x5fd1
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
movl $0xffffffff, 0x60(%rsp) # imm = 0xFFFFFFFF
movq %r15, %rdi
leaq 0xc(%rsp), %rsi
leaq 0x20(%rsp), %rdx
xorl %ecx, %ecx
movq %r14, %r8
callq 0xc092
movq 0x20(%rsp), %rbx
movq 0x28(%rsp), %r12
cmpq %r12, %rbx
je 0x5f90
movl (%rbx), %eax
movl %eax, 0x14(%rsp)
cmpl (%rsp), %eax
je 0x5f82
movq %r15, %rdi
movq %rbp, %rsi
callq 0xc2d2
cmpl $0x5, %eax
jne 0x5f82
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
movq $0x0, 0x70(%rsp)
movl $0x3, 0x10(%rsp)
movq %r15, %rdi
movq %rbp, %rsi
movq %rsp, %rdx
movq %r14, %rcx
leaq 0x10(%rsp), %r8
callq 0x4c42
movq 0x60(%rsp), %rdi
movq 0x68(%rsp), %rax
subq %rdi, %rax
cmpq $0x9, %rax
jae 0x5f95
testq %rdi, %rdi
je 0x5f82
callq 0x21a0
addq $0x4, %rbx
cmpq %r12, %rbx
jne 0x5f1b
movb $0x1, %r12b
jmp 0x5fba
movb $0x1, %r12b
jmp 0x5fbf
movl 0xc(%rsp), %eax
movq 0x78(%rsp), %rcx
movl %eax, (%rcx)
movl (%rsp), %eax
movq 0x80(%rsp), %rcx
movl %eax, (%rcx)
testq %rdi, %rdi
je 0x5fb7
callq 0x21a0
xorl %r12d, %r12d
movq 0x20(%rsp), %rbx
testq %rbx, %rbx
je 0x5fcc
movq %rbx, %rdi
callq 0x21a0
testb %r12b, %r12b
je 0x6019
incl %r13d
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %rax
subq %rdi, %rax
sarq $0x2, %rax
cmpq %r13, %rax
ja 0x5e8b
testq %rdi, %rdi
je 0x5ff8
callq 0x21a0
leaq 0x18(%rsp), %rbx
movq %r15, %rdi
movq %rbx, %rsi
callq 0xb94a
movl 0x18(%rsp), %eax
cmpl $-0x1, %eax
jne 0x5e31
xorl %eax, %eax
jmp 0x602a
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x6028
callq 0x21a0
movb $0x1, %al
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6040
jmp 0x6059
movq %rax, %rbx
jmp 0x606b
movq %rax, %rbx
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x605c
callq 0x21a0
jmp 0x605c
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x606b
callq 0x21a0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x607a
callq 0x21a0
movq %rbx, %rdi
callq 0x2320