// File: /workspace/github_cpp_makefile_star2_O3/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 %rsi, %rbx
movq %rdi, %r15
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rcx, 0x18(%rsp)
movl %eax, (%rcx)
movq %rdx, 0x10(%rsp)
movl %eax, (%rdx)
movl %eax, (%rsi)
leaq 0xa0(%rsp), %r12
movl %eax, (%r12)
movq %r12, %rsi
callq 0x527e
leaq 0x4c(%rsp), %rdx
movl %eax, (%rdx)
pxor %xmm0, %xmm0
leaq 0x50(%rsp), %rsi
movdqa %xmm0, (%rsi)
movq $0x0, 0x10(%rsi)
pcmpeqd %xmm0, %xmm0
leaq 0x20(%rsp), %r8
movdqa %xmm0, (%r8)
movq %r15, %rdi
movq %rbx, %rcx
callq 0x557e
testb %al, %al
je 0x5387
cmpl $-0x1, (%rbx)
jne 0x551b
jmp 0x5505
leaq 0xb0(%rsp), %r14
movl $0x0, 0x8(%rsp)
leaq 0x68(%rsp), %r13
leaq 0xc(%rsp), %rbp
movq 0x50(%rsp), %rbx
movq 0x58(%rsp), %rax
movq %rax, 0x40(%rsp)
cmpq %rax, %rbx
je 0x54e5
movl 0x8(%rsp), %eax
cmpl $0x2, %eax
je 0x53e3
testl %eax, %eax
jne 0x54d6
movq %r15, %rdi
movq %rbx, %rsi
callq 0xc2d2
cmpl $0x3, %eax
jbe 0x54d6
jmp 0x5505
leaq 0xd0(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq $0x1, 0xa8(%rsp)
pxor %xmm0, %xmm0
movdqu %xmm0, (%r14)
movl $0x3f800000, 0xc0(%rsp) # imm = 0x3F800000
movdqu %xmm0, -0x8(%rax)
leaq 0x10(%rbx), %rsi
movq %r12, 0x68(%rsp)
movq %r12, %rdi
movq %r13, %rdx
callq 0xd538
movq %r12, 0x68(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0xd538
leaq 0x98(%rsp), %rax
movq %rax, 0x68(%rsp)
movq $0x1, 0x70(%rsp)
pxor %xmm0, %xmm0
movdqu %xmm0, -0x20(%rax)
movl $0x3f800000, 0x88(%rsp) # imm = 0x3F800000
movdqu %xmm0, -0x8(%rax)
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
movq (%r14), %r14
testq %r14, %r14
je 0x5497
leaq 0x8(%r14), %rsi
movq %r15, %rdi
movq %r13, %rdx
movq %r12, %rcx
movq %rbp, %r8
callq 0xde74
testb %al, %al
jne 0x5476
movq 0x78(%rsp), %r14
testq %r14, %r14
je 0x54be
movl 0x8(%r14), %eax
movl %eax, 0xc(%rsp)
movq %r15, %rdi
movq %rbp, %rsi
callq 0xc2d2
cmpl $0x4, %eax
jae 0x54ee
movq (%r14), %r14
jmp 0x549c
movq %r13, %rdi
callq 0xc950
movq %r12, %rdi
callq 0xc950
leaq 0xb0(%rsp), %r14
addq $0x14, %rbx
cmpq 0x40(%rsp), %rbx
jne 0x53b9
incl 0x8(%rsp)
jmp 0x53a1
leaq 0x68(%rsp), %rdi
callq 0xc950
leaq 0xa0(%rsp), %rdi
callq 0xc950
movl 0x30(%rsp), %eax
movq 0x10(%rsp), %rcx
movl %eax, (%rcx)
movl 0x20(%rsp), %eax
movq 0x18(%rsp), %rcx
movl %eax, (%rcx)
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x552a
callq 0x21a0
movb $0x1, %al
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5540
movq %rax, %rbx
jmp 0x5566
movq %rax, %rbx
jmp 0x5559
jmp 0x554c
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0xc950
leaq 0xa0(%rsp), %rdi
callq 0xc950
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x5575
callq 0x21a0
movq %rbx, %rdi
callq 0x2320
nop