// File: /workspace/github_cpp_makefile_star2_O1/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 $0x98, %rsp
movq %rdx, 0x90(%rsp)
movq %rsi, 0x88(%rsp)
movq %rdi, %r15
leaq 0x28(%rsp), %rbx
movq $-0x1, (%rbx)
movq %rbx, %rsi
callq 0xc034
movl (%rbx), %eax
cmpl $-0x1, %eax
setne %bl
je 0x5fac
leaq 0x28(%rsp), %r14
movl %eax, 0x10(%rsp)
movq %r15, %rdi
leaq 0x10(%rsp), %rsi
callq 0xc98e
cmpl $0x3, %eax
jne 0x5f7c
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
movl $0xffffffff, 0x30(%rsp) # imm = 0xFFFFFFFF
movq %r15, %rdi
leaq 0x10(%rsp), %rsi
leaq 0x50(%rsp), %rdx
xorl %ecx, %ecx
leaq 0x30(%rsp), %r8
callq 0xc714
movq 0x50(%rsp), %rdi
cmpq %rdi, 0x58(%rsp)
je 0x5f6d
movb %bl, 0xf(%rsp)
xorl %ebp, %ebp
movl (%rdi,%rbp,4), %eax
movl %eax, 0x20(%rsp)
cmpl $0x2, %ebp
je 0x5e0b
cmpl $0x1, %ebp
je 0x5e16
testl %ebp, %ebp
jne 0x5e0b
movl 0x4(%rdi), %eax
jmp 0x5e18
movl (%rdi), %eax
movl %eax, 0x18(%rsp)
movl 0x4(%rdi), %eax
jmp 0x5e1f
movl (%rdi), %eax
movl %eax, 0x18(%rsp)
movl 0x8(%rdi), %eax
movl %eax, 0x14(%rsp)
movq %r15, %rdi
leaq 0x18(%rsp), %rsi
leaq 0x14(%rsp), %rdx
callq 0xc5e2
cmpl $-0x1, %eax
je 0x5f49
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movl $0xffffffff, 0x70(%rsp) # imm = 0xFFFFFFFF
movq %r15, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x30(%rsp), %rdx
xorl %ecx, %ecx
leaq 0x70(%rsp), %r8
callq 0xc714
movq 0x30(%rsp), %r13
movq 0x38(%rsp), %rbx
xorl %r14d, %r14d
cmpq %rbx, %r13
sete %r12b
je 0x5f34
movl (%r13), %eax
movl %eax, 0x1c(%rsp)
cmpl 0x10(%rsp), %eax
je 0x5eff
movq %r15, %rdi
leaq 0x1c(%rsp), %rsi
callq 0xc98e
cmpl $0x5, %eax
jne 0x5eff
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
movq $0x0, 0x80(%rsp)
movl $0x3, 0x24(%rsp)
movq %r15, %rdi
leaq 0x1c(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0x70(%rsp), %rcx
leaq 0x24(%rsp), %r8
callq 0x4bae
movq 0x70(%rsp), %rdi
movq 0x78(%rsp), %rax
subq %rdi, %rax
cmpq $0x9, %rax
jae 0x5f08
testq %rdi, %rdi
je 0x5eff
callq 0x21a0
addq $0x4, %r13
jmp 0x5e7d
movl 0x20(%rsp), %eax
movq 0x88(%rsp), %rcx
movl %eax, (%rcx)
movl 0x10(%rsp), %eax
movq 0x90(%rsp), %rcx
movl %eax, (%rcx)
testq %rdi, %rdi
je 0x5f2e
callq 0x21a0
movl $0x1, %r14d
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x5f43
callq 0x21a0
testb $0x1, %r12b
je 0x5f4c
xorl %r14d, %r14d
testl %r14d, %r14d
jne 0x5f99
incl %ebp
movq 0x50(%rsp), %rdi
movq 0x58(%rsp), %rax
subq %rdi, %rax
sarq $0x2, %rax
cmpq %rbp, %rax
ja 0x5df1
testq %rdi, %rdi
je 0x5f77
callq 0x21a0
leaq 0x28(%rsp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0xc034
movl 0x28(%rsp), %eax
cmpl $-0x1, %eax
setne %bl
jne 0x5d8f
jmp 0x5fac
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x5fa8
callq 0x21a0
movb 0xf(%rsp), %bl
andb $0x1, %bl
movl %ebx, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5fc7
jmp 0x5fe0
movq %rax, %rbx
jmp 0x5ff2
movq %rax, %rbx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x5fe3
callq 0x21a0
jmp 0x5fe3
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x5ff2
callq 0x21a0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x6001
callq 0x21a0
movq %rbx, %rdi
callq 0x2320
nop