// File: /workspace/github_c_makefile_star2_O1/lucvoo[P]sparse-dev/expand.c
// Function: expand_expression
static int expand_expression(struct expression *expr)
{
	if (!expr)
		return 0;
	if (!expr->ctype || expr->ctype == &bad_ctype)
		return UNSAFE;

	switch (expr->type) {
	case EXPR_VALUE:
	case EXPR_FVALUE:
	case EXPR_STRING:
		return 0;
	case EXPR_TYPE:
	case EXPR_SYMBOL:
		return expand_symbol_expression(expr);
	case EXPR_BINOP:
		return expand_binop(expr);

	case EXPR_LOGICAL:
		return expand_logical(expr);

	case EXPR_COMMA:
		return expand_comma(expr);

	case EXPR_COMPARE:
		return expand_compare(expr);

	case EXPR_ASSIGNMENT:
		return expand_assignment(expr);

	case EXPR_PREOP:
		return expand_preop(expr);

	case EXPR_POSTOP:
		return expand_postop(expr);

	case EXPR_CAST:
	case EXPR_FORCE_CAST:
	case EXPR_IMPLIED_CAST:
		return expand_cast(expr);

	case EXPR_CALL:
		return expand_call(expr);

	case EXPR_DEREF:
		warning(expr->pos, "we should not have an EXPR_DEREF left at expansion time");
		return UNSAFE;

	case EXPR_SELECT:
	case EXPR_CONDITIONAL:
		return expand_conditional(expr);

	case EXPR_STATEMENT: {
		struct statement *stmt = expr->statement;
		int cost = expand_statement(stmt);

		if (stmt->type == STMT_EXPRESSION && stmt->expression)
			*expr = *stmt->expression;
		return cost;
	}

	case EXPR_LABEL:
		return 0;

	case EXPR_INITIALIZER:
		sort_expression_list(&expr->expr_list);
		verify_nonoverlapping(&expr->expr_list, expr);
		return expand_expression_list(expr->expr_list);

	case EXPR_IDENTIFIER:
		return UNSAFE;

	case EXPR_INDEX:
		return UNSAFE;

	case EXPR_SLICE:
		return expand_expression(expr->base) + 1;

	case EXPR_POS:
		return expand_pos_expression(expr);

	case EXPR_GENERIC:
	case EXPR_SIZEOF:
	case EXPR_PTRSIZEOF:
	case EXPR_ALIGNOF:
	case EXPR_OFFSETOF:
		expression_error(expr, "internal front-end error: sizeof in expansion?");
		return UNSAFE;
	}
	return SIDE_EFFECTS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
xorl %ebx, %ebx
leaq 0x5eb42(%rip), %rax     # 0x6d8b8
leaq 0x32287(%rip), %rcx     # 0x41004
xorl %r13d, %r13d
xorl %ebp, %ebp
leal 0x2710(%rbx), %edx
testq %r14, %r14
je 0xef1c
movq 0x10(%r14), %rsi
testq %rsi, %rsi
je 0xede1
cmpq %rax, %rsi
je 0xede1
movzbl (%r14), %esi
decl %esi
cmpl $0x1e, %esi
ja 0xeeb6
movslq (%rcx,%rsi,4), %rsi
addq %rcx, %rsi
jmpq *%rsi
movq 0x20(%r14), %r14
testb $0x1, %r13b
cmovel %edx, %r12d
movb $0x1, %r13b
jmp 0xed88
movq 0x20(%r14), %r14
incl %ebx
jmp 0xed82
leaq 0x3245a(%rip), %rsi     # 0x41231
movq %r14, %rdi
xorl %eax, %eax
callq 0x11abc
movl $0x64, %ebp
jmp 0xef1c
movq 0x28(%r14), %r15
movq %r15, %rdi
callq 0xed5f
movzbl (%r15), %ecx
cmpl $0x1c, %ecx
je 0xee09
cmpl $0x1, %ecx
jne 0xef18
movq 0x10(%r14), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0xea84
jmp 0xef1c
movq %r14, %rdi
callq 0xf3be
jmp 0xef1a
movq %r14, %rdi
callq 0x10334
jmp 0xef1a
movq %r14, %rdi
callq 0xf9af
jmp 0xef1a
movq 0x8(%r14), %rdi
leaq 0x323aa(%rip), %rsi     # 0x411f9
xorl %eax, %eax
callq 0x118b4
jmp 0xede1
movq %r14, %rdi
callq 0xf439
jmp 0xef1a
movq 0x20(%r14), %r15
movq %r15, %rdi
callq 0xef37
movl %eax, %ebp
cmpl $0x2, (%r15)
jne 0xef1c
movq 0x10(%r15), %rax
testq %rax, %rax
je 0xef1c
movaps (%rax), %xmm0
movaps 0x10(%rax), %xmm1
movaps 0x20(%rax), %xmm2
movaps 0x30(%rax), %xmm3
movaps %xmm3, 0x30(%r14)
movaps %xmm2, 0x20(%r14)
movaps %xmm1, 0x10(%r14)
movaps %xmm0, (%r14)
jmp 0xef1c
movq %r14, %rdi
callq 0xfd3e
movl $0x2710, %ebp           # imm = 0x2710
jmp 0xef1c
leaq 0x20(%r14), %r15
leaq 0x1830(%rip), %rsi      # 0x106f8
movq %r15, %rdi
callq 0x2a384
movq %r15, %rdi
movq %r14, %rsi
callq 0x103e9
movq 0x20(%r14), %rdi
callq 0x10561
jmp 0xef1a
movq %r14, %rdi
callq 0xf902
jmp 0xef1a
movq %r14, %rdi
callq 0xfd55
jmp 0xef1a
movq %r14, %rdi
callq 0xfa36
jmp 0xef1a
movq %r14, %rdi
callq 0x105c6
jmp 0xef1a
movq %r14, %rdi
callq 0x101d7
jmp 0xef1a
incl %eax
movl %eax, %ebp
addl %ebp, %ebx
testb $0x1, %r13b
cmovnel %r12d, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq