// File: /workspace/github_c_makefile_star2_O1/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
cmpl $0xf, (%rdx)
movq %rdx, %rax
jb 0x5eef
movq 0x10(%r12), %rax
cmpl $0xb, (%rax)
jne 0x5f18
movl $0x4a, %ebp
testl %esi, %esi
je 0x5f22
cmpl $0x4a, %esi
je 0x5f22
leaq 0x1856b(%rip), %rdi     # 0x1e474
movq %r12, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x9720
jmp 0x5f22
testl %esi, %esi
movl $0x43, %ebp
cmovnel %esi, %ebp
cmpl $0x4e, %ebp
jne 0x5f89
movl (%r12), %eax
cmpl $0x10, %eax
je 0x5f70
cmpl $0x1f, %eax
je 0x5f70
movq %r12, %rcx
cmpl $0xf, %eax
jb 0x5f42
movq 0x10(%r12), %rcx
cmpl $0x9, (%rcx)
je 0x5f70
movq %r12, %rcx
cmpl $0xf, %eax
jb 0x5f54
movq 0x10(%r12), %rcx
cmpl $0xa, (%rcx)
je 0x5f70
movq %r12, %rcx
cmpl $0xf, %eax
jb 0x5f66
movq 0x10(%r12), %rcx
movl $0x4e, %ebp
cmpl $0xc, (%rcx)
jne 0x5f89
leaq 0x18525(%rip), %rdi     # 0x1e49c
movq %r12, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x9be3
movl $0x43, %ebp
leaq 0x23358(%rip), %rax     # 0x292e8
movq (%rax), %rsi
movq %r14, %rdi
callq 0x173d9
movq %rax, %r13
testq %rax, %rax
je 0x600e
movzwl 0x18(%r13), %ecx
leaq 0x28d81(%rip), %rax     # 0x2ed30
movl (%rax), %eax
cmpl %ecx, %eax
jle 0x5fc6
cmpw $0x4, %cx
setne %cl
cmpl $0x5, %eax
setne %al
orb %cl, %al
jne 0x600e
cmpl $0x4a, %ebp
jne 0x5ff8
cmpb $0x4a, 0x1a(%r13)
jne 0x5ff8
movq 0x20(%r13), %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x192a9
testl %eax, %eax
je 0x5ff8
movq 0x20(%r13), %rsi
movq %r12, %rdi
callq 0x18d3a
movq %rax, %r12
jmp 0x600e
movq 0x10(%r13), %rsi
leaq 0x28(%r13), %rdx
leaq 0x184bf(%rip), %rdi     # 0x1e4c6
xorl %eax, %eax
callq 0x9720
leaq 0x28d1b(%rip), %rbx     # 0x2ed30
cmpl $0x4, (%rbx)
jle 0x6448
leaq 0x232c3(%rip), %rsi     # 0x292e8
movq %r14, (%rsp)
movq %r14, %rdi
xorl %edx, %edx
callq 0x17429
movq %rax, %r14
movq %r12, 0x20(%rax)
movb %bpl, 0x1a(%rax)
movups (%r15), %xmm0
movups %xmm0, 0x28(%rax)
cmpl $0x4d, %ebp
jg 0x609e
cmpl $0x43, %ebp
je 0x60ee
cmpl $0x4a, %ebp
jne 0x6467
testq %r13, %r13
je 0x61f3
cmpw $0x3, 0x18(%r13)
jne 0x61f3
cmpb $0x51, 0x1a(%r13)
jne 0x61f3
movb $0x51, 0x1a(%r14)
movw $0x3, 0x18(%r14)
movq %r14, %rdi
callq 0x1a687
movzwl (%rbx), %eax
movw %ax, 0x18(%r14)
jmp 0x61fb
cmpl $0x4e, %ebp
je 0x6106
cmpl $0x51, %ebp
jne 0x6467
movq %r14, %rdi
callq 0x1a687
movq %r14, %rdi
xorl %esi, %esi
callq 0xcc77
testb $0x1, 0x1b(%r14)
jne 0x6122
movq 0x20(%r14), %rsi
cmpl $0x0, 0x8(%rsi)
jle 0x6431
movq %r14, %rdi
movl $0x2, %esi
callq 0xc9dc
movq 0x20(%r14), %rax
movl 0x8(%rax), %edi
callq 0x1a98c
jmp 0x6122
movq 0x2379b(%rip), %rsi     # 0x29890
movq %r14, %rdi
callq 0x16aec
movq %rax, 0x2378c(%rip)     # 0x29890
jmp 0x6122
movq 0x2377b(%rip), %rsi     # 0x29888
movq %r14, %rdi
callq 0x16aec
incl 0x23785(%rip)           # 0x298a0
movq %rax, 0x23766(%rip)     # 0x29888
orb $0x1, 0x1b(%r14)
leaq 0x258b2(%rip), %r15     # 0x2b9e0
cmpl $0x3d, (%r15)
jne 0x63a7
cmpl $0x4a, %ebp
jne 0x614f
leaq 0x1845c(%rip), %rdi     # 0x1e5a0
movq (%rsp), %rsi
xorl %eax, %eax
callq 0x9720
callq 0xe1c6
movl %eax, (%r15)
xorl %edi, %edi
callq 0x15027
movq 0x20(%r14), %rsi
movl (%rsi), %eax
movq %rsi, %rcx
cmpl $0xf, %eax
jb 0x6170
movq 0x10(%rsi), %rcx
cmpl $0x8, (%rcx)
jb 0x61b6
movq %rsi, %rcx
cmpl $0xf, %eax
jb 0x6181
movq 0x10(%rsi), %rcx
cmpl $0xd, (%rcx)
je 0x61b6
movq %rsi, %rcx
cmpl $0xf, %eax
jb 0x6192
movq 0x10(%rsi), %rcx
cmpl $0x9, (%rcx)
je 0x61ac
movq %rsi, %rcx
cmpl $0xf, %eax
jb 0x61a3
movq 0x10(%rsi), %rcx
cmpl $0xa, (%rcx)
jne 0x62dc
cmpl $0x7b, (%r15)
je 0x62dc
cmpl $0x7b, (%r15)
jne 0x61e7
callq 0xe1c6
movl %eax, (%r15)
xorl %edi, %edi
callq 0xaea6
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
callq 0xcadc
movl $0x7d, %edi
callq 0x983d
jmp 0x637b
xorl %edi, %edi
callq 0xaeb9
jmp 0x6378
movq %r14, %rdi
callq 0x1a687
leaq 0x22cc6(%rip), %rax     # 0x28ec8
movq (%rax), %rsi
movq (%rsp), %rdi
callq 0x173d9
movq %rax, %r15
testq %rax, %rax
je 0x626c
testq %r15, %r15
je 0x6127
movzbl 0x1a(%r15), %eax
cmpb $0x43, %al
movl $0x4a, %ecx
cmovnel %eax, %ecx
cmpb 0x1a(%r14), %cl
jne 0x624e
movq 0x20(%r15), %rdi
movq 0x20(%r14), %rsi
movl $0x1, %edx
callq 0x192a9
testl %eax, %eax
jne 0x6127
movq 0x10(%r15), %rsi
addq $0x28, %r15
leaq 0x182e8(%rip), %rdi     # 0x1e545
movq %r15, %rdx
xorl %eax, %eax
callq 0x9be3
jmp 0x6127
movq %r14, %rbx
addq $0x28, %rbx
movq 0x10(%r14), %rdi
leaq 0x22c4a(%rip), %rsi     # 0x28ec8
movl $0x1, %edx
callq 0x17429
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 0x23047(%rip), %rax     # 0x292f0
movq (%rax), %rsi
movq (%rsp), %rdi
callq 0x173d9
testq %rax, %rax
je 0x6216
movzbl 0x1a(%rax), %ecx
cmpl $0xd, %ecx
je 0x6216
cmpl $0x53, %ecx
je 0x6216
movq %rax, %r15
jmp 0x6216
movl %eax, %ecx
orl $0x10, %ecx
cmpl $0x1f, %ecx
je 0x6312
movq %rsi, %rcx
cmpl $0xf, %eax
jb 0x62f2
movq 0x10(%rsi), %rcx
cmpl $0xc, (%rcx)
jne 0x6305
movq 0x10(%rsi), %rax
movl (%rax), %eax
orl $0x10, %eax
cmpl $0x1f, %eax
je 0x6312
movl $0xf, %edi
callq 0x19015
movq %rax, %rsi
movl $0x51, %edi
movl $0x3, %edx
callq 0x175a8
movq %rax, %r15
movq %rax, %rdi
movl $0x1, %esi
callq 0xcc77
movq 0x20(%r14), %rcx
cmpl $0xf, (%rcx)
movq %rcx, %rax
jb 0x6341
movq 0x10(%rcx), %rax
cmpl $0xc, (%rax)
jne 0x6370
cmpl $0x0, 0x8(%rcx)
jne 0x6370
movq 0x20(%r15), %rdx
movl 0x8(%rdx), %eax
testl %eax, %eax
jle 0x6370
movq 0x10(%rcx), %rdi
movq 0x10(%rdx), %rcx
cltd
idivl 0x8(%rcx)
movl %eax, %esi
xorl %edx, %edx
callq 0x18a62
movq %rax, 0x20(%r14)
movq %r15, %rdi
callq 0x9d77
movq %rax, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x9efb
movq %rax, %rdi
callq 0x17ccb
movq %rax, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3941
orb $0x20, 0x1b(%r14)
movl $0x0, 0x1c(%r14)
cmpb $0x43, 0x1a(%r14)
jne 0x63eb
movq 0x20(%r14), %rax
cmpl $0xf, (%rax)
movq %rax, %rcx
jb 0x63be
movq 0x10(%rax), %rcx
cmpl $0xc, (%rcx)
jne 0x63eb
movq 0x10(%rax), %rdi
movl 0x8(%rdi), %ecx
testl %ecx, %ecx
jle 0x63eb
cmpw $0x0, 0x4(%rax)
jg 0x63eb
movl 0x8(%rax), %eax
cltd
idivl %ecx
movl %eax, %esi
movl $0x1, %edx
callq 0x18a62
movq %rax, 0x20(%r14)
movq 0x20(%r14), %rsi
cmpl $0xf, (%rsi)
movq %rsi, %rax
jb 0x63fb
movq 0x10(%rsi), %rax
cmpl $0xb, (%rax)
je 0x641f
testb $0x1, 0x1b(%r14)
je 0x641f
cmpl $0x0, 0x8(%rsi)
jg 0x641f
leaq 0x18170(%rip), %rdi     # 0x1e584
movq (%rsp), %rdx
xorl %eax, %eax
callq 0x9720
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r14), %rdx
leaq 0x18148(%rip), %rdi     # 0x1e584
xorl %eax, %eax
callq 0x9720
jmp 0x6122
leaq 0x180a8(%rip), %rdi     # 0x1e4f7
leaq 0x180b0(%rip), %rsi     # 0x1e506
leaq 0x180b7(%rip), %rcx     # 0x1e514
movl $0xbb, %edx
callq 0x30d0
leaq 0x17d2d(%rip), %rdi     # 0x1e19b
leaq 0x18091(%rip), %rsi     # 0x1e506
leaq 0x18098(%rip), %rcx     # 0x1e514
movl $0xec, %edx
callq 0x30d0