// File: /workspace/github_c_makefile_star2_O0/Oric4ever[P]lcc65/6502/build/../src/stmt.c
// Function: statement
void statement(loop, swp, lev) int loop,lev; struct swtch *swp; {
	int lab, ref = refinc;

	if (Aflag >= 2 && lev == 15)
		warning("more than 15 levels of nested statements\n");
	switch (t) {
	case IF:
		ifstmt(genlabel(2), loop, swp, lev + 1);
		break;
	case WHILE:
		whilestmt(genlabel(3), swp, lev + 1);
		break;
	case DO:
		dostmt(genlabel(3), swp, lev + 1);
		expect(';');
		break;
	case FOR:
		forstmt(genlabel(4), swp, lev + 1);
		break;
	case SWITCH:
		swstmt(loop, genlabel(2), lev + 1);
		break;
	case CASE:
		if (swp == 0)
			error("illegal case label\n");
		definelab(lab = genlabel(1));
		while (t == CASE) {
			Tree p;
			t = gettok();
			p = constexpr(':');
			if (generic(p->op) == CNST && isint(p->type)) {
				if (swp) {
					needconst++;
					p = cast(p, swp->sym->type);
					needconst--;
					caselabel(swp, p->u.v.i, lab);
				}
			} else
				error("case label must be a constant integer expression\n");
			ntree = 0;
		}
		statement(loop, swp, lev);
		break;
	case DEFAULT:
		if (swp)
			if (swp->deflab)
				error("extra default label\n");
			else {
				swp->deflab = findlabel(swp->lab);
				definelab(swp->deflab->u.l.label);
			}
		else
			error("illegal default label\n");
		t = gettok();
		expect(':');
		statement(loop, swp, lev);
		break;
	case RETURN:
		t = gettok();
		definept(0);
		if (t != ';')
			if (freturn(cfunc->type) == voidtype) {
				error("extraneous return value\n");
				expr(0);
				retcode(0, cfunc->u.f.label);
			} else
				retcode(expr(0), cfunc->u.f.label);
		else {
			if (freturn(cfunc->type) != voidtype
			&& (freturn(cfunc->type) != inttype || Aflag >= 1))
				warning("missing return value\n");
			retcode(0, cfunc->u.f.label);
		}
		expect(';');
		break;
	case BREAK:
		walk(0, 0, 0);
		if (swp && swp->lab > loop) {
			definept(0);
			branch(swp->lab + 1);
			t = gettok();
			expect(';');
			break;
		}
	case CONTINUE:
		walk(0, 0, 0);
		definept(0);
		if (loop)
			branch(loop + (t == BREAK ? 2 : 1));
		else
			error("illegal %k statement\n", t);
		t = gettok();
		expect(';');
		break;
	case '{':
		compound(loop, swp, lev + 1);
		break;
	case ';':
		definept(0);
		t = gettok();
		break;
	case GOTO:
		walk(0, 0, 0);
		definept(0);
		t = gettok();
		if (t == ID) {
			Symbol p = lookup(token, labels[0]);
			if (p == 0) {
				p = install(token, &labels[0], 0);
				p->u.l.label = genlabel(1);
				p->u.l.equatedto = p;
				p->src = src;
			}
			p->ref++;
			use(p, src);
			branch(p->u.l.label);
			t = gettok();
		} else
			error("missing label in goto\n");
		expect(';');
		break;
	case ID:
		if (getchr() == ':') {
			stmtlabel(token);
			statement(loop, swp, lev);
			break;
		}
	default:
		definept(0);
		if (kind[t] != ID) {
			error("unrecognized statement\n");
			t = gettok();
		} else {
			Tree e = expr0(0);
			listnodes(e, 0, 0);
			if (glevel > 1 || nodecount == 0 || nodecount > 200)
				walk(0, 0, 0);
			ntree = 0;
		}
		expect(';');
	}
	if (kind[t] != IF && kind[t] != ID && t != '}' && t != EOI) {
		static char follow[] = { IF, ID, '}', 0 };
		error("illegal statement termination\n");
		skipto(0, follow);
	}
	refinc = ref;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl 0x18a9c(%rip), %eax     # 0x39fb4
movl %eax, -0x1c(%rbp)
leaq 0x1c706(%rip), %rax     # 0x3dc28
cmpl $0x2, (%rax)
jl 0x2153b
cmpl $0xf, -0x14(%rbp)
jne 0x2153b
leaq 0x10867(%rip), %rdi     # 0x31d9b
movb $0x0, %al
callq 0xdba0
leaq 0x1c63e(%rip), %rax     # 0x3db80
movl (%rax), %eax
addl $-0x20, %eax
movl %eax, %ecx
movq %rcx, -0x40(%rbp)
subl $0x5b, %eax
ja 0x21b5f
movq -0x40(%rbp), %rax
leaq 0x10607(%rip), %rcx     # 0x31b68
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x2, %edi
callq 0x24d90
movl %eax, %edi
movl -0x4(%rbp), %esi
movq -0x10(%rbp), %rdx
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
callq 0x21c80
jmp 0x21c06
movl $0x3, %edi
callq 0x24d90
movl %eax, %edi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
addl $0x1, %edx
callq 0x21d70
jmp 0x21c06
movl $0x3, %edi
callq 0x24d90
movl %eax, %edi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
addl $0x1, %edx
callq 0x21eb0
movl $0x3b, %edi
callq 0xd670
jmp 0x21c06
movl $0x4, %edi
callq 0x24d90
movl %eax, %edi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
addl $0x1, %edx
callq 0x21f60
jmp 0x21c06
movl -0x4(%rbp), %eax
movl %eax, -0x44(%rbp)
movl $0x2, %edi
callq 0x24d90
movl -0x44(%rbp), %edi
movl %eax, %esi
movl -0x14(%rbp), %edx
addl $0x1, %edx
callq 0x22200
jmp 0x21c06
cmpq $0x0, -0x10(%rbp)
jne 0x21631
leaq 0x1079b(%rip), %rdi     # 0x31dc5
movb $0x0, %al
callq 0xd530
movl $0x1, %edi
callq 0x24d90
movl %eax, %edi
movl %edi, -0x18(%rbp)
callq 0x208b0
leaq 0x1c534(%rip), %rax     # 0x3db80
cmpl $0x45, (%rax)
jne 0x2176f
callq 0x15170
movl %eax, %ecx
leaq 0x1c51d(%rip), %rax     # 0x3db80
movl %ecx, (%rax)
movl $0x3a, %edi
callq 0xfdb0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %eax
andl $-0x10, %eax
cmpl $0x10, %eax
jne 0x2174f
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0xf, (%rax)
jb 0x216a4
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x50(%rbp)
jmp 0x216b0
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpl $0x3, (%rax)
jb 0x2174f
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0xf, (%rax)
jb 0x216dc
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x58(%rbp)
jmp 0x216e8
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpl $0x6, (%rax)
ja 0x2174f
cmpq $0x0, -0x10(%rbp)
je 0x2174d
leaq 0x1d7d9(%rip), %rax     # 0x3eed8
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x1d7cd(%rip), %rax     # 0x3eed8
movl %ecx, (%rax)
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rsi
callq 0xe9b0
movq %rax, -0x28(%rbp)
leaq 0x1d7ac(%rip), %rax     # 0x3eed8
movl (%rax), %ecx
addl $-0x1, %ecx
leaq 0x1d7a0(%rip), %rax     # 0x3eed8
movl %ecx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x28(%rax), %esi
movl -0x18(%rbp), %edx
callq 0x22670
jmp 0x2175d
leaq 0x10683(%rip), %rdi     # 0x31dd9
movb $0x0, %al
callq 0xd530
leaq 0x1f874(%rip), %rax     # 0x40fd8
movl $0x0, (%rax)
jmp 0x21645
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
callq 0x21500
jmp 0x21c06
cmpq $0x0, -0x10(%rbp)
je 0x217ce
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x217a5
leaq 0x1066f(%rip), %rdi     # 0x31e0b
movb $0x0, %al
callq 0xd530
jmp 0x217cc
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edi
callq 0x245d0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x48(%rax), %edi
callq 0x208b0
jmp 0x217dc
leaq 0x1064b(%rip), %rdi     # 0x31e20
movb $0x0, %al
callq 0xd530
callq 0x15170
movl %eax, %ecx
leaq 0x1c396(%rip), %rax     # 0x3db80
movl %ecx, (%rax)
movl $0x3a, %edi
callq 0xd670
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
callq 0x21500
jmp 0x21c06
callq 0x15170
movl %eax, %ecx
leaq 0x1c368(%rip), %rax     # 0x3db80
movl %ecx, (%rax)
xorl %eax, %eax
movl %eax, %edi
callq 0x20a20
leaq 0x1c356(%rip), %rax     # 0x3db80
cmpl $0x3b, (%rax)
je 0x21899
leaq 0x1a1d2(%rip), %rax     # 0x3ba08
movq (%rax), %rax
movq 0x20(%rax), %rdi
callq 0x28a30
leaq 0x229f7(%rip), %rcx     # 0x44240
cmpq (%rcx), %rax
jne 0x2187b
leaq 0x105e2(%rip), %rdi     # 0x31e37
movb $0x0, %al
callq 0xd530
xorl %edi, %edi
callq 0xfc70
leaq 0x1a19e(%rip), %rax     # 0x3ba08
movq (%rax), %rax
movl 0x78(%rax), %esi
xorl %eax, %eax
movl %eax, %edi
callq 0x20d70
jmp 0x21897
xorl %edi, %edi
callq 0xfc70
movq %rax, %rdi
leaq 0x1a17c(%rip), %rax     # 0x3ba08
movq (%rax), %rax
movl 0x78(%rax), %esi
callq 0x20d70
jmp 0x21907
leaq 0x1a168(%rip), %rax     # 0x3ba08
movq (%rax), %rax
movq 0x20(%rax), %rdi
callq 0x28a30
leaq 0x2298d(%rip), %rcx     # 0x44240
cmpq (%rcx), %rax
je 0x218f1
leaq 0x1a149(%rip), %rax     # 0x3ba08
movq (%rax), %rax
movq 0x20(%rax), %rdi
callq 0x28a30
leaq 0x22926(%rip), %rcx     # 0x441f8
cmpq (%rcx), %rax
jne 0x218e3
leaq 0x1c34a(%rip), %rax     # 0x3dc28
cmpl $0x1, (%rax)
jl 0x218f1
leaq 0xde1c(%rip), %rdi      # 0x2f706
movb $0x0, %al
callq 0xdba0
leaq 0x1a110(%rip), %rax     # 0x3ba08
movq (%rax), %rax
movl 0x78(%rax), %esi
xorl %eax, %eax
movl %eax, %edi
callq 0x20d70
movl $0x3b, %edi
callq 0xd670
jmp 0x21c06
xorl %eax, %eax
movl %eax, %edi
xorl %edx, %edx
movl %edx, %esi
callq 0x3a80
cmpq $0x0, -0x10(%rbp)
je 0x2196d
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
cmpl -0x4(%rbp), %eax
jle 0x2196d
xorl %eax, %eax
movl %eax, %edi
callq 0x20a20
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edi
addl $0x1, %edi
callq 0x21370
callq 0x15170
movl %eax, %ecx
leaq 0x1c224(%rip), %rax     # 0x3db80
movl %ecx, (%rax)
movl $0x3b, %edi
callq 0xd670
jmp 0x21c06
jmp 0x2196f
xorl %eax, %eax
movl %eax, %edi
xorl %edx, %edx
movl %edx, %esi
callq 0x3a80
xorl %eax, %eax
movl %eax, %edi
callq 0x20a20
cmpl $0x0, -0x4(%rbp)
je 0x219b0
movl -0x4(%rbp), %edi
leaq 0x1c1eb(%rip), %rax     # 0x3db80
movl (%rax), %edx
movl $0x1, %eax
movl $0x2, %ecx
cmpl $0x44, %edx
cmovel %ecx, %eax
addl %eax, %edi
callq 0x21370
jmp 0x219c7
leaq 0x1c1c9(%rip), %rax     # 0x3db80
movl (%rax), %esi
leaq 0x10490(%rip), %rdi     # 0x31e50
movb $0x0, %al
callq 0xd530
callq 0x15170
movl %eax, %ecx
leaq 0x1c1ab(%rip), %rax     # 0x3db80
movl %ecx, (%rax)
movl $0x3b, %edi
callq 0xd670
jmp 0x21c06
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
addl $0x1, %edx
callq 0x6190
jmp 0x21c06
xorl %eax, %eax
movl %eax, %edi
callq 0x20a20
callq 0x15170
movl %eax, %ecx
leaq 0x1c16c(%rip), %rax     # 0x3db80
movl %ecx, (%rax)
jmp 0x21c06
xorl %eax, %eax
movl %eax, %edi
xorl %edx, %edx
movl %edx, %esi
callq 0x3a80
xorl %eax, %eax
movl %eax, %edi
callq 0x20a20
callq 0x15170
movl %eax, %ecx
leaq 0x1c141(%rip), %rax     # 0x3db80
movl %ecx, (%rax)
leaq 0x1c138(%rip), %rax     # 0x3db80
cmpl $0x20, (%rax)
jne 0x21b13
leaq 0x1c090(%rip), %rax     # 0x3dae8
movq (%rax), %rdi
leaq 0x1f53e(%rip), %rax     # 0x40fa0
movq (%rax), %rsi
callq 0x24670
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x21aca
leaq 0x1c06c(%rip), %rax     # 0x3dae8
movq (%rax), %rdi
leaq 0x1f51a(%rip), %rsi     # 0x40fa0
xorl %edx, %edx
callq 0x24720
movq %rax, -0x30(%rbp)
movl $0x1, %edi
callq 0x24d90
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x48(%rax)
movq -0x30(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x30(%rbp), %rax
leaq 0x1c01d(%rip), %rcx     # 0x3dad8
movq (%rcx), %rdx
movq %rdx, 0x28(%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x30(%rax)
movq -0x30(%rbp), %rax
movl 0x1c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x1c(%rax)
movq -0x30(%rbp), %rdi
leaq 0x1bff6(%rip), %rax     # 0x3dad8
movq (%rax), %rsi
leaq 0x1bfec(%rip), %rax     # 0x3dad8
movq 0x8(%rax), %rdx
callq 0x252c0
movq -0x30(%rbp), %rax
movl 0x48(%rax), %edi
callq 0x21370
callq 0x15170
movl %eax, %ecx
leaq 0x1c071(%rip), %rax     # 0x3db80
movl %ecx, (%rax)
jmp 0x21b21
leaq 0x1034c(%rip), %rdi     # 0x31e66
movb $0x0, %al
callq 0xd530
movl $0x3b, %edi
callq 0xd670
jmp 0x21c06
callq 0x150b0
cmpl $0x3a, %eax
jne 0x21b5d
leaq 0x1bfa7(%rip), %rax     # 0x3dae8
movq (%rax), %rdi
callq 0x229d0
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
callq 0x21500
jmp 0x21c06
jmp 0x21b5f
xorl %eax, %eax
movl %eax, %edi
callq 0x20a20
leaq 0x1c011(%rip), %rax     # 0x3db80
movl (%rax), %eax
movl %eax, %ecx
leaq 0x17e16(%rip), %rax     # 0x39990
movsbl (%rax,%rcx), %eax
cmpl $0x20, %eax
je 0x21ba3
leaq 0x102f3(%rip), %rdi     # 0x31e7d
movb $0x0, %al
callq 0xd530
callq 0x15170
movl %eax, %ecx
leaq 0x1bfe1(%rip), %rax     # 0x3db80
movl %ecx, (%rax)
jmp 0x21bfc
xorl %edi, %edi
callq 0xff90
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x3c30
leaq 0x1c03e(%rip), %rax     # 0x3dc00
cmpl $0x1, (%rax)
jg 0x21be2
leaq 0x19e32(%rip), %rax     # 0x3ba00
cmpl $0x0, (%rax)
je 0x21be2
leaq 0x19e26(%rip), %rax     # 0x3ba00
cmpl $0xc8, (%rax)
jle 0x21bef
xorl %eax, %eax
movl %eax, %edi
xorl %edx, %edx
movl %edx, %esi
callq 0x3a80
leaq 0x1f3e2(%rip), %rax     # 0x40fd8
movl $0x0, (%rax)
movl $0x3b, %edi
callq 0xd670
leaq 0x1bf73(%rip), %rax     # 0x3db80
movl (%rax), %eax
movl %eax, %ecx
leaq 0x17d78(%rip), %rax     # 0x39990
movsbl (%rax,%rcx), %eax
cmpl $0x4d, %eax
je 0x21c70
leaq 0x1bf58(%rip), %rax     # 0x3db80
movl (%rax), %eax
movl %eax, %ecx
leaq 0x17d5d(%rip), %rax     # 0x39990
movsbl (%rax,%rcx), %eax
cmpl $0x20, %eax
je 0x21c70
leaq 0x1bf3d(%rip), %rax     # 0x3db80
cmpl $0x7d, (%rax)
je 0x21c70
leaq 0x1bf31(%rip), %rax     # 0x3db80
cmpl $0x7f, (%rax)
je 0x21c70
leaq 0x1023a(%rip), %rdi     # 0x31e95
movb $0x0, %al
callq 0xd530
xorl %edi, %edi
leaq 0x1834d(%rip), %rsi     # 0x39fb8
callq 0xd990
movl -0x1c(%rbp), %eax
movl %eax, 0x1833b(%rip)     # 0x39fb4
addq $0x60, %rsp
popq %rbp
retq
nop