// File: /workspace/github_cpp_makefile_star2_O2/iPapatsoris[P]Maximum-Independent-Set/src/Graph.cpp
// Function: Graph::getEffectiveNodeOrOptimalFunnel(unsigned int&, unsigned int&, unsigned int&) const
bool Graph::getEffectiveNodeOrOptimalFunnel(uint32_t &effectiveNode, uint32_t &nodeV, uint32_t &nodeA) const {
    effectiveNode = nodeV = nodeA = NONE;
    uint32_t measure = getEffectiveNodeMeasure();
    vector<Funnel> funnels;
    Funnel fourFunnel;
    if (getFunnels(funnels, &measure, &effectiveNode, &fourFunnel)) {
        if (effectiveNode != NONE) {
            return true;
        } else {
            nodeV = fourFunnel.v;
            nodeA = fourFunnel.a;
            return true;
        }
    } else {
        for (uint32_t i = 0 ; i < 3 ; i++) {
            for (auto &funnel: funnels) {
                bool optimal = false;
                if (!i && getNodeDegree(funnel.a) >= 4 || i == 1 && isInTriangle(funnel.a)) {
                    optimal = true;
                }
                else if (i == 2) {
                    unordered_set<uint32_t> nodes;
                    nodes.insert(funnel.v);
                    nodes.insert(funnel.a);
                    unordered_set<uint32_t> neighbors;
                    gatherAllNeighbors(nodes, neighbors);
                    for (auto neighbor: neighbors) {
                        if (getNodeDegree(neighbor) >= 4) {
                            optimal = true;
                            break;
                        }
                    }
                } else if (i == 3) {
                    Graph newGraph = *this;
                    vector<uint32_t> neighborsA;
                    gatherNeighbors(funnel.a, neighborsA);
                    neighborsA.push_back(funnel.a);
                    ReduceInfo dummy;
                    newGraph.remove(neighborsA, dummy);
                    optimal = newGraph.isFineInstance();
                }
                if (optimal) {
                    nodeV = fourFunnel.v;
                    nodeA = fourFunnel.a;
                    return true;
                }
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rcx, 0x18(%rsp)
orl $-0x1, (%rcx)
movq %rsi, %r12
movq %rdx, 0x10(%rsp)
orl $-0x1, (%rdx)
movq %rdi, %r15
orl $-0x1, (%rsi)
leaq 0xa0(%rsp), %rsi
orl $-0x1, (%rsi)
callq 0x4746
leaq 0x4c(%rsp), %rdx
movl %eax, (%rdx)
pxor %xmm0, %xmm0
leaq 0x50(%rsp), %rsi
andq $0x0, 0x10(%rsi)
movdqa %xmm0, (%rsi)
pcmpeqd %xmm0, %xmm0
leaq 0x20(%rsp), %r8
movdqa %xmm0, (%r8)
movq %r15, %rdi
movq %r12, %rcx
callq 0x4a0c
testb %al, %al
je 0x4836
cmpl $-0x1, (%r12)
jne 0x49b4
jmp 0x499e
leaq 0xd0(%rsp), %r14
xorl %r12d, %r12d
leaq 0xa0(%rsp), %rbx
leaq 0xc(%rsp), %rbp
movq 0x50(%rsp), %r13
movq 0x58(%rsp), %rax
movq %rax, 0x40(%rsp)
cmpq 0x40(%rsp), %r13
je 0x497f
cmpl $0x2, %r12d
je 0x48a8
cmpl $0x1, %r12d
je 0x4896
testl %r12d, %r12d
jne 0x4976
movq %r15, %rdi
movq %r13, %rsi
callq 0xa5ce
cmpl $0x3, %eax
jbe 0x4976
jmp 0x499e
callq 0x5014
testb %al, %al
je 0x4976
jmp 0x499e
movq %r14, 0xa0(%rsp)
movq $0x1, 0xa8(%rsp)
pxor %xmm0, %xmm0
movdqu %xmm0, -0x20(%r14)
movl $0x3f800000, 0xc0(%rsp) # imm = 0x3F800000
movdqu %xmm0, -0x8(%r14)
leaq 0x10(%r13), %rsi
movq %rbx, %rdi
callq 0xbc1a
movq %rbx, %rdi
movq %r13, %rsi
callq 0xbc1a
movq %rbx, %rsi
leaq 0x98(%rsp), %rax
movq %rax, 0x68(%rsp)
movq $0x1, 0x70(%rsp)
leaq 0x78(%rsp), %r14
pxor %xmm0, %xmm0
movdqu %xmm0, (%r14)
movl $0x3f800000, 0x88(%rsp) # imm = 0x3F800000
movdqu %xmm0, -0x8(%rax)
orl $-0x1, 0xc(%rsp)
movq %r15, %rdi
leaq 0x68(%rsp), %rdx
movq %rbp, %rcx
callq 0xa61a
movq (%r14), %r14
testq %r14, %r14
je 0x495c
movl 0x8(%r14), %eax
movl %eax, 0xc(%rsp)
movq %r15, %rdi
movq %rbp, %rsi
callq 0xa5ce
cmpl $0x4, %eax
jb 0x493a
jmp 0x4987
leaq 0x68(%rsp), %rdi
callq 0xad26
movq %rbx, %rdi
callq 0xad26
leaq 0xd0(%rsp), %r14
addq $0x14, %r13
jmp 0x485d
incl %r12d
jmp 0x484e
leaq 0x68(%rsp), %rdi
callq 0xad26
leaq 0xa0(%rsp), %rdi
callq 0xad26
movl 0x30(%rsp), %eax
movq 0x10(%rsp), %rcx
movl %eax, (%rcx)
movl 0x20(%rsp), %eax
movq 0x18(%rsp), %rcx
movl %eax, (%rcx)
leaq 0x50(%rsp), %rdi
callq 0xc4de
movb $0x1, %al
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x49e0
jmp 0x49d6
movq %rax, %rbx
jmp 0x49fa
movq %rax, %rbx
jmp 0x49ed
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0xad26
leaq 0xa0(%rsp), %rdi
callq 0xad26
leaq 0x50(%rsp), %rdi
callq 0xc4de
movq %rbx, %rdi
callq 0x22c0