// File: /workspace/github_c_makefile_star2_O3/Oric4ever[P]lcc65/6502/build/../src/decl.c
// Function: dcllocal
static Symbol dcllocal(int sclass, char *id, Type ty, Coordinate *pos) {
	Symbol p, q;

	if (isfunc(ty)) {
		if (sclass && sclass != EXTERN)
			error("invalid storage class `%k' for `%t %s'\n", sclass, ty, id);
		sclass = EXTERN;
	} else if (sclass == 0)
		sclass = AUTO;
	if (sclass == REGISTER && (isvolatile(ty) || isstruct(ty) || isarray(ty))) {
		warning("register declaration ignored for `%t %s'\n", ty, id);
		sclass = AUTO;
	}
	if ((q = lookup(id, identifiers))
	&& (q->scope >= level || q->scope == PARAM && level == PARAM+1))
		if (sclass == EXTERN && q->sclass == EXTERN && eqtype(q->type, ty, 1))
			ty = composite(ty, q->type);
		else
			error("redeclaration of `%s' previously declared at %w\n",
				q->name, &q->src);
	assert(level >= LOCAL);
	p = install(id, &identifiers, 0);
	p->type = ty;
	p->sclass = sclass;
	p->src = *pos;
	switch (sclass) {
	case EXTERN: {
		Symbol r;
		if (q && q->scope == GLOBAL && q->sclass == STATIC) {
			p->sclass = STATIC;
			p->scope = GLOBAL;
			defsymbol(p);
			p->scope = level;
		} else
			defsymbol(p);
		if ((r = lookup(id, externals)) == 0) {
			r = install(p->name, &externals, 1);
			r->src = p->src;
			r->type = p->type;
			r->sclass = p->sclass;
			if ((q = lookup(id, globals)) && q->sclass != TYPEDEF && q->sclass != ENUM)
				r = q;
		}
		if (r && ((r->sclass == AUTO ? EXTERN : r->sclass) != p->sclass
		|| !eqtype(r->type, p->type, 1)))
			warning("declaration of `%s' does not match previous declaration at %w\n",
				r->name, &r->src);
		break;
		}
	case STATIC:
		defsymbol(p);
		initglobal(p, 0);
		if (!p->defined)
			if (p->type->size > 0) {
				defglobal(p, BSS);
				space(p->type->size);
			} else
				error("undefined size for `%t %s'\n", p->type, p->name);
		p->defined = 1;
		break;
	case REGISTER:
		registers = append(p, registers);
		regcount++;
		p->defined = 1;
		break;
	case AUTO:
		autos = append(p, autos);
		p->defined = 1;
		break;
	default: assert(0);
	}
	if (t == '=') {
		Tree e;
		if (sclass == EXTERN)
			error("illegal initialization of `extern %s'\n", id);
		t = gettok();
		definept(0);
		if (isscalar(p->type) || isstruct(p->type) && t != '{') {
			if (t == '{') {
				t = gettok();
				e = constexpr(0);
				genconst(e, 0);
				expect('}');
			} else
				e = expr1(0);
		} else {
			Type ty = p->type;
			if (!isconst(ty) && (!isarray(ty) || !isconst(ty->type)))
				ty = qual(CONST, ty);
			q = genident(STATIC, ty, GLOBAL);
			initglobal(q, 1);
			if (isarray(p->type) && p->type->size == 0 && q->type->size > 0)
				p->type = array(p->type->type, q->type->size/q->type->type->size, 0);
			e = idnode(q);
		}
		walk(root(asgn(p, e)), 0, 0);
		p->initialized = 1;
		p->ref = 0;
	}
	if (p->sclass == AUTO && isarray(p->type) && p->type->type->size > 0
	&& p->type->align < STRUCT_ALIGN)
		p->type = array(p->type->type,
			p->type->size/p->type->type->size, STRUCT_ALIGN);
	if (!isfunc(p->type) && p->defined && p->type->size <= 0)
			error("undefined size for `%t %s'\n", p->type, id);
	return p;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r14
movl %edi, %esi
movl (%rdx), %eax
movl %eax, %ecx
cmpl $0xf, %eax
jb 0x5f32
movq 0x10(%r12), %rcx
movl (%rcx), %ecx
cmpl $0xb, %ecx
jne 0x5f5b
movl $0x4a, %ebp
testl %esi, %esi
je 0x5fae
cmpl $0x4a, %esi
je 0x5fae
leaq 0x18528(%rip), %rdi     # 0x1e474
movq %r12, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x974c
jmp 0x5fae
movl $0x43, %ebp
testl %esi, %esi
je 0x5fae
cmpl $0x4e, %esi
jne 0x5fac
cmpl $0x10, %eax
je 0x5f91
cmpl $0x1f, %eax
je 0x5f91
cmpl $0xf, %eax
jb 0x5f7f
movq 0x10(%r12), %rax
movl (%rax), %eax
leal -0x9(%rax), %ecx
cmpl $0x2, %ecx
jb 0x5f91
movl $0x4e, %ebp
cmpl $0xc, %eax
jne 0x5fae
leaq 0x18504(%rip), %rdi     # 0x1e49c
movq %r12, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x9bfd
movl $0x43, %ebp
jmp 0x5fae
movl %esi, %ebp
leaq 0x24333(%rip), %rax     # 0x2a2e8
movq (%rax), %rsi
movq %r14, %rdi
callq 0x1728e
movq %rax, %r13
testq %rax, %rax
je 0x6033
movzwl 0x18(%r13), %ecx
leaq 0x29d5c(%rip), %rax     # 0x2fd30
movl (%rax), %eax
cmpl %ecx, %eax
jle 0x5feb
cmpw $0x4, %cx
setne %cl
cmpl $0x5, %eax
setne %al
orb %cl, %al
jne 0x6033
cmpl $0x4a, %ebp
jne 0x601d
cmpb $0x4a, 0x1a(%r13)
jne 0x601d
movq 0x20(%r13), %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x190d9
testl %eax, %eax
je 0x601d
movq 0x20(%r13), %rsi
movq %r12, %rdi
callq 0x18bc1
movq %rax, %r12
jmp 0x6033
movq 0x10(%r13), %rsi
leaq 0x28(%r13), %rdx
leaq 0x1849a(%rip), %rdi     # 0x1e4c6
xorl %eax, %eax
callq 0x974c
leaq 0x29cf6(%rip), %rbx     # 0x2fd30
cmpl $0x4, (%rbx)
jle 0x6466
leaq 0x2429e(%rip), %rsi     # 0x2a2e8
movq %r14, (%rsp)
movq %r14, %rdi
xorl %edx, %edx
callq 0x172de
movq %rax, %r14
movq %r12, 0x20(%rax)
movb %bpl, 0x1a(%rax)
movups (%r15), %xmm0
movups %xmm0, 0x28(%rax)
cmpl $0x4d, %ebp
jg 0x60c3
cmpl $0x43, %ebp
je 0x6113
cmpl $0x4a, %ebp
jne 0x6485
testq %r13, %r13
je 0x61ea
cmpw $0x3, 0x18(%r13)
jne 0x61ea
cmpb $0x51, 0x1a(%r13)
jne 0x61ea
movb $0x51, 0x1a(%r14)
movw $0x3, 0x18(%r14)
movq %r14, %rdi
callq 0x1a458
movzwl (%rbx), %eax
movw %ax, 0x18(%r14)
jmp 0x61f2
cmpl $0x4e, %ebp
je 0x612b
cmpl $0x51, %ebp
jne 0x6485
movq %r14, %rdi
callq 0x1a458
movq %r14, %rdi
xorl %esi, %esi
callq 0xcc4e
testb $0x1, 0x1b(%r14)
jne 0x6147
movq 0x20(%r14), %rsi
cmpl $0x0, 0x8(%rsi)
jle 0x63ae
movq %r14, %rdi
movl $0x2, %esi
callq 0xc9a8
movq 0x20(%r14), %rax
movl 0x8(%rax), %edi
callq 0x1a74a
jmp 0x6147
movq 0x24776(%rip), %rsi     # 0x2a890
movq %r14, %rdi
callq 0x16a18
movq %rax, 0x24767(%rip)     # 0x2a890
jmp 0x6147
movq 0x24756(%rip), %rsi     # 0x2a888
movq %r14, %rdi
callq 0x16a18
incl 0x24760(%rip)           # 0x2a8a0
movq %rax, 0x24741(%rip)     # 0x2a888
orb $0x1, 0x1b(%r14)
leaq 0x2688d(%rip), %r15     # 0x2c9e0
cmpl $0x3d, (%r15)
jne 0x6323
cmpl $0x4a, %ebp
jne 0x6174
leaq 0x18437(%rip), %rdi     # 0x1e5a0
movq (%rsp), %rsi
xorl %eax, %eax
callq 0x974c
callq 0xe195
movl %eax, (%r15)
xorl %edi, %edi
callq 0x14ee1
movq 0x20(%r14), %rsi
movl (%rsi), %eax
cmpl $0xf, %eax
jb 0x61ac
movq 0x10(%rsi), %rcx
movl (%rcx), %ecx
cmpl $0x8, %ecx
jb 0x61b5
cmpl $0x9, %ecx
je 0x62e3
cmpl $0xd, %ecx
je 0x61b5
jmp 0x62da
cmpl $0x8, %eax
jae 0x62ca
cmpl $0x7b, (%r15)
jne 0x62ed
callq 0xe195
movl %eax, (%r15)
xorl %edi, %edi
callq 0xae7e
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
callq 0xcaa9
movl $0x7d, %edi
callq 0x9869
jmp 0x62f7
movq %r14, %rdi
callq 0x1a458
leaq 0x23ccf(%rip), %rax     # 0x29ec8
movq (%rax), %rsi
movq (%rsp), %rdi
callq 0x1728e
movq %rax, %r15
testq %rax, %rax
je 0x625a
movzbl 0x1a(%r15), %eax
cmpb $0x43, %al
movl $0x4a, %ecx
cmovnel %eax, %ecx
cmpb 0x1a(%r14), %cl
jne 0x623c
movq 0x20(%r15), %rdi
movq 0x20(%r14), %rsi
movl $0x1, %edx
callq 0x190d9
testl %eax, %eax
jne 0x614c
movq 0x10(%r15), %rsi
addq $0x28, %r15
leaq 0x182fa(%rip), %rdi     # 0x1e545
movq %r15, %rdx
xorl %eax, %eax
callq 0x9bfd
jmp 0x614c
movq %r14, %rbx
addq $0x28, %rbx
movq 0x10(%r14), %rdi
leaq 0x23c5c(%rip), %rsi     # 0x29ec8
movl $0x1, %edx
callq 0x172de
movq %rax, %r15
movups (%rbx), %xmm0
movups %xmm0, 0x28(%rax)
movq 0x20(%r14), %rax
movq %rax, 0x20(%r15)
movb 0x1a(%r14), %al
movb %al, 0x1a(%r15)
leaq 0x24059(%rip), %rax     # 0x2a2f0
movq (%rax), %rsi
movq (%rsp), %rdi
callq 0x1728e
testq %rax, %rax
je 0x620d
movzbl 0x1a(%rax), %ecx
cmpl $0xd, %ecx
je 0x620d
cmpl $0x53, %ecx
je 0x620d
movq %rax, %r15
jmp 0x620d
cmpl $0x9, %eax
je 0x62e3
movl %eax, %ecx
cmpl $0xd, %eax
je 0x61b5
cmpl $0xa, %ecx
jne 0x63c5
cmpl $0x7b, (%r15)
je 0x63c5
xorl %edi, %edi
callq 0xae91
movq %rax, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x9f07
movq %rax, %rdi
callq 0x17b52
movq %rax, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x394a
orb $0x20, 0x1b(%r14)
movl $0x0, 0x1c(%r14)
cmpb $0x43, 0x1a(%r14)
movq 0x20(%r14), %rsi
jne 0x636b
movl (%rsi), %eax
cmpl $0xf, %eax
jb 0x633b
movq 0x10(%rsi), %rax
movl (%rax), %eax
cmpl $0xc, %eax
jne 0x636b
movq 0x10(%rsi), %rdi
movl 0x8(%rdi), %ecx
testl %ecx, %ecx
jle 0x636b
cmpw $0x0, 0x4(%rsi)
jg 0x636b
movl 0x8(%rsi), %eax
cltd
idivl %ecx
movl %eax, %esi
movl $0x1, %edx
callq 0x188ea
movq %rax, %rsi
movq %rax, 0x20(%r14)
movl (%rsi), %eax
cmpl $0xf, %eax
jb 0x6378
movq 0x10(%rsi), %rax
movl (%rax), %eax
cmpl $0xb, %eax
je 0x639c
testb $0x1, 0x1b(%r14)
je 0x639c
cmpl $0x0, 0x8(%rsi)
jg 0x639c
leaq 0x181f3(%rip), %rdi     # 0x1e584
movq (%rsp), %rdx
xorl %eax, %eax
callq 0x974c
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r14), %rdx
leaq 0x181cb(%rip), %rdi     # 0x1e584
xorl %eax, %eax
callq 0x974c
jmp 0x6147
movl %eax, %ecx
orl $0x10, %ecx
cmpl $0x1f, %ecx
je 0x63fa
cmpl $0xf, %eax
jb 0x63da
movq 0x10(%rsi), %rax
movl (%rax), %eax
cmpl $0xc, %eax
jne 0x63ed
movq 0x10(%rsi), %rax
movl (%rax), %eax
orl $0x10, %eax
cmpl $0x1f, %eax
je 0x63fa
movl $0xf, %edi
callq 0x18e51
movq %rax, %rsi
movl $0x51, %edi
movl $0x3, %edx
callq 0x17456
movq %rax, %r15
movq %rax, %rdi
movl $0x1, %esi
callq 0xcc4e
movq 0x20(%r14), %rcx
movl (%rcx), %eax
cmpl $0xf, %eax
jb 0x642a
movq 0x10(%rcx), %rax
movl (%rax), %eax
cmpl $0xc, %eax
jne 0x6459
cmpl $0x0, 0x8(%rcx)
jne 0x6459
movq 0x20(%r15), %rdx
movl 0x8(%rdx), %eax
testl %eax, %eax
jle 0x6459
movq 0x10(%rcx), %rdi
movq 0x10(%rdx), %rcx
cltd
idivl 0x8(%rcx)
movl %eax, %esi
xorl %edx, %edx
callq 0x188ea
movq %rax, 0x20(%r14)
movq %r15, %rdi
callq 0x9d8b
jmp 0x62f4
leaq 0x1808a(%rip), %rdi     # 0x1e4f7
leaq 0x18092(%rip), %rsi     # 0x1e506
leaq 0x18099(%rip), %rcx     # 0x1e514
movl $0xbb, %edx
callq 0x30d0
leaq 0x17d0f(%rip), %rdi     # 0x1e19b
leaq 0x18073(%rip), %rsi     # 0x1e506
leaq 0x1807a(%rip), %rcx     # 0x1e514
movl $0xec, %edx
callq 0x30d0