// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]cproc/init.c
// Function: designator
static void
designator(struct scope *s, struct initparser *p)
{
	struct type *t;
	char *name;

	p->last = &p->init;
	p->sub = p->cur;
	for (;;) {
		t = p->sub->type;
		switch (tok.kind) {
		case TLBRACK:
			if (t->kind != TYPEARRAY)
				error(&tok.loc, "index designator is only valid for array types");
			next();
			p->sub->u.idx = intconstexpr(s, false) * t->base->size;
			if (p->sub->u.idx >= t->size) {
				if (!t->incomplete)
					error(&tok.loc, "index designator is larger than array length");
				t->size = p->sub->u.idx + t->base->size;
			}
			expect(TRBRACK, "for index designator");
			subobj(p, t->base, p->sub->u.idx);
			break;
		case TPERIOD:
			if (t->kind != TYPESTRUCT && t->kind != TYPEUNION)
				error(&tok.loc, "member designator only valid for struct/union types");
			next();
			name = expect(TIDENT, "for member designator");
			if (!findmember(p, name))
				error(&tok.loc, "%s has no member named '%s'", t->kind == TYPEUNION ? "union" : "struct", name);
			free(name);
			break;
		default:
			expect(TASSIGN, "after designator");
			return;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rcx
addq $0x410, %rcx            # imm = 0x410
movq -0x10(%rbp), %rax
movq %rcx, 0x418(%rax)
movq -0x10(%rbp), %rax
movq 0x400(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x408(%rax)
movq -0x10(%rbp), %rax
movq 0x408(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
leaq 0x15d42(%rip), %rax     # 0x221a8
movl (%rax), %eax
movl %eax, -0x24(%rbp)
subl $0x40, %eax
je 0xc483
jmp 0xc472
movl -0x24(%rbp), %eax
subl $0x46, %eax
je 0xc569
jmp 0xc602
movq -0x18(%rbp), %rax
cmpl $0xd, (%rax)
je 0xc4a5
leaq 0x15d15(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0xde0d(%rip), %rsi      # 0x1a2ab
movb $0x0, %al
callq 0x11190
callq 0xd540
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x90c0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
imulq 0x10(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x408(%rax), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x408(%rax), %rax
movq 0x10(%rax), %rax
movq -0x18(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jb 0xc533
movq -0x18(%rbp), %rax
testb $0x1, 0x3c(%rax)
jne 0xc510
leaq 0x15caa(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0xe4b6(%rip), %rsi      # 0x1a9bf
movb $0x0, %al
callq 0x11190
movq -0x10(%rbp), %rax
movq 0x408(%rax), %rax
movq 0x10(%rax), %rcx
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
addq 0x10(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movl $0x41, %edi
leaq 0xdd9b(%rip), %rsi      # 0x1a2da
callq 0xd8d0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x408(%rax), %rax
movq 0x10(%rax), %rdx
callq 0xca20
jmp 0xc619
movq -0x18(%rbp), %rax
cmpl $0xf, (%rax)
je 0xc594
movq -0x18(%rbp), %rax
cmpl $0x10, (%rax)
je 0xc594
leaq 0x15c26(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0xdd62(%rip), %rsi      # 0x1a2ef
movb $0x0, %al
callq 0x11190
callq 0xd540
movl $0x4, %edi
leaq 0xdd7e(%rip), %rsi      # 0x1a323
callq 0xd8d0
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xcac0
testb $0x1, %al
jne 0xc5f7
movq -0x18(%rbp), %rax
movl (%rax), %ecx
leaq 0xdd89(%rip), %rdx      # 0x1a355
leaq 0xd7e0(%rip), %rax      # 0x19db3
cmpl $0x10, %ecx
cmoveq %rax, %rdx
movq -0x20(%rbp), %rcx
leaq 0x15bc3(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0xdd49(%rip), %rsi      # 0x1a339
movb $0x0, %al
callq 0x11190
movq -0x20(%rbp), %rdi
callq 0x3260
jmp 0xc619
movl $0x63, %edi
leaq 0xe3de(%rip), %rsi      # 0x1a9ec
callq 0xd8d0
addq $0x30, %rsp
popq %rbp
retq
jmp 0xc44c
nop