// File: /workspace/github_c_makefile_star2_O2/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 %ebp, %ebp
pushq $0x20
popq %r12
leaq 0x295e8(%rip), %r13     # 0x39160
pushq $0x40
popq %r15
movl $0x2710, %ebx           # imm = 0x2710
testq %r14, %r14
je 0xfc30
movl (%r14), %eax
decl %eax
cmpl $0xc, %eax
ja 0xfde2
movslq (%r13,%rax,4), %rcx
addq %r13, %rcx
movq %r12, %rax
jmpq *%rcx
movq 0x10(%r14), %rdi
testq %rdi, %rdi
je 0xfc40
movq 0x10(%rdi), %rax
testq %rax, %rax
je 0xfc40
cmpq 0x4a39a(%rip), %rax     # 0x59f60
je 0xfc40
callq 0xe7b6
movq 0x18(%r14), %rdi
callq 0xfb5a
jmp 0xfbea
movq 0x10(%r14), %rdi
callq 0x10032
movq 0x18(%r14), %rdi
callq 0x10032
movq %r12, %rax
jmp 0xfc24
movq 0x30(%r14), %rdi
callq 0xe7b6
movq 0x48(%r14), %rdi
callq 0xe7b6
movq 0x28(%r14), %rdi
callq 0xfb5a
movq 0x38(%r14), %rdi
callq 0xfb5a
movq %r15, %rax
jmp 0xfc24
movq 0x10(%r14), %rdi
callq 0xe7b6
pushq $0x18
popq %rax
movq (%r14,%rax), %r14
movb $0x1, %bpl
jmp 0xfb81
xorl %ebx, %ebx
jmp 0xfde2
movq 0x10(%r14), %rdi
jmp 0xfddd
pushq $0x64
popq %rbx
jmp 0xfde2
movq 0x18(%r14), %r15
testq %r15, %r15
je 0xfc8c
movq %r15, %r12
xorl %r13d, %r13d
movl (%r12), %eax
movsbq %al, %rcx
cmpq %rcx, %r13
jge 0xfc82
movq 0x18(%r12,%r13,8), %rcx
cmpw $0x100, %ax             # imm = 0x100
jb 0xfc74
testq %rcx, %rcx
je 0xfc7d
movq 0x10(%rcx), %rdi
callq 0xe7b6
incq %r13
jmp 0xfc57
movq 0x10(%r12), %r12
cmpq %r15, %r12
jne 0xfc54
movq 0x20(%r14), %r14
testq %r14, %r14
je 0xfde2
movq %r14, %r15
xorl %r12d, %r12d
movl (%r15), %eax
movsbq %al, %rcx
cmpq %rcx, %r12
jge 0xfcc9
movq 0x18(%r15,%r12,8), %rcx
cmpw $0x100, %ax             # imm = 0x100
jb 0xfcbb
testq %rcx, %rcx
je 0xfcc4
movq 0x10(%rcx), %rdi
callq 0xe7b6
incq %r12
jmp 0xfc9f
movq 0x10(%r15), %r15
cmpq %r14, %r15
jne 0xfc9c
jmp 0xfde2
movq 0x10(%r14), %r14
testq %r14, %r14
je 0xfde2
movq %r14, %r15
xorl %r12d, %r12d
movl (%r15), %eax
movsbq %al, %rcx
cmpq %rcx, %r12
jge 0xfd10
movq 0x18(%r15,%r12,8), %rdi
cmpw $0x100, %ax             # imm = 0x100
jb 0xfd06
testq %rdi, %rdi
je 0xfd0b
callq 0xe773
incq %r12
jmp 0xfcea
movq 0x10(%r15), %r15
cmpq %r14, %r15
jne 0xfce7
jmp 0xfde2
movq 0x10(%r14), %rdi
callq 0xe7b6
movq 0x18(%r14), %rdi
callq 0xe7b6
movq 0x20(%r14), %rdi
jmp 0xfddd
movq 0x10(%r14), %rdi
callq 0xe7b6
movl %eax, %ebx
jmp 0xfde2
movl %ebp, 0xc(%rsp)
movq 0x18(%r14), %rdi
testq %rdi, %rdi
je 0xfd5b
callq 0xe773
movq 0x28(%r14), %r15
movq %r15, %rdi
callq 0xfb5a
movl %eax, %ebx
movq 0x10(%r14), %rax
testq %rax, %rax
je 0xfdfd
xorl %r13d, %r13d
testq %r15, %r15
setne %r13b
movq %rax, %rbp
movq %r15, %rsi
movq %rax, 0x10(%rsp)
xorl %r15d, %r15d
movl (%rbp), %eax
movsbq %al, %rcx
cmpq %rcx, %r15
jge 0xfdbf
movq 0x18(%rbp,%r15,8), %r12
cmpw $0x100, %ax             # imm = 0x100
jb 0xfdaa
testq %r12, %r12
je 0xfdba
incl %r13d
movq %r12, %rdi
callq 0xfb5a
addl %eax, %ebx
movq %r12, %rsi
incq %r15
jmp 0xfd8e
movq 0x10(%rbp), %rbp
movq 0x10(%rsp), %rax
cmpq %rax, %rbp
jne 0xfd8b
cmpl $0x1, %r13d
movl 0xc(%rsp), %ebp
jne 0xfde2
jmp 0xfe09
movq 0x18(%r14), %rdi
callq 0xe7b6
testb $0x1, %bpl
movl $0x2710, %eax           # imm = 0x2710
cmovel %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %r15, %r15
movl 0xc(%rsp), %ebp
movq %r15, %rsi
je 0xfde2
cmpq $0x0, 0x18(%r14)
jne 0xfde2
pushq $0xa
popq %rcx
movq %r14, %rdi
rep  movsq (%rsi), %es:(%rdi)
jmp 0xfde2