// File: /workspace/github_cpp_makefile_star2_O2/Davidc2525[P]Leaf/compiler/feactures/class/class_handler.cpp
// Function: LEAF::FEACTURE::CLASS::ClassHandler::cyclic(LEAF::HELPER::GRAPH::Node*, LEAF::HELPER::GRAPH::Node*)
bool ClassHandler::cyclic(Node *a, Node *b)
{

    bool p = false;
    vector<Edge *>::iterator x = edges->begin();
    for (; x != edges->end(); x++)
    {
        if ((0 == strcmp((*x)->nodea->name->c_str(), a->name->c_str())) && (0 == strcmp((*x)->nodeb->name->c_str(), b->name->c_str())))
        {
            p = true;
            cout << "cyclic" << endl;
        }
        if (0 == strcmp((*x)->nodea->name->c_str(), b->name->c_str()) && 0 == strcmp((*x)->nodeb->name->c_str(), a->name->c_str()))
        {
            p = true;
            cout << *(*x)->nodeb->name << " no puede hererdar " << *(*x)->nodea->name << ", ya se hereda una a la otra" << endl;
        }
    }

    if (!p)
    {
        vector<Edge *> *result;
        vector<Edge *> *list = new vector<Edge *>;
        this->path_from(a, list);
        vector<Edge *> *path_from_na = this->filter_path_from_by_nodea(a, list);

        vector<Edge *>::iterator pfa_i = path_from_na->begin();

        for (; pfa_i != path_from_na->end(); pfa_i++)
        {
            result = new vector<Edge *>;
            Edge *edge = (*pfa_i);
            if (p)
                return p;

            this->path_from(edge->nodeb, result);
            vector<Edge *>::iterator result_i = result->begin();

            for (; result_i != result->end(); result_i++)
            {
                if (0 == strcmp((*result_i)->nodeb->name->c_str(), b->name->c_str()))
                {
                    p = true;
                }
            }
        }
    }

    cout << "hay camino de " << *a->name << " a " << *b->name << " ? " << (p ? "si" : "no") << endl;

    return p;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, (%rsp)
movq %rdi, 0x8(%rsp)
movq (%rdi), %rax
movq (%rax), %r12
xorl %ebp, %ebp
cmpq 0x8(%rax), %r12
je 0x1579e
movq (%r12), %r15
movq (%r15), %rax
movq (%rax), %rax
movq (%rax), %r13
movq (%rsp), %rax
movq (%rax), %rax
movq (%rax), %rsi
movq %r13, %rdi
callq 0x5360
movq (%rbx), %r14
testl %eax, %eax
jne 0x15716
movq 0x8(%r15), %rax
movq (%rax), %rax
movq (%rax), %rdi
movq (%r14), %rsi
callq 0x5360
testl %eax, %eax
jne 0x15716
movq 0xf8e1(%rip), %rdi      # 0x24fd0
leaq 0x2ef5(%rip), %rsi      # 0x185eb
callq 0x5240
movq %rax, %rdi
callq 0x5120
movq (%r12), %r15
movq (%r15), %rax
movq (%rax), %rax
movq (%rax), %r13
movq (%rbx), %r14
movb $0x1, %bpl
movq (%r14), %rsi
movq %r13, %rdi
callq 0x5360
testl %eax, %eax
jne 0x1578d
movq 0x8(%r15), %rax
movq (%rax), %r13
movq (%r13), %rdi
movq (%rsp), %rax
movq (%rax), %rax
movq (%rax), %rsi
callq 0x5360
testl %eax, %eax
jne 0x1578d
movq 0xf886(%rip), %rdi      # 0x24fd0
movq %r13, %rsi
callq 0x5200
movq %rax, %rdi
leaq 0x2e96(%rip), %rsi      # 0x185f2
callq 0x5240
movq (%r12), %rcx
movq (%rcx), %rcx
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x5200
movq %rax, %rdi
leaq 0x2e89(%rip), %rsi      # 0x18606
callq 0x5240
movq %rax, %rdi
callq 0x5120
movb $0x1, %bpl
addq $0x8, %r12
movq 0x8(%rsp), %rax
movq (%rax), %rax
jmp 0x156a2
testb $0x1, %bpl
je 0x1581a
movq 0xf825(%rip), %rdi      # 0x24fd0
leaq 0x2e71(%rip), %rsi      # 0x18623
callq 0x5240
movq (%rsp), %rcx
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x5200
leaq 0x2e65(%rip), %rsi      # 0x18632
movq %rax, %rdi
callq 0x5240
movq (%rbx), %rsi
movq %rax, %rdi
callq 0x5200
leaq 0x2e4f(%rip), %rsi      # 0x18636
movq %rax, %rdi
callq 0x5240
leaq 0x2972(%rip), %rcx      # 0x18168
leaq 0x2e3d(%rip), %rsi      # 0x1863a
testb $0x1, %bpl
cmovneq %rcx, %rsi
movq %rax, %rdi
callq 0x5240
movq %rax, %rdi
callq 0x5120
jmp 0x158e3
pushq $0x18
popq %rdi
callq 0x5260
movq %rax, %r12
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movq 0x8(%rsp), %r15
movq %r15, %rdi
movq (%rsp), %r14
movq %r14, %rsi
movq %rax, %rdx
callq 0x1598a
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x1590c
movq %rax, 0x10(%rsp)
movq (%rax), %r13
pushq $0x1
popq %r15
movq 0x10(%rsp), %rax
cmpq 0x8(%rax), %r13
je 0x157a4
pushq $0x18
popq %rdi
callq 0x5260
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
andq $0x0, 0x10(%rax)
testb $0x1, %bpl
jne 0x158e0
movq %rax, %r12
movq (%r13), %rax
movq 0x8(%rax), %rsi
movq 0x8(%rsp), %rdi
movq %r12, %rdx
callq 0x1598a
movq (%r12), %r14
movq 0x8(%r12), %r12
cmpq %r12, %r14
je 0x158da
movq (%r14), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movq (%rax), %rdi
movq (%rbx), %rax
movq (%rax), %rsi
callq 0x5360
movl %r15d, %ecx
testl %eax, %eax
je 0x158d2
movzbl %bpl, %ecx
addq $0x8, %r14
movl %ecx, %ebp
jmp 0x158aa
addq $0x8, %r13
jmp 0x15861
movb $0x1, %bpl
andb $0x1, %bpl
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq