// File: /workspace/github_c_makefile_star2_O1/lucvoo[P]sparse-dev/expand.c
// Function: expand_statement
static int expand_statement(struct statement *stmt)
{
	if (!stmt)
		return 0;

	switch (stmt->type) {
	case STMT_DECLARATION: {
		struct symbol *sym;
		FOR_EACH_PTR(stmt->declaration, sym) {
			expand_symbol(sym);
		} END_FOR_EACH_PTR(sym);
		return SIDE_EFFECTS;
	}

	case STMT_RETURN:
		expand_return_expression(stmt);
		return SIDE_EFFECTS;

	case STMT_EXPRESSION:
		return expand_expression(stmt->expression);

	case STMT_COMPOUND:
		return expand_compound(stmt);

	case STMT_IF:
		return expand_if_statement(stmt);

	case STMT_ITERATOR:
		expand_expression(stmt->iterator_pre_condition);
		expand_expression(stmt->iterator_post_condition);
		expand_statement(stmt->iterator_pre_statement);
		expand_statement(stmt->iterator_statement);
		expand_statement(stmt->iterator_post_statement);
		return SIDE_EFFECTS;

	case STMT_SWITCH:
		expand_expression(stmt->switch_expression);
		expand_statement(stmt->switch_statement);
		return SIDE_EFFECTS;

	case STMT_CASE:
		expand_const_expression(stmt->case_expression, "case statement");
		expand_const_expression(stmt->case_to, "case statement");
		expand_statement(stmt->case_statement);
		return SIDE_EFFECTS;

	case STMT_LABEL:
		expand_statement(stmt->label_statement);
		return SIDE_EFFECTS;

	case STMT_GOTO:
		expand_expression(stmt->goto_expression);
		return SIDE_EFFECTS;

	case STMT_NONE:
		break;
	case STMT_ASM:
		expand_asm_statement(stmt);
		break;
	case STMT_CONTEXT:
		expand_expression(stmt->expression);
		break;
	case STMT_RANGE:
		expand_expression(stmt->range_expression);
		expand_expression(stmt->range_low);
		expand_expression(stmt->range_high);
		break;
	}
	return SIDE_EFFECTS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
xorl %r12d, %r12d
leaq 0x3212e(%rip), %r15     # 0x41080
movl $0x2710, %r13d          # imm = 0x2710
testq %r14, %r14
je 0xf018
movl (%r14), %eax
movl $0x2710, %ebx           # imm = 0x2710
decl %eax
cmpl $0xc, %eax
ja 0xf225
movslq (%r15,%rax,4), %rax
addq %r15, %rax
jmpq *%rax
movq 0x10(%r14), %rdi
movl $0x64, %ebx
testq %rdi, %rdi
je 0xf225
movq 0x10(%rdi), %rax
testq %rax, %rax
je 0xf225
cmpq 0x51fad(%rip), %rax     # 0x60f50
je 0xf225
callq 0xed5f
movq 0x18(%r14), %rdi
callq 0xef37
jmp 0xefcb
movq 0x10(%r14), %rdi
callq 0x10761
movq 0x18(%r14), %rdi
callq 0x10761
movq 0x20(%r14), %r14
jmp 0xf008
movq 0x30(%r14), %rdi
callq 0xed5f
movq 0x48(%r14), %rdi
callq 0xed5f
movq 0x28(%r14), %rdi
callq 0xef37
movq 0x38(%r14), %rdi
callq 0xef37
movq 0x40(%r14), %r14
jmp 0xf008
movq 0x10(%r14), %rdi
callq 0xed5f
movq 0x18(%r14), %r14
testb $0x1, %r12b
cmovel %r13d, %ebp
movb $0x1, %r12b
jmp 0xef58
xorl %ebx, %ebx
jmp 0xf225
movq 0x10(%r14), %rdi
jmp 0xf220
movl %r12d, 0x8(%rsp)
movq 0x18(%r14), %r15
testq %r15, %r15
je 0xf07c
movq %r15, %r12
movzwl (%r12), %eax
testb %al, %al
jle 0xf072
xorl %r13d, %r13d
movq 0x18(%r12,%r13,8), %rcx
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
jb 0xf059
testq %rcx, %rcx
je 0xf062
movq 0x10(%rcx), %rdi
callq 0xed5f
incq %r13
movl (%r12), %eax
movsbq %al, %rcx
cmpq %rcx, %r13
jl 0xf045
movq 0x10(%r12), %r12
cmpq %r15, %r12
jne 0xf039
movq 0x20(%r14), %r14
testq %r14, %r14
je 0xf0c8
movq %r14, %r15
movzwl (%r15), %eax
testb %al, %al
jle 0xf0bf
xorl %r12d, %r12d
movq 0x18(%r15,%r12,8), %rcx
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
jb 0xf0a7
testq %rcx, %rcx
je 0xf0b0
movq 0x10(%rcx), %rdi
callq 0xed5f
incq %r12
movl (%r15), %eax
movsbq %al, %rcx
cmpq %rcx, %r12
jl 0xf093
movq 0x10(%r15), %r15
cmpq %r14, %r15
jne 0xf088
movl 0x8(%rsp), %r12d
jmp 0xf225
movq 0x10(%r14), %rdi
callq 0xed5f
movl %eax, %ebx
jmp 0xf225
movq 0x18(%r14), %rdi
testq %rdi, %rdi
je 0xf0f0
callq 0xed1c
movq 0x28(%r14), %r15
movq %r15, %rdi
callq 0xef37
movl %eax, %ebx
testq %r15, %r15
setne %al
movq 0x10(%r14), %rcx
testq %rcx, %rcx
je 0xf191
movl %r12d, 0x8(%rsp)
movl %ebp, 0xc(%rsp)
xorl %r13d, %r13d
testq %r15, %r15
setne %r13b
movq %rcx, %rbp
movq %rcx, 0x10(%rsp)
movzwl (%rbp), %ecx
testb %cl, %cl
jle 0xf173
xorl %r12d, %r12d
movq %r15, %rax
movq 0x18(%rbp,%r12,8), %r15
movzwl %cx, %ecx
cmpl $0x100, %ecx            # imm = 0x100
jb 0xf154
testq %r15, %r15
jne 0xf154
movq %rax, %r15
jmp 0xf164
incl %r13d
movq %r15, %rdi
callq 0xef37
addl %eax, %ebx
movq %r15, %rax
incq %r12
movl (%rbp), %ecx
movsbq %cl, %rdx
cmpq %rdx, %r12
jl 0xf13a
movq 0x10(%rbp), %rbp
movq 0x10(%rsp), %rcx
cmpq %rcx, %rbp
jne 0xf12c
cmpl $0x1, %r13d
sete %al
movl 0xc(%rsp), %ebp
movl 0x8(%rsp), %r12d
testb %al, %al
je 0xf225
cmpq $0x0, 0x18(%r14)
jne 0xf225
movl $0xa, %ecx
movq %r14, %rdi
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
jmp 0xf225
movq 0x10(%r14), %rdi
callq 0xed5f
movq 0x18(%r14), %rdi
callq 0xed5f
movq 0x20(%r14), %rdi
jmp 0xf220
movq 0x10(%r14), %r14
testq %r14, %r14
je 0xf225
movl %r12d, %r13d
movq %r14, %r15
movzwl (%r15), %eax
testb %al, %al
jle 0xf20e
xorl %r12d, %r12d
movq 0x18(%r15,%r12,8), %rdi
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
jb 0xf1fa
testq %rdi, %rdi
je 0xf1ff
callq 0xed1c
incq %r12
movl (%r15), %eax
movsbq %al, %rcx
cmpq %rcx, %r12
jl 0xf1e6
movq 0x10(%r15), %r15
cmpq %r14, %r15
jne 0xf1db
movl %r13d, %r12d
jmp 0xf225
movq 0x18(%r14), %rdi
callq 0xed5f
testb $0x1, %r12b
cmovnel %ebp, %ebx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq