// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]cproc/decl.c
// Function: declcommon
static struct decl *
declcommon(struct scope *s, enum declkind kind, char *name, char *asmname, struct type *t, enum typequal tq, enum storageclass sc, struct decl *prior)
{
	struct decl *d;
	enum linkage linkage;
	const char *kindstr = kind == DECLFUNC ? "function" : "object";

	if (prior) {
		if (prior->linkage == LINKNONE)
			error(&tok.loc, "%s '%s' with no linkage redeclared", kindstr, name);
		linkage = getlinkage(kind, sc, prior, s == &filescope);
		if (prior->linkage != linkage)
			error(&tok.loc, "%s '%s' redeclared with different linkage", kindstr, name);
		if (!typecompatible(t, prior->type) || tq != prior->qual)
			error(&tok.loc, "%s '%s' redeclared with incompatible type", kindstr, name);
		if (asmname && (!prior->asmname || strcmp(prior->asmname, asmname) != 0))
			error(&tok.loc, "%s '%s' redeclared with different assembler name", kindstr, name);
		prior->type = typecomposite(t, prior->type);
		return prior;
	}
	if (s->parent)
		prior = scopegetdecl(s->parent, name, true);
	linkage = getlinkage(kind, sc, prior, s == &filescope);
	if (linkage != LINKNONE && s->parent) {
		/* XXX: should maintain map of identifiers with linkage to their declaration, and use that */
		if (s->parent != &filescope)
			prior = scopegetdecl(&filescope, name, false);
		if (prior && prior->linkage != LINKNONE) {
			if (prior->kind != kind)
				error(&tok.loc, "'%s' redeclared with different kind", name);
			if (prior->linkage != linkage)
				error(&tok.loc, "%s '%s' redeclared with different linkage", kindstr, name);
			if (!typecompatible(t, prior->type) || tq != prior->qual)
				error(&tok.loc, "%s '%s' redeclared with incompatible type", kindstr, name);
			if (!asmname)
				asmname = prior->asmname;
			else if (!prior->asmname || strcmp(prior->asmname, asmname) != 0)
				error(&tok.loc, "%s '%s' redeclared with different assembler name", kindstr, name);
			t = typecomposite(t, prior->type);
		}
	}
	d = mkdecl(name, kind, t, tq, linkage);
	d->asmname = asmname;
	scopeputdecl(s, d);
	return d;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq 0x18(%rbp), %rax
movl 0x10(%rbp), %eax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movl %r9d, -0x34(%rbp)
movl -0x14(%rbp), %edx
leaq 0x173ea(%rip), %rax     # 0x1c42a
leaq 0x14cc0(%rip), %rcx     # 0x19d07
cmpl $0x2, %edx
cmoveq %rcx, %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, 0x18(%rbp)
je 0x5191
movq 0x18(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jne 0x5088
movq -0x50(%rbp), %rdx
movq -0x20(%rbp), %rcx
leaq 0x1d132(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x13fd2(%rip), %rsi     # 0x19053
movb $0x0, %al
callq 0x11190
movl -0x14(%rbp), %edi
movl 0x10(%rbp), %esi
movq 0x18(%rbp), %rdx
leaq 0x1d0a7(%rip), %rax     # 0x22140
cmpq %rax, -0x10(%rbp)
sete %al
movzbl %al, %ecx
andl $0x1, %ecx
callq 0x6f80
movl %eax, -0x44(%rbp)
movq 0x18(%rbp), %rax
movl 0xc(%rax), %eax
cmpl -0x44(%rbp), %eax
je 0x50db
movq -0x50(%rbp), %rdx
movq -0x20(%rbp), %rcx
leaq 0x1d0df(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x13fa2(%rip), %rsi     # 0x19076
movb $0x0, %al
callq 0x11190
movq -0x30(%rbp), %rdi
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x11890
testb $0x1, %al
jne 0x50f2
jmp 0x50fe
movl -0x34(%rbp), %eax
movq 0x18(%rbp), %rcx
cmpl 0x18(%rcx), %eax
je 0x511f
movq -0x50(%rbp), %rdx
movq -0x20(%rbp), %rcx
leaq 0x1d09b(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x13f88(%rip), %rsi     # 0x190a0
movb $0x0, %al
callq 0x11190
cmpq $0x0, -0x28(%rbp)
je 0x5168
movq 0x18(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x5147
movq 0x18(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x3160
cmpl $0x0, %eax
je 0x5168
movq -0x50(%rbp), %rdx
movq -0x20(%rbp), %rcx
leaq 0x1d052(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x13f69(%rip), %rsi     # 0x190ca
movb $0x0, %al
callq 0x11190
movq -0x30(%rbp), %rdi
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x11ae0
movq %rax, %rcx
movq 0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x537b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x58(%rax)
je 0x51b6
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rdi
movq -0x20(%rbp), %rsi
movl $0x1, %edx
callq 0xfef0
movq %rax, 0x18(%rbp)
movl -0x14(%rbp), %edi
movl 0x10(%rbp), %esi
movq 0x18(%rbp), %rdx
leaq 0x1cf79(%rip), %rax     # 0x22140
cmpq %rax, -0x10(%rbp)
sete %al
movzbl %al, %ecx
andl $0x1, %ecx
callq 0x6f80
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
je 0x533f
movq -0x10(%rbp), %rax
cmpq $0x0, 0x58(%rax)
je 0x533f
movq -0x10(%rbp), %rax
leaq 0x1cf40(%rip), %rcx     # 0x22140
cmpq %rcx, 0x58(%rax)
je 0x521c
movq -0x20(%rbp), %rsi
leaq 0x1cf2f(%rip), %rdi     # 0x22140
xorl %edx, %edx
callq 0xfef0
movq %rax, 0x18(%rbp)
cmpq $0x0, 0x18(%rbp)
je 0x533d
movq 0x18(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x533d
movq 0x18(%rbp), %rax
movl 0x8(%rax), %eax
cmpl -0x14(%rbp), %eax
je 0x525e
movq -0x20(%rbp), %rdx
leaq 0x1cf5c(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x13195(%rip), %rsi     # 0x183ec
movb $0x0, %al
callq 0x11190
movq 0x18(%rbp), %rax
movl 0xc(%rax), %eax
cmpl -0x44(%rbp), %eax
je 0x528b
movq -0x50(%rbp), %rdx
movq -0x20(%rbp), %rcx
leaq 0x1cf2f(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x13df2(%rip), %rsi     # 0x19076
movb $0x0, %al
callq 0x11190
movq -0x30(%rbp), %rdi
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x11890
testb $0x1, %al
jne 0x52a2
jmp 0x52ae
movl -0x34(%rbp), %eax
movq 0x18(%rbp), %rcx
cmpl 0x18(%rcx), %eax
je 0x52cf
movq -0x50(%rbp), %rdx
movq -0x20(%rbp), %rcx
leaq 0x1ceeb(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x13dd8(%rip), %rsi     # 0x190a0
movb $0x0, %al
callq 0x11190
cmpq $0x0, -0x28(%rbp)
jne 0x52e4
movq 0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x5328
movq 0x18(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x5305
movq 0x18(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x3160
cmpl $0x0, %eax
je 0x5326
movq -0x50(%rbp), %rdx
movq -0x20(%rbp), %rcx
leaq 0x1ce94(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x13dab(%rip), %rsi     # 0x190ca
movb $0x0, %al
callq 0x11190
jmp 0x5328
movq -0x30(%rbp), %rdi
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x11ae0
movq %rax, -0x30(%rbp)
jmp 0x533f
movq -0x20(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x30(%rbp), %rdx
movl -0x34(%rbp), %ecx
movl -0x44(%rbp), %r8d
callq 0x38c0
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0xfd90
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)