// File: /workspace/github_c_makefile_star2_O0/lucvoo[P]sparse-dev/evaluate.c
// Function: evaluate_call
static struct symbol *evaluate_call(struct expression *expr)
{
	int args, fnargs;
	struct symbol *ctype, *sym;
	struct expression *fn = expr->fn;
	struct expression_list *arglist = expr->args;

	if (!evaluate_expression(fn))
		return NULL;
	sym = ctype = fn->ctype;
	if (ctype->type == SYM_NODE)
		ctype = ctype->ctype.base_type;
	if (ctype->type == SYM_PTR)
		ctype = get_base_type(ctype);

	if (ctype->type != SYM_FN) {
		struct expression *arg;

		if (fn->ctype == &bad_ctype)
			return NULL;

		expression_error(expr, "not a function %s",
			     show_ident(sym->ident));
		/* do typechecking in arguments */
		FOR_EACH_PTR (arglist, arg) {
			evaluate_expression(arg);
		} END_FOR_EACH_PTR(arg);
		return NULL;
	}

	examine_fn_arguments(ctype);
        if (sym->type == SYM_NODE && fn->type == EXPR_PREOP &&
	    sym->op && sym->op->args) {
		if (!sym->op->args(expr))
			return NULL;
	} else {
		if (!evaluate_arguments(ctype->arguments, arglist))
			return NULL;
		args = expression_list_size(expr->args);
		fnargs = symbol_list_size(ctype->arguments);
		if (args < fnargs) {
			expression_error(expr,
				     "not enough arguments for function %s",
				     show_ident(sym->ident));
			return NULL;
		}
		if (args > fnargs && !ctype->variadic)
			expression_error(expr,
				     "too many arguments for function %s",
				     show_ident(sym->ident));
	}
	expr->ctype = ctype->ctype.base_type;
	if (sym->type == SYM_NODE) {
		if (evaluate_symbol_call(expr))
			return expr->ctype;
	}
	return expr->ctype;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
callq 0x4bb70
cmpq $0x0, %rax
jne 0x4e7c3
movq $0x0, -0x8(%rbp)
jmp 0x4ea8f
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x3, %eax
jne 0x4e7ef
movq -0x20(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x4, %eax
jne 0x4e80c
movq -0x20(%rbp), %rdi
callq 0x51e40
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x5, %eax
je 0x4e90b
movq -0x30(%rbp), %rax
leaq 0x4446d(%rip), %rcx     # 0x92c98
cmpq %rcx, 0x10(%rax)
jne 0x4e83e
movq $0x0, -0x8(%rbp)
jmp 0x4ea8f
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x44150
movq -0x68(%rbp), %rdi
movq %rax, %rdx
leaq 0x1da16(%rip), %rsi     # 0x6c277
movb $0x0, %al
callq 0x17030
movq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x4e889
jmp 0x4e8fe
jmp 0x4e88b
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movq -0x50(%rbp), %rcx
movw (%rcx), %cx
shlw $0x8, %cx
sarw $0x8, %cx
movswl %cx, %ecx
cmpl %ecx, %eax
jge 0x4e8ea
movq -0x50(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movq 0x18(%rax,%rcx,8), %rax
movq %rax, -0x40(%rbp)
movq -0x50(%rbp), %rax
movw (%rax), %ax
sarw $0x8, %ax
cwtl
cmpl $0x0, %eax
je 0x4e8d6
cmpq $0x0, -0x40(%rbp)
jne 0x4e8d6
jmp 0x4e8df
movq -0x40(%rbp), %rdi
callq 0x4bb70
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x4e892
jmp 0x4e8ec
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x50(%rbp)
cmpq -0x48(%rbp), %rax
jne 0x4e88b
movq $0x0, -0x8(%rbp)
jmp 0x4ea8f
movq -0x20(%rbp), %rdi
callq 0x4b650
movq -0x28(%rbp), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x3, %eax
jne 0x4e977
movq -0x30(%rbp), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x9, %eax
jne 0x4e977
movq -0x28(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x4e977
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
cmpq $0x0, 0x18(%rax)
je 0x4e977
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
cmpl $0x0, %eax
jne 0x4e972
movq $0x0, -0x8(%rbp)
jmp 0x4ea8f
jmp 0x4ea45
movq -0x20(%rbp), %rax
movq 0x88(%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x4b830
cmpl $0x0, %eax
jne 0x4e99d
movq $0x0, -0x8(%rbp)
jmp 0x4ea8f
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x53ba0
movl %eax, -0x14(%rbp)
movq -0x20(%rbp), %rax
movq 0x88(%rax), %rdi
callq 0x53bc0
movl %eax, -0x18(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x4e9ff
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x44150
movq -0x70(%rbp), %rdi
movq %rax, %rdx
leaq 0x1d89e(%rip), %rsi     # 0x6c289
movb $0x0, %al
callq 0x17030
movq $0x0, -0x8(%rbp)
jmp 0x4ea8f
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jle 0x4ea43
movq -0x20(%rbp), %rax
movl 0x54(%rax), %eax
shrl $0x9, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x4ea43
movq -0x10(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x44150
movq -0x78(%rbp), %rdi
movq %rax, %rdx
leaq 0x1d872(%rip), %rsi     # 0x6c2ae
movb $0x0, %al
callq 0x17030
jmp 0x4ea45
movq -0x20(%rbp), %rax
movq 0x60(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x3, %eax
jne 0x4ea83
movq -0x10(%rbp), %rdi
callq 0x53be0
cmpl $0x0, %eax
je 0x4ea81
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x4ea8f
jmp 0x4ea83
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)