// File: /workspace/github_cpp_makefile_star2_O1/kelwinfc[P]ci4721-Fernandez-Gyomrey/src/AST/check.cpp
// Function: AST_variable_declaration::fill_and_check(symbol_table*)
void AST_variable_declaration::fill_and_check(symbol_table* st){

    if (types.has_type(sym->getName())) {
        logger->buf << "Identificador '" << sym->getName()
                    << "' ya existe como tipo '" << types.get_type(sym->getName())->name << "'.";
        logger->error(sym->getLine(), sym->getColumn());
    }

    sym->offset    = st->accumulated_offset;
    sym->width     = types.types[sym->getType()]->width;
    sym->alignment = types.types[sym->getType()]->alignment;
    
    int level;
    symbol* previous = st->lookup(sym->getName(), &level);
    
    if ( value ){
        value->fill_and_check(st);
    }
    
    if ( previous ){
        if ( previous->is_function ){
            logger->buf << "Identificador '" << sym->getName()
                        << "' ya fue definido previamente como función en "
                        << sym->getLine() << ':' << sym->getColumn();
            logger->error(sym->getLine(), sym->getColumn());
        } else if ( level == 0 ){
            logger->buf << "Identificador '" << sym->getName()
                        << "' ya fue definido previamente en "
                        << sym->getLine() << ':' << sym->getColumn();
            logger->error(sym->getLine(), sym->getColumn());
        } else {
            st->insert(sym);
        }
    } else {
        st->insert(sym);
    }
    
    if ( value
         && value->type != sym->getType()
         && value->type != INVALID
         && sym->getType() != INVALID
       )
    {
        logger->buf << "Inicialización de '" << sym->getName()
                    << "' con tipo inválido '" << types.types[value->type]->name
                    << "', esperado '" << types.types[sym->getType()]->name << "'.";
        logger->error(line, column);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movq 0x98(%rdi), %rsi
leaq 0x78(%rsp), %r12
movq %r12, %rdi
callq 0x17fb8
leaq 0x3282a(%rip), %r14     # 0x3e408
movq %r14, %rdi
movq %r12, %rsi
callq 0x19ff4
movl %eax, %ebp
leaq 0x88(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbc0c
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x62f0
testb %bpl, %bpl
je 0xbd19
leaq 0x327e4(%rip), %rbp     # 0x3e400
movq (%rbp), %r12
addq $0x48, %r12
leaq 0x20c61(%rip), %rsi     # 0x2c88c
movl $0xf, %edx
movq %r12, %rdi
callq 0x6360
movq 0x98(%rbx), %rsi
leaq 0x10(%rsp), %r13
movq %r13, %rdi
callq 0x17fb8
movq (%r13), %rsi
movq 0x8(%r13), %rdx
movq %r12, %rdi
callq 0x6360
movq %rax, %r12
leaq 0x20e10(%rip), %rsi     # 0x2ca76
movl $0x17, %edx
movq %rax, %rdi
callq 0x6360
movq 0x98(%rbx), %rsi
leaq 0x38(%rsp), %rdi
callq 0x17fb8
leaq 0x3277d(%rip), %rdi     # 0x3e408
leaq 0x38(%rsp), %rsi
callq 0x1a0d4
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
movq %r12, %rdi
callq 0x6360
leaq 0x258eb(%rip), %rsi     # 0x31597
movl $0x2, %edx
movq %rax, %rdi
callq 0x6360
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbcd4
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x62f0
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbcef
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x62f0
movq (%rbp), %r12
movq 0x98(%rbx), %rdi
callq 0x17fe2
movl %eax, %ebp
movq 0x98(%rbx), %rdi
callq 0x17fe6
movq %r12, %rdi
movl %ebp, %esi
movl %eax, %edx
callq 0x1a9e6
movl 0xc(%r15), %eax
movq 0x98(%rbx), %rdi
movl %eax, 0x34(%rdi)
callq 0x17fde
cltq
movq (%r14), %rcx
movq (%rcx,%rax,8), %rax
movl 0x28(%rax), %eax
movq 0x98(%rbx), %rdi
movl %eax, 0x38(%rdi)
callq 0x17fde
cltq
movq (%r14), %rcx
movq (%rcx,%rax,8), %rax
movl 0x2c(%rax), %eax
movq 0x98(%rbx), %rsi
movl %eax, 0x3c(%rsi)
leaq 0x58(%rsp), %r12
movq %r12, %rdi
callq 0x17fb8
leaq 0x34(%rsp), %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0x183ae
movq %rax, %r12
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbd98
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x62f0
movq 0xa0(%rbx), %rdi
testq %rdi, %rdi
je 0xbdad
movq (%rdi), %rax
movq %r15, %rsi
callq *0x8(%rax)
testq %r12, %r12
je 0xbe71
cmpb $0x1, 0x31(%r12)
jne 0xbe6a
leaq 0x32637(%rip), %r13     # 0x3e400
movq (%r13), %r15
addq $0x48, %r15
leaq 0x20ab4(%rip), %rsi     # 0x2c88c
movl $0xf, %edx
movq %r15, %rdi
callq 0x6360
movq 0x98(%rbx), %rsi
leaq 0x10(%rsp), %r12
movq %r12, %rdi
callq 0x17fb8
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %r15, %rdi
callq 0x6360
movq %rax, %r15
leaq 0x20c7a(%rip), %rsi     # 0x2ca8e
movl $0x2f, %edx
movq %rax, %rdi
callq 0x6360
movq 0x98(%rbx), %rdi
callq 0x17fe2
movq %r15, %rdi
movl %eax, %esi
callq 0x6530
leaq 0xf(%rsp), %rsi
movb $0x3a, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x6360
movq %rax, %r15
movq 0x98(%rbx), %rdi
callq 0x17fe6
movq %r15, %rdi
movl %eax, %esi
callq 0x6530
jmp 0xbf28
cmpl $0x0, 0x34(%rsp)
je 0xbe85
movq 0x98(%rbx), %rsi
movq %r15, %rdi
callq 0x184aa
jmp 0xbf6d
leaq 0x32574(%rip), %r13     # 0x3e400
movq (%r13), %r15
addq $0x48, %r15
leaq 0x209f1(%rip), %rsi     # 0x2c88c
movl $0xf, %edx
movq %r15, %rdi
callq 0x6360
movq 0x98(%rbx), %rsi
leaq 0x10(%rsp), %r12
movq %r12, %rdi
callq 0x17fb8
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %r15, %rdi
callq 0x6360
movq %rax, %r15
leaq 0x20be7(%rip), %rsi     # 0x2cabe
movl $0x21, %edx
movq %rax, %rdi
callq 0x6360
movq 0x98(%rbx), %rdi
callq 0x17fe2
movq %r15, %rdi
movl %eax, %esi
callq 0x6530
leaq 0xf(%rsp), %rsi
movb $0x3a, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x6360
movq %rax, %r15
movq 0x98(%rbx), %rdi
callq 0x17fe6
movq %r15, %rdi
movl %eax, %esi
callq 0x6530
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbf43
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x62f0
movq (%r13), %r15
movq 0x98(%rbx), %rdi
callq 0x17fe2
movl %eax, %ebp
movq 0x98(%rbx), %rdi
callq 0x17fe6
movq %r15, %rdi
movl %ebp, %esi
movl %eax, %edx
callq 0x1a9e6
movq 0xa0(%rbx), %rax
testq %rax, %rax
je 0xc0b5
movl 0x10(%rax), %ebp
movq 0x98(%rbx), %rdi
callq 0x17fde
cmpl %eax, %ebp
je 0xc0b5
movq 0xa0(%rbx), %rax
cmpl $0x1, 0x10(%rax)
je 0xc0b5
movq 0x98(%rbx), %rdi
callq 0x17fde
cmpl $0x1, %eax
je 0xc0b5
leaq 0x3243f(%rip), %r13     # 0x3e400
movq (%r13), %r15
addq $0x48, %r15
leaq 0x20b10(%rip), %rsi     # 0x2cae0
movl $0x14, %edx
movq %r15, %rdi
callq 0x6360
movq 0x98(%rbx), %rsi
leaq 0x10(%rsp), %r12
movq %r12, %rdi
callq 0x17fb8
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %r15, %rdi
callq 0x6360
movq %rax, %r15
leaq 0x20ae9(%rip), %rsi     # 0x2caf5
movl $0x16, %edx
movq %rax, %rdi
callq 0x6360
movq 0xa0(%rbx), %rax
movslq 0x10(%rax), %rax
movq (%r14), %rcx
movq (%rcx,%rax,8), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
movq %r15, %rdi
callq 0x6360
movq %rax, %r15
leaq 0x20825(%rip), %rsi     # 0x2c86a
movl $0xd, %edx
movq %rax, %rdi
callq 0x6360
movq 0x98(%rbx), %rdi
callq 0x17fde
cltq
movq (%r14), %rcx
movq (%rcx,%rax,8), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
movq %r15, %rdi
callq 0x6360
leaq 0x25519(%rip), %rsi     # 0x31597
movl $0x2, %edx
movq %rax, %rdi
callq 0x6360
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xc0a6
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x62f0
movq (%r13), %rdi
movl 0x8(%rbx), %esi
movl 0xc(%rbx), %edx
callq 0x1a9e6
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xc123
jmp 0xc123
movq %rax, %rbx
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xc141
movq 0x68(%rsp), %rsi
jmp 0xc139
movq %rax, %rbx
leaq 0x88(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xc141
movq 0x88(%rsp), %rsi
jmp 0xc139
movq %rax, %rbx
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xc126
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x62f0
jmp 0xc126
jmp 0xc123
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xc141
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x62f0
movq %rbx, %rdi
callq 0x6550
nop