// File: /workspace/github_c_makefile_star2_O0/lucvoo[P]sparse-dev/evaluate.c
// Function: evaluate_member_dereference
static struct symbol *evaluate_member_dereference(struct expression *expr)
{
	int offset;
	struct symbol *ctype, *member;
	struct expression *deref = expr->deref, *add;
	struct ident *ident = expr->member;
	struct ident *address_space;
	unsigned int mod;

	if (!evaluate_expression(deref))
		return NULL;
	if (!ident) {
		expression_error(expr, "bad member name");
		return NULL;
	}

	ctype = deref->ctype;
	examine_symbol_type(ctype);
	address_space = ctype->ctype.as;
	mod = ctype->ctype.modifiers;
	if (ctype->type == SYM_NODE) {
		ctype = ctype->ctype.base_type;
		combine_address_space(deref->pos, &address_space, ctype->ctype.as);
		mod |= ctype->ctype.modifiers;
	}
	if (!ctype || (ctype->type != SYM_STRUCT && ctype->type != SYM_UNION)) {
		expression_error(expr, "expected structure or union");
		return NULL;
	}
	offset = 0;
	member = find_identifier(ident, ctype->symbol_list, &offset);
	if (!member) {
		const char *type = ctype->type == SYM_STRUCT ? "struct" : "union";
		const char *name = "<unnamed>";
		int namelen = 9;
		if (ctype->ident) {
			name = ctype->ident->name;
			namelen = ctype->ident->len;
		}
		if (ctype->symbol_list)
			expression_error(expr, "no member '%s' in %s %.*s",
				show_ident(ident), type, namelen, name);
		else
			expression_error(expr, "using member '%s' in "
				"incomplete %s %.*s", show_ident(ident),
				type, namelen, name);
		return NULL;
	}

	/*
	 * The member needs to take on the address space and modifiers of
	 * the "parent" type.
	 */
	member = convert_to_as_mod(member, address_space, mod);
	ctype = get_base_type(member);

	if (!lvalue_expression(deref)) {
		if (deref->type != EXPR_SLICE) {
			expr->base = deref;
			expr->r_bitpos = 0;
		} else {
			expr->base = deref->base;
			expr->r_bitpos = deref->r_bitpos;
		}
		expr->r_bitpos += bytes_to_bits(offset);
		expr->type = EXPR_SLICE;
		expr->r_bitpos += member->bit_offset;
		expr->ctype = member;
		return member;
	}

	deref = deref->unop;
	expr->deref = deref;

	add = evaluate_offset(deref, offset);
	expr->type = EXPR_PREOP;
	expr->op = '*';
	expr->unop = add;

	expr->ctype = member;
	return member;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rdi
callq 0x4bb70
cmpq $0x0, %rax
jne 0x4e443
movq $0x0, -0x8(%rbp)
jmp 0x4e768
cmpq $0x0, -0x40(%rbp)
jne 0x4e469
movq -0x10(%rbp), %rdi
leaq 0x1ddaa(%rip), %rsi     # 0x6c1ff
movb $0x0, %al
callq 0x17030
movq $0x0, -0x8(%rbp)
jmp 0x4e768
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x3f650
movq -0x20(%rbp), %rax
movq 0x80(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movq 0x68(%rax), %rax
movl %eax, -0x4c(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x3, %eax
jne 0x4e4e1
movq -0x20(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
movq 0x80(%rcx), %rdx
movq 0x8(%rax), %rdi
leaq -0x48(%rbp), %rsi
callq 0x4b5e0
movq -0x20(%rbp), %rax
movq 0x68(%rax), %rcx
movl -0x4c(%rbp), %eax
orq %rcx, %rax
movl %eax, -0x4c(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x4e508
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x7, %eax
je 0x4e527
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x8, %eax
je 0x4e527
movq -0x10(%rbp), %rdi
leaq 0x1dcfc(%rip), %rsi     # 0x6c20f
movb $0x0, %al
callq 0x17030
movq $0x0, -0x8(%rbp)
jmp 0x4e768
movl $0x0, -0x14(%rbp)
movq -0x40(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x98(%rax), %rsi
leaq -0x14(%rbp), %rdx
callq 0x538c0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x4e637
movq -0x20(%rbp), %rax
movl (%rax), %edx
andl $0xff, %edx
leaq 0x1b066(%rip), %rax     # 0x695ce
leaq 0x17716(%rip), %rcx     # 0x65c85
cmpl $0x7, %edx
cmoveq %rcx, %rax
movq %rax, -0x58(%rbp)
leaq 0x1dcaa(%rip), %rax     # 0x6c22b
movq %rax, -0x60(%rbp)
movl $0x9, -0x64(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x4e5b6
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
addq $0x12, %rax
movq %rax, -0x60(%rbp)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movzbl 0x10(%rax), %eax
movl %eax, -0x64(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x98(%rax)
je 0x4e5f8
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x40(%rbp), %rdi
callq 0x44150
movq -0x70(%rbp), %rdi
movq %rax, %rdx
movq -0x58(%rbp), %rcx
movl -0x64(%rbp), %r8d
movq -0x60(%rbp), %r9
leaq 0x1dc46(%rip), %rsi     # 0x6c235
movb $0x0, %al
callq 0x17030
jmp 0x4e62a
movq -0x10(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x40(%rbp), %rdi
callq 0x44150
movq -0x78(%rbp), %rdi
movq %rax, %rdx
movq -0x58(%rbp), %rcx
movl -0x64(%rbp), %r8d
movq -0x60(%rbp), %r9
leaq 0x1dc2c(%rip), %rsi     # 0x6c24f
movb $0x0, %al
callq 0x17030
movq $0x0, -0x8(%rbp)
jmp 0x4e768
movq -0x28(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl -0x4c(%rbp), %edx
callq 0x53a20
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x51e40
movq %rax, -0x20(%rbp)
movq -0x30(%rbp), %rdi
callq 0x52a10
cmpl $0x0, %eax
jne 0x4e703
movq -0x30(%rbp), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x1d, %eax
je 0x4e693
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x28(%rax)
jmp 0x4e6b1
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x30(%rbp), %rax
movl 0x28(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x28(%rax)
movl -0x14(%rbp), %edi
callq 0x53ac0
movl %eax, %ecx
movq -0x10(%rbp), %rax
addl 0x28(%rax), %ecx
movl %ecx, 0x28(%rax)
movq -0x10(%rbp), %rax
movl (%rax), %ecx
andl $0xffffff00, %ecx       # imm = 0xFFFFFF00
orl $0x1d, %ecx
movl %ecx, (%rax)
movq -0x28(%rbp), %rax
movl 0x54(%rax), %ecx
andl $0xff, %ecx
movq -0x10(%rbp), %rax
addl 0x28(%rax), %ecx
movl %ecx, 0x28(%rax)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x4e768
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x30(%rbp), %rdi
movslq -0x14(%rbp), %rsi
callq 0x53ae0
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %ecx
andl $0xffffff00, %ecx       # imm = 0xFFFFFF00
orl $0x9, %ecx
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movl $0x2a, 0x4(%rax)
movq -0x38(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)