// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4f10
testb $0x1, %al
jne 0x4627
jmp 0x4630
movb $0x1, -0x1(%rbp)
jmp 0x4ef6
xorl %eax, %eax
movl %eax, %edi
xorl %esi, %esi
callq 0x3360
testb $0x1, %al
jne 0x4641
jmp 0x465a
movl $0x61, %edi
callq 0xd910
testb $0x1, %al
jne 0x4651
jmp 0x465a
movb $0x1, -0x1(%rbp)
jmp 0x4ef6
movq -0x10(%rbp), %rsi
leaq -0xc8(%rbp), %rdi
leaq -0x58(%rbp), %rdx
leaq -0x5c(%rbp), %rcx
leaq -0xac(%rbp), %r8
callq 0x3a30
movq -0xc8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x46aa
movb $0x0, -0x1(%rbp)
jmp 0x4ef6
cmpq $0x0, -0x18(%rbp)
je 0x46d2
cmpl $0x40, -0x58(%rbp)
jne 0x46d0
leaq 0x1daea(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x13c3b(%rip), %rsi     # 0x18304
movb $0x0, %al
callq 0x11190
jmp 0x471c
movl -0x58(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x46f6
leaq 0x1dac4(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x13c69(%rip), %rsi     # 0x18358
movb $0x0, %al
callq 0x11190
movl -0x58(%rbp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x471a
leaq 0x1daa0(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x13c72(%rip), %rsi     # 0x18385
movb $0x0, %al
callq 0x11190
jmp 0x471c
movl $0x61, %edi
callq 0xd910
testb $0x1, %al
jne 0x472c
jmp 0x4735
movb $0x1, -0x1(%rbp)
jmp 0x4ef6
jmp 0x4737
movq -0x10(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
leaq -0x30(%rbp), %rax
leaq -0x78(%rbp), %rdx
leaq -0xa8(%rbp), %rcx
xorl %r8d, %r8d
movq (%rax), %r9
movq %r9, (%rsp)
movq 0x8(%rax), %r9
movq %r9, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x42f0
movq -0xe0(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0xd8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0xd0(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0x40(%rbp), %eax
movl %eax, -0x54(%rbp)
movl $0x3e, %edi
callq 0xd910
testb $0x1, %al
jne 0x47b1
jmp 0x47f4
movl $0x42, %edi
leaq 0x13bf9(%rip), %rsi     # 0x183b6
callq 0xd8d0
movl $0x7, %edi
leaq 0x13bf6(%rip), %rsi     # 0x183c4
callq 0xd8d0
movq %rax, -0x80(%rbp)
movl $0x43, %edi
leaq 0x13bf4(%rip), %rsi     # 0x183d7
callq 0xd8d0
movl $0x0, -0x84(%rbp)
jmp 0x47fc
movq $0x0, -0x80(%rbp)
movl -0x58(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x4811
xorl %eax, %eax
movl %eax, -0xe4(%rbp)
jmp 0x482d
movq -0x50(%rbp), %rax
movl (%rax), %edx
movl $0x1, %eax
movl $0x2, %ecx
cmpl $0xe, %edx
cmovel %ecx, %eax
movl %eax, -0xe4(%rbp)
movl -0xe4(%rbp), %eax
movl %eax, -0x9c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x78(%rbp), %rsi
xorl %edx, %edx
callq 0xfef0
movq %rax, -0x98(%rbp)
cmpq $0x0, -0x98(%rbp)
je 0x4888
movq -0x98(%rbp), %rax
movl 0x8(%rax), %eax
cmpl -0x9c(%rbp), %eax
je 0x4888
movq -0x78(%rbp), %rdx
leaq 0x1d932(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x13b6b(%rip), %rsi     # 0x183ec
movb $0x0, %al
callq 0x11190
movl -0x9c(%rbp), %eax
movl %eax, -0xe8(%rbp)
testl %eax, %eax
je 0x48bf
jmp 0x489a
movl -0xe8(%rbp), %eax
subl $0x1, %eax
je 0x4992
jmp 0x48ab
movl -0xe8(%rbp), %eax
subl $0x2, %eax
je 0x4c45
jmp 0x4ec0
cmpl $0x0, -0xac(%rbp)
je 0x48e5
movq -0x78(%rbp), %rdx
leaq 0x1d8d5(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x13b32(%rip), %rsi     # 0x18410
movb $0x0, %al
callq 0x11190
cmpq $0x0, -0x80(%rbp)
je 0x4909
movq -0x78(%rbp), %rdx
leaq 0x1d8b1(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x13b3d(%rip), %rsi     # 0x1843f
movb $0x0, %al
callq 0x11190
cmpq $0x0, -0x98(%rbp)
jne 0x4945
movq -0x10(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0x78(%rbp), %rdi
movq -0x50(%rbp), %rdx
movl -0x54(%rbp), %ecx
xorl %r8d, %r8d
movl %r8d, %esi
callq 0x38c0
movq -0xf0(%rbp), %rdi
movq %rax, %rsi
callq 0xfd90
jmp 0x498d
movq -0x98(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x50(%rbp), %rsi
callq 0x11ab0
testb $0x1, %al
jne 0x495f
jmp 0x496e
movq -0x98(%rbp), %rax
movl 0x18(%rax), %eax
cmpl -0x54(%rbp), %eax
je 0x498b
movq -0x78(%rbp), %rdx
leaq 0x1d82f(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x13ae6(%rip), %rsi     # 0x1846a
movb $0x0, %al
callq 0x11190
jmp 0x498d
jmp 0x4ec0
cmpl $0x0, -0xac(%rbp)
je 0x49d5
movl -0xac(%rbp), %eax
movq -0x50(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x49d5
movq -0x78(%rbp), %rdx
movq -0x50(%rbp), %rax
movl 0x8(%rax), %ecx
movl -0xac(%rbp), %r8d
leaq 0x1d7e5(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x13ac7(%rip), %rsi     # 0x18495
movb $0x0, %al
callq 0x11190
movq -0x10(%rbp), %rdi
movl -0x9c(%rbp), %esi
movq -0x78(%rbp), %rdx
movq -0x80(%rbp), %rcx
movq -0x50(%rbp), %r8
movl -0x54(%rbp), %r9d
movl -0x58(%rbp), %r10d
movq -0x98(%rbp), %rax
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x5010
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
movl 0x40(%rax), %eax
cmpl -0xac(%rbp), %eax
jge 0x4a31
movl -0xac(%rbp), %ecx
movq -0x90(%rbp), %rax
movl %ecx, 0x40(%rax)
movq -0x90(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jne 0x4a5c
movl -0x58(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
jne 0x4a5c
movq -0x90(%rbp), %rax
movl $0x2, 0x44(%rax)
jmp 0x4ade
movl -0x58(%rbp), %edx
andl $0x40, %edx
xorl %ecx, %ecx
movl $0x1, %eax
cmpl $0x0, %edx
cmovnel %eax, %ecx
movq -0x90(%rbp), %rax
movl %ecx, 0x44(%rax)
movq -0x50(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x4ac4
movq -0x78(%rbp), %rdx
movq -0x90(%rbp), %rax
movl 0x44(%rax), %esi
leaq 0x164ad(%rip), %rcx     # 0x1af4a
leaq 0x13a8a(%rip), %rax     # 0x1852e
cmpl $0x0, %esi
cmoveq %rax, %rcx
leaq 0x1d6f6(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x13a29(%rip), %rsi     # 0x184e6
movb $0x0, %al
callq 0x11190
movq -0x90(%rbp), %rdi
callq 0x12c00
movq %rax, %rcx
movq -0x90(%rbp), %rax
movq %rcx, 0x20(%rax)
cmpq $0x0, -0x20(%rbp)
je 0x4af2
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x13fe0
movq $0x0, -0x68(%rbp)
movb $0x0, -0x69(%rbp)
movl $0x63, %edi
callq 0xd910
testb $0x1, %al
jne 0x4b11
jmp 0x4ba9
cmpq $0x0, -0x18(%rbp)
je 0x4b61
movq -0x90(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x4b61
movq -0x78(%rbp), %rdx
movq -0x90(%rbp), %rax
movl 0xc(%rax), %esi
leaq 0x13a48(%rip), %rcx     # 0x18582
leaq 0x13a38(%rip), %rax     # 0x18579
cmpl $0x2, %esi
cmoveq %rax, %rcx
leaq 0x1d659(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x139db(%rip), %rsi     # 0x18535
movb $0x0, %al
callq 0x11190
movq -0x90(%rbp), %rax
testb $0x1, 0x30(%rax)
je 0x4b8b
movq -0x78(%rbp), %rdx
leaq 0x1d62f(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x13a07(%rip), %rsi     # 0x1858b
movb $0x0, %al
callq 0x11190
movq -0x10(%rbp), %rdi
movq -0x90(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0xbee0
movq %rax, -0x68(%rbp)
movb $0x1, -0x69(%rbp)
jmp 0x4c24
movl -0x58(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x4bb9
jmp 0x4ec0
movq -0x90(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x4c20
movq -0x90(%rbp), %rax
cmpl $0x0, 0x44(%rax)
jne 0x4c20
movq -0x90(%rbp), %rax
testb $0x1, 0x30(%rax)
jne 0x4c1b
movq -0x90(%rbp), %rax
testb $0x1, 0x31(%rax)
jne 0x4c1b
movq -0x90(%rbp), %rax
movb $0x1, 0x31(%rax)
movq -0x90(%rbp), %rcx
movq 0x1c53a(%rip), %rax     # 0x21140
movq %rcx, (%rax)
movq -0x90(%rbp), %rax
addq $0x38, %rax
movq %rax, 0x1c525(%rip)     # 0x21140
jmp 0x4ec0
jmp 0x4c22
jmp 0x4c24
movq -0x90(%rbp), %rdi
movq -0x68(%rbp), %rsi
movb -0x69(%rbp), %al
movq -0x18(%rbp), %rcx
andb $0x1, %al
movzbl %al, %edx
callq 0x5390
jmp 0x4ec0
cmpl $0x0, -0xac(%rbp)
je 0x4c6b
movq -0x78(%rbp), %rdx
leaq 0x1d54f(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x1393d(%rip), %rsi     # 0x185a1
movb $0x0, %al
callq 0x11190
cmpq $0x0, -0x18(%rbp)
je 0x4c9b
cmpl $0x0, -0x58(%rbp)
je 0x4c9b
cmpl $0x4, -0x58(%rbp)
je 0x4c9b
movq -0x78(%rbp), %rdx
leaq 0x1d51f(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x1393d(%rip), %rsi     # 0x185d1
movb $0x0, %al
callq 0x11190
movq -0x10(%rbp), %rdi
movl -0x9c(%rbp), %esi
movq -0x78(%rbp), %rdx
movq -0x80(%rbp), %rcx
movq -0x50(%rbp), %r8
movl -0x54(%rbp), %r9d
movl -0x58(%rbp), %r10d
movq -0x98(%rbp), %rax
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x5010
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rdi
callq 0x12c00
movq %rax, %rcx
movq -0x90(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x90(%rbp), %rcx
xorl %eax, %eax
cmpl $0x2, 0xc(%rcx)
movb %al, -0xf1(%rbp)
jne 0x4d58
movl -0x5c(%rbp), %ecx
andl $0x2, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0xf1(%rbp)
je 0x4d58
movl -0x58(%rbp), %ecx
andl $0x4, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0xf1(%rbp)
jne 0x4d58
movb $0x1, %al
cmpq $0x0, -0x98(%rbp)
movb %al, -0xf2(%rbp)
je 0x4d4c
movq -0x98(%rbp), %rax
movb 0x40(%rax), %al
movb %al, -0xf2(%rbp)
movb -0xf2(%rbp), %al
movb %al, -0xf1(%rbp)
movb -0xf1(%rbp), %cl
movq -0x90(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x40(%rax)
movl -0x5c(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
setne %cl
movq -0x90(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x41(%rax)
leaq 0x1d41d(%rip), %rax     # 0x221a8
cmpl $0x44, (%rax)
jne 0x4ea6
cmpl $0x0, -0x84(%rbp)
jne 0x4db6
leaq 0x1d404(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x13866(%rip), %rsi     # 0x18615
movb $0x0, %al
callq 0x11190
movq -0x90(%rbp), %rax
testb $0x1, 0x30(%rax)
je 0x4de0
movq -0x78(%rbp), %rdx
leaq 0x1d3da(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x1385c(%rip), %rsi     # 0x18635
movb $0x0, %al
callq 0x11190
cmpq $0x0, -0xa8(%rbp)
je 0x4dec
jmp 0x4e0b
leaq 0x1385a(%rip), %rdi     # 0x1864d
leaq 0x1385d(%rip), %rsi     # 0x18657
movl $0x449, %edx            # imm = 0x449
leaq 0x13858(%rip), %rcx     # 0x1865e
callq 0x30f0
movq -0xa8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x90(%rbp), %rdi
movq -0x78(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq -0x10(%rbp), %rcx
callq 0x12d00
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x100b0
movq -0x90(%rbp), %rax
testb $0x1, 0x41(%rax)
je 0x4e55
movq -0x18(%rbp), %rdi
callq 0x13f20
movq -0x90(%rbp), %rax
testb $0x1, 0x40(%rax)
jne 0x4e7f
movq -0x18(%rbp), %rdi
movq -0x90(%rbp), %rax
cmpl $0x2, 0xc(%rax)
sete %al
movzbl %al, %esi
andl $0x1, %esi
callq 0x160e0
movq -0x10(%rbp), %rdi
callq 0xfe90
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rdi
callq 0x13840
movq -0x90(%rbp), %rax
movb $0x1, 0x30(%rax)
movb $0x1, -0x1(%rbp)
jmp 0x4ef6
cmpq $0x0, -0xa8(%rbp)
je 0x4ebc
movq -0xa8(%rbp), %rdi
callq 0xfe90
jmp 0x4ebe
jmp 0x4ec0
movl $0x61, %edi
callq 0xd910
testb $0x1, %al
jne 0x4ed0
jmp 0x4ed6
movb $0x1, -0x1(%rbp)
jmp 0x4ef6
movl $0x6e, %edi
leaq 0x137a6(%rip), %rsi     # 0x18688
callq 0xd8d0
movl $0x0, -0x84(%rbp)
jmp 0x4737
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nopw %cs:(%rax,%rax)