// File: /workspace/github_c_makefile_star2_O3/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 0x38886
movq %rcx, %r15
movq %rdx, %r14
movq %rdi, %rbx
movzbl (%rdi), %eax
cmpl $0x19, %eax
je 0x3874b
cmpl $0x1a, %eax
jne 0x38886
movq %rsi, %r12
movq 0x10(%rbx), %rsi
movq 0x28(%rbx), %rdi
movq %r14, %rdx
movq %r15, %rcx
callq 0x386dd
movl 0x24(%rbx), %ebp
testq %rax, %rax
je 0x38789
movq %rax, %r13
movq 0x8(%r14), %r14
xorl %edi, %edi
callq 0x2f9f5
movq %rax, %r12
movq %r14, 0x8(%rax)
movw $0x1a, (%rax)
movq %r13, %r14
jmp 0x38852
movq 0x10(%rbx), %rsi
movq 0x38(%rbx), %rdi
movq %r14, %rdx
movq %r15, %rcx
callq 0x386dd
movq 0x30(%rbx), %rbp
testq %rax, %rax
je 0x387d0
movq %rax, %r13
movq 0x8(%r14), %r14
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x2f9f5
movq %rax, %r12
movq %r14, 0x8(%rax)
movw $0x19, (%rax)
movq %r13, %r14
jmp 0x38803
incl %ebp
movq 0x10(%rbx), %rax
movslq 0x50(%rax), %rcx
leaq 0x2bf66(%rip), %rax     # 0x64700
movslq (%rax), %rsi
movq %rcx, %rax
xorl %edx, %edx
divq %rsi
subl %edx, %esi
testl %edx, %edx
cmovel %edx, %esi
movslq %esi, %rax
addq %rcx, %rax
movslq %ebp, %rcx
imulq %rax, %rcx
movslq 0x50(%r12), %rax
cmpq %rax, %rcx
jne 0x38838
movq %rbx, %rdi
callq 0x388e3
jmp 0x38886
movq 0x38(%rbp), %rbp
testq %rbp, %rbp
je 0x38874
movq 0x8(%r14), %r13
xorl %edi, %edi
callq 0x2f9f5
movq %rax, %r12
movq %r13, 0x8(%rax)
movw $0x19, (%rax)
movq %rax, (%r15)
movl 0x20(%rbx), %r15d
movq 0x30(%rbx), %rax
subl 0x48(%rax), %r15d
movq %rbp, 0x30(%r12)
movq 0x18(%rbp), %rax
movq %rax, 0x28(%r12)
movq %r14, 0x38(%r12)
movq %rbp, 0x10(%r12)
addl 0x48(%rbp), %r15d
movl %r15d, 0x20(%r12)
movq 0x38(%rbx), %rax
movb $0x1b, (%rbx)
movl $0x1, 0x24(%rbx)
movq %rax, 0x28(%rbx)
jmp 0x38889
movq 0x8(%r14), %r13
xorl %edi, %edi
callq 0x2f9f5
movq %rax, %r12
movq %r13, 0x8(%rax)
movw $0x1a, (%rax)
movq %rax, (%r15)
movl %ebp, 0x24(%r12)
movl %ebp, 0x20(%r12)
movq %r14, 0x28(%r12)
movq 0x10(%rbx), %rax
movq %rax, 0x10(%r12)
movq %rbx, %rdi
callq 0x388e3
jmp 0x38889
movq 0x38(%rbx), %rax
movb $0x1b, (%rbx)
movl $0x1, 0x24(%rbx)
movq %rax, 0x28(%rbx)
xorl %r12d, %r12d
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq