// File: /workspace/github_c_makefile_star2_O3/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, %rbx
xorl %eax, %eax
leaq 0x8(%rsp), %rcx
movq %rax, 0x400(%rcx)
movq %rcx, 0x408(%rcx)
movq %rax, (%rcx)
movq %rsi, 0x8(%rcx)
movb $0x0, 0x18(%rcx)
leaq 0x418(%rsp), %rcx
movq %rax, (%rcx)
movq %rcx, 0x8(%rcx)
cmpb $0x1, 0x3c(%rsi)
jne 0x99e8
cmpl $0xd, (%r15)
je 0x99ee
leaq 0x12732(%rip), %rdi     # 0x1c108
addq $0x8, %rdi
leaq 0xaa77(%rip), %rsi      # 0x14458
xorl %eax, %eax
callq 0xd55c
cmpl $0xd, (%r15)
jne 0x9a12
movq 0x20(%r15), %rax
cmpq $0x0, 0x10(%rax)
jne 0x9a12
leaq 0x12708(%rip), %rdi     # 0x1c108
addq $0x8, %rdi
leaq 0xaa77(%rip), %rsi      # 0x14482
xorl %eax, %eax
callq 0xd55c
leaq 0x126ef(%rip), %rbp     # 0x1c108
leaq 0x8(%rbp), %r15
leaq 0xac20(%rip), %r14      # 0x14644
movq 0x408(%rsp), %rax
testq %rax, %rax
je 0x9d10
movl (%rbp), %ecx
cmpl $0x46, %ecx
je 0x9a46
cmpl $0x40, %ecx
jne 0x9bf8
leaq 0x418(%rsp), %rdx
movq %rdx, 0x420(%rsp)
movq %rax, 0x410(%rsp)
movq 0x8(%rax), %r13
cmpl $0x46, %ecx
je 0x9b58
cmpl $0x40, %ecx
jne 0x9be2
cmpl $0xd, (%r13)
je 0x9a8c
movq %r15, %rdi
leaq 0xa3f6(%rip), %rsi      # 0x13e7b
xorl %eax, %eax
callq 0xd55c
callq 0xa920
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7359
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 0x9af2
cmpb $0x0, 0x3c(%r13)
jne 0x9ae6
movq %r15, %rdi
leaq 0xab0e(%rip), %rsi      # 0x145e1
xorl %eax, %eax
callq 0xd55c
movq 0x410(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x20(%r13), %rcx
addq 0x10(%rcx), %rax
movq %rax, 0x10(%r13)
movl $0x41, %edi
leaq 0xa3ac(%rip), %rsi      # 0x13eaa
callq 0xafeb
movq 0x20(%r13), %r12
movq 0x410(%rsp), %rax
movq (%rax), %r13
movq 0x10(%rax), %r14
addq $0x20, %rax
movq %rax, 0x410(%rsp)
leaq 0x408(%rsp), %rcx
cmpq %rcx, %rax
jne 0x9b45
leaq 0xaae9(%rip), %rdi      # 0x1461f
xorl %eax, %eax
callq 0xe058
movq 0x410(%rsp), %rax
addq %r14, %r13
movq %r12, 0x8(%rax)
movq %r13, (%rax)
movb $0x0, 0x18(%rax)
jmp 0x9bda
movl (%r13), %eax
addl $-0xf, %eax
cmpl $0x2, %eax
jb 0x9b75
movq %r15, %rdi
leaq 0xa351(%rip), %rsi      # 0x13ebf
xorl %eax, %eax
callq 0xd55c
callq 0xa920
movl $0x4, %edi
leaq 0xa36d(%rip), %rsi      # 0x13ef3
callq 0xafeb
movq %rax, %r12
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0xa149
testb %al, %al
jne 0x9bca
cmpl $0x10, (%r13)
leaq 0xa37a(%rip), %rdx      # 0x13f25
leaq 0x9dd1(%rip), %rax      # 0x13983
cmoveq %rax, %rdx
movq %r15, %rdi
leaq 0xa349(%rip), %rsi      # 0x13f09
movq %r12, %rcx
xorl %eax, %eax
callq 0xd55c
movq %r12, %rdi
callq 0x3250
movq 0x410(%rsp), %rax
movl (%rbp), %ecx
jmp 0x9a5e
movl $0x63, %edi
leaq 0xaa20(%rip), %rsi      # 0x1460e
callq 0xafeb
jmp 0x9d09
movq 0x410(%rsp), %rcx
cmpq %rax, %rcx
je 0x9c8f
leaq -0x20(%rcx), %rax
movq %rax, 0x410(%rsp)
movq -0x18(%rcx), %rdx
movl (%rdx), %esi
cmpl $0xf, %esi
je 0x9c4b
cmpl $0xd, %esi
jne 0x9c68
movq 0x20(%rdx), %rax
movq 0x10(%rax), %rax
addq %rax, -0x10(%rcx)
movq 0x410(%rsp), %rax
movq 0x10(%rax), %r12
cmpq 0x10(%rdx), %r12
jne 0x9cb3
cmpb $0x1, 0x3c(%rdx)
jne 0x9c68
jmp 0x9cb9
movq -0x10(%rcx), %rax
movq 0x28(%rax), %rax
movq %rax, -0x10(%rcx)
movq 0x410(%rsp), %rax
movq 0x10(%rax), %rcx
testq %rcx, %rcx
jne 0x9ca9
movq %rax, %rcx
cmpq 0x408(%rsp), %rax
jne 0x9c09
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0xd55c
movq 0x410(%rsp), %rcx
jmp 0x9c09
movq 0x8(%rax), %rax
movl (%rax), %eax
addl $-0xf, %eax
cmpl $0x1, %eax
ja 0x9d10
leaq 0x8(%rsp), %rdi
callq 0xa096
jmp 0x9d10
movq 0x8(%rcx), %r14
movq 0x18(%rcx), %r12
jmp 0x9cc9
movq 0x20(%rdx), %r14
jmp 0x9cc9
movq 0x20(%rdx), %r14
addq 0x10(%r14), %r12
movq %r12, 0x10(%rdx)
movq 0x10(%rax), %r12
movq (%rax), %r13
addq $0x20, %rax
movq %rax, 0x410(%rsp)
leaq 0x408(%rsp), %rcx
cmpq %rcx, %rax
jne 0x9cfb
leaq 0xa933(%rip), %rdi      # 0x1461f
xorl %eax, %eax
callq 0xe058
movq 0x410(%rsp), %rax
addq %r12, %r13
movq %r14, 0x8(%rax)
movq %r13, (%rax)
movb $0x0, 0x18(%rax)
leaq 0xa934(%rip), %r14      # 0x14644
movl $0x44, %edi
callq 0xb00a
testb %al, %al
je 0x9d98
movl $0x45, %edi
callq 0xb00a
testb %al, %al
jne 0x9e01
movq 0x408(%rsp), %rcx
movq 0x410(%rsp), %rax
cmpq %rax, %rcx
jne 0x9d87
movq 0x8(%rcx), %rax
testb $0x10, 0x4(%rax)
je 0x9d6c
movq %r15, %rdi
leaq 0xa78a(%rip), %rsi      # 0x144e3
xorl %eax, %eax
callq 0xd55c
movq 0x408(%rsp), %rax
movq 0x8(%rax), %rax
cmpl $0xd, (%rax)
jne 0xa058
leaq 0x8(%rsp), %rdi
callq 0xa096
movq 0x410(%rsp), %rax
movq %rax, 0x408(%rsp)
movb $0x1, 0x18(%rax)
jmp 0x9a2c
movq %rbx, %rdi
callq 0x73d0
movq %rax, %r12
movq 0x410(%rsp), %rax
movq 0x8(%rax), %r13
movl (%r13), %eax
leal -0xf(%rax), %ecx
cmpl $0x2, %ecx
jae 0x9dce
movq 0x8(%r12), %rdi
movq %r13, %rsi
callq 0xd8b8
testb %al, %al
je 0x9df5
jmp 0x9e2d
cmpl $0xd, %eax
jne 0x9e32
cmpb $0x1, 0x5(%r12)
jne 0x9df5
movq 0x18(%r12), %r14
cmpl $0x2, (%r14)
jne 0x9df5
movq 0x20(%r13), %rdi
movl 0x4(%rdi), %eax
testb $0x2, %al
jne 0x9f6e
leaq 0x8(%rsp), %rdi
callq 0xa096
jmp 0x9da3
movq 0x410(%rsp), %rax
movq 0x8(%rax), %rax
cmpb $0x1, 0x3c(%rax)
jne 0x9fb6
movq %r15, %rdi
leaq 0xa696(%rip), %rsi      # 0x144b7
xorl %eax, %eax
callq 0xd55c
jmp 0x9fb6
movq %r12, %r14
jmp 0x9e4b
testb $0x10, 0x4(%r13)
je 0xa077
movq %r12, %rdi
movq %r13, %rsi
callq 0x6790
movq %rax, %r14
movq 0x410(%rsp), %rax
xorl %edx, %edx
leaq 0x8(%rsp), %rcx
cmpq %rcx, %rax
jbe 0x9e74
movq -0x18(%rax), %rcx
movl (%rcx), %ecx
addl $-0xf, %ecx
cmpl $0x1, %ecx
ja 0x9e74
movq -0x10(%rax), %rcx
movl 0x20(%rcx), %edx
movq %rdx, (%rsp)
movq (%rax), %r13
movq 0x8(%rax), %rax
movq 0x10(%rax), %r12
addq %r13, %r12
movl $0x28, %edi
callq 0xe142
movq (%rsp), %rsi
movq %r13, (%rax)
movq %r12, 0x8(%rax)
movq %r14, 0x10(%rax)
movl %esi, 0x18(%rax)
movq $0x0, 0x20(%rax)
movq 0x420(%rsp), %rcx
movq (%rcx), %rdx
testq %rdx, %rdx
je 0x9f17
movl %esi, %edi
shrl $0x10, %edi
movswq %si, %rsi
leaq (%rsi,%r13,8), %rsi
shlq $0x3, %r12
movswq %di, %rdi
subq %rdi, %r12
movq 0x8(%rdx), %rdi
shlq $0x3, %rdi
movswq 0x1a(%rdx), %r8
subq %r8, %rdi
cmpq %rsi, %rdi
jbe 0x9f04
movq (%rdx), %r8
movswq 0x18(%rdx), %r9
leaq (%r9,%r8,8), %r8
cmpq %r8, %r12
leaq 0xa747(%rip), %r14      # 0x14644
jbe 0x9f20
cmpq %r12, %rdi
jbe 0x9f43
movq %rdx, %rcx
movq 0x20(%rdx), %rdi
addq $0x20, %rcx
movq %rdi, %rdx
testq %rdi, %rdi
jne 0x9ed2
xorl %edx, %edx
leaq 0xa724(%rip), %r14      # 0x14644
movq %rax, %rsi
addq $0x20, %rsi
movq %rdx, 0x20(%rax)
movq %rax, (%rcx)
movq %rsi, 0x420(%rsp)
movq 0x410(%rsp), %rax
jmp 0xa02b
leaq 0xa6fa(%rip), %r14      # 0x14644
movq 0x20(%rdx), %rdx
testq %rdx, %rdx
je 0x9f6a
movq 0x8(%rdx), %rsi
shlq $0x3, %rsi
movswq 0x1a(%rdx), %rdi
subq %rdi, %rsi
cmpq %r12, %rsi
jbe 0x9f4a
jmp 0x9f20
xorl %edx, %edx
jmp 0x9f20
movq 0x8(%r14), %rcx
movq 0x20(%rcx), %rsi
testb $0x1, %al
je 0x9f80
testb $0x1, 0x4(%rsi)
jne 0x9f9a
callq 0xd8b8
testb %al, %al
jne 0x9f9a
movq %r15, %rdi
leaq 0xa5d4(%rip), %rsi      # 0x14567
xorl %eax, %eax
callq 0xd55c
cmpb $0x1, 0x3c(%r13)
jne 0x9e4b
movq 0x8(%r14), %rax
movq 0x10(%rax), %rax
movq %rax, 0x10(%r13)
jmp 0x9e4b
cmpq $0x0, 0x408(%rsp)
je 0xa03e
movl (%rbp), %eax
cmpl $0x45, %eax
je 0x9ff0
cmpl $0x6e, %eax
jne 0x9fdf
callq 0xa920
cmpl $0x45, (%rbp)
jne 0x9a24
jmp 0x9ff0
movq %r15, %rdi
leaq 0xa5d2(%rip), %rsi      # 0x145bb
xorl %eax, %eax
callq 0xd55c
callq 0xa920
movq 0x408(%rsp), %rax
movq %rax, 0x410(%rsp)
movq %rax, %rcx
leaq 0x8(%rsp), %rdx
cmpq %rdx, %rcx
je 0xa021
leaq -0x20(%rcx), %rdx
cmpb $0x1, -0x8(%rcx)
movq %rdx, %rcx
jne 0xa008
jmp 0xa023
xorl %edx, %edx
movq %rdx, 0x408(%rsp)
movq 0x8(%rax), %rax
cmpb $0x1, 0x3c(%rax)
jne 0x9fb6
movb $0x0, 0x3c(%rax)
jmp 0x9fb6
movq 0x418(%rsp), %rax
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa4ac(%rip), %rdi      # 0x1450b
leaq 0xa4c4(%rip), %rsi      # 0x1452a
leaq 0xa4c4(%rip), %rcx      # 0x14531
movl $0xe7, %edx
callq 0x30e0
leaq 0xa528(%rip), %rdi      # 0x145a6
leaq 0xa4a5(%rip), %rsi      # 0x1452a
leaq 0xa4a5(%rip), %rcx      # 0x14531
movl $0x102, %edx            # imm = 0x102
callq 0x30e0