// File: /workspace/github_cpp_makefile_star2_O1/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 0x100(%rsp), %rcx
xorps %xmm0, %xmm0
movups %xmm0, 0x9(%rcx)
movups %xmm0, (%rcx)
movups %xmm0, 0x20(%rcx)
movq $0x0, 0x30(%rcx)
movq %rdx, -0x8(%rcx)
movb 0x20(%rdx), %al
movb %al, 0x18(%rcx)
movq 0x28(%rdx), %rax
movq %rax, 0x20(%rcx)
movq 0x30(%rdx), %rax
movq %rax, 0x28(%rcx)
movq 0x38(%rdx), %rax
movq %rax, 0x30(%rcx)
movq 0x28(%rsi), %rax
cmpq %rax, 0x30(%rsi)
je 0x107ab
movl $0x10, %r12d
xorl %r14d, %r14d
leaq 0x30(%rsp), %r13
leaq 0x188(%rsp), %rbp
movq -0x10(%rax,%r12), %rbx
leaq 0x40(%rsp), %rcx
movq %rcx, 0x30(%rsp)
movq -0x8(%rax,%r12), %rsi
movq (%rax,%r12), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x17a38
movq %rbp, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x1178c
leaq 0x100(%rsp), %rdi
movq %rbp, %rsi
callq 0x10b8e
leaq 0x1b0(%rsp), %rdi
callq 0x9812
movq 0x190(%rsp), %rdi
leaq 0x1a0(%rsp), %rax
cmpq %rax, %rdi
je 0x10762
movq 0x1a0(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x1077e
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3280
incq %r14
movq 0x28(%r15), %rax
movq 0x30(%r15), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $-0x3333333333333333, %rdx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rdx, %rcx
addq $0x28, %r12
cmpq %r14, %rcx
ja 0x106ef
movq (%r15), %r12
leaq 0x60(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x9231(%rip), %rsi      # 0x199ef
leaq 0x9234(%rip), %rdx      # 0x199f9
leaq 0x50(%rsp), %rdi
callq 0x9052
leaq 0x138(%rsp), %rdi
leaq 0x50(%rsp), %rdx
movq %r12, %rsi
callq 0x1178c
leaq 0x138(%rsp), %rsi
leaq 0x100(%rsp), %rdi
callq 0x10b8e
leaq 0x160(%rsp), %rbx
movq %rbx, %rdi
callq 0x9812
movq -0x20(%rbx), %rdi
leaq 0x150(%rsp), %rax
cmpq %rax, %rdi
je 0x1082a
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0x10841
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x40(%r15), %rax
cmpq %rax, 0x48(%r15)
setne %r13b
je 0x108a5
xorl %ebp, %ebp
leaq 0xf8(%rsp), %r12
xorl %r14d, %r14d
movq (%rax,%rbp,8), %rbx
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x117fc
testb %al, %al
je 0x10884
cmpl $0x3, (%rbx)
movzbl %r14b, %r14d
movl $0x1, %ecx
cmovel %ecx, %r14d
testb %al, %al
je 0x108a8
incq %rbp
movq 0x40(%r15), %rax
movq 0x48(%r15), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbp, %rcx
seta %r13b
ja 0x1085c
jmp 0x108a8
xorl %r14d, %r14d
movl %r13d, %ebp
xorb $0x1, %bpl
testb $0x1, %r13b
jne 0x10a1a
testb $0x1, %r14b
jne 0x10a1a
leaq 0x8(%r15), %rdx
leaq 0x90e5(%rip), %rsi      # 0x199b3
leaq 0x70(%rsp), %rdi
callq 0xa33e
leaq 0x911b(%rip), %rsi      # 0x199fa
leaq 0x70(%rsp), %rdi
callq 0x33f0
leaq 0x20(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x10910
movq %rdx, 0x10(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x20(%rsp)
jmp 0x10916
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
movq 0x8(%rax), %rdx
movq %rdx, 0x18(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq (%r15), %rax
leaq 0x98(%rsp), %rdi
movq %rax, -0x8(%rdi)
leaq 0xa8(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x8(%r15), %rsi
movq 0x10(%r15), %rdx
addq %rsi, %rdx
callq 0x17a38
leaq 0x28(%r15), %rsi
leaq 0xb8(%rsp), %r12
movq %r12, %rdi
callq 0x105d8
leaq 0x40(%r15), %rsi
leaq 0xd0(%rsp), %rdi
callq 0xb122
movups 0x58(%r15), %xmm0
leaq 0x90(%rsp), %rdx
movups %xmm0, 0x58(%rdx)
leaq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0x1054a
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x109bb
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3280
movq %r12, %rdi
callq 0x9812
movq 0x98(%rsp), %rdi
cmpq %r14, %rdi
je 0x109e0
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
je 0x109f7
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3280
leaq 0x80(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x10a18
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x3280
xorl %ebp, %ebp
leaq 0x100(%rsp), %rdi
callq 0x15538
andb $0x1, %bpl
movl %ebp, %eax
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
leaq 0x90(%rsp), %rdi
callq 0x986e
jmp 0x10a83
movq %rax, %r15
movq %r12, %rdi
callq 0x9812
jmp 0x10a61
movq %rax, %r15
movq 0x98(%rsp), %rdi
cmpq %r14, %rdi
je 0x10a83
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x10a83
movq %rax, %r15
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
je 0x10a9f
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x10a9f
movq %rax, %r15
leaq 0x80(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x10b1c
movq 0x80(%rsp), %rsi
jmp 0x10b14
jmp 0x10ae6
movq %rax, %r15
leaq 0x138(%rsp), %rdi
callq 0x103f6
jmp 0x10ad1
movq %rax, %r15
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0x10b1c
movq 0x60(%rsp), %rsi
jmp 0x10b14
jmp 0x10ae6
jmp 0x10ae6
movq %rax, %r15
jmp 0x10b1c
movq %rax, %r15
jmp 0x10b00
movq %rax, %r15
leaq 0x188(%rsp), %rdi
callq 0x103f6
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x10b1c
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3280
leaq 0x100(%rsp), %rdi
callq 0x15538
movq %r15, %rdi
callq 0x33b0
nop