// File: /workspace/github_c_makefile_star2_O3/lucvoo[P]sparse-dev/dissect.c
// Function: do_expression
static struct symbol *do_expression(usage_t mode, struct expression *expr)
{
	struct symbol *ret = &int_ctype;

again:
	if (expr) switch (expr->type) {
	default:
		warning(expr->pos, "bad expr->type: %d", expr->type);

	case EXPR_TYPE:		// [struct T]; Why ???
	case EXPR_VALUE:
	case EXPR_FVALUE:

	break; case EXPR_LABEL:
		ret = &label_ctype;

	break; case EXPR_STRING:
		ret = &string_ctype;

	break; case EXPR_STATEMENT:
		ret = do_statement(mode, expr->statement);

	break; case EXPR_SIZEOF: case EXPR_ALIGNOF: case EXPR_PTRSIZEOF:
		do_expression(U_VOID, expr->cast_expression);

	break; case EXPR_COMMA:
		do_expression(U_VOID, expr->left);
		ret = do_expression(mode, expr->right);

	break; case EXPR_CAST: case EXPR_FORCE_CAST: //case EXPR_IMPLIED_CAST:
		ret = base_type(expr->cast_type);
		do_initializer(ret, expr->cast_expression);

	break; case EXPR_COMPARE: case EXPR_LOGICAL:
		mode = u_rval(mode);
		do_expression(mode, expr->left);
		do_expression(mode, expr->right);

	break; case EXPR_CONDITIONAL: //case EXPR_SELECT:
		do_expression(expr->cond_true
					? U_R_VAL : U_R_VAL | mode,
				expr->conditional);
		ret = do_expression(mode, expr->cond_true);
		ret = do_expression(mode, expr->cond_false);

	break; case EXPR_CALL:
		if (expr->fn->type == EXPR_SYMBOL)
			expr->fn->op = 'f'; /* for expr_symbol() */
		ret = do_expression(U_R_PTR, expr->fn);
		if (is_ptr(ret))
			ret = ret->ctype.base_type;
		DO_2_LIST(ret->arguments, expr->args, arg, val,
			do_expression(u_lval(base_type(arg)), val));
		ret = ret->type == SYM_FN ? base_type(ret)
			: &bad_ctype;

	break; case EXPR_ASSIGNMENT:
		mode |= U_W_VAL | U_R_VAL;
		if (expr->op == '=')
			mode &= ~U_R_VAL;
		ret = do_expression(mode, expr->left);
		report_implicit(mode, &expr->pos, ret);
		mode = expr->op == '='
			? u_lval(ret) : U_R_VAL;
		do_expression(mode, expr->right);

	break; case EXPR_BINOP: {
		struct symbol *l, *r;
		mode |= u_rval(mode);
		l = do_expression(mode, expr->left);
		r = do_expression(mode, expr->right);
		if (expr->op != '+' && expr->op != '-')
			;
		else if (!is_ptr_type(r))
			ret = l;
		else if (!is_ptr_type(l))
			ret = r;
	}

	break; case EXPR_PREOP: case EXPR_POSTOP: {
		struct expression *unop = expr->unop;

		switch (expr->op) {
		case SPECIAL_INCREMENT:
		case SPECIAL_DECREMENT:
			mode |= U_W_VAL | U_R_VAL;
		default:
			mode |= u_rval(mode);
		case '(':
			ret = do_expression(mode, unop);

		break; case '&':
			if ((expr = peek_preop(unop, '*')))
				goto again;
			ret = alloc_symbol(unop->pos, SYM_PTR);
			ret->ctype.base_type =
				do_expression(u_addr(mode), unop);

		break; case '*':
			if ((expr = peek_preop(unop, '&')))
				goto again;
			if (mode & (U_MASK << U_SHIFT))
				mode |= U_R_VAL;
			mode <<= U_SHIFT;
			if (mode & (U_R_AOF << U_SHIFT))
				mode |= U_R_VAL;
			if (mode & (U_W_VAL << U_SHIFT))
				mode |= U_W_AOF;
			ret = do_expression(mode, unop);
			ret = is_ptr(ret) ? base_type(ret)
				: &bad_ctype;
		}
	}

	break; case EXPR_DEREF: {
		struct symbol *p_type;
		usage_t p_mode;

		p_mode = mode & U_SELF;
		if (!(mode & U_MASK) && (mode & (U_MASK << U_SHIFT)))
			p_mode = U_R_VAL;
		p_type = do_expression(p_mode, expr->deref);

		ret = report_member(mode, &expr->pos, p_type,
			lookup_member(p_type, expr->member, NULL));
	}

	break; case EXPR_OFFSETOF: {
		struct symbol *in = base_type(expr->in);

		do {
			if (expr->op == '.') {
				in = report_member(U_VOID, &expr->pos, in,
					lookup_member(in, expr->ident, NULL));
			} else {
				do_expression(U_R_VAL, expr->index);
				in = in->ctype.base_type;
			}
		} while ((expr = expr->down));
	}

	break; case EXPR_GENERIC: {
		struct type_expression *map;

		do_expression(U_VOID, expr->control);

		for (map = expr->map; map; map = map->next)
			ret = do_expression(mode, map->expr);
		if (expr->def)
			ret = do_expression(mode, expr->def);
	}

	break; case EXPR_SYMBOL:
		ret = report_symbol(mode, expr);
	}

	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
testq %rsi, %rsi
je 0x1265e
movq %rsi, %r14
movl %edi, %ebp
xorl %ecx, %ecx
leaq 0x3315e(%rip), %r13     # 0x45490
movl %ecx, 0x4(%rsp)
movl %ebp, %r12d
orl $0x4, %r12d
movq %r14, %rbx
movzbl (%rbx), %edx
leal -0x1(%rdx), %eax
cmpl $0x1e, %eax
ja 0x12641
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
movq 0x20(%rbx), %r14
movl 0x4(%rbx), %ecx
movq %r14, %rax
cmpl $0x29, %ecx
jle 0x1241d
cmpl $0x2a, %ecx
jne 0x12477
cmpb $0x9, (%rax)
jne 0x12584
movl 0x4(%rax), %ecx
cmpl $0x28, %ecx
jne 0x12441
movq 0x20(%rax), %rax
testq %rax, %rax
jne 0x12375
jmp 0x12584
movq 0x20(%rbx), %rsi
xorl %edi, %edi
callq 0x1230d
movq 0x30(%rbx), %r14
leaq 0x5f6d2(%rip), %r15     # 0x71a80
testq %r14, %r14
je 0x123ca
movq 0x8(%r14), %rsi
movl %ebp, %edi
callq 0x1230d
movq 0x10(%r14), %r14
testq %r14, %r14
jne 0x123b3
movq %rax, %r15
movq 0x28(%rbx), %rbx
testq %rbx, %rbx
jne 0x1240f
jmp 0x12951
cmpq $0x0, 0x28(%rbx)
movl $0x4, %edi
cmovel %r12d, %edi
movq 0x20(%rbx), %rsi
callq 0x1230d
movq 0x28(%rbx), %rsi
movl %ebp, %edi
callq 0x1230d
movq 0x30(%rbx), %rbx
jmp 0x1240f
movq 0x20(%rbx), %rsi
xorl %edi, %edi
callq 0x1230d
movq 0x28(%rbx), %rbx
testq %rbx, %rbx
jne 0x12340
jmp 0x1294a
cmpl $0x26, %ecx
jne 0x1249c
cmpb $0x9, (%rax)
jne 0x125e3
movl 0x4(%rax), %ecx
cmpl $0x28, %ecx
jne 0x1245c
movq 0x20(%rax), %rax
testq %rax, %rax
jne 0x12422
jmp 0x125e3
cmpl $0x26, %ecx
jne 0x12584
movq 0x20(%rax), %rbx
testq %rbx, %rbx
jne 0x12340
jmp 0x12584
cmpl $0x2a, %ecx
jne 0x125e3
movq 0x20(%rax), %rbx
testq %rbx, %rbx
jne 0x12340
jmp 0x125e3
cmpl $0x101, %ecx            # imm = 0x101
je 0x12487
cmpl $0x103, %ecx            # imm = 0x103
jne 0x1248a
orl $0xc, %ebp
xorl %eax, %eax
testl $0xd04, %ebp            # imm = 0xD04
setne %al
shll $0x2, %eax
orl %eax, %ebp
jmp 0x124a1
cmpl $0x28, %ecx
jne 0x1248a
testq %r14, %r14
jne 0x12336
jmp 0x1294a
xorl %ebp, %ebp
leaq 0x5f5c8(%rip), %r14     # 0x71a80
jmp 0x124e1
xorl %r15d, %r15d
testl $0xd04, %ebp            # imm = 0xD04
setne %r15b
shll $0x2, %r15d
movq 0x20(%rbx), %rsi
movl %r15d, %edi
callq 0x1230d
leaq 0x5f5a2(%rip), %r14     # 0x71a80
movl %r15d, %ebp
movq 0x8(%rsp), %rcx
movl 0x4(%rsp), %edx
testb $0x1, %dl
cmoveq %r14, %rcx
movq %rcx, 0x8(%rsp)
movq 0x28(%rbx), %r14
movb $0x1, %cl
testq %r14, %r14
jne 0x12332
jmp 0x12958
orl $0xc, %ebp
movl %ebp, %r15d
andl $-0x5, %r15d
cmpl $0x3d, 0x4(%rbx)
cmovnel %ebp, %r15d
movq 0x20(%rbx), %rsi
movl %r15d, %edi
callq 0x1230d
movq %rax, %r14
leaq 0x8(%rbx), %rsi
movl %r15d, %edi
movq %rax, %rdx
callq 0x12f9b
movl $0x4, %ebp
cmpl $0x3d, 0x4(%rbx)
jne 0x124e1
movl (%r14), %eax
movl $0xfd, %ecx
andl %ecx, %eax
cmpl $0x4, %eax
movq 0x8(%rsp), %rcx
movl 0x4(%rsp), %edx
jne 0x12567
testb $0x2, 0x69(%r14)
sete %al
jmp 0x12569
xorl %eax, %eax
cmpq 0x53a20(%rip), %r14     # 0x65f90
movzbl %al, %eax
leal 0x4(%rax,%rax), %ebp
movl $0x6, %eax
cmovel %eax, %ebp
jmp 0x124ea
testl $0xd00, %ebp            # imm = 0xD00
cmovel %ebp, %r12d
movl %r12d, %eax
shll $0x8, %eax
movl %r12d, %ecx
andl $0x1, %ecx
leal (%rax,%rcx,4), %eax
shrl $0x2, %r12d
andl $0x2, %r12d
orl %eax, %r12d
movl %r12d, %edi
movq %r14, %rsi
callq 0x1230d
movl $0xfd, %ecx
andl (%rax), %ecx
leaq 0x6063f(%rip), %r15     # 0x72c00
cmpl $0x4, %ecx
jne 0x12951
movq 0x60(%rax), %r15
testq %r15, %r15
jne 0x12951
leaq 0x60622(%rip), %r15     # 0x72c00
jmp 0x12951
movq 0x8(%r14), %rdi
movl $0x4, %esi
callq 0x20277
movq %rax, %rbx
movl %ebp, %eax
andl $0xd, %eax
andl $0x2, %ebp
incl %ebp
testl %eax, %eax
cmovel %eax, %ebp
movl %ebp, %edi
movq %r14, %rsi
callq 0x1230d
movq %rax, 0x60(%rbx)
testb $0x1, 0x4(%rsp)
movq 0x8(%rsp), %r15
cmoveq %rbx, %r15
jmp 0x1295d
movq 0x20(%rbx), %rdi
callq 0x12d51
movq %rax, %r15
movq 0x28(%rbx), %rsi
movq %rax, %rdi
callq 0x12d83
jmp 0x12951
movq 0x8(%rbx), %rdi
leaq 0x32f20(%rip), %rsi     # 0x4556c
xorl %eax, %eax
callq 0x13394
testb $0x1, 0x4(%rsp)
jne 0x12958
leaq 0x5f41b(%rip), %r15     # 0x71a80
jmp 0x1295d
testb $0x1, 0x4(%rsp)
jne 0x12958
leaq 0x604a4(%rip), %r15     # 0x72b20
jmp 0x1295d
movq 0x20(%rbx), %rsi
movl %ebp, %edi
callq 0x12b03
jmp 0x12701
movzbl %bpl, %eax
testl $0xd00, %ebp            # imm = 0xD00
movl $0x4, %edi
cmovel %eax, %edi
testb $0xd, %al
cmovnel %eax, %edi
movq 0x20(%rbx), %rsi
callq 0x1230d
movq %rax, %r14
movq 0x28(%rbx), %r15
addq $0x8, %rbx
movq %rax, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x13176
testq %rax, %rax
jne 0x126f1
cmpq $0x0, 0x98(%r14)
jne 0x126e3
leaq 0x5756c(%rip), %rax     # 0x69c48
movq (%rax), %rax
movq %rax, 0x30(%r14)
movq %r15, 0x53c1e(%rip)     # 0x66308
leaq 0x53bff(%rip), %rax     # 0x662f0
movl %ebp, %edi
movq %rbx, %rsi
movq %r14, %rdx
movq %rax, %rcx
callq 0x1303b
testb $0x1, 0x4(%rsp)
jne 0x12958
movq %rax, %r15
jmp 0x1295d
leaq 0x60085(%rip), %r15     # 0x727a0
jmp 0x12951
movq 0x20(%rbx), %r14
testq %r14, %r14
jne 0x12775
movq 0x28(%rbx), %rdi
movl $0x10, %esi
callq 0x20241
movq %rax, %r14
testq %rax, %rax
jne 0x12775
movq 0x8(%rbx), %rdi
movl $0x10, %esi
callq 0x20277
movq %rax, %r14
movq 0x28(%rbx), %rsi
movq %rax, %rdi
movl $0x10, %edx
callq 0x21136
movl 0x4(%rbx), %eax
testl %eax, %eax
movl $0x76, %ecx
cmovnel %eax, %ecx
movb %cl, 0xd0(%r14)
movq 0x60(%r14), %r15
testq %r15, %r15
jne 0x12789
leaq 0x6047b(%rip), %r15     # 0x72c00
movq %r15, 0x60(%r14)
cmpb $0x3, (%r14)
jne 0x1279d
movq %r14, %rdi
xorl %esi, %esi
callq 0x12065
movq 0x60(%r14), %r15
testq %r15, %r15
jne 0x127a9
leaq 0x60457(%rip), %r15     # 0x72c00
movq 0x5a418(%rip), %rax     # 0x6cbc8
movq 0x10(%rax), %r12
movq %r15, %rdi
movl %ebp, %esi
callq 0x130f7
addq $0x8, %rbx
movl %eax, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq *%r12
jmp 0x12951
xorl %r14d, %r14d
testl $0xd04, %ebp            # imm = 0xD04
setne %r14b
shll $0x2, %r14d
orl %ebp, %r14d
movq 0x20(%rbx), %rsi
movl %r14d, %edi
callq 0x1230d
movq %rax, %r15
movq 0x28(%rbx), %rsi
movl %r14d, %edi
callq 0x1230d
movl 0x4(%rbx), %ecx
cmpl $0x2d, %ecx
je 0x12812
cmpl $0x2b, %ecx
jne 0x1294a
movzbl (%rax), %ecx
cmpl $0x3, %ecx
jne 0x12821
movq 0x60(%rax), %rcx
movzbl (%rcx), %ecx
movl %ecx, %edx
orl $0x2, %edx
cmpl $0x6, %edx
jne 0x12a76
movl (%r15), %ecx
cmpb $0x3, %cl
jne 0x1283d
movq 0x60(%r15), %rcx
movl (%rcx), %ecx
movl %ecx, %edx
orb $0x2, %dl
leaq 0x5f237(%rip), %r15     # 0x71a80
cmpb $0x6, %dl
je 0x12951
cmpb $0x5, %cl
jne 0x1285e
leaq 0x5f222(%rip), %rax     # 0x71a80
movq %rax, %r15
jmp 0x12951
movq 0x20(%rbx), %rsi
cmpb $0x3, (%rsi)
jne 0x1287a
movl $0x66, 0x4(%rsi)
movq 0x20(%rbx), %rsi
movl $0x400, %edi            # imm = 0x400
callq 0x1230d
movl $0xfd, %ecx
andl (%rax), %ecx
cmpl $0x4, %ecx
jne 0x12894
movq 0x60(%rax), %rax
movq 0x88(%rax), %r12
testq %r12, %r12
movq %rax, 0x20(%rsp)
je 0x1296f
movq %r12, %r13
cmpb $0x0, (%r13)
jg 0x12978
movq 0x10(%r13), %r13
cmpq %r12, %r13
jne 0x128ac
xorl %ebp, %ebp
jmp 0x12974
movq 0x20(%rbx), %rdi
callq 0x12d51
movq %rax, %r14
leaq 0x5736e(%rip), %r12     # 0x69c48
leaq 0x53a0f(%rip), %r13     # 0x662f0
cmpl $0x2e, 0x4(%rbx)
jne 0x1292f
movq 0x30(%rbx), %r15
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x13176
testq %rax, %rax
jne 0x12919
cmpq $0x0, 0x98(%r14)
jne 0x1290f
movq (%r12), %rax
movq %rax, 0x30(%r14)
movq %r15, 0x539f2(%rip)     # 0x66308
movq %r13, %rax
leaq 0x8(%rbx), %rsi
xorl %edi, %edi
movq %r14, %rdx
movq %rax, %rcx
callq 0x1303b
movq %rax, %r14
jmp 0x12941
movq 0x30(%rbx), %rsi
movl $0x4, %edi
callq 0x1230d
movq 0x60(%r14), %r14
movq 0x28(%rbx), %rbx
testq %rbx, %rbx
jne 0x128e1
leaq 0x5f12f(%rip), %r15     # 0x71a80
testb $0x1, 0x4(%rsp)
je 0x1295d
movq 0x8(%rsp), %r15
movq %r15, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
xorl %r13d, %r13d
xorl %edi, %edi
jmp 0x12985
movq 0x18(%r13), %rdi
andq $-0x4, %rdi
movl $0x1, %ebp
movq 0x28(%rbx), %rax
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x12a5c
movq 0x10(%rsp), %rdx
movzwl (%rdx), %eax
testb %al, %al
jle 0x12a4d
xorl %r15d, %r15d
movq %rdx, 0x18(%rsp)
movq 0x18(%rdx,%r15,8), %rbx
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
jb 0x129c3
testq %rbx, %rbx
je 0x12a3b
movq %rdi, %r14
callq 0x12d51
movl (%rax), %ecx
movl $0xfd, %edx
andl %edx, %ecx
cmpl $0x4, %ecx
jne 0x129e2
testb $0x2, 0x69(%rax)
sete %cl
jmp 0x129e4
xorl %ecx, %ecx
cmpq 0x535a5(%rip), %rax     # 0x65f90
movzbl %cl, %eax
leal 0x4(%rax,%rax), %edi
movl $0x6, %eax
cmovel %eax, %edi
movq %rbx, %rsi
callq 0x1230d
testq %r14, %r14
je 0x12a24
movq 0x18(%rsp), %rdx
movsbl (%r13), %eax
cmpl %eax, %ebp
jl 0x12a2d
movq 0x10(%r13), %r13
xorl %ebp, %ebp
cmpq %r12, %r13
jne 0x12a0c
xorl %edi, %edi
jmp 0x12a3b
xorl %edi, %edi
movq 0x18(%rsp), %rdx
jmp 0x12a3b
movslq %ebp, %rax
movq 0x18(%r13,%rax,8), %rdi
andq $-0x4, %rdi
incl %ebp
incq %r15
movl (%rdx), %eax
movsbq %al, %rcx
cmpq %rcx, %r15
jl 0x129af
movq 0x10(%rdx), %rdx
cmpq 0x10(%rsp), %rdx
jne 0x1299c
movq 0x20(%rsp), %rax
cmpb $0x5, (%rax)
leaq 0x60195(%rip), %r15     # 0x72c00
je 0x125ca
jmp 0x12951
cmpl $0x5, %ecx
je 0x1282f
jmp 0x12951