// File: /workspace/github_cpp_makefile_star2_O3/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 $0x28, %rsp
movq %rdx, %r15
movq %rsi, 0x8(%rsp)
movq %rdi, 0x10(%rsp)
movq (%rdi), %rax
movq (%rax), %r12
cmpq 0x8(%rax), %r12
je 0x183b9
xorl %ebp, %ebp
movq (%r12), %rbx
movq (%rbx), %rax
movq (%rax), %rax
movq (%rax), %r13
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rsi
movq %r13, %rdi
callq 0x53a0
movq (%r15), %r14
testl %eax, %eax
jne 0x182db
movq 0x8(%rbx), %rax
movq (%rax), %rax
movq (%rax), %rdi
movq (%r14), %rsi
callq 0x53a0
testl %eax, %eax
jne 0x182db
movl $0x6, %edx
movq 0xdd46(%rip), %rbx      # 0x25fd8
movq %rbx, %rdi
leaq 0x332f(%rip), %rsi      # 0x1b5cb
callq 0x5300
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5260
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5050
movq %rax, %rdi
callq 0x51a0
movq (%r12), %rbx
movq (%rbx), %rax
movq (%rax), %rax
movq (%rax), %r13
movq (%r15), %r14
movb $0x1, %bpl
movq (%r14), %rsi
movq %r13, %rdi
callq 0x53a0
testl %eax, %eax
jne 0x18398
movq 0x8(%rbx), %rax
movq (%rax), %rbx
movq (%rbx), %r13
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rsi
movq %r13, %rdi
callq 0x53a0
testl %eax, %eax
jne 0x18398
movq 0x8(%rbx), %rdx
movq 0xdcba(%rip), %rdi      # 0x25fd8
movq %r13, %rsi
callq 0x5300
movq %rax, %r13
movl $0x13, %edx
movq %rax, %rdi
leaq 0x329a(%rip), %rsi      # 0x1b5d2
callq 0x5300
movq (%r12), %rax
movq (%rax), %rax
movq (%rax), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r13, %rdi
callq 0x5300
movq %rax, %r13
movl $0x1c, %edx
movq %rax, %rdi
leaq 0x327e(%rip), %rsi      # 0x1b5e6
callq 0x5300
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x5260
movsbl %al, %esi
movq %r13, %rdi
callq 0x5050
movq %rax, %rdi
callq 0x51a0
movb $0x1, %bpl
addq $0x8, %r12
movq 0x10(%rsp), %rax
movq (%rax), %rax
cmpq 0x8(%rax), %r12
jne 0x18249
testb $0x1, %bpl
je 0x183bb
jmp 0x184b5
xorl %ebp, %ebp
movl $0x18, %edi
callq 0x5290
movq %rax, %r12
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movq 0x10(%rsp), %r14
movq %r14, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rsi
movq %rax, %rdx
callq 0x18650
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x185a4
movq (%rax), %rbx
movq %rax, 0x20(%rsp)
cmpq 0x8(%rax), %rbx
je 0x184b5
movl %ebp, %r12d
movq %r15, 0x18(%rsp)
movl $0x18, %edi
callq 0x5290
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
testb $0x1, %r12b
jne 0x18576
movq %rax, %r13
movq (%rbx), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rsp), %rdi
movq %r13, %rdx
callq 0x18650
movq (%r13), %r14
movq 0x8(%r13), %r15
cmpq %r15, %r14
je 0x18497
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq (%rax), %r13
movq (%r14), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movq (%rax), %rdi
movq %r13, %rsi
callq 0x53a0
movl $0x1, %ebp
testl %eax, %eax
je 0x18489
movzbl %r12b, %ebp
addq $0x8, %r14
movl %ebp, %r12d
cmpq %r15, %r14
jne 0x18467
jmp 0x1849a
movl %r12d, %ebp
addq $0x8, %rbx
movl %ebp, %r12d
movq 0x20(%rsp), %rax
cmpq 0x8(%rax), %rbx
movq 0x18(%rsp), %r15
jne 0x18416
movq %r15, %rbx
movq 0xdb19(%rip), %r15      # 0x25fd8
leaq 0x313d(%rip), %rsi      # 0x1b603
movl $0xe, %edx
movq %r15, %rdi
callq 0x5300
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r15, %rdi
callq 0x5300
movq %rax, %r14
leaq 0x311e(%rip), %rsi      # 0x1b612
movl $0x3, %edx
movq %rax, %rdi
callq 0x5300
movq (%rbx), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r14, %rdi
callq 0x5300
movq %rax, %rbx
leaq 0x30f9(%rip), %rsi      # 0x1b616
movl $0x3, %edx
movq %rax, %rdi
callq 0x5300
leaq 0x2c17(%rip), %rax      # 0x1b148
leaq 0x30e2(%rip), %rsi      # 0x1b61a
testb $0x1, %bpl
cmovneq %rax, %rsi
movl $0x2, %edx
movq %rbx, %rdi
callq 0x5300
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5260
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5050
movq %rax, %rdi
callq 0x51a0
jmp 0x18579
movb $0x1, %bpl
andb $0x1, %bpl
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop