// File: /workspace/github_c_makefile_star2_O2/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 0x5862
movq 0x10(%r12), %rcx
movl (%rcx), %ecx
pushq $0x4a
popq %rbx
cmpl $0xb, %ecx
jne 0x588f
movl %ebx, %ebp
testl %esi, %esi
je 0x58da
movl %ebx, %ebp
cmpl $0x4a, %esi
je 0x58da
leaq 0x16bf6(%rip), %rdi     # 0x1c474
movq %r12, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x8dd4
movl %ebx, %ebp
jmp 0x58da
pushq $0x43
popq %rbp
testl %esi, %esi
je 0x58da
cmpl $0x4e, %esi
jne 0x58d8
cmpl $0x10, %eax
je 0x58c2
cmpl $0x1f, %eax
je 0x58c2
cmpl $0xf, %eax
jb 0x58b1
movq 0x10(%r12), %rax
movl (%rax), %eax
leal -0x9(%rax), %ecx
cmpl $0x2, %ecx
jb 0x58c2
cmpl $0xc, %eax
jne 0x5d61
leaq 0x16bd3(%rip), %rdi     # 0x1c49c
movq %r12, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x9239
jmp 0x58da
movl %esi, %ebp
leaq 0x23a07(%rip), %rax     # 0x292e8
movq (%rax), %rsi
movq %r14, %rdi
callq 0x15ec0
movq %rax, %r13
testq %rax, %rax
je 0x595d
movzwl 0x18(%r13), %ecx
leaq 0x29430(%rip), %rax     # 0x2ed30
movl (%rax), %eax
cmpl %ecx, %eax
jle 0x5917
cmpw $0x4, %cx
setne %cl
cmpl $0x5, %eax
setne %al
orb %cl, %al
jne 0x595d
cmpl $0x4a, %ebp
jne 0x5947
cmpb $0x4a, 0x1a(%r13)
jne 0x5947
movq 0x20(%r13), %rdi
pushq $0x1
popq %rdx
movq %r12, %rsi
callq 0x17b46
testl %eax, %eax
je 0x5947
movq 0x20(%r13), %rsi
movq %r12, %rdi
callq 0x1763b
movq %rax, %r12
jmp 0x595d
movq 0x10(%r13), %rsi
leaq 0x28(%r13), %rdx
leaq 0x16b70(%rip), %rdi     # 0x1c4c6
xorl %eax, %eax
callq 0x8dd4
leaq 0x293cc(%rip), %rbx     # 0x2ed30
cmpl $0x4, (%rbx)
jle 0x5d69
leaq 0x23974(%rip), %rsi     # 0x292e8
movq %r14, (%rsp)
movq %r14, %rdi
xorl %edx, %edx
callq 0x15f13
movq %rax, %r14
movq %r12, 0x20(%rax)
movb %bpl, 0x1a(%rax)
movups (%r15), %xmm0
movups %xmm0, 0x28(%rax)
cmpl $0x43, %ebp
je 0x5a13
cmpl $0x51, %ebp
je 0x5a2e
cmpl $0x4e, %ebp
je 0x59f2
cmpl $0x4a, %ebp
jne 0x5d88
testq %r13, %r13
je 0x5a75
cmpw $0x3, 0x18(%r13)
jne 0x5a75
cmpb $0x51, 0x1a(%r13)
jne 0x5a75
movb $0x51, 0x1a(%r14)
movw $0x3, 0x18(%r14)
movq %r14, %rdi
callq 0x18f6d
movzwl (%rbx), %eax
movw %ax, 0x18(%r14)
jmp 0x5a7d
movq 0x23e8f(%rip), %rsi     # 0x29888
movq %r14, %rdi
callq 0x156a0
incl 0x23e99(%rip)           # 0x298a0
movq %rax, 0x23e7a(%rip)     # 0x29888
jmp 0x5b63
movq 0x23e76(%rip), %rsi     # 0x29890
movq %r14, %rdi
callq 0x156a0
movq %rax, 0x23e67(%rip)     # 0x29890
jmp 0x5b63
movq %r14, %rdi
callq 0x18f6d
movq %r14, %rdi
xorl %esi, %esi
callq 0xbf49
testb $0x1, 0x1b(%r14)
jne 0x5b63
movq 0x20(%r14), %rsi
cmpl $0x0, 0x8(%rsi)
jle 0x5b51
pushq $0x2
popq %rsi
movq %r14, %rdi
callq 0xbcf8
movq 0x20(%r14), %rax
movl 0x8(%rax), %edi
callq 0x19255
jmp 0x5b63
movq %r14, %rdi
callq 0x18f6d
leaq 0x23444(%rip), %rax     # 0x28ec8
movq (%rax), %rsi
movq (%rsp), %rdi
callq 0x15ec0
movq %rax, %r15
testq %rax, %rax
pushq $0x4a
popq %r12
je 0x5ae3
movzbl 0x1a(%r15), %eax
cmpb $0x43, %al
cmovnel %eax, %r12d
cmpb 0x1a(%r14), %r12b
jne 0x5ac5
movq 0x20(%r15), %rdi
movq 0x20(%r14), %rsi
pushq $0x1
popq %rdx
callq 0x17b46
testl %eax, %eax
jne 0x5b68
movq 0x10(%r15), %rsi
addq $0x28, %r15
leaq 0x16a71(%rip), %rdi     # 0x1c545
movq %r15, %rdx
xorl %eax, %eax
callq 0x9239
jmp 0x5b68
movq %r14, %rbx
addq $0x28, %rbx
movq 0x10(%r14), %rdi
leaq 0x233d3(%rip), %rsi     # 0x28ec8
pushq $0x1
popq %rdx
callq 0x15f13
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 0x237d2(%rip), %rax     # 0x292f0
movq (%rax), %rsi
movq (%rsp), %rdi
callq 0x15ec0
testq %rax, %rax
je 0x5a9c
movzbl 0x1a(%rax), %ecx
cmpl $0xd, %ecx
je 0x5a9c
cmpl $0x53, %ecx
je 0x5a9c
movq %rax, %r15
jmp 0x5a9c
movq 0x10(%r14), %rdx
leaq 0x16a28(%rip), %rdi     # 0x1c584
xorl %eax, %eax
callq 0x8dd4
orb $0x1, 0x1b(%r14)
leaq 0x25e71(%rip), %rbx     # 0x2b9e0
cmpl $0x3d, (%rbx)
jne 0x5c3f
cmpl $0x4a, %ebp
jne 0x5b8f
leaq 0x16a1c(%rip), %rdi     # 0x1c5a0
movq (%rsp), %rsi
xorl %eax, %eax
callq 0x8dd4
callq 0xd3c9
movl %eax, (%rbx)
xorl %edi, %edi
callq 0x13c31
movq 0x20(%r14), %rsi
movl (%rsi), %eax
cmpl $0xf, %eax
jb 0x5bbf
movq 0x10(%rsi), %rcx
movl (%rcx), %ecx
cmpl $0x8, %ecx
jb 0x5bc4
cmpl $0x9, %ecx
je 0x5c03
cmpl $0xd, %ecx
je 0x5bc4
jmp 0x5bfa
cmpl $0x8, %eax
jae 0x5bee
cmpl $0x7b, (%rbx)
jne 0x5c0c
callq 0xd3c9
movl %eax, (%rbx)
xorl %edi, %edi
callq 0xa426
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
callq 0xbdcb
pushq $0x7d
popq %rdi
callq 0x8ee9
jmp 0x5c16
cmpl $0x9, %eax
je 0x5c03
movl %eax, %ecx
cmpl $0xd, %eax
je 0x5bc4
cmpl $0xa, %ecx
jne 0x5cc8
cmpl $0x7b, (%rbx)
je 0x5cc8
xorl %edi, %edi
callq 0xa439
movq %rax, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x952e
movq %rax, %rdi
callq 0x16750
movq %rax, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x376d
orb $0x20, 0x1b(%r14)
andl $0x0, 0x1c(%r14)
cmpb $0x43, 0x1a(%r14)
movq 0x20(%r14), %rsi
jne 0x5c85
movl (%rsi), %eax
cmpl $0xf, %eax
jb 0x5c57
movq 0x10(%rsi), %rax
movl (%rax), %eax
cmpl $0xc, %eax
jne 0x5c85
movq 0x10(%rsi), %rdi
movl 0x8(%rdi), %ecx
testl %ecx, %ecx
jle 0x5c85
cmpw $0x0, 0x4(%rsi)
jg 0x5c85
movl 0x8(%rsi), %eax
cltd
idivl %ecx
pushq $0x1
popq %rdx
movl %eax, %esi
callq 0x17382
movq %rax, %rsi
movq %rax, 0x20(%r14)
movl (%rsi), %eax
cmpl $0xf, %eax
jb 0x5c92
movq 0x10(%rsi), %rax
movl (%rax), %eax
cmpl $0xb, %eax
je 0x5cb6
testb $0x1, 0x1b(%r14)
je 0x5cb6
cmpl $0x0, 0x8(%rsi)
jg 0x5cb6
leaq 0x168d9(%rip), %rdi     # 0x1c584
movq (%rsp), %rdx
xorl %eax, %eax
callq 0x8dd4
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %ecx
orl $0x10, %ecx
cmpl $0x1f, %ecx
je 0x5cfb
cmpl $0xf, %eax
jb 0x5cdd
movq 0x10(%rsi), %rax
movl (%rax), %eax
cmpl $0xc, %eax
jne 0x5cf0
movq 0x10(%rsi), %rax
movl (%rax), %eax
orl $0x10, %eax
cmpl $0x1f, %eax
je 0x5cfb
pushq $0xf
popq %rdi
callq 0x178ba
movq %rax, %rsi
pushq $0x51
popq %rdi
pushq $0x3
popq %rdx
callq 0x16090
movq %rax, %r15
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0xbf49
movq 0x20(%r14), %rcx
movl (%rcx), %eax
cmpl $0xf, %eax
jb 0x5d25
movq 0x10(%rcx), %rax
movl (%rax), %eax
cmpl $0xc, %eax
jne 0x5d54
cmpl $0x0, 0x8(%rcx)
jne 0x5d54
movq 0x20(%r15), %rdx
movl 0x8(%rdx), %eax
testl %eax, %eax
jle 0x5d54
movq 0x10(%rcx), %rdi
movq 0x10(%rdx), %rcx
cltd
idivl 0x8(%rcx)
movl %eax, %esi
xorl %edx, %edx
callq 0x17382
movq %rax, 0x20(%r14)
movq %r15, %rdi
callq 0x93b4
jmp 0x5c13
pushq $0x4e
popq %rbp
jmp 0x58da
leaq 0x16787(%rip), %rdi     # 0x1c4f7
leaq 0x1678f(%rip), %rsi     # 0x1c506
leaq 0x16796(%rip), %rcx     # 0x1c514
movl $0xbb, %edx
callq 0x30d0
leaq 0x1640c(%rip), %rdi     # 0x1c19b
leaq 0x16770(%rip), %rsi     # 0x1c506
leaq 0x16777(%rip), %rcx     # 0x1c514
movl $0xec, %edx
callq 0x30d0