// File: /workspace/github_c_makefile_star2_O1/lucvoo[P]sparse-dev/linearize.c
// Function: linearize_expression
static pseudo_t linearize_expression(struct entrypoint *ep, struct expression *expr)
{
	if (!expr || !valid_type(expr->ctype))
		return VOID;

	current_pos = expr->pos;
	switch (expr->type) {
	case EXPR_SYMBOL:
		linearize_one_symbol(ep, expr->symbol);
		return add_symbol_address(ep, expr);

	case EXPR_VALUE:
		return value_pseudo(expr->value);

	case EXPR_STRING:
	case EXPR_LABEL:
		return add_setval(ep, expr->ctype, expr);

	case EXPR_FVALUE:
		return add_setfval(ep, expr->ctype, expr->fvalue);

	case EXPR_STATEMENT:
		return linearize_statement(ep, expr->statement);

	case EXPR_CALL:
		return linearize_call_expression(ep, expr);

	case EXPR_BINOP:
		if (expr->op == SPECIAL_LOGICAL_AND || expr->op == SPECIAL_LOGICAL_OR)
			return linearize_binop_bool(ep, expr);
		return linearize_binop(ep, expr);

	case EXPR_LOGICAL:
		return linearize_logical(ep, expr);

	case EXPR_COMPARE:
		return  linearize_compare(ep, expr);

	case EXPR_SELECT:
		return	linearize_select(ep, expr);

	case EXPR_CONDITIONAL:
		if (!expr->cond_true)
			return linearize_short_conditional(ep, expr, expr->conditional, expr->cond_false);

		return  linearize_conditional(ep, expr, expr->conditional,
					      expr->cond_true, expr->cond_false);

	case EXPR_COMMA:
		linearize_expression(ep, expr->left);
		return linearize_expression(ep, expr->right);

	case EXPR_ASSIGNMENT:
		return linearize_assignment(ep, expr);

	case EXPR_PREOP:
		return linearize_preop(ep, expr);

	case EXPR_POSTOP:
		return linearize_postop(ep, expr);

	case EXPR_CAST:
	case EXPR_FORCE_CAST:
	case EXPR_IMPLIED_CAST:
		return linearize_cast(ep, expr);
	
	case EXPR_SLICE:
		return linearize_slice(ep, expr);

	case EXPR_INITIALIZER:
	case EXPR_POS:
		warning(expr->pos, "unexpected initializer expression (%d %d)", expr->type, expr->op);
		return VOID;
	default: 
		warning(expr->pos, "unknown expression (%d %d)", expr->type, expr->op);
		return VOID;
	}
	return VOID;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x52539(%rip), %r15     # 0x669d0
leaq 0x5941a(%rip), %r12     # 0x6d8b8
leaq 0x2d5a3(%rip), %r13     # 0x41a48
testq %rbx, %rbx
je 0x145a9
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
je 0x145a9
cmpq %r12, %rsi
je 0x145a9
movq 0x8(%rbx), %rdi
movq %rdi, 0x53899(%rip)     # 0x67d68
movzbl (%rbx), %edx
leal -0x1(%rdx), %eax
cmpl $0x1c, %eax
ja 0x14598
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
movq 0x20(%rbx), %rsi
movq %r14, %rdi
callq 0x1447d
movq 0x28(%rbx), %rbx
jmp 0x144a5
movq 0x28(%rbx), %r12
testq %r12, %r12
je 0x145a9
movq %r14, %rdi
movq %r12, %rsi
callq 0x1447d
movq 0x10(%r12), %rdx
movq 0x10(%rbx), %rcx
movq %r14, %rdi
movq %rax, %rsi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x175ad
movl $0x48, %edi
callq 0x13602
movq %rax, %r12
xorl %edi, %edi
callq 0x303a3
movq %rax, %r15
movl $0x3, 0x4(%rax)
movl 0x535f9(%rip), %eax     # 0x67b50
incl %eax
movl %eax, 0x535f1(%rip)     # 0x67b50
movl %eax, (%r15)
movq %r12, 0x18(%r15)
movq %r15, 0x20(%r12)
movq %rbx, 0x30(%r12)
movq 0x20(%r14), %rdi
testq %rdi, %rdi
je 0x145a9
movq %rdi, 0x8(%r12)
addq $0x28, %rdi
movq %r12, %rsi
callq 0x2285b
jmp 0x145a9
movl 0x4(%rbx), %ecx
leaq 0x2e511(%rip), %rsi     # 0x42aa7
jmp 0x145a2
movl 0x4(%rbx), %ecx
leaq 0x2e52f(%rip), %rsi     # 0x42ad1
xorl %eax, %eax
callq 0x118b4
movq %r15, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movl 0x4(%rbx), %eax
orl $0x2, %eax
movq %r14, %rdi
movq %rbx, %rsi
addq $0x10, %rsp
cmpl $0x10e, %eax            # imm = 0x10E
jne 0x1474c
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x15980
movq 0x20(%rbx), %rsi
movq %r14, %rdi
callq 0x14815
movq %r14, %rdi
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x148fb
movq 0x20(%rbx), %rdi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x136d3
movq %r14, %rdi
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x15607
movq %r14, %rdi
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x16015
movq %r14, %rdi
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x165ee
movq %r14, %rdi
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x160a9
movq 0x20(%rbx), %rsi
movq %r14, %rdi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x14a3c
movq %r14, %rdi
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x15c55
movq %r14, %rdi
movq %rbx, %rsi
movl $0x1, %edx
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x17c1b
movq %r14, %rdi
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x164c1
fldt 0x20(%rbx)
fstpt (%rsp)
movq %r14, %rdi
callq 0x149c4
jmp 0x145ac
movq %r14, %rdi
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x16735
movq 0x20(%rbx), %rdx
movq 0x28(%rbx), %rcx
movq 0x30(%rbx), %r8
movq %r14, %rdi
movq %rbx, %rsi
testq %rcx, %rcx
je 0x14737
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x16347
movq %r8, %rcx
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x1622c
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x15bc3