// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x20(%rdi), %r15
movq 0x28(%rdi), %r12
movq %r15, %rdi
callq 0x32c63
testq %rax, %rax
je 0x355f0
testq %r12, %r12
je 0x355f8
movq 0x10(%r15), %r13
movq %r13, %rdi
callq 0x2b5f4
movq 0x80(%r13), %rcx
movq 0x68(%r13), %rbp
cmpb $0x3, (%r13)
jne 0x3560b
movq 0x60(%r13), %r13
movq 0x80(%r13), %rax
testq %rax, %rax
je 0x35607
testq %rcx, %rcx
je 0x35604
cmpq %rax, %rcx
je 0x35607
movq 0x8(%r15), %rdi
leaq 0x124dc(%rip), %rsi     # 0x47abc
xorl %eax, %eax
callq 0x11a38
leaq 0x30df2(%rip), %rcx     # 0x663e0
jmp 0x35607
xorl %r14d, %r14d
jmp 0x35773
leaq 0x15f70(%rip), %rsi     # 0x4b56f
jmp 0x35766
movq %rax, %rcx
orq 0x68(%r13), %rbp
testq %r13, %r13
je 0x3575f
movzbl (%r13), %eax
addl $-0x7, %eax
cmpl $0x2, %eax
jae 0x3575f
movq %rcx, 0x8(%rsp)
leaq 0x14(%rsp), %rdx
movl $0x0, (%rdx)
movq 0x98(%r13), %rsi
movq %r12, %rdi
callq 0x38549
testq %rax, %rax
je 0x35785
movq %rax, %r14
movq 0x68(%rax), %rax
orl %eax, %ebp
movslq %ebp, %r13
movq 0x8(%rsp), %rcx
cmpq %rcx, 0x80(%r14)
jne 0x3566c
cmpq %r13, %rax
je 0x356a0
movq 0x4(%r14), %rdi
movl $0x3, %esi
movq %rcx, %rbp
callq 0x2b547
movq %rax, %r12
movl $0xe0, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0xe1e0
movq %rbp, 0x80(%r12)
movq %r13, 0x68(%r12)
movq %r12, %r14
movq 0x60(%r14), %rdi
callq 0x2b5f4
movl (%r15), %eax
cmpb $0x1d, %al
je 0x3580b
movzbl %al, %eax
cmpl $0x9, %eax
jne 0x35819
cmpl $0x2a, 0x4(%r15)
jne 0x35806
movq 0x20(%r15), %r12
movq %r12, 0x20(%rbx)
movslq 0x14(%rsp), %r13
movq 0x8(%r12), %rbp
xorl %edi, %edi
callq 0x30029
movq %rax, %r15
movl (%rax), %eax
orl $0x5, %eax
movq %rbp, 0x8(%r15)
andl $0xffff0005, %eax       # imm = 0xFFFF0005
movl %eax, (%r15)
movl $0x2b, 0x4(%r15)
movq %r12, 0x20(%r15)
movq 0x8(%r12), %rbp
xorl %edi, %edi
callq 0x30029
movl (%rax), %ecx
orl $0x1, %ecx
movq %rbp, 0x8(%rax)
andl $0xffff0001, %ecx       # imm = 0xFFFF0001
movl %ecx, (%rax)
movq %rax, 0x28(%r15)
leaq 0x3700c(%rip), %rcx     # 0x6c738
movq %rcx, 0x10(%rax)
movq 0x28(%r15), %rax
movq %r13, 0x20(%rax)
leaq 0x37ed9(%rip), %rax     # 0x6d618
movq %rax, 0x10(%r15)
movb 0x1(%r12), %al
movb %al, 0x1(%r15)
movb $0x9, (%rbx)
movl $0x2a, 0x4(%rbx)
movq %r15, 0x20(%rbx)
jmp 0x35842
leaq 0x15e19(%rip), %rsi     # 0x4b57f
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %eax, %eax
callq 0x11abc
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x7, (%r13)
leaq 0xfbcb(%rip), %rax      # 0x4535c
leaq 0x1315e(%rip), %r15     # 0x488f6
cmoveq %rax, %r15
movq 0x18(%r13), %rbp
testq %rbp, %rbp
je 0x357b3
movzbl 0x10(%rbp), %eax
movl %eax, 0x8(%rsp)
addq $0x12, %rbp
jmp 0x357c2
movl $0x9, 0x8(%rsp)
leaq 0x15dd9(%rip), %rbp     # 0x4b59b
movq 0x98(%r13), %r14
movq %r12, %rdi
callq 0x2e465
testq %r14, %r14
je 0x357df
leaq 0x15dc8(%rip), %rsi     # 0x4b5a5
jmp 0x357e6
leaq 0x15dd9(%rip), %rsi     # 0x4b5bf
xorl %r14d, %r14d
movq %rbx, %rdi
movq %rax, %rdx
movq %r15, %rcx
movl 0x8(%rsp), %r8d
movq %rbp, %r9
xorl %eax, %eax
callq 0x11abc
jmp 0x35773
cmpl $0x1d, %eax
jne 0x35819
movq 0x20(%r15), %rax
movq %rax, 0x20(%rbx)
movl 0x28(%r15), %eax
jmp 0x3581f
movq %r15, 0x20(%rbx)
xorl %eax, %eax
movl %eax, 0x28(%rbx)
leaq 0x2fed7(%rip), %rcx     # 0x65700
movl (%rcx), %ecx
imull 0x14(%rsp), %ecx
addl %eax, %ecx
movl %ecx, 0x28(%rbx)
movb $0x1d, (%rbx)
movzbl 0x54(%r14), %eax
addl %ecx, %eax
movl %eax, 0x28(%rbx)
movq %r14, 0x10(%rbx)
jmp 0x35773