// File: /workspace/github_cpp_makefile_star2_O2/kelwinfc[P]ci4721-Fernandez-Gyomrey/src/AST/check.cpp
// Function: AST_function_call::fill_and_check(symbol_table*)
void AST_function_call::fill_and_check(symbol_table* st){
    
    params->fill_and_check(st);
    
    sym = st->lookup(name);
    
    if ( !sym ){

        logger->buf << "Función '" << name << "' no definida.";
        logger->error(line, column);
        
        type = UNDEFINED;
    } else if ( !sym->is_function ){
        sym = 0;

        logger->buf << "Identificador '" << name << "' no es un nombre de función.";
        logger->error(line, column);
        
        type = UNDEFINED;
    } else {
        symbol_function* f = (symbol_function*)sym;
        
        if ( params->elem.size() != f->params.size() ){
            logger->buf << "Se esperaban " << f->params.size()
                        << " argumentos para la función '" << name
                        << "', " << params->elem.size() << " recibidos.";
            logger->error(line, column);
        } else {
            uint nsize = params->elem.size();
            
            for (uint i=0; i<nsize; i++){
                if ( params->elem[i]->type != INVALID
                     && params->elem[i]->type != f->params[i] )
                {
                    logger->buf << "Argumento " << i << " de '" << name << "' de tipo inválido '"
                                << types.types[params->elem[i]->type]->name << "'.";
                    logger->error(line, column);
                }
            }
        }
        
        type = f->getType();
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movq 0x80(%rdi), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x50(%rbx), %r14
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x63e0
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x1422e
movq %rax, 0x70(%rbx)
leaq 0x8(%rsp), %rdi
callq 0x65c8
movq 0x70(%rbx), %r15
testq %r15, %r15
je 0xa0f9
cmpb $0x0, 0x31(%r15)
je 0xa127
movq 0x80(%rbx), %rcx
movq 0x18(%rcx), %rax
subq 0x10(%rcx), %rax
sarq $0x3, %rax
movq 0x80(%r15), %rcx
subq 0x78(%r15), %rcx
sarq $0x2, %rcx
cmpq %rcx, %rax
jne 0xa175
movl %eax, %r13d
xorl %r12d, %r12d
leaq 0x2e3d4(%rip), %rbp     # 0x38400
cmpq %r12, %r13
je 0xa209
movq 0x80(%rbx), %rax
movq 0x10(%rax), %rax
movq (%rax,%r12,8), %rax
movl 0x10(%rax), %eax
cmpl $0x1, %eax
je 0xa0f1
movq 0x78(%r15), %rcx
cmpl (%rcx,%r12,4), %eax
je 0xa0f1
movq (%rbp), %rdi
addq $0x48, %rdi
leaq 0x199e8(%rip), %rsi     # 0x23a55
callq 0x62b0
movq %rax, %rdi
movq %r12, %rsi
callq 0x61e0
movq %rax, %rdi
leaq 0x19a68(%rip), %rsi     # 0x23aef
callq 0x62b0
movq %rax, %rdi
movq %r14, %rsi
callq 0x62a0
movq %rax, %rdi
leaq 0x199bf(%rip), %rsi     # 0x23a60
callq 0x62b0
movq 0x80(%rbx), %rcx
movq 0x10(%rcx), %rcx
movq (%rcx,%r12,8), %rcx
movslq 0x10(%rcx), %rcx
leaq 0x2e348(%rip), %rdx     # 0x38408
movq (%rdx), %rdx
movq (%rdx,%rcx,8), %rsi
addq $0x8, %rsi
movq %rax, %rdi
callq 0x62a0
movq %rax, %rdi
leaq 0x1e4ba(%rip), %rsi     # 0x28597
callq 0x62b0
movq (%rbp), %rdi
movl 0x8(%rbx), %esi
movl 0xc(%rbx), %edx
callq 0x16112
incq %r12
jmp 0xa02c
leaq 0x2e300(%rip), %r15     # 0x38400
movq (%r15), %rdi
addq $0x48, %rdi
leaq 0x198d1(%rip), %rsi     # 0x239df
callq 0x62b0
movq %rax, %rdi
movq %r14, %rsi
callq 0x62a0
leaq 0x198c5(%rip), %rsi     # 0x239ea
jmp 0xa158
andq $0x0, 0x70(%rbx)
leaq 0x2e2cd(%rip), %r15     # 0x38400
movq (%r15), %rdi
addq $0x48, %rdi
leaq 0x1974b(%rip), %rsi     # 0x2388c
callq 0x62b0
movq %rax, %rdi
movq %r14, %rsi
callq 0x62a0
leaq 0x198a1(%rip), %rsi     # 0x239f9
movq %rax, %rdi
callq 0x62b0
movq (%r15), %rdi
movl 0x8(%rbx), %esi
movl 0xc(%rbx), %edx
callq 0x16112
xorl %eax, %eax
jmp 0xa211
leaq 0x2e284(%rip), %r12     # 0x38400
movq (%r12), %rdi
addq $0x48, %rdi
leaq 0x1988d(%rip), %rsi     # 0x23a18
callq 0x62b0
movq 0x80(%r15), %rsi
subq 0x78(%r15), %rsi
sarq $0x2, %rsi
movq %rax, %rdi
callq 0x61e0
leaq 0x19878(%rip), %rsi     # 0x23a26
movq %rax, %rdi
callq 0x62b0
movq %rax, %rdi
movq %r14, %rsi
callq 0x62a0
leaq 0x1987d(%rip), %rsi     # 0x23a45
movq %rax, %rdi
callq 0x62b0
movq 0x80(%rbx), %rcx
movq 0x18(%rcx), %rsi
subq 0x10(%rcx), %rsi
sarq $0x3, %rsi
movq %rax, %rdi
callq 0x61e0
leaq 0x19857(%rip), %rsi     # 0x23a49
movq %rax, %rdi
callq 0x62b0
movq (%r12), %rdi
movl 0x8(%rbx), %esi
movl 0xc(%rbx), %edx
callq 0x16112
movq %r15, %rdi
callq 0x13f0c
movl %eax, 0x10(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x65c8
movq %rbx, %rdi
callq 0x6530