// File: /workspace/github_c_makefile_star2_O2/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
movq %rdi, %rbx
xorl %r14d, %r14d
leaq 0x1304c(%rip), %r15     # 0x42d00
pushq $0x20
popq %r12
pushq $0x1
popq %rbp
pushq $0x40
popq %r13
movq $0x0, (%rsp)
testq %rbx, %rbx
je 0x30202
movl (%rbx), %eax
decl %eax
cmpl $0xc, %eax
ja 0x30202
movslq (%r15,%rax,4), %rax
addq %r15, %rax
jmpq *%rax
movq 0x20(%rbx), %rbx
jmp 0x2fcc7
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x30202
xorl %esi, %esi
callq 0x313ac
movq 0x18(%rbx), %rdi
callq 0x2fc99
jmp 0x2fd53
movq 0x20(%rbx), %rdi
callq 0x305cd
movq 0x30(%rbx), %rdi
movl %ebp, %esi
callq 0x313ac
movq 0x48(%rbx), %rdi
movl %ebp, %esi
callq 0x313ac
movq 0x28(%rbx), %rdi
callq 0x2fc99
movq 0x38(%rbx), %rdi
callq 0x2fc99
movq %r13, %rax
jmp 0x2fd56
movq 0x10(%rbx), %rdi
callq 0x2d0ed
movq 0x18(%rbx), %rdi
callq 0x2d0ed
movq %r12, %rax
movq (%rbx,%rax), %rbx
movb $0x1, %al
movq %rax, (%rsp)
jmp 0x2fcc7
andq $0x0, 0x10(%rsp)
movq 0x10(%rbx), %r14
movq %r14, %rdi
callq 0x2d0ed
movq 0x18(%rbx), %rdi
callq 0x2fc99
testq %r14, %r14
je 0x301ff
movq 0x10(%r14), %rdi
testq %rdi, %rdi
je 0x3021f
callq 0x3250c
xorl %ecx, %ecx
testl %eax, %eax
leaq 0x10(%rsp), %r15
cmovneq %rcx, %r15
jmp 0x30224
movq 0x10(%rbx), %rdi
callq 0x2d0ed
movq 0x18(%rbx), %rdi
callq 0x2d0ed
movq 0x20(%rbx), %rdi
jmp 0x301fa
movq 0x18(%rbx), %rdi
callq 0x3031d
movq 0x28(%rbx), %rdi
callq 0x2fc99
movq %rax, %r14
movq 0x10(%rbx), %rbx
testq %rbx, %rbx
je 0x301e4
movq %rbx, %r15
movq (%rsp), %r13
xorl %r12d, %r12d
movl (%r15), %eax
movsbq %al, %rcx
cmpq %rcx, %r12
jge 0x2fe1d
movq 0x18(%r15,%r12,8), %rdi
cmpw $0x100, %ax             # imm = 0x100
jb 0x2fe10
testq %rdi, %rdi
je 0x2fe18
callq 0x2fc99
movq %rax, %r14
incq %r12
jmp 0x2fdf4
movq 0x10(%r15), %r15
cmpq %rbx, %r15
jne 0x2fdf1
jmp 0x301e8
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
je 0x301f6
movq 0x4(%rbx), %rdi
callq 0x302d1
jmp 0x301ff
movq 0x10(%rbx), %rdi
callq 0x2d0ed
testq %rax, %rax
je 0x301ff
movq 0x10(%rbx), %rdi
movq 0x10(%rdi), %rax
cmpq 0x2a149(%rip), %rax     # 0x59fb0
movq (%rsp), %r13
jne 0x2fe80
leaq 0x366c4(%rip), %rsi     # 0x66538
callq 0x2f54c
movq %rax, %rdi
movq %rax, 0x10(%rbx)
callq 0x2f6c0
movq %rax, %rdi
callq 0x30635
movq %rax, %r14
jmp 0x30206
cmpq $0x0, 0x10(%rbx)
je 0x301ff
movq 0x18(%rbx), %rax
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x2ff6d
xorl %r14d, %r14d
movq 0x8(%rsp), %r12
xorl %r15d, %r15d
movl (%r12), %eax
movsbq %al, %rcx
cmpq %rcx, %r15
jge 0x2ff5d
movq 0x18(%r12,%r15,8), %r13
cmpw $0x100, %ax             # imm = 0x100
jb 0x2fede
testq %r13, %r13
je 0x2ff55
cmpq $0x0, 0x8(%r13)
je 0x2ff0e
movq %r13, %rdi
callq 0x3264f
testb $0x1, 0x18(%r13)
jne 0x2ff0e
movq 0x8(%r13), %rdi
movq 0x28(%rdi), %rdx
addq $0x4, %rdx
leaq 0x13dc5(%rip), %rsi     # 0x43ccc
xorl %eax, %eax
callq 0x11292
movq 0x10(%r13), %rbp
movq %rbp, %rdi
callq 0x2d0ed
testq %rax, %rax
je 0x30202
cmpb $0x9, (%rbp)
jne 0x2ff2f
cmpl $0x2a, 0x4(%rbp)
je 0x2ff41
movq 0x8(%rbp), %rdi
leaq 0x13d03(%rip), %rsi     # 0x43c3d
xorl %eax, %eax
callq 0x1108a
movq 0x10(%rbp), %rsi
movq %rbp, %rdi
callq 0x31553
movq %r13, %rdi
callq 0x32757
incq %r15
jmp 0x2febd
movq 0x10(%r12), %r12
cmpq 0x8(%rsp), %r12
jne 0x2feba
movq 0x20(%rbx), %r13
testq %r13, %r13
je 0x2fffb
xorl %r14d, %r14d
movq %r13, %rbp
xorl %r15d, %r15d
movl (%rbp), %eax
movsbq %al, %rcx
cmpq %rcx, %r15
jge 0x2fff2
movq 0x18(%rbp,%r15,8), %r12
cmpw $0x100, %ax             # imm = 0x100
jb 0x2ff9f
testq %r12, %r12
je 0x2ffed
cmpq $0x0, 0x8(%r12)
je 0x2ffd2
movq %r12, %rdi
callq 0x3264f
testb $0x1, 0x18(%r12)
je 0x2ffd2
movq 0x8(%r12), %rdi
movq 0x28(%rdi), %rdx
addq $0x4, %rdx
leaq 0x13d3a(%rip), %rsi     # 0x43d05
xorl %eax, %eax
callq 0x11292
movq 0x10(%r12), %rdi
callq 0x2d0ed
testq %rax, %rax
je 0x30202
movq %r12, %rdi
callq 0x32757
incq %r15
jmp 0x2ff83
movq 0x10(%rbp), %rbp
cmpq %r13, %rbp
jne 0x2ff80
movq 0x28(%rbx), %r15
testq %r15, %r15
je 0x30055
leaq 0x13c5f(%rip), %r14     # 0x43c6a
movq %r15, %r12
xorl %r13d, %r13d
movl (%r12), %eax
movsbq %al, %rcx
cmpq %rcx, %r13
jge 0x3004b
movq 0x18(%r12,%r13,8), %rdi
cmpw $0x100, %ax             # imm = 0x100
jb 0x3002e
testq %rdi, %rdi
je 0x30046
testq %rdi, %rdi
je 0x302aa
cmpb $0x2, (%rdi)
je 0x30046
movq %r14, %rsi
xorl %eax, %eax
callq 0x11292
incq %r13
jmp 0x30011
movq 0x10(%r12), %r12
cmpq %r15, %r12
jne 0x3000e
movq 0x30(%rbx), %rax
xorl %r14d, %r14d
testq %rax, %rax
je 0x30202
movq %rax, %rcx
movq (%rsp), %r13
movzwl (%rcx), %edx
movsbl %dl, %esi
testw %si, %si
movl $0x0, %edi
cmovgl %esi, %edi
movzwl %di, %esi
xorl %edi, %edi
cmpq %rdi, %rsi
je 0x300b0
movq 0x18(%rcx,%rdi,8), %r8
cmpw $0x100, %dx             # imm = 0x100
jb 0x30098
testq %r8, %r8
je 0x300ab
testq %r8, %r8
je 0x302c4
cmpb $0xc, (%r8)
jne 0x302c4
incq %rdi
jmp 0x30082
movq 0x10(%rcx), %rcx
cmpq %rax, %rcx
jne 0x3006c
jmp 0x30206
movq 0x10(%rbx), %rbx
testq %rbx, %rbx
je 0x301ff
xorl %r14d, %r14d
movq %rbx, %r15
movq (%rsp), %r13
xorl %r12d, %r12d
movl (%r15), %eax
movsbq %al, %rcx
cmpq %rcx, %r12
jge 0x300fe
movq 0x18(%r15,%r12,8), %rdi
cmpw $0x100, %ax             # imm = 0x100
jb 0x300f4
testq %rdi, %rdi
je 0x300f9
callq 0x3031d
incq %r12
jmp 0x300d8
movq 0x10(%r15), %r15
cmpq %rbx, %r15
jne 0x300d5
jmp 0x30206
movq 0x10(%rbx), %rdi
jmp 0x301fa
movq 0x10(%rbx), %r14
movq %r14, %rdi
callq 0x2d0ed
movq 0x59e48(%rip), %rax     # 0x89f70
movq 0x60(%rax), %rax
movq 0x60(%rax), %rsi
testq %rsi, %rsi
setne %al
cmpq 0x29e0b(%rip), %rsi     # 0x59f48
setne %cl
testb %cl, %al
jne 0x301b5
testq %r14, %r14
movq (%rsp), %r13
je 0x301df
movq 0x10(%r14), %rax
testq %rax, %rax
je 0x30192
cmpb $0x3, (%rax)
jne 0x30163
movq 0x60(%rax), %rax
cmpq 0x29dde(%rip), %rax     # 0x59f48
je 0x30192
testq %rsi, %rsi
leaq 0x13a47(%rip), %rax     # 0x43bbd
leaq 0xb634(%rip), %rdx      # 0x3b7b1
cmoveq %rax, %rdx
leaq 0x13a14(%rip), %rsi     # 0x43b9c
movq %r14, %rdi
xorl %eax, %eax
callq 0x11292
leaq 0x30c93(%rip), %rax     # 0x60e2c
cmpl $0x0, (%rax)
je 0x301df
movq 0x4(%rbx), %rdi
leaq 0x13a1d(%rip), %rsi     # 0x43bc6
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x1108a
jmp 0x30206
testq %r14, %r14
movq (%rsp), %r13
je 0x30290
cmpq $0x0, 0x10(%r14)
je 0x301df
addq $0x10, %rbx
leaq 0x13a2f(%rip), %rcx     # 0x43c03
movq %r14, %rdi
movq %rbx, %rdx
callq 0x30c8b
xorl %r14d, %r14d
jmp 0x30206
movq (%rsp), %r13
testq %r14, %r14
jne 0x30206
leaq 0x34f24(%rip), %r14     # 0x65118
jmp 0x30206
movq 0x18(%rbx), %rdi
callq 0x2d0ed
xorl %r14d, %r14d
movq (%rsp), %r13
xorl %eax, %eax
testb $0x1, %r13b
cmoveq %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 0x301ff
movq %rbx, %r12
xorl %r13d, %r13d
movl (%r12), %eax
movsbq %al, %rcx
cmpq %rcx, %r13
jge 0x30281
movq 0x18(%r12,%r13,8), %rcx
cmpw $0x100, %ax             # imm = 0x100
jb 0x30257
testq %rcx, %rcx
je 0x3027c
movq 0x90(%rcx), %rbp
movq 0x10(%rbp), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x32524
movq 0x18(%rbp), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x32524
incq %r13
jmp 0x3023a
movq 0x10(%r12), %r12
cmpq %rbx, %r12
jne 0x30237
jmp 0x301ff
movq 0x4(%rbx), %rdi
leaq 0x1394c(%rip), %rsi     # 0x43be7
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x1120e
jmp 0x30206
movq 0x4(%rbx), %rdi
leaq 0x139a4(%rip), %rsi     # 0x43c59
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x1120e
jmp 0x30202
movq 0x4(%rbx), %rdi
leaq 0x139b7(%rip), %rsi     # 0x43c86
jmp 0x3029b