// File: CobaltXII[P]cxcc/./semantic/semantic_analyzer.hpp
// Function: semantic_analyzer_t::validate_function(function_t&, symbol_table_t&)
bool validate_function(function_t& function, symbol_table_t& global_symbols) {
		symbol_table_t symbols(&global_symbols);
		// Load the function parameters as symbols.
		for (int i = 0; i < function.parameters.size(); i++) {
			symbols.add_symbol(symbol_t(
				function.parameters[i].type,
				function.parameters[i].identifier
			));
		}
		// Add the function return value as a special symbol with the
		// identifier __return__.
		symbols.add_symbol(symbol_t(function.type, "__return__"));
		// Iterate through each statement in the function body.
		bool had_return_stmt = false;
		for (int i = 0; i < function.body.size(); i++) {
			statement_t* statement = function.body[i];
			if (!validate_statement(statement, symbols)) {
				return false;
			}
			if (statement->type == st_return) {
				had_return_stmt = true;
			}
		}
		// The function is invalid if it has no return statement.
		if (!had_return_stmt) {
			die("function '" + function.identifier + "' has no return statement", function);
			return false;
		}
		return true;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x250, %rsp            # imm = 0x250
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x230(%rbp)
movq -0x20(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x191a0
movl $0x0, -0x64(%rbp)
movslq -0x64(%rbp), %rax
movq %rax, -0x238(%rbp)
movq -0x18(%rbp), %rdi
addq $0x28, %rdi
callq 0xf6c0
movq %rax, %rcx
movq -0x238(%rbp), %rax
cmpq %rcx, %rax
jae 0x198a0
movq -0x18(%rbp), %rdi
addq $0x28, %rdi
movslq -0x64(%rbp), %rsi
callq 0x1c080
movq (%rax), %rax
movq %rax, -0xc0(%rbp)
movq -0x18(%rbp), %rdi
addq $0x28, %rdi
movslq -0x64(%rbp), %rsi
callq 0x1c080
movq %rax, %rsi
addq $0x8, %rsi
leaq -0xe0(%rbp), %rdi
callq 0x3130
jmp 0x197f2
movq -0xc0(%rbp), %rsi
leaq -0xb8(%rbp), %rdi
leaq -0xe0(%rbp), %rdx
callq 0x1c0a0
jmp 0x1980e
leaq -0x60(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x19230
jmp 0x19820
leaq -0xb8(%rbp), %rdi
callq 0x193b0
leaq -0xe0(%rbp), %rdi
callq 0x31c0
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x19786
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
jmp 0x19b83
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
jmp 0x1988f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x193b0
leaq -0xe0(%rbp), %rdi
callq 0x31c0
jmp 0x19b83
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x148(%rbp)
leaq -0x169(%rbp), %rdi
movq %rdi, -0x240(%rbp)
callq 0x34d0
movq -0x240(%rbp), %rdx
leaq 0xedf8(%rip), %rsi      # 0x286c7
leaq -0x168(%rbp), %rdi
callq 0x6d70
jmp 0x198dd
movq -0x148(%rbp), %rsi
leaq -0x140(%rbp), %rdi
leaq -0x168(%rbp), %rdx
callq 0x1c0a0
jmp 0x198f9
leaq -0x60(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x19230
jmp 0x1990b
leaq -0x140(%rbp), %rdi
callq 0x193b0
leaq -0x168(%rbp), %rdi
callq 0x31c0
leaq -0x169(%rbp), %rdi
callq 0x3320
movb $0x0, -0x16a(%rbp)
movl $0x0, -0x170(%rbp)
movslq -0x170(%rbp), %rax
movq %rax, -0x248(%rbp)
movq -0x18(%rbp), %rdi
addq $0x40, %rdi
callq 0x10c30
movq %rax, %rcx
movq -0x248(%rbp), %rax
cmpq %rcx, %rax
jae 0x19a56
movq -0x18(%rbp), %rdi
addq $0x40, %rdi
movslq -0x170(%rbp), %rsi
callq 0x1c130
movq -0x230(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x178(%rbp)
movq -0x178(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0x1c150
movb %al, -0x249(%rbp)
jmp 0x199ab
movb -0x249(%rbp), %al
testb $0x1, %al
jne 0x19a2d
jmp 0x199b7
movb $0x0, -0x1(%rbp)
movl $0x1, -0x17c(%rbp)
jmp 0x19b6c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
jmp 0x19a1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
jmp 0x19a10
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x193b0
leaq -0x168(%rbp), %rdi
callq 0x31c0
leaq -0x169(%rbp), %rdi
callq 0x3320
jmp 0x19b83
movq -0x178(%rbp), %rax
cmpl $0x3, (%rax)
jne 0x19a40
movb $0x1, -0x16a(%rbp)
jmp 0x19a42
movl -0x170(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x170(%rbp)
jmp 0x19940
testb $0x1, -0x16a(%rbp)
jne 0x19b5e
movq -0x18(%rbp), %rdx
addq $0x8, %rdx
leaq 0xec19(%rip), %rsi      # 0x2868b
leaq -0x1c0(%rbp), %rdi
callq 0xeda0
jmp 0x19a80
leaq 0xec4b(%rip), %rdx      # 0x286d2
leaq -0x1a0(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0x7160
jmp 0x19a9c
movq -0x18(%rbp), %rsi
leaq -0x228(%rbp), %rdi
callq 0x19420
jmp 0x19aae
movq -0x230(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
leaq -0x228(%rbp), %rdx
callq 0x195e0
jmp 0x19aca
leaq -0x228(%rbp), %rdi
callq 0xd890
leaq -0x1a0(%rbp), %rdi
callq 0x31c0
leaq -0x1c0(%rbp), %rdi
callq 0x31c0
movb $0x0, -0x1(%rbp)
movl $0x1, -0x17c(%rbp)
jmp 0x19b6c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
jmp 0x19b50
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
jmp 0x19b44
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
leaq -0x228(%rbp), %rdi
callq 0xd890
leaq -0x1a0(%rbp), %rdi
callq 0x31c0
leaq -0x1c0(%rbp), %rdi
callq 0x31c0
jmp 0x19b83
movb $0x1, -0x1(%rbp)
movl $0x1, -0x17c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x19c10
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x250, %rsp            # imm = 0x250
popq %rbp
retq
leaq -0x60(%rbp), %rdi
callq 0x19c10
movq -0xe8(%rbp), %rdi
callq 0x34c0
nopl (%rax,%rax)