// File: /workspace/github_cpp_makefile_star2_O3/Davidc2525[P]Leaf/tree.cpp
// Function: EffectiveAddr::toString()
char *EffectiveAddr::toString()
{
    RegisterProvider *rp = RegisterManager::getInstance()->getProviderBy(64);
    string *addr = new string();

    /**
     * TODO: delete
     * TODO: colocar el registro dependiendo de la arquitectura
    */
    if (withBp)
    {
        //  RegisterProvider *rp = RegisterManager::getInstance()->getProviderBy(64);

        addr->append(rp->get_by_name("rbp")->getName());
        addr->append("+");
    }

    if (!this->parts.empty())
    {
        //std::sort(regis.begin(), regis.end(), compareEfectivePart);

        for (int i = 0; i < parts.size(); i++)
        {

            if (i != 0)
                addr->append(modoToString(parts[i]->mode));
            if (parts[i]->type == Reg)
            {

                addr->append(rp->get(parts[i]->load)->getName());
            }
            else if (parts[i]->type == Num)
            {
                addr->append(to_string(parts[i]->load));
            }
        }
    }

    return (char *)addr->c_str();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
callq 0x11a82
movq %rax, %rdi
movl $0x40, %esi
callq 0x11aec
movq %rax, 0x8(%rsp)
movl $0x20, %edi
callq 0x5290
movq %rax, %r15
addq $0x10, %rax
movq %rax, (%r15)
movq $0x0, 0x8(%r15)
movb $0x0, 0x10(%r15)
cmpb $0x1, (%rbx)
jne 0x10926
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
leaq 0xa679(%rip), %rsi      # 0x1af7a
callq *0x10(%rax)
movq %rax, %rdi
callq 0x118ec
movq %r15, %rdi
movq %rax, %rsi
callq 0x54b0
leaq 0xa562(%rip), %rsi      # 0x1ae80
movq %r15, %rdi
callq 0x54b0
movq 0x8(%rbx), %rax
cmpq 0x10(%rbx), %rax
je 0x10a74
leaq 0x20(%rsp), %r14
xorl %r12d, %r12d
movq %r15, 0x30(%rsp)
testq %r12, %r12
je 0x10965
movq (%rax,%r12,8), %rax
movslq 0x4(%rax), %rax
leaq 0x14d2b(%rip), %rcx     # 0x25680
movq (%rcx,%rax,8), %rsi
movq %r15, %rdi
callq 0x54b0
movq 0x8(%rbx), %rax
movq (%rax,%r12,8), %rax
movl 0x8(%rax), %ecx
cmpl $0x1, %ecx
je 0x1099e
testl %ecx, %ecx
jne 0x10a59
movl (%rax), %esi
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq %rax, %rdi
callq 0x118ec
movq %r15, %rdi
movq %rax, %rsi
callq 0x54b0
jmp 0x10a59
movl (%rax), %r15d
movl %r15d, %ebp
negl %ebp
cmovsl %r15d, %ebp
movl $0x1, %r13d
cmpl $0xa, %ebp
jb 0x109fb
movl $0x4, %r13d
movl %ebp, %eax
movl $0xd1b71759, %esi       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0x109f2
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x109f8
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x109fb
movl %eax, %ecx
imulq %rsi, %rcx
shrq $0x2d, %rcx
addl $0x4, %r13d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x109c2
addl $-0x3, %r13d
jmp 0x109fb
addl $-0x2, %r13d
jmp 0x109fb
decl %r13d
shrl $0x1f, %r15d
movl %r15d, %esi
addl %r13d, %esi
movq %r14, 0x10(%rsp)
leaq 0x10(%rsp), %rdi
movl $0x2d, %edx
callq 0x5310
movq 0x10(%rsp), %rdi
addq %r15, %rdi
movl %r13d, %esi
movl %ebp, %edx
callq 0x7d64
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0x50f0
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x10a59
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x52a0
incq %r12
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r12, %rcx
ja 0x10941
movq (%r15), %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x10aa0
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x52a0
movq %rbx, %rdi
callq 0x5470