// File: /workspace/github_cpp_makefile_star2_O1/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 0x16c42
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x183ae
movq %rax, 0x68(%rbx)
movq 0x30(%rsp), %rdi
cmpq %r12, %rdi
je 0xaa7c
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x62f0
movq 0x68(%rbx), %rdi
testq %rdi, %rdi
je 0xab76
cmpb $0x1, 0x31(%rdi)
jne 0xabd6
leaq 0x33966(%rip), %r12     # 0x3e400
movq (%r12), %r14
addq $0x48, %r14
leaq 0x21de3(%rip), %rsi     # 0x2c88c
movl $0xf, %edx
movq %r14, %rdi
callq 0x6360
movq 0x68(%rbx), %rsi
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x17fb8
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %r14, %rdi
callq 0x6360
movq %rax, %r14
leaq 0x21dbc(%rip), %rsi     # 0x2c89c
movl $0x1c, %edx
movq %rax, %rdi
callq 0x6360
movq 0x68(%rbx), %rdi
callq 0x17fe2
movq %r14, %rdi
movl %eax, %esi
callq 0x6530
leaq 0xf(%rsp), %rsi
movb $0x3a, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x6360
movq %rax, %r14
movq 0x68(%rbx), %rdi
callq 0x17fe6
movq %r14, %rdi
movl %eax, %esi
callq 0x6530
leaq 0x21d87(%rip), %rsi     # 0x2c8b9
movl $0x18, %edx
movq %rax, %rdi
callq 0x6360
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xab5a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x62f0
movq (%r12), %rdi
movl 0x8(%rbx), %esi
movl 0xc(%rbx), %edx
callq 0x1a9e6
movq $0x0, 0x68(%rbx)
jmp 0xaccc
movl $0x1, 0x10(%rbx)
leaq 0x3387c(%rip), %r15     # 0x3e400
movq (%r15), %r14
addq $0x48, %r14
leaq 0x21cfa(%rip), %rsi     # 0x2c88c
movl $0xf, %edx
movq %r14, %rdi
callq 0x6360
movq 0x48(%rbx), %rsi
movq 0x50(%rbx), %rdx
movq %r14, %rdi
callq 0x6360
leaq 0x21d4b(%rip), %rsi     # 0x2c901
movl $0x1a, %edx
movq %rax, %rdi
callq 0x6360
movq (%r15), %rdi
movl 0x8(%rbx), %esi
movl 0xc(%rbx), %edx
callq 0x1a9e6
jmp 0xaccc
testb %bpl, %bpl
je 0xacbc
callq 0x17fda
testb %al, %al
je 0xacd9
leaq 0x3380d(%rip), %r12     # 0x3e400
movq (%r12), %r14
addq $0x48, %r14
leaq 0x21cd0(%rip), %rsi     # 0x2c8d2
movl $0x1f, %edx
movq %r14, %rdi
callq 0x6360
movq 0x68(%rbx), %rsi
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x17fb8
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %r14, %rdi
callq 0x6360
movq %rax, %r14
leaq 0x21cb9(%rip), %rsi     # 0x2c8f2
movl $0xe, %edx
movq %rax, %rdi
callq 0x6360
movq 0x68(%rbx), %rdi
callq 0x17fe2
movq %r14, %rdi
movl %eax, %esi
callq 0x6530
leaq 0xf(%rsp), %rsi
movb $0x3a, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x6360
movq %rax, %r14
movq 0x68(%rbx), %rdi
callq 0x17fe6
movq %r14, %rdi
movl %eax, %esi
callq 0x6530
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xac9f
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x62f0
movq (%r12), %rdi
movl 0x8(%rbx), %esi
movl 0xc(%rbx), %edx
callq 0x1a9e6
movq 0x68(%rbx), %rdi
callq 0x17fde
movl %eax, 0x10(%rbx)
jmp 0xaccc
callq 0x17fde
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
movq 0x68(%rbx), %rdi
callq 0x17fde
movl %eax, 0x10(%rbx)
testb %bpl, %bpl
je 0xacc4
jmp 0xaccc
jmp 0xad02
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r12, %rdi
je 0xad20
movq 0x40(%rsp), %rsi
jmp 0xad18
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xad20
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x62f0
movq %rbx, %rdi
callq 0x6550