// File: /workspace/github_c_makefile_star2_O1/Oric4ever[P]lcc65/6502/build/../src/decl.c
// Function: compound
void compound(int loop, struct swtch *swp, int lev) {
	Symbol p;
	Code cp;
	int i, j, nregs;

	walk(0, 0, 0);
	cp = code(Blockbeg);
	enterscope();
	cp->u.block.bnumber = ++bnumber;
	cp->u.block.level = level;
	autos = registers = 0;
	if (level == LOCAL && isstruct(freturn(cfunc->type))) {
		retv = genident(AUTO, ptr(freturn(cfunc->type)), level);
		retv->defined = 1;
		retv->initialized = 1;
		registers = append(retv, registers);	/* insures that retv is the 1st local */
	}
	if (level == LOCAL && events.entry)
		apply(events.entry, (Generic)cfunc, (Generic)0);
	expect('{');
	while (kind[t] == CHAR || kind[t] == STATIC
	|| (t == ID && tsym && tsym->sclass == TYPEDEF && (level < LOCAL || getchr() != ':')))
		decl(dcllocal, 0);
	nregs = length(registers);
	cp->u.block.locals = (Symbol *)list_to_a(registers, (Generic *)talloc((nregs + length(autos) + 1)*sizeof(Symbol)));
	list_to_a(autos, (Generic *)&cp->u.block.locals[nregs]);
	while (kind[t] == IF || kind[t] == ID)
		statement(loop, swp, lev);
	walk(0, 0, 0);
	foreach(identifiers, level, checkref, (Generic)0);
	for (i = nregs; p = cp->u.block.locals[i]; i++) {
		for (j = i; j > nregs && cp->u.block.locals[j-1]->ref < p->ref; j--)
			cp->u.block.locals[j] = cp->u.block.locals[j-1];
		cp->u.block.locals[j] = p;
	}
	cp->u.block.identifiers = identifiers;
	cp->u.block.types = types;
	code(Blockend);
	if (level > LOCAL) {
		exitscope();
		expect('}');
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, 0xc(%rsp)
movq %rsi, %r14
movl %edi, %r15d
xorl %r12d, %r12d
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3941
xorl %edi, %edi
callq 0x3468
movq %rax, %rbx
callq 0x1709e
leaq 0x29c8c(%rip), %rax     # 0x2ed60
movl (%rax), %ecx
incl %ecx
movl %ecx, (%rax)
movw %cx, 0x20(%rbx)
leaq 0x29c4b(%rip), %rax     # 0x2ed30
movl (%rax), %eax
movw %ax, 0x22(%rbx)
movq %r12, 0x24796(%rip)     # 0x29888
movq %r12, 0x24797(%rip)     # 0x29890
cmpl $0x5, %eax
jne 0x51b1
movq 0x2476f(%rip), %rax     # 0x29878
movq 0x20(%rax), %rdi
callq 0x197d4
movl (%rax), %ebp
movq 0x2475d(%rip), %rax     # 0x29878
movq 0x20(%rax), %rdi
callq 0x197d4
cmpl $0xf, %ebp
jb 0x512d
movq 0x10(%rax), %rax
cmpl $0x9, (%rax)
je 0x5162
movq 0x2473f(%rip), %rax     # 0x29878
movq 0x20(%rax), %rdi
callq 0x197d4
movl (%rax), %ebp
movq 0x2472d(%rip), %rax     # 0x29878
movq 0x20(%rax), %rdi
callq 0x197d4
cmpl $0xf, %ebp
jb 0x515d
movq 0x10(%rax), %rax
cmpl $0xa, (%rax)
jne 0x51b1
movq 0x2470f(%rip), %rax     # 0x29878
movq 0x20(%rax), %rdi
callq 0x197d4
movq %rax, %rdi
callq 0x18a44
leaq 0x29baf(%rip), %rcx     # 0x2ed30
movl (%rcx), %edx
movl $0x43, %edi
movq %rax, %rsi
callq 0x175a8
movq %rax, 0x24701(%rip)     # 0x29898
orb $0x21, 0x1b(%rax)
movq 0x246e6(%rip), %rsi     # 0x29888
movq %rax, %rdi
callq 0x16aec
movq %rax, 0x246d7(%rip)     # 0x29888
leaq 0x29b78(%rip), %rax     # 0x2ed30
cmpl $0x5, (%rax)
sete %al
leaq 0x2683b(%rip), %rcx     # 0x2ba00
movq (%rcx), %rdi
testq %rdi, %rdi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x51e3
movq 0x2469c(%rip), %rsi     # 0x29878
xorl %edx, %edx
callq 0x102f8
movl $0x7b, %edi
callq 0x983d
leaq 0x267ec(%rip), %r13     # 0x2b9e0
leaq 0x23385(%rip), %rbp     # 0x28580
leaq 0xcca(%rip), %r12       # 0x5ecc
movl (%r13), %eax
movzbl (%rbp,%rax), %ecx
cmpl $0x3, %ecx
je 0x5245
cmpl $0x51, %ecx
je 0x5245
cmpl $0x20, %eax
jne 0x5251
leaq 0x2672f(%rip), %rax     # 0x2b950
movq (%rax), %rax
testq %rax, %rax
je 0x5251
cmpb $0x53, 0x1a(%rax)
jne 0x5251
leaq 0x29afa(%rip), %rax     # 0x2ed30
cmpl $0x5, (%rax)
jl 0x5245
callq 0xe158
cmpl $0x3a, %eax
je 0x5251
movq %r12, %rdi
xorl %esi, %esi
callq 0x53de
jmp 0x5202
movq 0x24630(%rip), %rdi     # 0x29888
callq 0x16b69
movl %eax, %r12d
movq 0x24621(%rip), %rax     # 0x29888
movq %rax, 0x10(%rsp)
movq 0x2461d(%rip), %rdi     # 0x29890
callq 0x16b69
movl %r12d, 0x8(%rsp)
addl %r12d, %eax
leal 0x8(,%rax,8), %edi
leaq 0x244ea(%rip), %rax     # 0x29778
movq (%rax), %rax
movl %edi, (%rax)
movq 0x8(%rax), %rsi
movslq %edi, %rcx
addq %rsi, %rcx
cmpq 0x10(%rax), %rcx
jae 0x52a9
movq %rcx, 0x8(%rax)
jmp 0x52b8
leaq 0x244c8(%rip), %rsi     # 0x29778
callq 0x17978
movq %rax, %rsi
movq 0x10(%rsp), %rdi
callq 0x16b7f
movq %rax, 0x28(%rbx)
movq 0x245c3(%rip), %rdi     # 0x29890
movslq 0x8(%rsp), %r12
leaq (%rax,%r12,8), %rsi
callq 0x16b7f
movl (%r13), %eax
movzbl (%rbp,%rax), %eax
cmpl $0x4d, %eax
je 0x52ee
cmpl $0x20, %eax
jne 0x52ff
movl %r15d, %edi
movq %r14, %rsi
movl 0xc(%rsp), %edx
callq 0x15635
jmp 0x52db
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3941
leaq 0x23fd7(%rip), %r14     # 0x292e8
movq (%r14), %rdi
leaq 0x29a15(%rip), %rax     # 0x2ed30
movl (%rax), %esi
leaq 0x1162(%rip), %rdx      # 0x6486
xorl %ecx, %ecx
callq 0x172b1
movq 0x28(%rbx), %rax
movq (%rax,%r12,8), %rax
testq %rax, %rax
movl 0x8(%rsp), %r9d
je 0x5387
movq %r12, %rcx
movl %ecx, %edx
cmpq %r12, %rcx
jle 0x536b
movl 0x1c(%rax), %esi
movq %rcx, %rdx
movq 0x28(%rbx), %rdi
movq -0x8(%rdi,%rdx,8), %r8
cmpl %esi, 0x1c(%r8)
jge 0x536b
movq %r8, (%rdi,%rdx,8)
decq %rdx
cmpq %r12, %rdx
jg 0x534d
movl %r9d, %edx
movq 0x28(%rbx), %rsi
movslq %edx, %rdx
movq %rax, (%rsi,%rdx,8)
movq 0x28(%rbx), %rax
movq 0x8(%rax,%rcx,8), %rax
incq %rcx
testq %rax, %rax
jne 0x5340
movq (%r14), %rax
movq %rax, 0x30(%rbx)
leaq 0x2437b(%rip), %rax     # 0x29710
movq (%rax), %rax
movq %rax, 0x38(%rbx)
movl $0x1, %edi
callq 0x3468
leaq 0x29983(%rip), %rax     # 0x2ed30
cmpl $0x6, (%rax)
jl 0x53cf
callq 0x170c3
movl $0x7d, %edi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x983d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq