// File: /workspace/github_cpp_makefile_star2_O2/CobaltXII[P]cxcc/./semantic/semantic_analyzer.hpp
// Function: semantic_analyzer_t::validate_statement(statement_t*, symbol_table_t&)
bool validate_statement(statement_t* statement, symbol_table_t& symbols) {
		if (statement->type == st_compound) {
			compound_statement_t stmt = statement->compound_stmt;
			// A compound statement is invalid if any of it's child statements
			// are invalid.
			symbol_table_t new_symbols(&symbols);
			for (int i = 0; i < stmt.statements.size(); i++) {
				if (!validate_statement(stmt.statements[i], new_symbols)) {
					return false;
				}
			}
		} else if (statement->type == st_conditional) {
			conditional_statement_t stmt = statement->conditional_stmt;
			// A conditional statement is invalid if it's condition is
			// invalid.
			if (!validate_expression(stmt.condition, symbols)) {
				return false;
			}
			// A conditional statement is invalid if it's condition cannot be
			// converted to int.
			type_t condition_type = expression_type(stmt.condition, symbols);
			if (!can_convert(condition_type, {0})) {
				die("cannot convert expression of type '" + prettyprint_type(condition_type) + "' to 'int'", stmt.condition);
				return false;
			}
			// A conditional statement is invalid if it's body statement is
			// invalid.
			symbol_table_t new_symbols(&symbols);
			if (!validate_statement(stmt.body, new_symbols)) {
				return false;
			}
		} else if (statement->type == st_while) {
			while_statement_t stmt = statement->while_stmt;
			// A while statement is invalid if it's condition is invalid.
			if (!validate_expression(stmt.condition, symbols)) {
				return false;
			}
			// A while statement is invalid if it's condition cannot be
			// converted to int.
			type_t condition_type = expression_type(stmt.condition, symbols);
			if (!can_convert(condition_type, {0})) {
				die("cannot convert expression of type '" + prettyprint_type(condition_type) + "' to 'int'", stmt.condition);
				return false;
			}
			// A while statement is invalid if it's body statement is invalid.
			symbol_table_t new_symbols(&symbols);
			new_symbols.in_loop = true;
			if (!validate_statement(stmt.body, new_symbols)) {
				return false;
			}
		} else if (statement->type == st_return) {
			return_statement_t stmt = statement->return_stmt;
			// A return statement is invalid if it's value's type cannot be
			// converted to the type of the return value of the function.
			type_t value_type = expression_type(stmt.value, symbols);
			type_t return_type = symbols.fetch("__return__").type;
			if (!can_convert(value_type, return_type)) {
				die("no conversion from value of type '" + prettyprint_type(value_type) + "' to function return type '" + prettyprint_type(return_type) + "'", stmt.value);
			}
			// A return statement is invalid if it's value is invalid.
			if (!validate_expression(stmt.value, symbols)) {
				return false;
			}
		} else if (statement->type == st_variable_declaration) {
			variable_declaration_statement_t stmt = statement->variable_declaration_stmt;
			// A variable declaration statement is invalid if it's identifier
			// is a reserved identifier.
			if (is_reserved(stmt.identifier)) {
				die("cannot declare variable with reserved identifier '" + stmt.identifier + "'");
				return false;
			}
			// A variable declaration statement is invalid if it's initializer
			// is invalid.
			if (stmt.initializer) {
				if (!validate_expression(stmt.initializer, symbols)) {
					return false;
				}
			}
			// A variable declaration statement is invalid if the type of it's
			// initializer cannot be converted to it's declared type.
			if (stmt.initializer) {
				type_t initializer_type = expression_type(stmt.initializer, symbols);
				if (!can_convert(initializer_type, stmt.type)) {
					die("no conversion from initializer value of type '" + prettyprint_type(initializer_type) + "' to variable type '" + prettyprint_type(stmt.type) + "'", stmt.initializer);
					return false;
				}
			}
			// A variable declaration statement is invalid if a variable under
			// the same identifier has already been declared in the current
			// scope.
			if (symbols.exists_locally(stmt.identifier)) {
				die("redefinition of '" + stmt.identifier + "'");
				return false;
			}
			// Add the variable to the current scope.
			symbols.add_symbol(symbol_t(stmt.type, stmt.identifier));
		} else if (statement->type == st_expression) {
			expression_statement_t stmt = statement->expression_stmt;
			// An expression statement is invalid if it's expression is
			// invalid.
			if (!validate_expression(stmt.expression, symbols)) {
				return false;
			}
		} else if (statement->type == st_break ||
				   statement->type == st_continue) {
			// A break or continue statement is invalid if it is encountered
			// outside of a loop.
			if (!symbols.in_loop) {
				if (statement->type == st_break) {
					die("break statement not within loop", statement->lineno, statement->colno);
				} else {
					die("continue statement not within loop", statement->lineno, statement->colno);
				}
				return false;
			}
		}
		return true;
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3f8, %rsp            # imm = 0x3F8
movl (%rsi), %eax
cmpq $0x8, %rax
ja 0xb586
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x5163(%rip), %rcx      # 0x10150
movslq (%rcx,%rax,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
cmpb $0x0, 0x20(%r15)
jne 0xb586
cmpl $0x7, %eax
jne 0xb3d7
leaq 0x5ac0(%rip), %rsi      # 0x10ad1
leaq 0x88(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x3a1e
movq 0x80(%r14), %rdx
movq 0x88(%r14), %rcx
leaq 0x88(%rsp), %rsi
movq %rbx, %rdi
callq 0xaca2
leaq 0x88(%rsp), %rdi
jmp 0xb51a
movq 0x78(%r14), %r14
leaq 0x238(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0xc78c
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xb6e4
movl %eax, %ebx
leaq 0x240(%rsp), %rdi
jmp 0xb318
movq 0x20(%r14), %r12
movq 0x28(%r14), %r14
leaq 0x3b8(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0xc78c
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0xb6e4
movl %eax, %ebp
leaq 0x3c0(%rsp), %rdi
callq 0xdbb0
testb %bpl, %bpl
je 0xb51f
leaq 0x378(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0xc78c
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0xc7c4
leaq 0x380(%rsp), %rdi
callq 0xdbb0
leaq 0x30(%rsp), %r12
xorps %xmm0, %xmm0
andq $0x0, 0x10(%r12)
movups %xmm0, (%r12)
movq %r15, -0x8(%r12)
movb 0x20(%r15), %al
movb %al, 0x18(%r12)
movups 0x28(%r15), %xmm0
movups %xmm0, 0x20(%r12)
movq 0x38(%r15), %rax
movq %rax, 0x30(%r12)
leaq 0x28(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xafc0
jmp 0xb1ec
movq 0x30(%r14), %r12
movq 0x38(%r14), %r14
leaq 0x338(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0xc78c
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0xb6e4
movl %eax, %ebp
leaq 0x340(%rsp), %rdi
callq 0xdbb0
testb %bpl, %bpl
je 0xb51f
leaq 0x2f8(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0xc78c
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0xc7c4
leaq 0x300(%rsp), %rdi
callq 0xdbb0
leaq 0x30(%rsp), %r12
andq $0x0, 0x10(%r12)
xorps %xmm0, %xmm0
movups %xmm0, (%r12)
movq %r15, -0x8(%r12)
movups 0x28(%r15), %xmm0
movups %xmm0, 0x20(%r12)
movq 0x38(%r15), %rax
movq %rax, 0x30(%r12)
movb $0x1, 0x18(%r12)
leaq 0x28(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xafc0
movl %eax, %ebx
movq %r12, %rdi
jmp 0xb318
addq $0x8, %r14
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x71ec
leaq 0x30(%rsp), %r14
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
andq $0x0, 0x10(%r14)
movq %r15, -0x8(%r14)
movb 0x20(%r15), %al
movb %al, 0x18(%r14)
movups 0x28(%r15), %xmm0
movups %xmm0, 0x20(%r14)
movq 0x38(%r15), %rax
movq %rax, 0x30(%r14)
xorl %r12d, %r12d
leaq 0x28(%rsp), %r15
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r12, %rcx
jbe 0xb3c0
movq (%rax,%r12,8), %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0xafc0
incq %r12
testb %al, %al
jne 0xb23e
movq %r14, %rdi
callq 0xdbb0
leaq 0x8(%rsp), %rdi
callq 0x72ee
jmp 0xb51f
movq 0x40(%r14), %r14
leaq 0x2b8(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0xc78c
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xc7c4
leaq 0x2c0(%rsp), %rdi
callq 0xdbb0
leaq 0x57a9(%rip), %rsi      # 0x10a67
leaq 0x108(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x3a1e
leaq 0x108(%rsp), %rsi
movq %r15, %rdi
callq 0xcc74
leaq 0x108(%rsp), %rdi
callq 0x2100
leaq 0x278(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0xc78c
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xb6e4
movl %eax, %ebx
leaq 0x280(%rsp), %rdi
callq 0xdbb0
testb %bl, %bl
je 0xb51f
jmp 0xb586
addq $0x48, %r14
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
callq 0xcd7a
leaq 0x30(%rsp), %r14
leaq 0x1c8(%rsp), %rdi
movq %r14, %rsi
callq 0x22e0
leaq 0x1c8(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0xcda8
movl %eax, %ebp
movq %r12, %rdi
callq 0x2100
testb %bpl, %bpl
je 0xb412
leaq 0x570f(%rip), %rsi      # 0x10a8c
leaq 0x8(%rsp), %rdi
movq %r14, %rdx
callq 0x6775
leaq 0x5854(%rip), %rdx      # 0x10be5
leaq 0xe8(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x3ae1
leaq 0xe8(%rsp), %rsi
movq %rbx, %rdi
callq 0xcdd4
leaq 0xe8(%rsp), %rdi
jmp 0xb508
movq %r14, %rdi
callq 0xdbb0
leaq 0x8(%rsp), %rdi
callq 0x72ee
jmp 0xb586
leaq 0x5713(%rip), %rsi      # 0x10af1
leaq 0x68(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x3a1e
movq 0x80(%r14), %rdx
movq 0x88(%r14), %rcx
leaq 0x68(%rsp), %rsi
movq %rbx, %rdi
callq 0xaca2
leaq 0x68(%rsp), %rdi
jmp 0xb51a
movq 0x50(%rsp), %r12
testq %r12, %r12
je 0xb491
leaq 0x188(%rsp), %rdi
movq %r15, %rsi
callq 0xc78c
leaq 0x188(%rsp), %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0xb6e4
movl %eax, %ebp
leaq 0x190(%rsp), %rdi
callq 0xdbb0
testb %bpl, %bpl
je 0xb517
movq 0x50(%rsp), %r12
testq %r12, %r12
je 0xb491
leaq 0x148(%rsp), %rdi
movq %r15, %rsi
callq 0xc78c
leaq 0x148(%rsp), %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0xc7c4
leaq 0x150(%rsp), %rdi
callq 0xdbb0
leaq 0x128(%rsp), %rdi
movq %r14, %rsi
callq 0x22e0
leaq 0x128(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0xcdf2
movl %eax, %ebp
movq %r12, %rdi
callq 0x2100
testb %bpl, %bpl
je 0xb523
leaq 0x55f5(%rip), %rsi      # 0x10abf
leaq 0x8(%rsp), %rdi
movq %r14, %rdx
callq 0x6775
leaq 0x5707(%rip), %rdx      # 0x10be5
leaq 0xc8(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x3ae1
leaq 0xc8(%rsp), %rsi
movq %rbx, %rdi
callq 0xcdd4
leaq 0xc8(%rsp), %rdi
callq 0x2100
leaq 0x8(%rsp), %rdi
callq 0x2100
movq %r14, %rdi
callq 0x2100
xorl %eax, %eax
jmp 0xb588
movq 0x28(%rsp), %rbx
leaq 0xa8(%rsp), %rdi
movq %r14, %rsi
callq 0x22e0
leaq 0x1e8(%rsp), %rdi
leaq 0xa8(%rsp), %rdx
movq %rbx, %rsi
callq 0xaf68
addq $0x8, %r15
leaq 0x1e8(%rsp), %rsi
movq %r15, %rdi
callq 0xa578
leaq 0x1e8(%rsp), %rdi
callq 0xa0d6
leaq 0xa8(%rsp), %rdi
callq 0x2100
movq %r14, %rdi
callq 0x2100
movb $0x1, %al
addq $0x3f8, %rsp            # imm = 0x3F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x150(%rsp), %rdi
jmp 0xb5ea
jmp 0xb6ba
movq %rax, %rbx
leaq 0x1e8(%rsp), %rdi
callq 0xa0d6
jmp 0xb5ce
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
jmp 0xb5ff
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
jmp 0xb60e
jmp 0xb606
jmp 0xb6ba
movq %rax, %rbx
leaq 0x190(%rsp), %rdi
callq 0xdbb0
jmp 0xb6bd
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x2100
jmp 0xb609
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2100
jmp 0xb6bd
jmp 0xb61a
movq %rax, %rbx
movq %r12, %rdi
jmp 0xb6b3
jmp 0xb6ba
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
jmp 0xb6c0
movq %rax, %rbx
leaq 0x300(%rsp), %rdi
jmp 0xb6b3
movq %rax, %rbx
leaq 0x380(%rsp), %rdi
jmp 0xb6b3
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
jmp 0xb6c0
jmp 0xb67c
jmp 0xb67c
movq %rax, %rbx
leaq 0x280(%rsp), %rdi
jmp 0xb6b3
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
jmp 0xb6c0
movq %rax, %rbx
jmp 0xb6dc
movq %rax, %rbx
leaq 0x2c0(%rsp), %rdi
jmp 0xb6b3
movq %rax, %rbx
leaq 0x340(%rsp), %rdi
jmp 0xb6b3
movq %rax, %rbx
leaq 0x3c0(%rsp), %rdi
jmp 0xb6b3
movq %rax, %rbx
leaq 0x240(%rsp), %rdi
callq 0xdbb0
jmp 0xb6dc
movq %rax, %rbx
movq %r14, %rdi
callq 0x2100
jmp 0xb6dc
movq %rax, %rbx
movq %r14, %rdi
callq 0xdbb0
leaq 0x8(%rsp), %rdi
callq 0x72ee
movq %rbx, %rdi
callq 0x2390