// File: /workspace/github_cpp_makefile_star2_O1/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, %r14
movq %rsi, %r15
movq %rdi, 0x8(%rsp)
movq (%rdi), %rax
movq (%rax), %r13
cmpq 0x8(%rax), %r13
je 0x1859f
xorl %r12d, %r12d
movq (%r13), %rbx
movq (%rbx), %rax
movq (%rax), %rax
movq (%rax), %rdi
movq (%r15), %rax
movq (%rax), %rsi
callq 0x53a0
testl %eax, %eax
jne 0x184c2
movq 0x8(%rbx), %rax
movq (%rax), %rax
movq (%rax), %rdi
movq (%r14), %rax
movq (%rax), %rsi
callq 0x53a0
testl %eax, %eax
jne 0x184c2
movl $0x6, %edx
movq 0xdb4f(%rip), %rbx      # 0x25fd8
movq %rbx, %rdi
leaq 0x30d8(%rip), %rsi      # 0x1b56b
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
movb $0x1, %r12b
movq (%r13), %rbx
movq (%rbx), %rax
movq (%rax), %rax
movq (%rax), %rdi
movq (%r14), %rax
movq (%rax), %rsi
callq 0x53a0
testl %eax, %eax
jne 0x18587
movq 0x8(%rbx), %rax
movq (%rax), %rbx
movq (%rbx), %rbp
movq (%r15), %rax
movq (%rax), %rsi
movq %rbp, %rdi
callq 0x53a0
testl %eax, %eax
jne 0x18587
movq 0x8(%rbx), %rdx
movq 0xdacb(%rip), %rdi      # 0x25fd8
movq %rbp, %rsi
callq 0x5300
movq %rax, %rbp
movl $0x13, %edx
movq %rax, %rdi
leaq 0x304b(%rip), %rsi      # 0x1b572
callq 0x5300
movq (%r13), %rax
movq (%rax), %rax
movq (%rax), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %rbp, %rdi
callq 0x5300
movq %rax, %rbp
movl $0x1c, %edx
movq %rax, %rdi
leaq 0x302f(%rip), %rsi      # 0x1b586
callq 0x5300
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x5260
movsbl %al, %esi
movq %rbp, %rdi
callq 0x5050
movq %rax, %rdi
callq 0x51a0
movb $0x1, %r12b
addq $0x8, %r13
movq 0x8(%rsp), %rax
movq (%rax), %rax
cmpq 0x8(%rax), %r13
jne 0x18448
jmp 0x185a2
xorl %r12d, %r12d
testb $0x1, %r12b
movq %r14, 0x10(%rsp)
movq %r15, 0x18(%rsp)
jne 0x186c6
movl $0x18, %edi
callq 0x5290
movq %rax, %r13
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x1885c
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x187b0
movq (%rax), %r15
movq %rax, 0x20(%rsp)
cmpq 0x8(%rax), %r15
sete %dl
je 0x186af
movb %dl, 0x7(%rsp)
movl $0x18, %edi
callq 0x5290
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movl %r12d, %ecx
testb $0x1, %r12b
jne 0x1868e
movq %rax, %r13
movq (%r15), %rax
movq 0x8(%rax), %rsi
movq 0x8(%rsp), %rdi
movq %r13, %rdx
callq 0x1885c
movq (%r13), %rbx
movq 0x8(%r13), %r14
movl %r12d, %ecx
cmpq %r14, %rbx
je 0x1868e
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq (%rax), %r13
movl %r12d, %ebp
movq (%rbx), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movq (%rax), %rdi
movq %r13, %rsi
callq 0x53a0
movl $0x1, %ecx
testl %eax, %eax
je 0x18683
movzbl %bpl, %ecx
addq $0x8, %rbx
movl %ecx, %ebp
cmpq %r14, %rbx
jne 0x18661
testb $0x1, %r12b
jne 0x186b4
addq $0x8, %r15
movl %ecx, %r12d
movq 0x20(%rsp), %rax
cmpq 0x8(%rax), %r15
sete %dl
jne 0x18607
jmp 0x186b8
movl %r12d, %ecx
jmp 0x186b8
movb 0x7(%rsp), %dl
movb $0x1, %al
movl %ecx, %r12d
testb $0x1, %dl
je 0x1878a
movq 0xd90b(%rip), %r15      # 0x25fd8
leaq 0x2ecf(%rip), %rsi      # 0x1b5a3
movl $0xe, %edx
movq %r15, %rdi
callq 0x5300
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r15, %rdi
callq 0x5300
movq %rax, %r14
leaq 0x2eb0(%rip), %rsi      # 0x1b5b2
movl $0x3, %edx
movq %rax, %rdi
callq 0x5300
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r14, %rdi
callq 0x5300
movq %rax, %rbx
leaq 0x2e86(%rip), %rsi      # 0x1b5b6
movl $0x3, %edx
movq %rax, %rdi
callq 0x5300
leaq 0x29a4(%rip), %rax      # 0x1b0e8
leaq 0x2e6f(%rip), %rsi      # 0x1b5ba
testb $0x1, %r12b
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
movl %r12d, %eax
andb $0x1, %al
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop