// File: /workspace/github_c_makefile_star2_O1/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 $0x28, %rsp
movq %rdi, %rbx
xorl %r14d, %r14d
leaq 0x14bbe(%rip), %r15     # 0x4ab40
xorl %r13d, %r13d
testq %rbx, %rbx
je 0x364f7
movl (%rbx), %eax
cmpl $0x9, %eax
jne 0x35f9b
movq 0x20(%rbx), %rbx
jmp 0x35f85
decl %eax
cmpl $0xc, %eax
ja 0x364f7
movslq (%r15,%rax,4), %rax
addq %r15, %rax
movq %r13, 0x8(%rsp)
jmpq *%rax
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x364f7
xorl %esi, %esi
callq 0x38093
movq 0x18(%rbx), %rdi
callq 0x35f67
jmp 0x36022
movq 0x20(%rbx), %rdi
callq 0x36f42
movq 0x30(%rbx), %rdi
movl $0x1, %esi
callq 0x38093
movq 0x48(%rbx), %rdi
movl $0x1, %esi
callq 0x38093
movq 0x28(%rbx), %rdi
callq 0x35f67
movq 0x38(%rbx), %rdi
callq 0x35f67
movq 0x40(%rbx), %rbx
jmp 0x36026
movq 0x10(%rbx), %rdi
callq 0x32c63
movq 0x18(%rbx), %rdi
callq 0x32c63
movq 0x20(%rbx), %rbx
testb $0x1, %r13b
cmoveq %r14, %r12
movb $0x1, %r13b
jmp 0x35f85
movq 0x10(%rbx), %rdi
jmp 0x363b1
cmpq $0x0, 0x10(%rbx)
je 0x363b6
movq %r12, 0x10(%rsp)
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x363ca
leaq 0x15a18(%rip), %r14     # 0x4ba7b
movq %rax, %r15
movq %rax, 0x20(%rsp)
movzwl (%r15), %eax
testb %al, %al
jle 0x3611e
xorl %ebp, %ebp
movq 0x18(%r15,%rbp,8), %r12
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
jb 0x3608d
testq %r12, %r12
je 0x3610b
cmpq $0x0, 0x8(%r12)
je 0x360c0
movq %r12, %rdi
callq 0x39696
testb $0x1, 0x18(%r12)
jne 0x360c0
movq 0x8(%r12), %rdi
movq 0x28(%rdi), %rdx
addq $0x4, %rdx
leaq 0x15a51(%rip), %rsi     # 0x4bb0a
xorl %eax, %eax
callq 0x11abc
movq 0x10(%r12), %r13
movq %r13, %rdi
callq 0x32c63
testq %rax, %rax
je 0x363be
cmpb $0x9, (%r13)
jne 0x360e4
cmpl $0x2a, 0x4(%r13)
je 0x360f2
movq 0x8(%r13), %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x118b4
movq 0x10(%r13), %rsi
movq %r13, %rdi
callq 0x381e1
movq %r12, %rdi
callq 0x397a2
movq 0x8(%rsp), %r13
incq %rbp
movl (%r15), %eax
movsbq %al, %rcx
cmpq %rcx, %rbp
jl 0x36079
movq 0x10(%r15), %r15
movq 0x20(%rsp), %rax
cmpq %rax, %r15
jne 0x3606b
xorl %eax, %eax
jmp 0x363cf
movq 0x10(%rbx), %rdi
callq 0x32c63
testq %rax, %rax
je 0x363b6
movq 0x10(%rbx), %rdi
movq 0x10(%rdi), %rax
cmpq 0x2ae58(%rip), %rax     # 0x60fb0
jne 0x3616a
leaq 0x373d7(%rip), %rsi     # 0x6d538
callq 0x334cd
movq %rax, 0x10(%rbx)
movq 0x10(%rbx), %rdi
callq 0x33628
movq %rax, %rdi
callq 0x36fb5
movq %rax, %r14
jmp 0x364f7
movq %r12, %r13
movq 0x18(%rbx), %rdi
callq 0x366a3
movq 0x28(%rbx), %rdi
callq 0x35f67
movq %rax, %r14
movq 0x10(%rbx), %rbx
testq %rbx, %rbx
je 0x361e6
movq %rbx, %r15
movzwl (%r15), %eax
testb %al, %al
jle 0x361dd
xorl %r12d, %r12d
movq 0x18(%r15,%r12,8), %rdi
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
jb 0x361c6
testq %rdi, %rdi
je 0x361ce
callq 0x35f67
movq %rax, %r14
incq %r12
movl (%r15), %eax
movsbq %al, %rcx
cmpq %rcx, %r12
jl 0x361b2
movq 0x10(%r15), %r15
cmpq %rbx, %r15
jne 0x361a7
testq %r14, %r14
jne 0x362a2
leaq 0x35f22(%rip), %r14     # 0x6c118
jmp 0x362a2
movq %r12, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movq 0x10(%rbx), %r14
movq %r14, %rdi
callq 0x32c63
movq 0x18(%rbx), %rdi
callq 0x35f67
testq %r14, %r14
je 0x364ea
movq 0x10(%r14), %rax
testq %rax, %rax
je 0x36473
cmpb $0x3, (%rax)
jne 0x3623d
movq 0x60(%rax), %rax
xorl %ecx, %ecx
cmpb $0x9, (%rax)
leaq 0x18(%rsp), %r15
cmoveq %rcx, %r15
jmp 0x36478
movq 0x10(%rbx), %rbx
testq %rbx, %rbx
je 0x363b6
movq %r12, %r13
xorl %r14d, %r14d
movq %rbx, %r15
movzwl (%r15), %eax
testb %al, %al
jle 0x36299
xorl %r12d, %r12d
movq 0x18(%r15,%r12,8), %rdi
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
jb 0x36285
testq %rdi, %rdi
je 0x3628a
callq 0x366a3
incq %r12
movl (%r15), %eax
movsbq %al, %rcx
cmpq %rcx, %r12
jl 0x36271
movq 0x10(%r15), %r15
cmpq %rbx, %r15
jne 0x36266
movq %r13, %r12
jmp 0x364f2
movq 0x10(%rbx), %r15
movq %r15, %rdi
callq 0x32c63
movq 0x5acb3(%rip), %rax     # 0x90f70
movq 0x60(%rax), %rax
movq 0x60(%rax), %rsi
testq %rsi, %rsi
setne %al
cmpq 0x2ac66(%rip), %rsi     # 0x60f38
setne %cl
testb %cl, %al
jne 0x36385
testq %r15, %r15
je 0x36323
movq 0x10(%r15), %rax
testq %rax, %rax
je 0x36323
cmpb $0x3, (%rax)
jne 0x362f4
movq 0x60(%rax), %rax
cmpq 0x2ac3d(%rip), %rax     # 0x60f38
je 0x36323
testq %rsi, %rsi
leaq 0x156f4(%rip), %rax     # 0x4b9fb
leaq 0xd480(%rip), %rdx      # 0x4378e
cmoveq %rax, %rdx
leaq 0x156c1(%rip), %rsi     # 0x4b9da
movq %r15, %rdi
xorl %eax, %eax
callq 0x11abc
xorl %r14d, %r14d
testq %r15, %r15
je 0x364f7
leaq 0x31af6(%rip), %rax     # 0x67e2c
cmpl $0x0, (%rax)
je 0x364f7
movq 0x4(%rbx), %rdi
leaq 0x156ba(%rip), %rsi     # 0x4ba04
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x118b4
jmp 0x364f7
movq 0x10(%rbx), %rdi
callq 0x32c63
movq 0x18(%rbx), %rdi
callq 0x32c63
movq 0x20(%rbx), %rdi
jmp 0x363b1
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
je 0x363ad
movq 0x4(%rbx), %rdi
callq 0x36657
jmp 0x363b6
testq %r15, %r15
je 0x36527
cmpq $0x0, 0x10(%r15)
je 0x363b6
addq $0x10, %rbx
leaq 0x156a1(%rip), %rcx     # 0x4ba41
movq %r15, %rdi
movq %rbx, %rdx
callq 0x377d9
jmp 0x363b6
movq 0x18(%rbx), %rdi
callq 0x32c63
xorl %r14d, %r14d
jmp 0x364f7
movl $0x1, %eax
movq 0x8(%rsp), %r13
jmp 0x363cf
movl $0x2, %eax
testb $0x1, %al
jne 0x3651d
movq 0x20(%rbx), %r12
testq %r12, %r12
je 0x36537
leaq 0x15758(%rip), %r14     # 0x4bb43
movq %r12, %r13
movzwl (%r13), %eax
testb %al, %al
jle 0x36463
xorl %ebp, %ebp
movq 0x18(%r13,%rbp,8), %r15
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
jb 0x3640d
testq %r15, %r15
je 0x36453
cmpq $0x0, 0x8(%r15)
je 0x36439
movq %r15, %rdi
callq 0x39696
testb $0x1, 0x18(%r15)
je 0x36439
movq 0x8(%r15), %rdi
movq 0x28(%rdi), %rdx
addq $0x4, %rdx
movq %r14, %rsi
xorl %eax, %eax
callq 0x11abc
movq 0x10(%r15), %rdi
callq 0x32c63
testq %rax, %rax
je 0x36511
movq %r15, %rdi
callq 0x397a2
incq %rbp
movl (%r13), %eax
movsbq %al, %rcx
cmpq %rcx, %rbp
jl 0x363f9
movq 0x10(%r13), %r13
cmpq %r12, %r13
jne 0x363ee
xorl %eax, %eax
jmp 0x36516
leaq 0x18(%rsp), %r15
movq 0x28(%rbx), %rax
movq 0x98(%rax), %rbx
testq %rbx, %rbx
je 0x364ea
movq %rbx, %r12
movzwl (%r12), %eax
testb %al, %al
jle 0x364e0
xorl %r13d, %r13d
movq 0x18(%r12,%r13,8), %rcx
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
jb 0x364ab
testq %rcx, %rcx
je 0x364d0
movq 0x90(%rcx), %rbp
movq 0x10(%rbp), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x394a8
movq 0x18(%rbp), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x394a8
incq %r13
movl (%r12), %eax
movsbq %al, %rcx
cmpq %rcx, %r13
jl 0x36497
movq 0x10(%r12), %r12
cmpq %rbx, %r12
jne 0x3648b
xorl %r14d, %r14d
movq 0x10(%rsp), %r12
movq 0x8(%rsp), %r13
testb $0x1, %r13b
cmovneq %r12, %r14
movq %r14, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %eax
movq 0x8(%rsp), %r13
jmp 0x3653c
xorl %r14d, %r14d
movq 0x10(%rsp), %r12
jmp 0x364f7
movq 0x4(%rbx), %rdi
leaq 0x154f3(%rip), %rsi     # 0x4ba25
jmp 0x36648
movl $0x9, %eax
cmpl $0x9, %eax
movq 0x10(%rsp), %r12
je 0x3654e
testl %eax, %eax
jne 0x363b6
movq 0x28(%rbx), %r15
testq %r15, %r15
je 0x365d6
leaq 0x1554a(%rip), %r14     # 0x4baa8
movq %r15, %r12
movzwl (%r12), %eax
testb %al, %al
jle 0x365a5
xorl %r13d, %r13d
movq 0x18(%r12,%r13,8), %rdi
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
jb 0x36581
testq %rdi, %rdi
je 0x36595
testq %rdi, %rdi
je 0x365b3
cmpb $0x2, (%rdi)
je 0x36595
movq %r14, %rsi
xorl %eax, %eax
callq 0x11abc
incq %r13
movl (%r12), %eax
movsbq %al, %rcx
cmpq %rcx, %r13
jl 0x3656d
movq 0x10(%r12), %r12
cmpq %r15, %r12
jne 0x36561
xorl %eax, %eax
jmp 0x365ca
movq 0x4(%rbx), %rdi
leaq 0x154d9(%rip), %rsi     # 0x4ba97
xorl %eax, %eax
callq 0x11a38
movl $0x1, %eax
movq 0x10(%rsp), %r12
movq 0x8(%rsp), %r13
jmp 0x365db
movl $0x10, %eax
testb $0xf, %al
jne 0x363b6
movq 0x30(%rbx), %rax
testq %rax, %rax
je 0x363b6
xorl %r14d, %r14d
movq %rax, %rcx
movzwl (%rcx), %esi
movsbl %sil, %edx
testw %dx, %dx
jle 0x3662f
movzwl %dx, %edx
movzwl %si, %esi
xorl %edi, %edi
movq 0x18(%rcx,%rdi,8), %r8
cmpl $0x100, %esi            # imm = 0x100
jb 0x3661c
testq %r8, %r8
je 0x36627
testq %r8, %r8
je 0x3663d
cmpb $0xc, (%r8)
jne 0x3663d
incq %rdi
cmpq %rdi, %rdx
jne 0x3660a
movq 0x10(%rcx), %rcx
cmpq %rax, %rcx
jne 0x365f6
jmp 0x364f7
movq 0x4(%rbx), %rdi
leaq 0x1547c(%rip), %rsi     # 0x4bac4
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x11a38
jmp 0x364f7