// File: /workspace/github_c_makefile_star2_O2/Oric4ever[P]lcc65/6502/build/../src/decl.c
// Function: dclr1
static Type dclr1(char **id, int lev) {
	Type ty = 0;

	switch (t) {
	case ID:
		if (id)
			*id = token;
		else
			error("extraneous identifier `%s'\n", token);
		t = gettok();
		break;
	case '*':
		t = gettok();
		if (t == CONST || t == VOLATILE) {
			Type ty1;
			ty1 = ty = tnode(t, 0);
			while ((t = gettok()) == CONST || t == VOLATILE)
				ty1 = tnode(t, ty1);
			ty->type = dclr1(id, lev);
			ty = ty1;
		} else
			ty = dclr1(id, lev);
		ty = tnode(POINTER, ty);
		break;
	case '(':
		t = gettok();
		if (kind[t] == CHAR || t == ID && tsym && tsym->sclass == TYPEDEF) {
			ty = tnode(FUNCTION, ty);
			ty->u.proto = parameters(lev);
			{ foreach(identifiers, level, checkparam, (Generic)0); exitscope(); }
		} else {
			ty = dclr1(id, lev);
			expect(')');
			if (ty == 0 && id == 0)
				return tnode(FUNCTION, ty);
		}
		break;
	case '[':
		break;
	default:
		return ty;
	}
	while (t == '(' || t == '[')
		if (t == '(') {
			t = gettok();
			ty = tnode(FUNCTION, ty);
			ty->u.proto = parameters(lev);
			if (lev == 0 && funcdclr == 0)
				funcdclr++;
			else
				{ foreach(identifiers, level, checkparam, (Generic)0); exitscope(); }
		} else {
			int n = 0;
			t = gettok();
			if (kind[t] == ID) {
				n = intexpr(']', 1);
				if (n <= 0) {
					error("`%d' is an illegal array size\n", n);
					n = 1;
				}
			} else
				expect(']');
			ty = tnode(ARRAY, ty);
			ty->size = n;
		}
	return ty;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
leaq 0x24511(%rip), %rbp     # 0x2b9e0
movl (%rbp), %eax
xorl %r14d, %r14d
cmpl $0x5b, %eax
je 0x7650
movq %rdi, %r15
cmpl $0x28, %eax
je 0x7513
cmpl $0x2a, %eax
je 0x7571
cmpl $0x20, %eax
jne 0x7730
leaq 0x24449(%rip), %rax     # 0x2b948
movq (%rax), %rsi
testq %r15, %r15
je 0x7637
movq %rsi, (%r15)
jmp 0x7645
callq 0xd3c9
movl %eax, (%rbp)
movl %eax, %ecx
leaq 0x2105c(%rip), %rdx     # 0x28580
cmpb $0x3, (%rdx,%rcx)
jne 0x75b0
pushq $0xb
popq %rdi
xorl %esi, %esi
callq 0x7742
movq %rax, %r14
movl %ebx, %edi
callq 0x778a
movq %rax, 0x18(%r14)
leaq 0x21d9b(%rip), %rax     # 0x292e8
movq (%rax), %rdi
leaq 0x277d9(%rip), %rax     # 0x2ed30
movl (%rax), %esi
leaq -0x2b9(%rip), %rdx      # 0x72a7
xorl %ecx, %ecx
callq 0x15d9b
callq 0x15be4
jmp 0x7650
callq 0xd3c9
movl %eax, (%rbp)
leal -0xf(%rax), %ecx
cmpl $0x1, %ecx
ja 0x7609
movl %eax, %edi
xorl %esi, %esi
callq 0x7742
movq %rax, %r12
movq %rax, %r14
callq 0xd3c9
movl %eax, (%rbp)
leal -0xf(%rax), %ecx
cmpl $0x1, %ecx
ja 0x7618
movl %eax, %edi
movq %r14, %rsi
callq 0x7742
jmp 0x7591
cmpl $0x20, %eax
sete %cl
leaq 0x24393(%rip), %rax     # 0x2b950
movq (%rax), %rax
testq %rax, %rax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x75d7
cmpb $0x53, 0x1a(%rax)
je 0x752e
movq %r15, %rdi
movl %ebx, %esi
callq 0x74bb
movq %rax, %r14
pushq $0x29
popq %rdi
callq 0x8ee9
orq %r14, %r15
jne 0x7650
pushq $0xb
popq %rdi
xorl %esi, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x7742
movq %r15, %rdi
movl %ebx, %esi
callq 0x74bb
movq %rax, %r14
jmp 0x7627
movq %r15, %rdi
movl %ebx, %esi
callq 0x74bb
movq %rax, 0x10(%r12)
pushq $0x7
popq %rdi
movq %r14, %rsi
callq 0x7742
movq %rax, %r14
jmp 0x7650
leaq 0x1550d(%rip), %rdi     # 0x1cb4b
xorl %eax, %eax
callq 0x8dd4
callq 0xd3c9
movl %eax, (%rbp)
xorl %r14d, %r14d
pushq $0x1
popq %r13
pushq $0xc
popq %r12
movl (%rbp), %eax
cmpl $0x5b, %eax
je 0x76a0
cmpl $0x28, %eax
jne 0x7730
callq 0xd3c9
movl %eax, (%rbp)
pushq $0xb
popq %rdi
movq %r14, %rsi
callq 0x7742
movq %rax, %r14
movl %ebx, %edi
callq 0x778a
movq %rax, 0x18(%r14)
testl %ebx, %ebx
jne 0x76df
testb $0x1, 0x2220f(%rip)     # 0x298a4
jne 0x76df
movb $0x1, 0x22206(%rip)     # 0x298a4
jmp 0x7658
callq 0xd3c9
movl %eax, (%rbp)
movl %eax, %eax
leaq 0x20ecf(%rip), %rcx     # 0x28580
cmpb $0x20, (%rcx,%rax)
jne 0x770a
pushq $0x5d
popq %rdi
movl %r13d, %esi
callq 0xa80a
movl %eax, %r15d
testl %eax, %eax
jg 0x7715
leaq 0x15497(%rip), %rdi     # 0x1cb67
movl %r15d, %esi
xorl %eax, %eax
callq 0x8dd4
movl %r13d, %r15d
jmp 0x7715
leaq 0x21c02(%rip), %rax     # 0x292e8
movq (%rax), %rdi
leaq 0x27640(%rip), %rax     # 0x2ed30
movl (%rax), %esi
leaq -0x452(%rip), %rdx      # 0x72a7
xorl %ecx, %ecx
callq 0x15d9b
callq 0x15be4
jmp 0x7658
pushq $0x5d
popq %rdi
callq 0x8ee9
xorl %r15d, %r15d
movl %r12d, %edi
movq %r14, %rsi
callq 0x7742
movq %rax, %r14
movl %r15d, 0x8(%rax)
pushq $0x1
popq %r13
jmp 0x7658
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq