// File: /workspace/github_c_makefile_star2_O1/michaelforney[P]cproc/init.c
// Function: parseinit
struct init *
parseinit(struct scope *s, struct type *t)
{
	struct initparser p;
	struct expr *expr;
	struct type *base;
	struct bitfield bits;

	p.cur = NULL;
	p.sub = p.obj;
	p.sub->offset = 0;
	p.sub->type = t;
	p.sub->iscur = false;
	p.init = NULL;
	p.last = &p.init;
	if (t->incomplete && t->kind != TYPEARRAY)
		error(&tok.loc, "initializer specified for incomplete type");
	if (t->kind == TYPEARRAY && t->base->size == 0)
		error(&tok.loc, "initializer specified for variable length array type");
	for (;;) {
		if (p.cur) {
			if (tok.kind == TLBRACK || tok.kind == TPERIOD)
				designator(s, &p);
			else if (p.sub != p.cur)
				advance(&p);
			else if (p.cur->type->kind == TYPESTRUCT || p.cur->type->kind == TYPEUNION)
				focus(&p);
		}
		if (consume(TLBRACE)) {
			if (consume(TRBRACE)){
				if (p.sub->type->incomplete)
					error(&tok.loc, "array of unknown size has empty initializer");
				goto next;
			}
			if (p.cur == p.sub) {
				if (p.cur->type->prop & PROPSCALAR)
					error(&tok.loc, "nested braces around scalar initializer");
				assert(p.cur->type->kind == TYPEARRAY);
				focus(&p);
			}
			p.cur = p.sub;
			p.cur->iscur = true;
			continue;
		}
		expr = assignexpr(s);
		for (;;) {
			t = p.sub->type;
			switch (t->kind) {
			case TYPEARRAY:
				if (!expr->decayed || expr->base->kind != EXPRSTRING || !(t->base->prop & PROPINT))
					break;
				base = t->base;
				expr = expr->base;
				if (!(base->prop & PROPCHAR && expr->type->base->prop & PROPCHAR) && !typecompatible(base, expr->type->base))
					error(&tok.loc, "cannot initialize array with string literal of different width");
				if (t->incomplete)
					t->size = expr->type->size;
				goto add;
			case TYPESTRUCT:
			case TYPEUNION:
				if (typecompatible(expr->type, t))
					goto add;
				break;
			default:  /* scalar type */
				assert(t->prop & PROPSCALAR);
				expr = exprassign(expr, t);
				goto add;
			}
			focus(&p);
		}
	add:
		if (p.sub > p.obj && (p.sub[-1].type->kind == TYPESTRUCT || p.sub[-1].type->kind == TYPEUNION))
			bits = p.sub[-1].u.mem->bits;
		else
			bits = (struct bitfield){0};
		initadd(&p, mkinit(p.sub->offset, p.sub->offset + p.sub->type->size, bits, expr));
		for (;;) {
			if (p.sub->type->incomplete)
				p.sub->type->incomplete = false;
		next:
			if (!p.cur)
				return p.init;
			if (tok.kind == TCOMMA) {
				next();
				if (tok.kind != TRBRACE)
					break;
			} else if (tok.kind != TRBRACE) {
				error(&tok.loc, "expected ',' or '}' after initializer");
			}
			next();
			p.sub = p.cur;
			do p.cur = p.cur == p.obj ? NULL : p.cur - 1;
			while (p.cur && !p.cur->iscur);
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x428, %rsp            # imm = 0x428
movq %rsi, %r15
movq %rdi, (%rsp)
xorl %eax, %eax
leaq 0x8(%rsp), %r14
movq %rax, 0x400(%r14)
movq %r14, 0x408(%r14)
movq %rax, (%r14)
movq %rsi, 0x8(%r14)
movb $0x0, 0x18(%r14)
leaq 0x418(%rsp), %rcx
movq %rax, (%rcx)
movq %rcx, 0x8(%rcx)
cmpb $0x1, 0x3c(%rsi)
jne 0x9b8a
cmpl $0xd, (%r15)
je 0x9b8a
leaq 0x12590(%rip), %rdi     # 0x1c108
addq $0x8, %rdi
leaq 0xa875(%rip), %rsi      # 0x143f8
xorl %eax, %eax
callq 0xd56a
cmpl $0xd, (%r15)
jne 0x9bb4
movq 0x20(%r15), %rax
cmpq $0x0, 0x10(%rax)
jne 0x9bb4
leaq 0x12566(%rip), %rdi     # 0x1c108
addq $0x8, %rdi
leaq 0xa875(%rip), %rsi      # 0x14422
xorl %eax, %eax
callq 0xd56a
leaq 0x1254d(%rip), %rbx     # 0x1c108
leaq 0x8(%rbx), %r15
movq 0x408(%rsp), %rax
testq %rax, %rax
je 0x9ed9
movl (%rbx), %ecx
cmpl $0x46, %ecx
je 0x9be0
cmpl $0x40, %ecx
jne 0x9d90
leaq 0x418(%rsp), %rcx
movq %rcx, 0x420(%rsp)
movq %rax, 0x410(%rsp)
movq 0x410(%rsp), %rax
movq 0x8(%rax), %r13
movl (%rbx), %eax
cmpl $0x46, %eax
je 0x9cfd
cmpl $0x40, %eax
jne 0x9d7a
cmpl $0xd, (%r13)
je 0x9c30
movq %r15, %rdi
leaq 0xa1f2(%rip), %rsi      # 0x13e1b
xorl %eax, %eax
callq 0xd56a
callq 0xa9d0
movq (%rsp), %rdi
xorl %esi, %esi
callq 0x74a9
movq 0x20(%r13), %rcx
imulq 0x10(%rcx), %rax
movq 0x410(%rsp), %rcx
movq %rax, 0x10(%rcx)
movq 0x410(%rsp), %rax
movq 0x10(%rax), %rax
cmpq 0x10(%r13), %rax
jb 0x9c97
cmpb $0x0, 0x3c(%r13)
jne 0x9c7f
movq %r15, %rdi
leaq 0xa909(%rip), %rsi      # 0x14581
xorl %eax, %eax
callq 0xd56a
movq 0x410(%rsp), %rax
movq 0x20(%r13), %rcx
movq 0x10(%rcx), %rcx
addq 0x10(%rax), %rcx
movq %rcx, 0x10(%r13)
movl $0x41, %edi
leaq 0xa1a7(%rip), %rsi      # 0x13e4a
callq 0xb07a
movq 0x20(%r13), %r12
movq 0x410(%rsp), %rax
movq (%rax), %r13
movq 0x10(%rax), %rbp
addq $0x20, %rax
movq %rax, 0x410(%rsp)
leaq 0x408(%rsp), %rcx
cmpq %rcx, %rax
jne 0x9ce2
leaq 0xa8e4(%rip), %rdi      # 0x145bf
xorl %eax, %eax
callq 0xe054
addq %rbp, %r13
movq 0x410(%rsp), %rax
movq %r12, 0x8(%rax)
movq %r13, (%rax)
movb $0x0, 0x18(%rax)
jmp 0x9bf8
movl (%r13), %eax
addl $-0xf, %eax
cmpl $0x2, %eax
jb 0x9d1a
movq %r15, %rdi
leaq 0xa14c(%rip), %rsi      # 0x13e5f
xorl %eax, %eax
callq 0xd56a
callq 0xa9d0
movl $0x4, %edi
leaq 0xa168(%rip), %rsi      # 0x13e93
callq 0xb07a
movq %rax, %r12
movq %r14, %rdi
movq %rax, %rsi
callq 0xa307
testb %al, %al
jne 0x9d6d
cmpl $0x10, (%r13)
leaq 0xa177(%rip), %rdx      # 0x13ec5
leaq 0x9bce(%rip), %rax      # 0x13923
cmoveq %rax, %rdx
movq %r15, %rdi
leaq 0xa146(%rip), %rsi      # 0x13ea9
movq %r12, %rcx
xorl %eax, %eax
callq 0xd56a
movq %r12, %rdi
callq 0x3250
jmp 0x9bf8
movl $0x63, %edi
leaq 0xa828(%rip), %rsi      # 0x145ae
callq 0xb07a
jmp 0x9ed9
cmpq %rax, 0x410(%rsp)
je 0x9e34
movq 0x410(%rsp), %rcx
leaq -0x20(%rcx), %rax
movq %rax, 0x410(%rsp)
movq -0x18(%rcx), %rax
movl (%rax), %edx
cmpl $0xf, %edx
je 0x9def
cmpl $0xd, %edx
jne 0x9e0c
movq 0x20(%rax), %rdx
movq 0x10(%rdx), %rdx
addq %rdx, -0x10(%rcx)
movq 0x410(%rsp), %rcx
movq 0x10(%rax), %rdx
cmpq %rdx, 0x10(%rcx)
jne 0x9e79
cmpb $0x1, 0x3c(%rax)
jne 0x9e0c
jmp 0x9e82
movq -0x10(%rcx), %rax
movq 0x28(%rax), %rax
movq %rax, -0x10(%rcx)
movq 0x410(%rsp), %rax
movq 0x10(%rax), %rcx
testq %rcx, %rcx
jne 0x9e53
movq 0x410(%rsp), %rax
cmpq 0x408(%rsp), %rax
jne 0x9d9e
movq %r15, %rdi
leaq 0xa7bc(%rip), %rsi      # 0x145e4
xorl %eax, %eax
callq 0xd56a
jmp 0x9d9e
movq 0x8(%rax), %rax
movl (%rax), %eax
addl $-0xf, %eax
cmpl $0x1, %eax
ja 0x9ed9
movq %r14, %rdi
callq 0xa24d
jmp 0x9ed9
movq 0x8(%rcx), %r12
movq 0x18(%rcx), %rbp
movq (%rax), %r13
addq $0x20, %rax
movq %rax, 0x410(%rsp)
leaq 0x408(%rsp), %rcx
cmpq %rcx, %rax
jne 0x9ec3
jmp 0x9eb5
addq $0x20, %rax
movq %rax, %rsi
jmp 0x9e92
leaq 0x20(%rax), %rsi
movq 0x20(%rax), %rdi
addq 0x10(%rdi), %rdx
movq %rdx, 0x10(%rax)
movq (%rsi), %r12
movq (%rcx), %r13
movq 0x10(%rcx), %rbp
addq $0x20, %rcx
movq %rcx, 0x410(%rsp)
leaq 0x408(%rsp), %rax
cmpq %rax, %rcx
jne 0x9ec3
leaq 0xa703(%rip), %rdi      # 0x145bf
xorl %eax, %eax
callq 0xe054
addq %rbp, %r13
movq 0x410(%rsp), %rax
movq %r12, 0x8(%rax)
movq %r13, (%rax)
movb $0x0, 0x18(%rax)
movl $0x44, %edi
callq 0xb099
testb %al, %al
je 0x9f25
movl $0x45, %edi
callq 0xb099
testb %al, %al
je 0x9f93
movq 0x410(%rsp), %rax
movq 0x8(%rax), %rax
cmpb $0x1, 0x3c(%rax)
jne 0xa16d
movq %r15, %rdi
leaq 0xa53e(%rip), %rsi      # 0x14457
xorl %eax, %eax
callq 0xd56a
jmp 0xa16d
movq (%rsp), %rdi
callq 0x7520
movq %rax, %rbp
movq 0x410(%rsp), %rax
movq 0x8(%rax), %r13
movl (%r13), %eax
leal -0xf(%rax), %ecx
cmpl $0x2, %ecx
jae 0x9f5b
movq 0x8(%rbp), %rdi
movq %r13, %rsi
callq 0xd8c4
testb %al, %al
je 0x9f84
jmp 0x9f8e
cmpl $0xd, %eax
jne 0x9ff6
cmpb $0x1, 0x5(%rbp)
jne 0x9f84
movq 0x18(%rbp), %r12
cmpl $0x2, (%r12)
jne 0x9f84
movq 0x20(%r13), %rdi
movl 0x4(%rdi), %eax
testb $0x2, %al
jne 0xa11a
movq %r14, %rdi
callq 0xa24d
jmp 0x9f31
movq %rbp, %r12
jmp 0xa00f
movq 0x408(%rsp), %rax
cmpq 0x410(%rsp), %rax
jne 0x9fdd
movq 0x8(%rax), %rax
testb $0x10, 0x4(%rax)
je 0x9fc0
movq %r15, %rdi
leaq 0xa4ca(%rip), %rsi      # 0x14483
xorl %eax, %eax
callq 0xd56a
movq 0x408(%rsp), %rax
movq 0x8(%rax), %rax
cmpl $0xd, (%rax)
jne 0xa22e
movq %r14, %rdi
callq 0xa24d
movq 0x410(%rsp), %rax
movq %rax, 0x408(%rsp)
movb $0x1, 0x18(%rax)
jmp 0x9bbf
testb $0x10, 0x4(%r13)
je 0xa20f
movq %rbp, %rdi
movq %r13, %rsi
callq 0x691c
movq %rax, %r12
movq 0x410(%rsp), %rax
xorl %ebx, %ebx
cmpq %r14, %rax
jbe 0xa033
movq -0x18(%rax), %rcx
movl (%rcx), %ecx
addl $-0xf, %ecx
cmpl $0x1, %ecx
ja 0xa033
movq -0x10(%rax), %rcx
movl 0x20(%rcx), %ebx
movq (%rax), %rbp
movq 0x8(%rax), %rax
movq 0x10(%rax), %r13
addq %rbp, %r13
movl $0x28, %edi
callq 0xe13e
movq %rbp, (%rax)
movq %r13, 0x8(%rax)
movq %r12, 0x10(%rax)
movl %ebx, 0x18(%rax)
movq $0x0, 0x20(%rax)
movq 0x420(%rsp), %rcx
movq (%rcx), %rdx
testq %rdx, %rdx
je 0xa0f6
movswq 0x18(%rax), %rsi
leaq (%rsi,%rbp,8), %rsi
shlq $0x3, %r13
leaq 0x1207f(%rip), %rbx     # 0x1c108
movq 0x8(%rdx), %r8
shlq $0x3, %r8
movswq 0x1a(%rdx), %rdi
subq %rdi, %r8
cmpq %rsi, %r8
jbe 0xa0bf
movswq 0x1a(%rax), %r9
movq %r13, %rdi
subq %r9, %rdi
movq (%rdx), %r9
movswq 0x18(%rdx), %r10
leaq (%r10,%r9,8), %r9
cmpq %r9, %rdi
jbe 0xa0ff
cmpq %rdi, %r8
jbe 0xa0d6
movq %rdx, %rcx
movq 0x20(%rdx), %rdi
addq $0x20, %rcx
movq %rdi, %rdx
testq %rdi, %rdi
jne 0xa089
xorl %edx, %edx
jmp 0xa0ff
movq 0x20(%rdx), %rdx
testq %rdx, %rdx
je 0xa0d2
movq 0x8(%rdx), %rsi
shlq $0x3, %rsi
movswq 0x1a(%rdx), %r8
subq %r8, %rsi
cmpq %rdi, %rsi
jbe 0xa0d6
jmp 0xa0ff
xorl %edx, %edx
leaq 0x12009(%rip), %rbx     # 0x1c108
movq %rax, %rsi
addq $0x20, %rsi
movq %rdx, 0x20(%rax)
movq %rax, (%rcx)
movq %rsi, 0x420(%rsp)
jmp 0xa1da
testb $0x1, %al
je 0xa12d
movq 0x8(%r12), %rax
movq 0x20(%rax), %rax
testb $0x1, 0x4(%rax)
jne 0xa150
movq 0x8(%r12), %rax
movq 0x20(%rax), %rsi
callq 0xd8c4
testb %al, %al
jne 0xa150
movq %r15, %rdi
leaq 0xa3be(%rip), %rsi      # 0x14507
xorl %eax, %eax
callq 0xd56a
cmpb $0x1, 0x3c(%r13)
jne 0xa00f
movq 0x8(%r12), %rax
movq 0x10(%rax), %rax
movq %rax, 0x10(%r13)
jmp 0xa00f
cmpq $0x0, 0x408(%rsp)
je 0xa1f5
movl (%rbx), %eax
cmpl $0x45, %eax
je 0xa1a5
cmpl $0x6e, %eax
jne 0xa194
callq 0xa9d0
cmpl $0x45, (%rbx)
jne 0x9bbf
jmp 0xa1a5
movq %r15, %rdi
leaq 0xa3bd(%rip), %rsi      # 0x1455b
xorl %eax, %eax
callq 0xd56a
callq 0xa9d0
movq 0x408(%rsp), %rax
movq %rax, 0x410(%rsp)
leaq -0x20(%rax), %rcx
cmpq %r14, %rax
movl $0x0, %eax
cmovneq %rcx, %rax
je 0xa1d2
cmpb $0x1, 0x18(%rax)
jne 0xa1ba
movq %rax, 0x408(%rsp)
movq 0x410(%rsp), %rax
movq 0x8(%rax), %rax
cmpb $0x1, 0x3c(%rax)
jne 0xa16d
movb $0x0, 0x3c(%rax)
jmp 0xa16d
movq 0x418(%rsp), %rax
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa330(%rip), %rdi      # 0x14546
leaq 0xa2ad(%rip), %rsi      # 0x144ca
leaq 0xa2ad(%rip), %rcx      # 0x144d1
movl $0x102, %edx            # imm = 0x102
callq 0x30e0
leaq 0xa276(%rip), %rdi      # 0x144ab
leaq 0xa28e(%rip), %rsi      # 0x144ca
leaq 0xa28e(%rip), %rcx      # 0x144d1
movl $0xe7, %edx
callq 0x30e0