// File: /workspace/github_cpp_makefile_star2_O1/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 0x68(%rsp), %r12
movl %eax, (%r12)
movq %r12, %rsi
callq 0x5198
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 0x54d2
testb %al, %al
je 0x52d0
cmpl $-0x1, (%rbx)
jne 0x52ad
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 0x52bc
callq 0x21a0
movb $0x1, %al
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x78(%rsp), %r14
movl $0x0, 0x8(%rsp)
leaq 0xa0(%rsp), %r13
leaq 0xc(%rsp), %rbp
movq 0x50(%rsp), %rbx
movq 0x58(%rsp), %rax
movq %rax, 0x40(%rsp)
cmpq %rax, %rbx
je 0x547a
cmpl $0x2, 0x8(%rsp)
je 0x5333
cmpl $0x0, 0x8(%rsp)
jne 0x546b
movq %r15, %rdi
movq %rbx, %rsi
callq 0xc98e
cmpl $0x3, %eax
ja 0x5297
cmpl $0x2, 0x8(%rsp)
jne 0x546b
leaq 0x98(%rsp), %rax
movq %rax, 0x68(%rsp)
movq $0x1, 0x70(%rsp)
pxor %xmm0, %xmm0
movdqu %xmm0, (%r14)
movl $0x3f800000, 0x88(%rsp) # imm = 0x3F800000
movdqu %xmm0, -0x8(%rax)
leaq 0x10(%rbx), %rsi
movq %r12, 0xa0(%rsp)
movq %r12, %rdi
movq %r13, %rdx
callq 0xdc3e
movq %r12, 0xa0(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0xdc3e
leaq 0xd0(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq $0x1, 0xa8(%rsp)
pxor %xmm0, %xmm0
movdqu %xmm0, -0x20(%rax)
movl $0x3f800000, 0xc0(%rsp) # imm = 0x3F800000
movdqu %xmm0, -0x8(%rax)
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
movq (%r14), %r14
testq %r14, %r14
je 0x53ed
leaq 0x8(%r14), %rsi
movq %r15, %rdi
movq %r13, %rdx
movq %r12, %rcx
movq %rbp, %r8
callq 0xe514
testb %al, %al
jne 0x53cc
movq 0xb0(%rsp), %r12
testq %r12, %r12
je 0x5451
xorl %r14d, %r14d
movl 0x8(%r12), %eax
movl %eax, 0xc(%rsp)
movq %r15, %rdi
movq %rbp, %rsi
callq 0xc98e
movzbl %r14b, %r14d
cmpl $0x4, %eax
movl $0x1, %eax
cmovael %eax, %r14d
jae 0x542c
movq (%r12), %r12
testq %r12, %r12
jne 0x53fd
movq %r13, %rdi
callq 0xcff8
leaq 0x68(%rsp), %r12
movq %r12, %rdi
callq 0xcff8
testb $0x1, %r14b
leaq 0x78(%rsp), %r14
je 0x546b
jmp 0x5297
movq %r13, %rdi
callq 0xcff8
leaq 0x68(%rsp), %r12
movq %r12, %rdi
callq 0xcff8
leaq 0x78(%rsp), %r14
addq $0x14, %rbx
cmpq 0x40(%rsp), %rbx
jne 0x5302
movl 0x8(%rsp), %eax
incl %eax
movl %eax, 0x8(%rsp)
cmpl $0x3, %eax
jne 0x52ea
jmp 0x52ad
jmp 0x5494
movq %rax, %rbx
jmp 0x54ba
movq %rax, %rbx
jmp 0x54b0
jmp 0x54a0
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0xcff8
leaq 0x68(%rsp), %rdi
callq 0xcff8
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x54c9
callq 0x21a0
movq %rbx, %rdi
callq 0x2320
nop