// File: /workspace/github_c_makefile_star2_O0/System-Glitch[P]ESGILinter-C/src/parsing_expressions.c
// Function: check_function_expression
static void check_function_expression(function_t *function, int line_index, scope_t *scope, type_t *type, messages_t *messages) {
	function_t *function_dec = NULL;
	function_t *prototype    = NULL;

	if(scope == NULL)
		arraylist_add(messages->undeclared_functions, function);
	else {

		function_dec = find_function(scope, function->name, 0);
		if(function_dec != NULL) {
			prototype = find_function_prototype(get_root_scope(scope), function->name);
			if(function_dec->line < line_index || (prototype != NULL && prototype->line < line_index)) {
				free(type->name);

				if(function->negate_operator > 0) {
					type->name = strduplicate("int");
					type->is_pointer = 0;
				} else {
					type->name = strduplicate(function_dec->return_type.name);
					type->is_pointer = function_dec->return_type.is_pointer;
				}
				type->is_literal = 0;
				if(messages->functions_list) {
					arraylist_remove(messages->functions_list, arraylist_index_of(messages->functions_list, function_dec));
				}
				check_function_call_parameters(scope, function, function_dec, line_index, messages);
				function_free(function);
			} else {
				arraylist_add(messages->undeclared_functions, function);
				check_function_call_parameters(scope, function, function_dec, line_index, messages);
			}
		} else {
			arraylist_add(messages->undeclared_functions, function);
			check_function_call_parameters(scope, function, function_dec, line_index, messages);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x11368
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rsi
callq 0x8730
jmp 0x114dc
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rsi
xorl %edx, %edx
callq 0x8320
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x114b1
movq -0x18(%rbp), %rdi
callq 0x8290
movq %rax, %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rsi
callq 0x8470
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movl 0x28(%rax), %eax
cmpl -0xc(%rbp), %eax
jl 0x113cc
cmpq $0x0, -0x38(%rbp)
je 0x11486
movq -0x38(%rbp), %rax
movl 0x28(%rax), %eax
cmpl -0xc(%rbp), %eax
jge 0x11486
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x2030
movq -0x8(%rbp), %rax
cmpl $0x0, 0x2c(%rax)
jle 0x11402
leaq 0x351c(%rip), %rdi      # 0x14905
callq 0xa550
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movb $0x0, 0x8(%rax)
jmp 0x11427
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xa550
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
movb 0x10(%rax), %cl
movq -0x20(%rbp), %rax
movb %cl, 0x8(%rax)
movq -0x20(%rbp), %rax
movb $0x0, 0x9(%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x11463
movq -0x28(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x30(%rbp), %rsi
callq 0x89a0
movq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0x88d0
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x30(%rbp), %rdx
movl -0xc(%rbp), %ecx
movq -0x28(%rbp), %r8
callq 0xfea0
movq -0x8(%rbp), %rdi
callq 0x100e0
jmp 0x114af
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rsi
callq 0x8730
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x30(%rbp), %rdx
movl -0xc(%rbp), %ecx
movq -0x28(%rbp), %r8
callq 0xfea0
jmp 0x114da
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rsi
callq 0x8730
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x30(%rbp), %rdx
movl -0xc(%rbp), %ecx
movq -0x28(%rbp), %r8
callq 0xfea0
jmp 0x114dc
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)