// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movq %rsi, %r15
movq %rdi, 0x8(%rsp)
leaq 0x78(%rsp), %rcx
xorps %xmm0, %xmm0
movups %xmm0, (%rcx)
andq $0x0, 0x10(%rcx)
movq %rdx, -0x8(%rcx)
movb 0x20(%rdx), %al
movb %al, 0x18(%rcx)
movups 0x28(%rdx), %xmm0
movups %xmm0, 0x20(%rcx)
movq 0x38(%rdx), %rax
movq %rax, 0x30(%rcx)
pushq $0x8
popq %rbx
xorl %r14d, %r14d
leaq 0xb0(%rsp), %r12
leaq 0x188(%rsp), %r13
movq 0x28(%r15), %rsi
movq 0x30(%r15), %rax
subq %rsi, %rax
cqto
pushq $0x28
popq %rcx
idivq %rcx
cmpq %r14, %rax
jbe 0xa369
movq -0x8(%rsi,%rbx), %rbp
addq %rbx, %rsi
movq %r12, %rdi
callq 0x22e0
movq %r13, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0xaf68
leaq 0x78(%rsp), %rdi
movq %r13, %rsi
callq 0xa578
movq %r13, %rdi
callq 0xa0d6
movq %r12, %rdi
callq 0x2100
incq %r14
addq $0x28, %rbx
jmp 0xa30d
movq (%r15), %r12
leaq 0x66f4(%rip), %rsi      # 0x10a67
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x3a1e
leaq 0xd0(%rsp), %rdi
leaq 0x50(%rsp), %rdx
movq %r12, %rsi
callq 0xaf68
leaq 0xd0(%rsp), %rsi
leaq 0x78(%rsp), %rdi
callq 0xa578
leaq 0xd0(%rsp), %rdi
callq 0xa0d6
leaq 0x50(%rsp), %rdi
callq 0x2100
xorl %ebx, %ebx
leaq 0x70(%rsp), %r12
xorl %r14d, %r14d
movq 0x40(%r15), %rax
movq 0x48(%r15), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbx, %rcx
jbe 0xa40a
movq (%rax,%rbx,8), %r13
movq 0x8(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0xafc0
testb %al, %al
je 0xa486
cmpl $0x3, (%r13)
sete %al
orb %al, %r14b
incq %rbx
jmp 0xa3ca
movb $0x1, %bpl
testb $0x1, %r14b
jne 0xa488
leaq 0x8(%r15), %rdx
leaq 0x660d(%rip), %rsi      # 0x10a2b
leaq 0x10(%rsp), %rdi
callq 0x6775
leaq 0x6643(%rip), %rdx      # 0x10a72
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x3ae1
leaq 0x120(%rsp), %rdi
movq %r15, %rsi
callq 0xa0f0
leaq 0x30(%rsp), %rsi
leaq 0x120(%rsp), %rdx
movq 0x8(%rsp), %rdi
callq 0xa208
leaq 0x120(%rsp), %rdi
callq 0x606a
leaq 0x30(%rsp), %rdi
callq 0x2100
leaq 0x10(%rsp), %rdi
callq 0x2100
xorl %ebp, %ebp
leaq 0x78(%rsp), %rdi
callq 0xdbb0
movl %ebp, %eax
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq 0x120(%rsp), %rdi
callq 0x606a
jmp 0xa4bb
movq %rax, %r14
leaq 0x30(%rsp), %rdi
callq 0x2100
jmp 0xa4ca
movq %rax, %r14
leaq 0x10(%rsp), %rdi
jmp 0xa510
jmp 0xa517
movq %rax, %r14
leaq 0xd0(%rsp), %rdi
callq 0xa0d6
jmp 0xa4e8
movq %rax, %r14
leaq 0x50(%rsp), %rdi
jmp 0xa510
jmp 0xa517
jmp 0xa517
movq %rax, %r14
leaq 0x188(%rsp), %rdi
callq 0xa0d6
jmp 0xa508
movq %rax, %r14
leaq 0xb0(%rsp), %rdi
callq 0x2100
jmp 0xa51a
movq %rax, %r14
leaq 0x78(%rsp), %rdi
callq 0xdbb0
movq %r14, %rdi
callq 0x2390