// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rdi, %rdi
je 0x35ac8
movq %rdi, %rbx
xorl %eax, %eax
leaq 0x14585(%rip), %r14     # 0x49ab0
movl %eax, 0xc(%rsp)
movl (%rbx), %eax
cmpl $0x9, %eax
jne 0x35544
movq 0x20(%rbx), %rbx
testq %rbx, %rbx
jne 0x3552f
jmp 0x35ac3
decl %eax
cmpl $0xc, %eax
ja 0x35ac3
movslq (%r14,%rax,4), %rax
addq %r14, %rax
jmpq *%rax
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x35ac3
xorl %esi, %esi
callq 0x37599
movq 0x18(%rbx), %rdi
callq 0x35508
jmp 0x355c7
movq 0x20(%rbx), %rdi
callq 0x3642b
movq 0x30(%rbx), %rdi
movl $0x1, %esi
callq 0x37599
movq 0x48(%rbx), %rdi
movl $0x1, %esi
callq 0x37599
movq 0x28(%rbx), %rdi
callq 0x35508
movq 0x38(%rbx), %rdi
callq 0x35508
movl $0x40, %eax
jmp 0x355cc
movq 0x10(%rbx), %rdi
callq 0x32223
movq 0x18(%rbx), %rdi
callq 0x32223
movl $0x20, %eax
movq (%rbx,%rax), %rbx
movb $0x1, %al
testq %rbx, %rbx
jne 0x3552b
jmp 0x35ac8
movq 0x10(%rbx), %rdi
jmp 0x35abe
movq 0x18(%rbx), %rdi
callq 0x35be9
movq 0x28(%rbx), %rdi
callq 0x35508
movq %rax, %r14
movq 0x10(%rbx), %rbx
testq %rbx, %rbx
je 0x3564e
movq %rbx, %r15
movzwl (%r15), %eax
testb %al, %al
jle 0x35645
xorl %r12d, %r12d
movq 0x18(%r15,%r12,8), %rdi
movzwl %ax, %ecx
cmpl $0x100, %ecx            # imm = 0x100
jb 0x3562a
testq %rdi, %rdi
je 0x35636
callq 0x35508
movq %rax, %r14
movzwl (%r15), %eax
incq %r12
movzwl %ax, %ecx
movsbq %cl, %rcx
cmpq %rcx, %r12
jl 0x35615
movq 0x10(%r15), %r15
cmpq %rbx, %r15
jne 0x3560a
testq %r14, %r14
movl 0xc(%rsp), %eax
jne 0x3565e
leaq 0x35aba(%rip), %r14     # 0x6b118
testb $0x1, %al
jne 0x35ac8
jmp 0x35acb
cmpq $0x0, 0x10(%rbx)
je 0x35ac3
movq 0x18(%rbx), %rbp
testq %rbp, %rbp
je 0x35753
movq %rbp, %r15
movzwl (%r15), %eax
testb %al, %al
jle 0x35746
xorl %r14d, %r14d
movq 0x18(%r15,%r14,8), %r12
movzwl %ax, %ecx
cmpl $0x100, %ecx            # imm = 0x100
jb 0x356ae
testq %r12, %r12
je 0x35733
cmpq $0x0, 0x8(%r12)
je 0x356e1
movq %r12, %rdi
callq 0x38b21
testb $0x1, 0x18(%r12)
jne 0x356e1
movq 0x8(%r12), %rdi
movq 0x28(%rdi), %rdx
addq $0x4, %rdx
leaq 0x153a0(%rip), %rsi     # 0x4aa7a
xorl %eax, %eax
callq 0x11b04
movq 0x10(%r12), %r13
movq %r13, %rdi
callq 0x32223
testq %rax, %rax
je 0x35ac3
cmpb $0x9, (%r13)
jne 0x35705
cmpl $0x2a, 0x4(%r13)
je 0x35717
movq 0x8(%r13), %rdi
leaq 0x152db(%rip), %rsi     # 0x4a9eb
xorl %eax, %eax
callq 0x118fc
movq 0x10(%r13), %rax
movq 0x68(%rax), %rsi
movq %r13, %rdi
callq 0x376dc
movq %r12, %rdi
callq 0x38c38
movzwl (%r15), %eax
incq %r14
movzwl %ax, %ecx
movsbq %cl, %rcx
cmpq %rcx, %r14
jl 0x35695
movq 0x10(%r15), %r15
cmpq %rbp, %r15
jne 0x35686
movq 0x20(%rbx), %r12
testq %r12, %r12
je 0x357f2
leaq 0x1534c(%rip), %rbp     # 0x4aab3
movq %r12, %r13
movzwl (%r13), %eax
testb %al, %al
jle 0x357e5
xorl %r14d, %r14d
movq 0x18(%r13,%r14,8), %r15
movzwl %ax, %ecx
cmpl $0x100, %ecx            # imm = 0x100
jb 0x3578b
testq %r15, %r15
je 0x357d6
cmpq $0x0, 0x8(%r15)
je 0x357b7
movq %r15, %rdi
callq 0x38b21
testb $0x1, 0x18(%r15)
je 0x357b7
movq 0x8(%r15), %rdi
movq 0x28(%rdi), %rdx
addq $0x4, %rdx
movq %rbp, %rsi
xorl %eax, %eax
callq 0x11b04
movq 0x10(%r15), %rdi
callq 0x32223
testq %rax, %rax
je 0x35ac3
movq %r15, %rdi
callq 0x38c38
movzwl (%r13), %eax
incq %r14
movzwl %ax, %ecx
movsbq %cl, %rcx
cmpq %rcx, %r14
jl 0x35776
movq 0x10(%r13), %r13
cmpq %r12, %r13
jne 0x3576a
movq 0x28(%rbx), %r15
testq %r15, %r15
je 0x3585c
leaq 0x15216(%rip), %r14     # 0x4aa18
movq %r15, %r12
movzwl (%r12), %eax
testb %al, %al
jle 0x35852
xorl %r13d, %r13d
movq 0x18(%r12,%r13,8), %rdi
movzwl %ax, %ecx
cmpl $0x100, %ecx            # imm = 0x100
jb 0x35826
testq %rdi, %rdi
je 0x35843
testq %rdi, %rdi
je 0x35b6b
cmpb $0x2, (%rdi)
je 0x35843
movq %r14, %rsi
xorl %eax, %eax
callq 0x11b04
movzwl (%r12), %eax
incq %r13
movzwl %ax, %ecx
movsbq %cl, %rcx
cmpq %rcx, %r13
jl 0x35811
movq 0x10(%r12), %r12
cmpq %r15, %r12
jne 0x35805
movq 0x30(%rbx), %rax
testq %rax, %rax
je 0x35ac3
movq %rax, %rcx
movzwl (%rcx), %esi
movsbl %sil, %edx
testw %dx, %dx
jle 0x358ad
movzwl %dx, %edx
movzwl %si, %esi
xorl %edi, %edi
movq 0x18(%rcx,%rdi,8), %r8
cmpl $0x100, %esi            # imm = 0x100
jb 0x35892
testq %r8, %r8
je 0x358a5
testq %r8, %r8
je 0x35b78
cmpb $0xc, (%r8)
jne 0x35b78
incq %rdi
cmpq %rdi, %rdx
jne 0x35880
movq 0x10(%rcx), %rcx
cmpq %rax, %rcx
jne 0x3586c
jmp 0x35ac3
movq 0x10(%rbx), %rdi
callq 0x32223
movq 0x18(%rbx), %rdi
callq 0x32223
movq 0x20(%rbx), %rdi
jmp 0x35abe
movq 0x10(%rbx), %rbx
testq %rbx, %rbx
je 0x35ac3
movq %rbx, %r14
movzwl (%r14), %eax
testb %al, %al
jle 0x3591e
xorl %r15d, %r15d
movq 0x18(%r14,%r15,8), %rdi
movzwl %ax, %ecx
cmpl $0x100, %ecx            # imm = 0x100
jb 0x35906
testq %rdi, %rdi
je 0x3590f
callq 0x35be9
movzwl (%r14), %eax
incq %r15
movzwl %ax, %ecx
movsbq %cl, %rcx
cmpq %rcx, %r15
jl 0x358f1
movq 0x10(%r14), %r14
cmpq %rbx, %r14
jne 0x358e6
jmp 0x35ac3
movq $0x0, 0x10(%rsp)
movq 0x10(%rbx), %r14
movq %r14, %rdi
callq 0x32223
movq 0x18(%rbx), %rdi
callq 0x35508
testq %r14, %r14
je 0x35ac3
movq 0x10(%r14), %rax
testq %rax, %rax
je 0x35add
movzbl (%rax), %ecx
cmpl $0x3, %ecx
jne 0x3596f
movq 0x60(%rax), %rax
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x9, %ecx
leaq 0x10(%rsp), %r15
cmoveq %rax, %r15
jmp 0x35ae2
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
je 0x35aba
movq 0x4(%rbx), %rdi
callq 0x35b9d
jmp 0x35ac3
movq 0x10(%rbx), %rdi
callq 0x32223
testq %rax, %rax
je 0x35ac3
movq 0x10(%rbx), %rdi
movq 0x10(%rdi), %rax
cmpq 0x2a5fa(%rip), %rax     # 0x5ffb8
jne 0x359d3
leaq 0x36b71(%rip), %rsi     # 0x6c538
callq 0x32aa9
movq %rax, %rdi
movq %rax, 0x10(%rbx)
callq 0x32bf6
movq %rax, %rdi
callq 0x364a3
testb $0x1, 0xc(%rsp)
jne 0x35ac8
movq %rax, %r14
jmp 0x35acb
movq 0x10(%rbx), %r14
movq %r14, %rdi
callq 0x32223
movq 0x5a56a(%rip), %rax     # 0x8ff70
movq 0x60(%rax), %rax
movq 0x60(%rax), %rsi
testq %rsi, %rsi
setne %al
cmpq 0x2a52d(%rip), %rsi     # 0x5ff48
setne %cl
testb %cl, %al
jne 0x35a92
testq %r14, %r14
je 0x35ac3
movq 0x10(%r14), %rax
testq %rax, %rax
je 0x35a6c
cmpb $0x3, (%rax)
jne 0x35a3d
movq 0x60(%rax), %rax
cmpq 0x2a504(%rip), %rax     # 0x5ff48
je 0x35a6c
testq %rsi, %rsi
leaq 0x14f1b(%rip), %rax     # 0x4a96b
leaq 0xccfa(%rip), %rdx      # 0x42751
cmoveq %rax, %rdx
leaq 0x14ee8(%rip), %rsi     # 0x4a94a
movq %r14, %rdi
xorl %eax, %eax
callq 0x11b04
leaq 0x313b9(%rip), %rax     # 0x66e2c
cmpl $0x0, (%rax)
je 0x35ac3
movq 0x4(%rbx), %rdi
leaq 0x14ef1(%rip), %rsi     # 0x4a974
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x118fc
jmp 0x35b8d
testq %r14, %r14
je 0x35b5e
cmpq $0x0, 0x10(%r14)
je 0x35ac3
addq $0x10, %rbx
leaq 0x14f04(%rip), %rcx     # 0x4a9b1
movq %r14, %rdi
movq %rbx, %rdx
callq 0x36caf
jmp 0x35ac3
movq 0x18(%rbx), %rdi
callq 0x32223
testb $0x1, 0xc(%rsp)
xorl %r14d, %r14d
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x10(%rsp), %r15
movq 0x28(%rbx), %rax
movq 0x98(%rax), %rbx
testq %rbx, %rbx
je 0x35ac3
movq %rbx, %r12
movzwl (%r12), %eax
testb %al, %al
jle 0x35b4f
xorl %r13d, %r13d
movq 0x18(%r12,%r13,8), %rcx
movzwl %ax, %edx
cmpl $0x100, %edx            # imm = 0x100
jb 0x35b16
testq %rcx, %rcx
je 0x35b40
movq 0x90(%rcx), %rbp
movq 0x10(%rbp), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x3891f
movq 0x18(%rbp), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x3891f
movzwl (%r12), %eax
incq %r13
movzwl %ax, %ecx
movsbq %cl, %rcx
cmpq %rcx, %r13
jl 0x35b01
movq 0x10(%r12), %r12
cmpq %rbx, %r12
jne 0x35af5
jmp 0x35ac3
movq 0x4(%rbx), %rdi
leaq 0x14e2c(%rip), %rsi     # 0x4a995
jmp 0x35b83
movq 0x4(%rbx), %rdi
leaq 0x14e91(%rip), %rsi     # 0x4aa07
jmp 0x35b83
movq 0x4(%rbx), %rdi
leaq 0x14eb1(%rip), %rsi     # 0x4aa34
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x11a80
testb $0x1, 0xc(%rsp)
jne 0x35ac8
jmp 0x35acb