// File: /workspace/github_cpp_makefile_star2_O3/kelwinfc[P]ci4721-Fernandez-Gyomrey/src/AST/check.cpp
// Function: AST_ident::fill_and_check(symbol_table*, bool)
void AST_ident::fill_and_check(symbol_table* st, bool lval){
    sym = st->lookup(value);
    
    /* El simbolo existe en la tabla */
    if ( sym ){
        
        /* El simbolo es una function, uso incorrecto como variable */
        if ( sym->is_function ){
            logger->buf << "Identificador '" << sym->getName()
                        << "' definido como función en "
                        << sym->getLine() << ':' << sym->getColumn()
                        << " (se esperaba variable).";
            logger->error(line, column);
            sym = 0;
        }
        /* Intento de acceso a constante como lvalue */
        else if ( lval && sym->isConst() ){
            logger->buf << "Intento de acceso a constante '"
                        << sym->getName() << "' definida en "
                        << sym->getLine() << ':' << sym->getColumn();
            logger->error(line, column);
            
            type = sym->getType();
        } else {
            type = sym->getType();
            
            if ( !lval ){
                sym->unused = false;
            }
        }
    } else {
        /* El simbolo no existe en la tabla */
        type = INVALID;
        logger->buf << "Identificador '" << value << "' no definido previamente.";
        logger->error(line, column);
    }
    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x50, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x40(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x48(%rdi), %rsi
movq 0x50(%rdi), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0x16c68
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x183ea
movq %rax, 0x68(%rbx)
movq 0x30(%rsp), %rdi
cmpq %r12, %rdi
je 0xaa54
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x6300
movq 0x68(%rbx), %rax
testq %rax, %rax
je 0xab4a
cmpb $0x1, 0x31(%rax)
jne 0xabaa
leaq 0x3499a(%rip), %r12     # 0x3f408
movq (%r12), %r14
addq $0x48, %r14
leaq 0x22e0f(%rip), %rsi     # 0x2d88c
movl $0xf, %edx
movq %r14, %rdi
callq 0x6370
movq 0x68(%rbx), %rsi
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x17ff4
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %r14, %rdi
callq 0x6370
movq %rax, %r14
leaq 0x22de8(%rip), %rsi     # 0x2d89c
movl $0x1c, %edx
movq %rax, %rdi
callq 0x6370
movq 0x68(%rbx), %rdi
callq 0x1801e
movq %r14, %rdi
movl %eax, %esi
callq 0x6540
leaq 0xf(%rsp), %rsi
movb $0x3a, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x6370
movq %rax, %r14
movq 0x68(%rbx), %rdi
callq 0x18022
movq %r14, %rdi
movl %eax, %esi
callq 0x6540
leaq 0x22db3(%rip), %rsi     # 0x2d8b9
movl $0x18, %edx
movq %rax, %rdi
callq 0x6370
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xab2e
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x6300
movq (%r12), %rdi
movl 0x8(%rbx), %esi
movl 0xc(%rbx), %edx
callq 0x1aa40
movq $0x0, 0x68(%rbx)
jmp 0xaca3
movl $0x1, 0x10(%rbx)
leaq 0x348b0(%rip), %r15     # 0x3f408
movq (%r15), %r14
addq $0x48, %r14
leaq 0x22d26(%rip), %rsi     # 0x2d88c
movl $0xf, %edx
movq %r14, %rdi
callq 0x6370
movq 0x48(%rbx), %rsi
movq 0x50(%rbx), %rdx
movq %r14, %rdi
callq 0x6370
leaq 0x22d77(%rip), %rsi     # 0x2d901
movl $0x1a, %edx
movq %rax, %rdi
callq 0x6370
movq (%r15), %rdi
movl 0x8(%rbx), %esi
movl 0xc(%rbx), %edx
callq 0x1aa40
jmp 0xaca3
movq %rax, %rdi
testb %bpl, %bpl
je 0xac93
callq 0x18016
testb %al, %al
je 0xac85
leaq 0x3483e(%rip), %r12     # 0x3f408
movq (%r12), %r14
addq $0x48, %r14
leaq 0x22cf9(%rip), %rsi     # 0x2d8d2
movl $0x1f, %edx
movq %r14, %rdi
callq 0x6370
movq 0x68(%rbx), %rsi
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x17ff4
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %r14, %rdi
callq 0x6370
movq %rax, %r14
leaq 0x22ce2(%rip), %rsi     # 0x2d8f2
movl $0xe, %edx
movq %rax, %rdi
callq 0x6370
movq 0x68(%rbx), %rdi
callq 0x1801e
movq %r14, %rdi
movl %eax, %esi
callq 0x6540
leaq 0xf(%rsp), %rsi
movb $0x3a, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x6370
movq %rax, %r14
movq 0x68(%rbx), %rdi
callq 0x18022
movq %r14, %rdi
movl %eax, %esi
callq 0x6540
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xac76
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x6300
movq (%r12), %rdi
movl 0x8(%rbx), %esi
movl 0xc(%rbx), %edx
callq 0x1aa40
movq 0x68(%rbx), %rdi
callq 0x1801a
movl %eax, 0x10(%rbx)
jmp 0xaca3
callq 0x1801a
movl %eax, 0x10(%rbx)
movq 0x68(%rbx), %rax
movb $0x0, 0x32(%rax)
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0xacc6
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r12, %rdi
je 0xace4
movq 0x40(%rsp), %rsi
jmp 0xacdc
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xace4
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x6300
movq %rbx, %rdi
callq 0x6560