// File: /workspace/github_c_makefile_star2_O0/Oric4ever[P]lcc65/6502/build/../src/decl.c
// Function: funcdecl
static void funcdecl(int sclass, char *id, Type ty, Coordinate pt) {
	int i, n;
	Code rp;
	Symbol *callee, *caller, p;
	List callees = 0;

	regcount = 0;
	if (isstruct(freturn(ty)) && freturn(ty)->size == 0)
		error("illegal use of incomplete type `%t'\n", freturn(ty));
	callees = 0;
	foreach(identifiers, PARAM, fillcallees, (Generic)&callees);
	n = length(callees);
	if (Aflag >= 2 && n > 31)
		warning("more than 31 parameters in function `%s'\n", id);
	caller = (Symbol *)list_to_a(callees, (Generic *)0);
	callee = (Symbol *)talloc((n + 1)*sizeof *caller);
	for (i = 0; p = caller[i]; i++) {
		callee[--n] = p;
		caller[i] = (Symbol)talloc(sizeof *caller[i]);
		if (*p->name >= '1' && *p->name <= '9')
			error("missing parameter name to function `%s'\n", id);
	}
	callee[i] = 0;
	if (ty->u.proto)
		ty = newstyle(ty, caller, callee);
	else
		ty = oldstyle(id, ty, caller, callee);
	if (Aflag >= 1 && !hasproto(ty))
		warning("missing prototype\n");
	for (i = 0; p = callee[i]; i++)
		if (p->type->size == 0) {
			error("undefined size for parameter `%t %s'\n", p->type, p->name);
			caller[i]->type = p->type = inttype;
		}
	if ((p = lookup(id, identifiers)) && isfunc(p->type)) {
		if (p->defined)
			error("redefinition of `%s' previously defined at %w\n",
				p->name, &p->src);
		if (xref)
			use(p, p->src);
	}
	cfunc = dclglobal(sclass, id, ty, &pt);
	cfunc->u.f.pt[0] = pt;
	if (JUMP_ON_RETURN || glevel > 1)
		cfunc->u.f.label = genlabel(1);
	cfunc->u.f.callee = callee;
	cfunc->defined = 1;
	if (Pflag)
		printproto(cfunc, cfunc->u.f.callee);
	labels[0] = table(0, LABELS);
	labels[1] = table(0, LABELS);
	refinc = 1000;
	bnumber = -1;
	codelist = &codehead;
	codelist->next = 0;
	if (ncalled >= 0)
		ncalled = findfunc(cfunc->name, pt.file);
	cfunc->u.f.pt[2] = definept(0)->u.point.src;
	compound(0, (struct swtch *)0, 0);
	for (rp = codelist; rp->kind < Label; rp = rp->prev)
		;
	if (rp->kind != Jump) {
		if (cfunc->u.f.label == 0)
			definept(0);
		if (freturn(cfunc->type) != voidtype
		&& (freturn(cfunc->type) != inttype || Aflag >= 1))
			warning("missing return value\n");
		retcode(0, 0);
	}
	if (cfunc->u.f.label) {
		definelab(cfunc->u.f.label);
		definept(0);
		walk(0, 0, 0);
	}
	exitscope();
	foreach(identifiers, level, checkref, (Generic)0);
	flushequ();
	swtoseg(CODE);
	if (cfunc->sclass != STATIC)
		export(cfunc);
	if (glevel) {
		stabsym(cfunc);
		swtoseg(CODE);
	}
	for (i = 0; caller[i]; i++) {
		if (glevel > 1)
			callee[i]->sclass = AUTO;
#ifdef NOARGB
		if (isstruct(caller[i]->type)) {
			caller[i]->type = ptr(caller[i]->type);
			callee[i]->type = ptr(callee[i]->type);
			caller[i]->structarg = callee[i]->structarg = 1;
		}
#endif
	}
	function(cfunc, caller, callee, cfunc->u.f.ncalls);
	if (glevel)
		stabfend(cfunc, lineno);
	outflush();
	cfunc->u.f.pt[1] = src;
	expect('}');
	setuses(labels[0]);
	foreach(labels[0], LABELS, checklab, (Generic)0);
	if (events.exit)
		apply(events.exit, (Generic)cfunc, (Generic)0);
	exitscope();
	retv = 0;
	tfree();
	cfunc = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rcx, -0x10(%rbp)
movq %r8, -0x8(%rbp)
movl %edi, -0x14(%rbp)
movq %rsi, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
movq $0x0, -0x58(%rbp)
movl $0x0, 0x33630(%rip)     # 0x3ba30
movq -0x28(%rbp), %rdi
callq 0x28a30
cmpl $0xf, (%rax)
jb 0x8421
movq -0x28(%rbp), %rdi
callq 0x28a30
movq 0x10(%rax), %rax
movq %rax, -0x60(%rbp)
jmp 0x842e
movq -0x28(%rbp), %rdi
callq 0x28a30
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpl $0x9, (%rax)
je 0x846e
movq -0x28(%rbp), %rdi
callq 0x28a30
cmpl $0xf, (%rax)
jb 0x8458
movq -0x28(%rbp), %rdi
callq 0x28a30
movq 0x10(%rax), %rax
movq %rax, -0x68(%rbp)
jmp 0x8465
movq -0x28(%rbp), %rdi
callq 0x28a30
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
cmpl $0xa, (%rax)
jne 0x8497
movq -0x28(%rbp), %rdi
callq 0x28a30
cmpl $0x0, 0x8(%rax)
jne 0x8497
movq -0x28(%rbp), %rdi
callq 0x28a30
movq %rax, %rsi
leaq 0x271a9(%rip), %rdi     # 0x2f639
movb $0x0, %al
callq 0xd530
movq $0x0, -0x58(%rbp)
leaq 0x32c92(%rip), %rax     # 0x3b138
movq (%rax), %rdi
movl $0x4, %esi
leaq 0x7eb(%rip), %rdx       # 0x8ca0
leaq -0x58(%rbp), %rcx
callq 0x243f0
movq -0x58(%rbp), %rdi
callq 0x23630
movl %eax, -0x30(%rbp)
leaq 0x35757(%rip), %rax     # 0x3dc28
cmpl $0x2, (%rax)
jl 0x84ee
cmpl $0x1f, -0x30(%rbp)
jle 0x84ee
movq -0x20(%rbp), %rsi
leaq 0x27177(%rip), %rdi     # 0x2f65e
movb $0x0, %al
callq 0xdba0
movq -0x58(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x23670
movq %rax, -0x48(%rbp)
movl -0x30(%rbp), %eax
addl $0x1, %eax
cltq
shlq $0x3, %rax
addq $0x7, %rax
andq $-0x8, %rax
movl %eax, %ecx
leaq 0x3312c(%rip), %rax     # 0x3b648
movq (%rax), %rax
movl %ecx, (%rax)
leaq 0x33120(%rip), %rax     # 0x3b648
movq (%rax), %rax
movq 0x8(%rax), %rax
leaq 0x33112(%rip), %rcx     # 0x3b648
movq (%rcx), %rcx
movslq (%rcx), %rcx
addq %rcx, %rax
leaq 0x33102(%rip), %rcx     # 0x3b648
movq (%rcx), %rcx
cmpq 0x10(%rcx), %rax
jb 0x856d
leaq 0x330f2(%rip), %rax     # 0x3b648
movq (%rax), %rax
movl (%rax), %edi
leaq 0x330e6(%rip), %rsi     # 0x3b648
callq 0x253d0
movq %rax, -0x70(%rbp)
jmp 0x85b8
leaq 0x330d4(%rip), %rax     # 0x3b648
movq (%rax), %rax
movl (%rax), %edx
leaq 0x330c8(%rip), %rax     # 0x3b648
movq (%rax), %rax
movq 0x8(%rax), %rcx
movslq %edx, %rdx
addq %rdx, %rcx
movq %rcx, 0x8(%rax)
leaq 0x330b0(%rip), %rax     # 0x3b648
movq (%rax), %rax
movq 0x8(%rax), %rax
leaq 0x330a2(%rip), %rcx     # 0x3b648
movq (%rcx), %rcx
movslq (%rcx), %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x48(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, %rax
je 0x86f2
movq -0x50(%rbp), %rdx
movq -0x40(%rbp), %rax
movl -0x30(%rbp), %ecx
addl $-0x1, %ecx
movl %ecx, -0x30(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
leaq 0x33048(%rip), %rax     # 0x3b648
movq (%rax), %rax
movl $0x88, (%rax)
leaq 0x33038(%rip), %rax     # 0x3b648
movq (%rax), %rax
movq 0x8(%rax), %rax
leaq 0x3302a(%rip), %rcx     # 0x3b648
movq (%rcx), %rcx
movslq (%rcx), %rcx
addq %rcx, %rax
leaq 0x3301a(%rip), %rcx     # 0x3b648
movq (%rcx), %rcx
cmpq 0x10(%rcx), %rax
jb 0x8655
leaq 0x3300a(%rip), %rax     # 0x3b648
movq (%rax), %rax
movl (%rax), %edi
leaq 0x32ffe(%rip), %rsi     # 0x3b648
callq 0x253d0
movq %rax, -0x78(%rbp)
jmp 0x86a0
leaq 0x32fec(%rip), %rax     # 0x3b648
movq (%rax), %rax
movl (%rax), %edx
leaq 0x32fe0(%rip), %rax     # 0x3b648
movq (%rax), %rax
movq 0x8(%rax), %rcx
movslq %edx, %rdx
addq %rdx, %rcx
movq %rcx, 0x8(%rax)
leaq 0x32fc8(%rip), %rax     # 0x3b648
movq (%rax), %rax
movq 0x8(%rax), %rax
leaq 0x32fba(%rip), %rcx     # 0x3b648
movq (%rcx), %rcx
movslq (%rcx), %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rdx
movq -0x48(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
movsbl (%rax), %eax
cmpl $0x31, %eax
jl 0x86e2
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
movsbl (%rax), %eax
cmpl $0x39, %eax
jg 0x86e2
movq -0x20(%rbp), %rsi
leaq 0x26fad(%rip), %rdi     # 0x2f688
movb $0x0, %al
callq 0xd530
jmp 0x86e4
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x85c7
movq -0x40(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x8724
movq -0x28(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x8cd0
movq %rax, -0x28(%rbp)
jmp 0x873d
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq -0x40(%rbp), %rcx
callq 0x8da0
movq %rax, -0x28(%rbp)
leaq 0x354e4(%rip), %rax     # 0x3dc28
cmpl $0x1, (%rax)
jl 0x8765
movq -0x28(%rbp), %rdi
callq 0x28aa0
cmpl $0x0, %eax
jne 0x8765
leaq 0x26cc5(%rip), %rdi     # 0x2f423
movb $0x0, %al
callq 0xdba0
movl $0x0, -0x2c(%rbp)
movq -0x40(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, %rax
je 0x87dd
movq -0x50(%rbp), %rax
movq 0x20(%rax), %rax
cmpl $0x0, 0x8(%rax)
jne 0x87d0
movq -0x50(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rdx
leaq 0x26f0a(%rip), %rdi     # 0x2f6b1
movb $0x0, %al
callq 0xd530
leaq 0x3ba43(%rip), %rax     # 0x441f8
movq (%rax), %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x48(%rbp), %rax
movslq -0x2c(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, 0x20(%rax)
jmp 0x87d2
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x876c
movq -0x20(%rbp), %rdi
leaq 0x32950(%rip), %rax     # 0x3b138
movq (%rax), %rsi
callq 0x24670
movq %rax, -0x50(%rbp)
cmpq $0x0, %rax
je 0x8884
movq -0x50(%rbp), %rax
movq 0x20(%rax), %rax
cmpl $0xf, (%rax)
jb 0x881d
movq -0x50(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x80(%rbp)
jmp 0x8829
movq -0x50(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
cmpl $0xb, (%rax)
jne 0x8884
movq -0x50(%rbp), %rax
movb 0x1b(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x8861
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x50(%rbp), %rdx
addq $0x28, %rdx
leaq 0x26e7d(%rip), %rdi     # 0x2f6d7
movb $0x0, %al
callq 0xd530
leaq 0x3539c(%rip), %rax     # 0x3dc04
cmpl $0x0, (%rax)
je 0x8882
movq -0x50(%rbp), %rdi
movq -0x50(%rbp), %rax
movq 0x28(%rax), %rsi
movq 0x30(%rax), %rdx
callq 0x252c0
jmp 0x8884
movl -0x14(%rbp), %edi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
leaq -0x10(%rbp), %rcx
callq 0x7aa0
movq %rax, 0x33169(%rip)     # 0x3ba08
movq 0x33162(%rip), %rax     # 0x3ba08
movq -0x10(%rbp), %rcx
movq %rcx, 0x48(%rax)
movq -0x8(%rbp), %rcx
movq %rcx, 0x50(%rax)
leaq 0x35343(%rip), %rax     # 0x3dc00
cmpl $0x1, (%rax)
jle 0x88d8
movl $0x1, %edi
callq 0x24d90
movl %eax, %ecx
movq 0x33133(%rip), %rax     # 0x3ba08
movl %ecx, 0x78(%rax)
movq -0x40(%rbp), %rcx
movq 0x33125(%rip), %rax     # 0x3ba08
movq %rcx, 0x80(%rax)
movq 0x33117(%rip), %rax     # 0x3ba08
movb 0x1b(%rax), %cl
andb $-0x2, %cl
orb $0x1, %cl
movb %cl, 0x1b(%rax)
leaq 0x35328(%rip), %rax     # 0x3dc2c
cmpl $0x0, (%rax)
je 0x8923
movq 0x330f8(%rip), %rdi     # 0x3ba08
movq 0x330f1(%rip), %rax     # 0x3ba08
movq 0x80(%rax), %rsi
callq 0x29a90
xorl %eax, %eax
movl %eax, %edi
movl $0x2, %esi
callq 0x24dc0
movq %rax, %rcx
leaq 0x38665(%rip), %rax     # 0x40fa0
movq %rcx, (%rax)
xorl %eax, %eax
movl %eax, %edi
movl $0x2, %esi
callq 0x24dc0
movq %rax, %rcx
leaq 0x3864a(%rip), %rax     # 0x40fa0
movq %rcx, 0x8(%rax)
leaq 0x31653(%rip), %rax     # 0x39fb4
movl $0x3e8, (%rax)          # imm = 0x3E8
leaq 0x38652(%rip), %rax     # 0x40fc0
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
leaq 0x307ad(%rip), %rax     # 0x39128
leaq 0x3075e(%rip), %rcx     # 0x390e0
movq %rcx, (%rax)
leaq 0x3079c(%rip), %rax     # 0x39128
movq (%rax), %rax
movq $0x0, 0x10(%rax)
leaq 0x31172(%rip), %rax     # 0x39b10
cmpl $0x0, (%rax)
jl 0x89c2
movq 0x3305e(%rip), %rax     # 0x3ba08
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x1b2b0
movl %eax, %ecx
leaq 0x31150(%rip), %rax     # 0x39b10
movl %ecx, (%rax)
movq 0x3303f(%rip), %rax     # 0x3ba08
movq %rax, -0x88(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x20a20
movq %rax, %rcx
movq -0x88(%rbp), %rax
movq 0x18(%rcx), %rdx
movq %rdx, 0x68(%rax)
movq 0x20(%rcx), %rcx
movq %rcx, 0x70(%rax)
xorl %edx, %edx
xorl %eax, %eax
movl %eax, %esi
movl %edx, %edi
callq 0x6190
leaq 0x30721(%rip), %rax     # 0x39128
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpl $0x5, (%rax)
jae 0x8a27
jmp 0x8a19
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x8a0e
movq -0x38(%rbp), %rax
cmpl $0x9, (%rax)
je 0x8aa3
movq 0x32fd1(%rip), %rax     # 0x3ba08
cmpl $0x0, 0x78(%rax)
jne 0x8a46
xorl %eax, %eax
movl %eax, %edi
callq 0x20a20
movq 0x32fbb(%rip), %rax     # 0x3ba08
movq 0x20(%rax), %rdi
callq 0x28a30
leaq 0x3b7e3(%rip), %rcx     # 0x44240
cmpq (%rcx), %rax
je 0x8a98
movq 0x32f9f(%rip), %rax     # 0x3ba08
movq 0x20(%rax), %rdi
callq 0x28a30
leaq 0x3b77f(%rip), %rcx     # 0x441f8
cmpq (%rcx), %rax
jne 0x8a8a
leaq 0x351a3(%rip), %rax     # 0x3dc28
cmpl $0x1, (%rax)
jl 0x8a98
leaq 0x26c75(%rip), %rdi     # 0x2f706
movb $0x0, %al
callq 0xdba0
xorl %eax, %eax
movl %eax, %edi
xorl %esi, %esi
callq 0x20d70
movq 0x32f5e(%rip), %rax     # 0x3ba08
cmpl $0x0, 0x78(%rax)
je 0x8ad5
movq 0x32f51(%rip), %rax     # 0x3ba08
movl 0x78(%rax), %edi
callq 0x208b0
xorl %eax, %eax
movl %eax, %edi
callq 0x20a20
xorl %eax, %eax
movl %eax, %edi
xorl %edx, %edx
movl %edx, %esi
callq 0x3a80
callq 0x24130
leaq 0x32657(%rip), %rax     # 0x3b138
movq (%rax), %rdi
leaq 0x384a5(%rip), %rax     # 0x40f90
movl (%rax), %esi
leaq -0x1714(%rip), %rdx     # 0x73e0
xorl %eax, %eax
movl %eax, %ecx
callq 0x243f0
callq 0x20cd0
movl $0x1, %edi
callq 0x12a40
movq 0x32ef5(%rip), %rax     # 0x3ba08
movzbl 0x1a(%rax), %eax
cmpl $0x51, %eax
je 0x8b28
movq 0x32ee5(%rip), %rdi     # 0x3ba08
callq 0x2a5a0
leaq 0x350d1(%rip), %rax     # 0x3dc00
cmpl $0x0, (%rax)
je 0x8b3e
movl $0x1, %edi
callq 0x12a40
movl $0x0, -0x2c(%rbp)
movq -0x48(%rbp), %rax
movslq -0x2c(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x8b7d
leaq 0x350a5(%rip), %rax     # 0x3dc00
cmpl $0x1, (%rax)
jle 0x8b70
movq -0x40(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movb $0x43, 0x1a(%rax)
jmp 0x8b72
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x8b45
movq 0x32e84(%rip), %rdi     # 0x3ba08
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq 0x32e75(%rip), %rax     # 0x3ba08
movl 0x7c(%rax), %ecx
callq 0x2aa60
leaq 0x3505e(%rip), %rax     # 0x3dc00
cmpl $0x0, (%rax)
je 0x8ba9
jmp 0x8ba9
callq 0x1a770
movq 0x32e53(%rip), %rax     # 0x3ba08
leaq 0x34f1c(%rip), %rcx     # 0x3dad8
movq (%rcx), %rdx
movq %rdx, 0x58(%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x60(%rax)
movl $0x7d, %edi
callq 0xd670
leaq 0x383c4(%rip), %rax     # 0x40fa0
movq (%rax), %rdi
callq 0x24320
leaq 0x383b5(%rip), %rax     # 0x40fa0
movq (%rax), %rdi
movl $0x2, %esi
leaq 0x5a6(%rip), %rdx       # 0x91a0
xorl %eax, %eax
movl %eax, %ecx
callq 0x243f0
leaq 0x34fc6(%rip), %rax     # 0x3dbd0
cmpq $0x0, 0x8(%rax)
je 0x8c2c
leaq 0x34fb8(%rip), %rax     # 0x3dbd0
movq 0x8(%rax), %rdi
movq 0x32de5(%rip), %rsi     # 0x3ba08
xorl %eax, %eax
movl %eax, %edx
callq 0x18640
callq 0x24130
movq $0x0, 0x32dec(%rip) # 0x3ba28
callq 0x26160
movq $0x0, 0x32dbc(%rip) # 0x3ba08
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)