// File: /workspace/github_cpp_makefile_star2_O3/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, %r14
movq %rdi, %rbx
movq 0x80(%rdi), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x50(%rbx), %rsi
movq 0x58(%rbx), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x16c68
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x183ea
movq %rax, %r14
movq %rax, 0x70(%rbx)
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0xb8aa
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6300
movq 0x70(%rbx), %r14
testq %r14, %r14
je 0xb9f7
cmpb $0x0, 0x31(%r14)
je 0xba37
movq 0x80(%rbx), %rax
movq 0x18(%rax), %rcx
subq 0x10(%rax), %rcx
movq %rcx, %rax
sarq $0x3, %rax
movq 0x80(%r14), %rdx
subq 0x78(%r14), %rdx
sarq $0x2, %rdx
cmpq %rdx, %rax
jne 0xba9a
shrq $0x3, %rcx
testl %ecx, %ecx
je 0xbb50
movl %eax, %ebp
xorl %r15d, %r15d
leaq 0x33b04(%rip), %r12     # 0x3f408
movq 0x80(%rbx), %rax
movq 0x10(%rax), %rax
movq (%rax,%r15,8), %rax
movl 0x10(%rax), %eax
cmpl $0x1, %eax
je 0xb9e6
movq 0x78(%r14), %rcx
cmpl (%rcx,%r15,4), %eax
je 0xb9e6
movq (%r12), %r13
addq $0x48, %r13
movl $0xa, %edx
movq %r13, %rdi
leaq 0x22111(%rip), %rsi     # 0x2da55
callq 0x6370
movq %r13, %rdi
movq %r15, %rsi
callq 0x61f0
movq %rax, %r13
movl $0x5, %edx
movq %rax, %rdi
leaq 0x22189(%rip), %rsi     # 0x2daef
callq 0x6370
movq 0x50(%rbx), %rsi
movq 0x58(%rbx), %rdx
movq %r13, %rdi
callq 0x6370
movq %rax, %r13
movl $0x15, %edx
movq %rax, %rdi
leaq 0x220d3(%rip), %rsi     # 0x2da60
callq 0x6370
movq 0x80(%rbx), %rax
movq 0x10(%rax), %rax
movq (%rax,%r15,8), %rax
movslq 0x10(%rax), %rax
leaq 0x33a64(%rip), %rcx     # 0x3f410
movq (%rcx), %rcx
movq (%rcx,%rax,8), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
movq %r13, %rdi
callq 0x6370
movl $0x2, %edx
movq %rax, %rdi
leaq 0x26bc5(%rip), %rsi     # 0x32597
callq 0x6370
movq (%r12), %rdi
movl 0x8(%rbx), %esi
movl 0xc(%rbx), %edx
callq 0x1aa40
incq %r15
cmpq %r15, %rbp
jne 0xb904
jmp 0xbb50
leaq 0x33a0a(%rip), %r15     # 0x3f408
movq (%r15), %r14
addq $0x48, %r14
leaq 0x21fd3(%rip), %rsi     # 0x2d9df
movl $0xa, %edx
movq %r14, %rdi
callq 0x6370
movq 0x50(%rbx), %rsi
movq 0x58(%rbx), %rdx
movq %r14, %rdi
callq 0x6370
leaq 0x21fba(%rip), %rsi     # 0x2d9ea
movl $0xe, %edx
jmp 0xba7d
movq $0x0, 0x70(%rbx)
leaq 0x339c2(%rip), %r15     # 0x3f408
movq (%r15), %r14
addq $0x48, %r14
leaq 0x21e38(%rip), %rsi     # 0x2d88c
movl $0xf, %edx
movq %r14, %rdi
callq 0x6370
movq 0x50(%rbx), %rsi
movq 0x58(%rbx), %rdx
movq %r14, %rdi
callq 0x6370
leaq 0x21f81(%rip), %rsi     # 0x2d9f9
movl $0x1e, %edx
movq %rax, %rdi
callq 0x6370
movq (%r15), %rdi
movl 0x8(%rbx), %esi
movl 0xc(%rbx), %edx
callq 0x1aa40
xorl %eax, %eax
jmp 0xbb58
leaq 0x33967(%rip), %r12     # 0x3f408
movq (%r12), %r15
addq $0x48, %r15
leaq 0x21f68(%rip), %rsi     # 0x2da18
movl $0xd, %edx
movq %r15, %rdi
callq 0x6370
movq 0x80(%r14), %rsi
subq 0x78(%r14), %rsi
sarq $0x2, %rsi
movq %r15, %rdi
callq 0x61f0
movq %rax, %r15
leaq 0x21f48(%rip), %rsi     # 0x2da26
movl $0x1e, %edx
movq %rax, %rdi
callq 0x6370
movq 0x50(%rbx), %rsi
movq 0x58(%rbx), %rdx
movq %r15, %rdi
callq 0x6370
movq %rax, %r15
leaq 0x21f40(%rip), %rsi     # 0x2da45
movl $0x3, %edx
movq %rax, %rdi
callq 0x6370
movq 0x80(%rbx), %rax
movq 0x18(%rax), %rsi
subq 0x10(%rax), %rsi
sarq $0x3, %rsi
movq %r15, %rdi
callq 0x61f0
leaq 0x21f15(%rip), %rsi     # 0x2da49
movl $0xb, %edx
movq %rax, %rdi
callq 0x6370
movq (%r12), %rdi
movl 0x8(%rbx), %esi
movl 0xc(%rbx), %edx
callq 0x1aa40
movq %r14, %rdi
callq 0x1801a
movl %eax, 0x10(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0xbb84
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6300
movq %rbx, %rdi
callq 0x6560