// File: /workspace/github_c_makefile_star2_O2/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, 0x10(%rsp)
movl %edi, %r15d
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x376d
xorl %edi, %edi
callq 0x32d6
movq %rax, %rbx
callq 0x15bbf
leaq 0x2a281(%rip), %rax     # 0x2ed60
movl (%rax), %ecx
incl %ecx
movl %ecx, (%rax)
movw %cx, 0x20(%rbx)
leaq 0x2a240(%rip), %rax     # 0x2ed30
movl (%rax), %eax
movw %ax, 0x22(%rbx)
andq $0x0, 0x24d8a(%rip)     # 0x29888
andq $0x0, 0x24d8a(%rip)     # 0x29890
cmpl $0x5, %eax
jne 0x4bbc
movq 0x24d62(%rip), %rax     # 0x29878
movq 0x20(%rax), %rdi
callq 0x18021
movl (%rax), %ebp
movq 0x24d50(%rip), %rax     # 0x29878
movq 0x20(%rax), %rdi
callq 0x18021
cmpl $0xf, %ebp
jb 0x4b3a
movq 0x10(%rax), %rax
cmpl $0x9, (%rax)
je 0x4b6f
movq 0x24d32(%rip), %rax     # 0x29878
movq 0x20(%rax), %rdi
callq 0x18021
movl (%rax), %ebp
movq 0x24d20(%rip), %rax     # 0x29878
movq 0x20(%rax), %rdi
callq 0x18021
cmpl $0xf, %ebp
jb 0x4b6a
movq 0x10(%rax), %rax
cmpl $0xa, (%rax)
jne 0x4bbc
movq 0x24d02(%rip), %rax     # 0x29878
movq 0x20(%rax), %rdi
callq 0x18021
movq %rax, %rdi
callq 0x1736a
leaq 0x2a1a2(%rip), %rcx     # 0x2ed30
movl (%rcx), %edx
pushq $0x43
popq %rdi
movq %rax, %rsi
callq 0x16090
movq %rax, 0x24cf6(%rip)     # 0x29898
orb $0x21, 0x1b(%rax)
movq 0x24cdb(%rip), %rsi     # 0x29888
movq %rax, %rdi
callq 0x156a0
movq %rax, 0x24ccc(%rip)     # 0x29888
leaq 0x2a16d(%rip), %rax     # 0x2ed30
cmpl $0x5, (%rax)
sete %al
leaq 0x26e30(%rip), %rcx     # 0x2ba00
movq (%rcx), %rdi
testq %rdi, %rdi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x4bee
movq 0x24c91(%rip), %rsi     # 0x29878
xorl %edx, %edx
callq 0xf206
pushq $0x7b
popq %rdi
callq 0x8ee9
leaq 0x26de3(%rip), %r13     # 0x2b9e0
leaq 0x2397c(%rip), %rbp     # 0x28580
leaq 0xc31(%rip), %r12       # 0x583c
leaq 0x26d3e(%rip), %r14     # 0x2b950
movl (%r13), %eax
movzbl (%rbp,%rax), %ecx
cmpl $0x3, %ecx
je 0x4c4e
cmpl $0x51, %ecx
je 0x4c4e
cmpl $0x20, %eax
jne 0x4c5a
movq (%r14), %rax
testq %rax, %rax
je 0x4c5a
cmpb $0x53, 0x1a(%rax)
jne 0x4c5a
leaq 0x2a0f1(%rip), %rax     # 0x2ed30
cmpl $0x5, (%rax)
jl 0x4c4e
callq 0xd37c
cmpl $0x3a, %eax
je 0x4c5a
movq %r12, %rdi
xorl %esi, %esi
callq 0x4dc6
jmp 0x4c12
movq 0x24c27(%rip), %rdi     # 0x29888
callq 0x1571b
movl %eax, %r12d
movq 0x24c18(%rip), %r14     # 0x29888
movq 0x24c19(%rip), %rdi     # 0x29890
callq 0x1571b
addl %r12d, %eax
leal 0x8(,%rax,8), %edi
leaq 0x24aeb(%rip), %rax     # 0x29778
movq (%rax), %rax
movl %edi, (%rax)
movq 0x8(%rax), %rsi
movslq %edi, %rcx
addq %rsi, %rcx
cmpq 0x10(%rax), %rcx
jae 0x4ca8
movq %rcx, 0x8(%rax)
jmp 0x4cb7
leaq 0x24ac9(%rip), %rsi     # 0x29778
callq 0x16438
movq %rax, %rsi
movq %r14, %rdi
callq 0x15731
movq %rax, 0x28(%rbx)
movq 0x24bc6(%rip), %rdi     # 0x29890
movslq %r12d, %r14
leaq (%rax,%r14,8), %rsi
callq 0x15731
movl (%r13), %eax
movzbl (%rbp,%rax), %eax
cmpl $0x4d, %eax
je 0x4ce9
cmpl $0x20, %eax
jne 0x4cfc
movl %r15d, %edi
movq 0x10(%rsp), %rsi
movl 0xc(%rsp), %edx
callq 0x14218
jmp 0x4cd6
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x376d
leaq 0x245da(%rip), %r15     # 0x292e8
movq (%r15), %rdi
leaq 0x2a018(%rip), %rax     # 0x2ed30
movl (%rax), %esi
leaq 0x1086(%rip), %rdx      # 0x5da7
xorl %ecx, %ecx
callq 0x15d9b
movq %r14, %rax
cmpl %eax, %r12d
movl %eax, %edx
cmovll %r12d, %edx
movq 0x28(%rbx), %rsi
movq (%rsi,%rax,8), %rcx
testq %rcx, %rcx
je 0x4d73
movq %rax, %rdi
cmpq %r14, %rdi
jle 0x4d67
movq -0x8(%rsi,%rdi,8), %r8
movl 0x1c(%r8), %r9d
cmpl 0x1c(%rcx), %r9d
jge 0x4d65
movq %r8, (%rsi,%rdi,8)
decq %rdi
movq 0x28(%rbx), %rsi
jmp 0x4d44
movl %edi, %edx
movslq %edx, %rdx
movq %rcx, (%rsi,%rdx,8)
incq %rax
jmp 0x4d2b
movq (%r15), %rax
movq %rax, 0x30(%rbx)
leaq 0x2498f(%rip), %rax     # 0x29710
movq (%rax), %rax
movq %rax, 0x38(%rbx)
pushq $0x1
popq %rdi
callq 0x32d6
leaq 0x29f99(%rip), %rax     # 0x2ed30
cmpl $0x6, (%rax)
jl 0x4db7
callq 0x15be4
pushq $0x7d
popq %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8ee9
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq