// File: /workspace/github_c_makefile_star2_O1/michaelforney[P]cproc/decl.c
// Function: decl
bool
decl(struct scope *s, struct func *f)
{
	struct qualtype base, qt;
	struct type *t;
	enum typequal tq;
	enum storageclass sc;
	enum funcspec fs;
	struct init *init;
	bool hasinit;
	char *name, *asmname;
	int allowfunc = !f;
	struct decl *d, *prior;
	enum declkind kind;
	struct scope *funcscope;
	int align;

	if (staticassert(s))
		return true;
	if (attr(NULL, 0) && consume(TSEMICOLON))
		return true;
	base = declspecs(s, &sc, &fs, &align);
	if (!base.type)
		return false;
	if (f) {
		if (sc == SCTHREADLOCAL)
			error(&tok.loc, "block scope declaration containing 'thread_local' must contain 'static' or 'extern'");
	} else {
		/* 6.9p2 */
		if (sc & SCAUTO)
			error(&tok.loc, "external declaration must not contain 'auto'");
		if (sc & SCREGISTER)
			error(&tok.loc, "external declaration must not contain 'register'");
	}
	if (consume(TSEMICOLON)) {
		/* XXX 6.7p2 error unless in function parameter/struct/union, or tag/enum members are declared */
		return true;
	}
	for (;;) {
		qt = declarator(s, base, &name, &funcscope, false);
		t = qt.type;
		tq = qt.qual;
		if (consume(T__ASM__)) {
			expect(TLPAREN, "after __asm__");
			asmname = expect(TSTRINGLIT, "for assembler name");
			expect(TRPAREN, "after assembler name");
			allowfunc = 0;
		} else {
			asmname = NULL;
		}
		kind = sc & SCTYPEDEF ? DECLTYPE : t->kind == TYPEFUNC ? DECLFUNC : DECLOBJECT;
		prior = scopegetdecl(s, name, false);
		if (prior && prior->kind != kind)
			error(&tok.loc, "'%s' redeclared with different kind", name);
		switch (kind) {
		case DECLTYPE:
			if (align)
				error(&tok.loc, "typedef '%s' declared with alignment specifier", name);
			if (asmname)
				error(&tok.loc, "typedef '%s' declared with assembler label", name);
			if (!prior)
				scopeputdecl(s, mkdecl(name, DECLTYPE, t, tq, LINKNONE));
			else if (!typesame(prior->type, t) || prior->qual != tq)
				error(&tok.loc, "typedef '%s' redefined with different type", name);
			break;
		case DECLOBJECT:
			if (align && align < t->align)
				error(&tok.loc, "object '%s' requires alignment %d, which is stricter than specified alignment %d", name, t->align, align);
			d = declcommon(s, kind, name, asmname, t, tq, sc, prior);
			if (d->u.obj.align < align)
				d->u.obj.align = align;
			if (d->linkage == LINKNONE && !(sc & SCSTATIC)) {
				d->u.obj.storage = SDAUTO;
			} else {
				d->u.obj.storage = sc & SCTHREADLOCAL ? SDTHREAD : SDSTATIC;
				if (t->prop & PROPVM)
					error(&tok.loc, "object '%s' with %s storage duration cannot have variably modified type", name, d->u.obj.storage == SDSTATIC ? "static" : "thread");
				d->value = mkglobal(d);
			}

			if (base.expr)
				funcexpr(f, base.expr);
			init = NULL;
			hasinit = false;
			if (consume(TASSIGN)) {
				if (f && d->linkage != LINKNONE)
					error(&tok.loc, "object '%s' with block scope and %s linkage cannot have initializer", name, d->linkage == LINKEXTERN ? "external" : "internal");
				if (d->defined)
					error(&tok.loc, "object '%s' redefined", name);
				init = parseinit(s, d->type);
				hasinit = true;
			} else if (sc & SCEXTERN) {
				break;
			} else if (d->linkage != LINKNONE && d->u.obj.storage == SDSTATIC) {
				if (!d->defined && !d->tentative) {
					d->tentative = true;
					*tentativedefnsend = d;
					tentativedefnsend = &d->next;
				}
				break;
			}
			defineobj(d, init, hasinit, f);
			break;
		case DECLFUNC:
			if (align)
				error(&tok.loc, "function '%s' declared with alignment specifier", name);
			if (f && sc && sc != SCEXTERN)  /* 6.7.1p7 */
				error(&tok.loc, "function '%s' with block scope may only have storage class 'extern'", name);
			d = declcommon(s, kind, name, asmname, t, tq, sc, prior);
			d->value = mkglobal(d);
			d->u.func.inlinedefn = d->linkage == LINKEXTERN && fs & FUNCINLINE && !(sc & SCEXTERN) && (!prior || prior->u.func.inlinedefn);
			d->u.func.isnoreturn = fs & FUNCNORETURN;
			if (tok.kind == TLBRACE) {
				if (!allowfunc)
					error(&tok.loc, "function definition not allowed");
				if (d->defined)
					error(&tok.loc, "function '%s' redefined", name);
				/* re-open scope from function declarator */
				assert(funcscope);
				s = funcscope;
				f = mkfunc(d, name, t, s);
				stmt(f, s);
				if (d->u.func.isnoreturn)
					funchlt(f);
				/* XXX: need to keep track of function in case a later declaration specifies extern */
				if (!d->u.func.inlinedefn)
					emitfunc(f, d->linkage == LINKEXTERN);
				s = delscope(s);
				delfunc(f);
				d->defined = true;
				return true;
			} else if (funcscope) {
				delscope(funcscope);
			}
			break;
		}
		if (consume(TSEMICOLON))
			return true;
		expect(TCOMMA, "or ';' after declarator");
		allowfunc = 0;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %r15
movq %rsi, 0x20(%rsp)
testq %rsi, %rsi
setne %r14b
callq 0x52ce
movb $0x1, %bpl
testb %al, %al
jne 0x529e
xorl %edi, %edi
xorl %esi, %esi
callq 0x33ec
testb %al, %al
je 0x4ce1
movl $0x61, %edi
callq 0xb099
testb %al, %al
jne 0x529e
leaq 0x38(%rsp), %rbx
leaq 0xc(%rsp), %rdx
leaq 0x2c(%rsp), %rcx
leaq 0x28(%rsp), %r8
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3912
cmpq $0x0, (%rbx)
je 0x4d20
movl 0xc(%rsp), %eax
cmpq $0x0, 0x20(%rsp)
je 0x4d27
cmpl $0x40, %eax
jne 0x4d64
leaq 0xd45a(%rip), %rsi      # 0x12178
jmp 0x4d52
xorl %ebp, %ebp
jmp 0x529e
testb $0x10, %al
je 0x4d44
leaq 0x173d6(%rip), %rdi     # 0x1c108
addq $0x8, %rdi
leaq 0xd48f(%rip), %rsi      # 0x121cc
xorl %eax, %eax
callq 0xd56a
testb $0x20, 0xc(%rsp)
je 0x4d64
leaq 0xd4a7(%rip), %rsi      # 0x121f9
leaq 0x173af(%rip), %rdi     # 0x1c108
addq $0x8, %rdi
xorl %eax, %eax
callq 0xd56a
movl $0x61, %edi
callq 0xb099
testb %al, %al
jne 0x529e
leaq 0x1738b(%rip), %rax     # 0x1c108
addq $0x8, %rax
movq %rax, 0x18(%rsp)
subq $0x20, %rsp
movq 0x68(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x58(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
leaq 0x30(%rsp), %rdx
leaq 0x50(%rsp), %rcx
xorl %r8d, %r8d
callq 0x4ab2
addq $0x20, %rsp
movq 0x50(%rsp), %rbp
movl 0x58(%rsp), %r13d
movl $0x3e, %edi
callq 0xb099
testb %al, %al
je 0x4e10
movl $0x42, %edi
leaq 0xd44b(%rip), %rsi      # 0x1222a
callq 0xb07a
movl $0x7, %edi
leaq 0xd448(%rip), %rsi      # 0x12238
callq 0xb07a
movq %rax, %r14
movl $0x43, %edi
leaq 0xd447(%rip), %rsi      # 0x1224b
callq 0xb07a
movb $0x1, 0xb(%rsp)
jmp 0x4e18
movb %r14b, 0xb(%rsp)
xorl %r14d, %r14d
xorl %r12d, %r12d
testb $0x2, 0xc(%rsp)
jne 0x4e30
xorl %r12d, %r12d
cmpl $0xe, (%rbp)
sete %r12b
incl %r12d
movq 0x10(%rsp), %rsi
movq %r15, %rdi
xorl %edx, %edx
callq 0xc6f9
movq %rax, %rbx
testq %rax, %rax
je 0x4e65
cmpl %r12d, 0x8(%rbx)
je 0x4e65
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rdi
leaq 0xd402(%rip), %rsi      # 0x12260
xorl %eax, %eax
callq 0xd56a
movl 0x28(%rsp), %r8d
cmpl $0x2, %r12d
je 0x4ef8
cmpl $0x1, %r12d
jne 0x4fbf
testl %r8d, %r8d
je 0x4ea3
movl 0x8(%rbp), %ecx
cmpl %ecx, %r8d
jge 0x4ea3
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rdi
leaq 0xd46d(%rip), %rsi      # 0x12309
xorl %eax, %eax
callq 0xd56a
movq 0x10(%rsp), %rdx
movl 0xc(%rsp), %eax
movq %r15, %rdi
movl $0x1, %esi
movq %r14, %rcx
movq %rbp, %r8
movl %r13d, %r9d
pushq %rbx
pushq %rax
callq 0x53b6
addq $0x10, %rsp
movq %rax, %rbx
movl 0x28(%rsp), %eax
cmpl %eax, 0x40(%rbx)
jge 0x4ed7
movl %eax, 0x40(%rbx)
cmpl $0x0, 0xc(%rbx)
jne 0x5039
testb $0x8, 0xc(%rsp)
jne 0x5039
movl $0x2, 0x44(%rbx)
jmp 0x5084
testl %r8d, %r8d
je 0x4f15
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rdi
leaq 0xd507(%rip), %rsi      # 0x12415
xorl %eax, %eax
callq 0xd56a
cmpq $0x0, 0x20(%rsp)
je 0x4f3e
movl 0xc(%rsp), %eax
andl $-0x5, %eax
je 0x4f3e
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rdi
leaq 0xd50e(%rip), %rsi      # 0x12445
xorl %eax, %eax
callq 0xd56a
movq 0x10(%rsp), %rdx
movl 0xc(%rsp), %eax
movq %r15, %rdi
movl $0x2, %esi
movq %r14, %rcx
movq %rbp, %r8
movl %r13d, %r9d
pushq %rbx
pushq %rax
callq 0x53b6
addq $0x10, %rsp
movq %rax, %r14
movq %rax, %rdi
callq 0xe328
movq %rax, 0x20(%r14)
cmpl $0x2, 0xc(%r14)
jne 0x4f84
testb $0x2, 0x2c(%rsp)
jne 0x51a7
xorl %eax, %eax
movb %al, 0x40(%r14)
movb 0x2c(%rsp), %al
shrb $0x2, %al
andb $0x1, %al
movb %al, 0x41(%r14)
leaq 0x1716a(%rip), %rax     # 0x1c108
cmpl $0x44, (%rax)
je 0x51f9
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x5180
callq 0xc6b9
jmp 0x5180
testl %r8d, %r8d
je 0x4fdc
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rdi
leaq 0xd2af(%rip), %rsi      # 0x12284
xorl %eax, %eax
callq 0xd56a
testq %r14, %r14
je 0x4ff9
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rdi
leaq 0xd2c1(%rip), %rsi      # 0x122b3
xorl %eax, %eax
callq 0xd56a
testq %rbx, %rbx
je 0x513f
movq 0x10(%rbx), %rdi
movq %rbp, %rsi
callq 0xd9be
testb %al, %al
je 0x501c
cmpl %r13d, 0x18(%rbx)
je 0x5180
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rdi
leaq 0xd2b1(%rip), %rsi      # 0x122de
xorl %eax, %eax
callq 0xd56a
jmp 0x5180
movl 0xc(%rsp), %eax
shrl $0x6, %eax
andl $0x1, %eax
movl %eax, 0x44(%rbx)
testb $0x40, 0x4(%rbp)
je 0x5078
movq 0x10(%rsp), %rdx
testl %eax, %eax
leaq 0xfab2(%rip), %rcx      # 0x14b0c
leaq 0xd341(%rip), %rax      # 0x123a2
cmoveq %rax, %rcx
movq 0x18(%rsp), %rdi
leaq 0xd2e9(%rip), %rsi      # 0x1235a
xorl %eax, %eax
callq 0xd56a
movq %rbx, %rdi
callq 0xe328
movq %rax, 0x20(%rbx)
movq 0x48(%rsp), %rsi
testq %rsi, %rsi
je 0x5098
movq 0x20(%rsp), %rdi
callq 0xf240
movl $0x63, %edi
callq 0xb099
movl %eax, %ebp
testb %al, %al
je 0x5113
cmpq $0x0, 0x20(%rsp)
je 0x50e4
movl 0xc(%rbx), %eax
testl %eax, %eax
je 0x50e4
movq 0x10(%rsp), %rdx
cmpl $0x2, %eax
leaq 0xd330(%rip), %rcx      # 0x123f6
leaq 0xd320(%rip), %rax      # 0x123ed
cmoveq %rax, %rcx
movq 0x18(%rsp), %rdi
leaq 0xd2cc(%rip), %rsi      # 0x123a9
xorl %eax, %eax
callq 0xd56a
cmpb $0x1, 0x30(%rbx)
jne 0x5102
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rdi
leaq 0xd304(%rip), %rsi      # 0x123ff
xorl %eax, %eax
callq 0xd56a
movq 0x10(%rbx), %rsi
movq %r15, %rdi
callq 0x9b1d
movq %rax, %rsi
jmp 0x512c
testb $0x4, 0xc(%rsp)
jne 0x5180
cmpl $0x0, 0xc(%rbx)
je 0x512a
cmpl $0x0, 0x44(%rbx)
je 0x51ca
xorl %esi, %esi
movzbl %bpl, %edx
movq %rbx, %rdi
movq 0x20(%rsp), %rcx
callq 0x5708
jmp 0x5180
movq 0x10(%rsp), %rbx
movl $0x48, %edi
callq 0xe13e
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
xorl %ecx, %ecx
movq %rcx, 0x40(%rax)
movq %rbx, (%rax)
movq %rcx, 0x8(%rax)
movq %rbp, 0x10(%rax)
movl %r13d, 0x18(%rax)
movq %r15, %rdi
movq %rax, %rsi
callq 0xc628
movl $0x61, %edi
callq 0xb099
testb %al, %al
jne 0x51f1
movl $0x6e, %edi
leaq 0xd362(%rip), %rsi      # 0x124fc
callq 0xb07a
movb $0x1, %r14b
jmp 0x4d86
testq %rbx, %rbx
sete %cl
movl 0xc(%rsp), %edx
andl $0x4, %edx
sete %al
shrl $0x2, %edx
orb %cl, %dl
jne 0x4f86
movb 0x40(%rbx), %al
jmp 0x4f86
cmpb $0x0, 0x30(%rbx)
jne 0x5180
cmpb $0x0, 0x31(%rbx)
jne 0x5180
movb $0x1, 0x31(%rbx)
movq 0x15f5f(%rip), %rax     # 0x1b140
movq %rbx, (%rax)
addq $0x38, %rbx
movq %rbx, 0x15f51(%rip)     # 0x1b140
jmp 0x5180
movb $0x1, %bpl
jmp 0x529e
testb $0x1, 0xb(%rsp)
je 0x5213
leaq 0xd282(%rip), %rsi      # 0x12489
movq 0x18(%rsp), %rdi
xorl %eax, %eax
callq 0xd56a
cmpb $0x1, 0x30(%r14)
jne 0x5232
movq 0x10(%rsp), %rdx
leaq 0xd283(%rip), %rsi      # 0x124a9
movq 0x18(%rsp), %rdi
xorl %eax, %eax
callq 0xd56a
movq 0x30(%rsp), %rbx
testq %rbx, %rbx
je 0x52af
movq 0x10(%rsp), %rsi
movq %r14, %rdi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0xe39b
movq %rax, %r15
movq %rax, %rdi
movq %rbx, %rsi
callq 0xc814
cmpb $0x1, 0x41(%r14)
jne 0x526c
movq %r15, %rdi
callq 0xf18a
cmpb $0x0, 0x40(%r14)
movb $0x1, %bpl
jne 0x5289
xorl %esi, %esi
cmpl $0x2, 0xc(%r14)
sete %sil
movq %r15, %rdi
callq 0x109df
movq %rbx, %rdi
callq 0xc6b9
movq %r15, %rdi
callq 0xed57
movb $0x1, 0x30(%r14)
movl %ebp, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd20b(%rip), %rdi      # 0x124c1
leaq 0xd20e(%rip), %rsi      # 0x124cb
leaq 0xd20e(%rip), %rcx      # 0x124d2
movl $0x449, %edx            # imm = 0x449
callq 0x30e0