// File: /workspace/github_c_makefile_star2_O0/lucvoo[P]sparse-dev/evaluate.c
// Function: evaluate_statement
struct symbol *evaluate_statement(struct statement *stmt)
{
	if (!stmt)
		return NULL;

	switch (stmt->type) {
	case STMT_DECLARATION: {
		struct symbol *s;
		FOR_EACH_PTR(stmt->declaration, s) {
			evaluate_symbol(s);
		} END_FOR_EACH_PTR(s);
		return NULL;
	}

	case STMT_RETURN:
		return evaluate_return_expression(stmt);

	case STMT_EXPRESSION:
		if (!evaluate_expression(stmt->expression))
			return NULL;
		if (stmt->expression->ctype == &null_ctype)
			stmt->expression = cast_to(stmt->expression, &ptr_ctype);
		return unqualify_type(degenerate(stmt->expression));

	case STMT_COMPOUND: {
		struct statement *s;
		struct symbol *type = NULL;

		/* Evaluate the return symbol in the compound statement */
		evaluate_symbol(stmt->ret);

		/*
		 * Then, evaluate each statement, making the type of the
		 * compound statement be the type of the last statement
		 */
		type = evaluate_statement(stmt->args);
		FOR_EACH_PTR(stmt->stmts, s) {
			type = evaluate_statement(s);
		} END_FOR_EACH_PTR(s);
		if (!type)
			type = &void_ctype;
		return type;
	}
	case STMT_IF:
		evaluate_if_statement(stmt);
		return NULL;
	case STMT_ITERATOR:
		evaluate_iterator(stmt);
		return NULL;
	case STMT_SWITCH:
		evaluate_switch_statement(stmt);
		return NULL;
	case STMT_CASE:
		evaluate_case_statement(stmt);
		return NULL;
	case STMT_LABEL:
		return evaluate_statement(stmt->label_statement);
	case STMT_GOTO:
		evaluate_goto_statement(stmt);
		return NULL;
	case STMT_NONE:
		break;
	case STMT_ASM:
		evaluate_asm_statement(stmt);
		return NULL;
	case STMT_CONTEXT:
		evaluate_expression(stmt->expression);
		return NULL;
	case STMT_RANGE:
		evaluate_expression(stmt->range_expression);
		evaluate_expression(stmt->range_low);
		evaluate_expression(stmt->range_high);
		return NULL;
	}
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x4f0d0
movq $0x0, -0x8(%rbp)
jmp 0x4f3eb
movq -0x10(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x70(%rbp)
subq $0xd, %rax
ja 0x4f3e3
movq -0x70(%rbp), %rax
leaq 0x1c605(%rip), %rcx     # 0x6b6f4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0x4f0fa
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x4f11f
jmp 0x4f194
jmp 0x4f121
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x28(%rbp), %rcx
movw (%rcx), %cx
shlw $0x8, %cx
sarw $0x8, %cx
movswl %cx, %ecx
cmpl %ecx, %eax
jge 0x4f180
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq 0x18(%rax,%rcx,8), %rax
movq %rax, -0x18(%rbp)
movq -0x28(%rbp), %rax
movw (%rax), %ax
sarw $0x8, %ax
cwtl
cmpl $0x0, %eax
je 0x4f16c
cmpq $0x0, -0x18(%rbp)
jne 0x4f16c
jmp 0x4f175
movq -0x18(%rbp), %rdi
callq 0x4f490
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x4f128
jmp 0x4f182
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq -0x20(%rbp), %rax
jne 0x4f121
movq $0x0, -0x8(%rbp)
jmp 0x4f3eb
movq -0x10(%rbp), %rdi
callq 0x50000
movq %rax, -0x8(%rbp)
jmp 0x4f3eb
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x4bb70
cmpq $0x0, %rax
jne 0x4f1d3
movq $0x0, -0x8(%rbp)
jmp 0x4f3eb
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
leaq 0x43b96(%rip), %rcx     # 0x92d78
cmpq %rcx, 0x10(%rax)
jne 0x4f207
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0x43721(%rip), %rsi     # 0x92918
callq 0x4c020
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x4c1c0
movq %rax, %rdi
callq 0x50150
movq %rax, -0x8(%rbp)
jmp 0x4f3eb
movq $0x0, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x4f490
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x4f0b0
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x4f270
jmp 0x4f2e9
jmp 0x4f272
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
movq -0x58(%rbp), %rcx
movw (%rcx), %cx
shlw $0x8, %cx
sarw $0x8, %cx
movswl %cx, %ecx
cmpl %ecx, %eax
jge 0x4f2d5
movq -0x58(%rbp), %rax
movslq -0x64(%rbp), %rcx
movq 0x18(%rax,%rcx,8), %rax
movq %rax, -0x40(%rbp)
movq -0x58(%rbp), %rax
movw (%rax), %ax
sarw $0x8, %ax
cwtl
cmpl $0x0, %eax
je 0x4f2bd
cmpq $0x0, -0x40(%rbp)
jne 0x4f2bd
jmp 0x4f2ca
movq -0x40(%rbp), %rdi
callq 0x4f0b0
movq %rax, -0x48(%rbp)
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x4f279
jmp 0x4f2d7
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x58(%rbp)
cmpq -0x50(%rbp), %rax
jne 0x4f272
cmpq $0x0, -0x48(%rbp)
jne 0x4f2fb
leaq 0x42201(%rip), %rax     # 0x914f8
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x4f3eb
movq -0x10(%rbp), %rdi
callq 0x501f0
movq $0x0, -0x8(%rbp)
jmp 0x4f3eb
movq -0x10(%rbp), %rdi
callq 0x50240
movq $0x0, -0x8(%rbp)
jmp 0x4f3eb
movq -0x10(%rbp), %rdi
callq 0x502b0
movq $0x0, -0x8(%rbp)
jmp 0x4f3eb
movq -0x10(%rbp), %rdi
callq 0x50410
movq $0x0, -0x8(%rbp)
jmp 0x4f3eb
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x4f0b0
movq %rax, -0x8(%rbp)
jmp 0x4f3eb
movq -0x10(%rbp), %rdi
callq 0x50450
movq $0x0, -0x8(%rbp)
jmp 0x4f3eb
jmp 0x4f3e3
movq -0x10(%rbp), %rdi
callq 0x504a0
movq $0x0, -0x8(%rbp)
jmp 0x4f3eb
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x4bb70
movq $0x0, -0x8(%rbp)
jmp 0x4f3eb
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x4bb70
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x4bb70
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x4bb70
movq $0x0, -0x8(%rbp)
jmp 0x4f3eb
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)