// File: /workspace/github_c_makefile_star2_O1/lucvoo[P]sparse-dev/evaluate.c
// Function: next_designators
static struct expression *next_designators(struct expression *old,
			     struct symbol *ctype,
			     struct expression *e, struct expression **v)
{
	struct expression *new = NULL;

	if (!old)
		return NULL;
	if (old->type == EXPR_INDEX) {
		struct expression *copy;
		unsigned n;

		copy = next_designators(old->idx_expression,
					old->ctype, e, v);
		if (!copy) {
			n = old->idx_to + 1;
			if (array_element_offset(old->ctype->bit_size, n) == ctype->bit_size) {
				convert_index(old);
				return NULL;
			}
			copy = e;
			*v = new = alloc_expression(e->pos, EXPR_INDEX);
		} else {
			n = old->idx_to;
			new = alloc_expression(e->pos, EXPR_INDEX);
		}

		new->idx_from = new->idx_to = n;
		new->idx_expression = copy;
		new->ctype = old->ctype;
		convert_index(old);
	} else if (old->type == EXPR_IDENTIFIER) {
		struct expression *copy;
		struct symbol *field;
		int offset = 0;

		copy = next_designators(old->ident_expression,
					old->ctype, e, v);
		if (!copy) {
			field = old->field->next_subobject;
			if (!field) {
				convert_ident(old);
				return NULL;
			}
			copy = e;
			*v = new = alloc_expression(e->pos, EXPR_IDENTIFIER);
			/*
			 * We can't necessarily trust "field->offset",
			 * because the field might be in an anonymous
			 * union, and the field offset is then the offset
			 * within that union.
			 *
			 * The "old->offset - old->field->offset"
			 * would be the offset of such an anonymous
			 * union.
			 */
			offset = old->offset - old->field->offset;
		} else {
			field = old->field;
			new = alloc_expression(e->pos, EXPR_IDENTIFIER);
		}

		new->field = field;
		new->expr_ident = field->ident;
		new->ident_expression = copy;
		new->ctype = field;
		new->offset = field->offset + offset;
		convert_ident(old);
	}
	return new;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x39396
movq %rcx, %r12
movq %rdx, %r15
movq %rdi, %rbx
movzbl (%rdi), %eax
cmpl $0x19, %eax
je 0x392bd
cmpl $0x1a, %eax
jne 0x39396
movq %rsi, %r13
movq 0x10(%rbx), %rsi
movq 0x28(%rbx), %rdi
movq %r15, %rdx
movq %r12, %rcx
callq 0x39244
movl 0x24(%rbx), %edi
testq %rax, %rax
je 0x3930a
movq %rax, %rbp
movl %edi, %r13d
movq 0x8(%r15), %r15
xorl %edi, %edi
callq 0x30029
movq %rax, %r14
movl (%rax), %eax
orl $0x1a, %eax
movq %r15, 0x8(%r14)
andl $0xffff001a, %eax       # imm = 0xFFFF001A
movl %eax, (%r14)
movq %rbp, %r15
jmp 0x39372
movq 0x10(%rbx), %rsi
movq 0x38(%rbx), %rdi
movq %r15, %rdx
movq %r12, %rcx
callq 0x39244
movq 0x30(%rbx), %rbp
testq %rax, %rax
je 0x393ab
movq %rax, %r13
movq 0x8(%r15), %r15
xorl %r12d, %r12d
xorl %edi, %edi
callq 0x30029
movq %rax, %r14
movl (%rax), %eax
orl $0x19, %eax
movq %r15, 0x8(%r14)
andl $0xffff0019, %eax       # imm = 0xFFFF0019
movl %eax, (%r14)
movq %r13, %r15
jmp 0x393e3
incl %edi
movq 0x10(%rbx), %rax
movslq 0x50(%rax), %rcx
leaq 0x2c3e5(%rip), %rax     # 0x65700
movslq (%rax), %rsi
xorl %r14d, %r14d
movq %rcx, %rax
xorl %edx, %edx
divq %rsi
subl %edx, %esi
testl %edx, %edx
cmovel %edx, %esi
movslq %esi, %rax
addq %rcx, %rax
movslq %edi, %rcx
imulq %rax, %rcx
movslq 0x50(%r13), %rax
movl $0x0, %r13d
cmpq %rax, %rcx
je 0x39389
movl %edi, %r13d
movq 0x8(%r15), %rbp
xorl %edi, %edi
callq 0x30029
movq %rax, %r14
movl (%rax), %eax
orl $0x1a, %eax
movq %rbp, 0x8(%r14)
andl $0xffff001a, %eax       # imm = 0xFFFF001A
movl %eax, (%r14)
movq %r14, (%r12)
movl %r13d, 0x24(%r14)
movl %r13d, 0x20(%r14)
movq %r15, 0x28(%r14)
movq 0x10(%rbx), %rax
movq %rax, 0x10(%r14)
movb $0x1, %r13b
movq %rbx, %rdi
callq 0x3946c
testb %r13b, %r13b
jne 0x39399
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x38(%rbp), %rbp
testq %rbp, %rbp
je 0x39420
movq 0x8(%r15), %r13
xorl %edi, %edi
callq 0x30029
movq %rax, %r14
movl (%rax), %eax
orl $0x19, %eax
movq %r13, 0x8(%r14)
andl $0xffff0019, %eax       # imm = 0xFFFF0019
movl %eax, (%r14)
movq %r14, (%r12)
movl 0x20(%rbx), %r12d
movq 0x30(%rbx), %rax
subl 0x48(%rax), %r12d
movq %rbp, 0x30(%r14)
movq 0x18(%rbp), %rax
movq %rax, 0x28(%r14)
movq %r15, 0x38(%r14)
movq %rbp, 0x10(%r14)
addl 0x48(%rbp), %r12d
movl %r12d, 0x20(%r14)
movb $0x1, %al
movq 0x38(%rbx), %rcx
movb $0x1b, (%rbx)
movl $0x1, 0x24(%rbx)
movq %rcx, 0x28(%rbx)
testb %al, %al
je 0x39396
jmp 0x39399
xorl %r14d, %r14d
xorl %eax, %eax
jmp 0x39401