// File: /workspace/github_c_makefile_star2_O0/Oric4ever[P]lcc65/6502/build/../src/decl.c
// Function: enumdecl
static Type enumdecl() {
	char *tag;
	Type ty;
	Symbol p;
	Coordinate pos;

	t = gettok();
	if (t == ID) {
		tag = token;
		pos = src;
		t = gettok();
	} else
		tag = string("");
	if (t == '{') {
		static char follow[] = { IF, 0 };
		int n = 0, min, max, k = -1;
		List idlist = 0;
		ty = newstruct(ENUM, tag);
		t = gettok();
		if (t != ID)
			error("expecting an enumerator identifier\n");
		while (t == ID) {
			char *id = token;
			Coordinate s;
			if (tsym && tsym->scope == level)
				error("redeclaration of `%s' previously declared at %w\n",
					token, &tsym->src);
			s = src;
			t = gettok();
			if (t == '=') {
				t = gettok();
				k = intexpr(0, 0);
			} else {
				if (k == INT_MAX)
					error("overflow in value for enumeration constant `%s'\n", p->name);
				k++;
			}
			if (idlist) {
				if (k < min)
					min = k;
				if (k > max)
					max = k;
			} else
				min = max = k;
			p = install(id, &identifiers, level < LOCAL);
			p->src = s;
			p->type = ty;
			p->sclass = ENUM;
			p->u.value = k;
			idlist = append(p, idlist);
			n++;
			if (Aflag >= 2 && n == 128)
				warning("more than 127 enumeration constants in `%t'\n", ty);
			if (t != ',')
				break;
			t = gettok();
			if (Aflag >= 2 && t == '}')
				warning("non-ANSI trailing comma in enumerator list\n");
		}
		test('}', follow);
		if (min >= 0 && max <= 255)
			ty->type = unsignedchar;
		else if (min >= -128 && max <= 127)
			ty->type = signedchar;
		else if (min >= 0 && max <= 65535 && unsignedshort->size >= 2)
			ty->type = unsignedshort;
		else if (min >= -32768 && max <= 32767 && shorttype->size >= 2)
			ty->type = shorttype;
		else
			ty->type = inttype;
		ty->size = ty->type->size;
		ty->align = ty->type->align;
		ty->u.sym->u.idlist = (Symbol *)list_to_a(idlist, (Generic *)alloc((length(idlist) + 1)*sizeof(Symbol)));
		ty->u.sym->defined = 1;
	} else if ((p = lookup(tag, types)) && p->type->op == ENUM) {
		if (*tag && xref)
			use(p, pos);
		ty = p->type;
	} else {
		error("unknown enumeration `%s'\n",  tag);
		ty = newstruct(ENUM, tag);
		ty->type = inttype;
	}
	return ty;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
callq 0x15170
movl %eax, %ecx
leaq 0x3465a(%rip), %rax     # 0x3db80
movl %ecx, (%rax)
leaq 0x34651(%rip), %rax     # 0x3db80
cmpl $0x20, (%rax)
jne 0x956a
leaq 0x345ad(%rip), %rax     # 0x3dae8
movq (%rax), %rax
movq %rax, -0x8(%rbp)
leaq 0x3458f(%rip), %rax     # 0x3dad8
movq (%rax), %rcx
movq %rcx, -0x28(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
callq 0x15170
movl %eax, %ecx
leaq 0x3461a(%rip), %rax     # 0x3db80
movl %ecx, (%rax)
jmp 0x957a
leaq 0x275cc(%rip), %rdi     # 0x30b3d
callq 0x237e0
movq %rax, -0x8(%rbp)
leaq 0x345ff(%rip), %rax     # 0x3db80
cmpl $0x7b, (%rax)
jne 0x99ca
movl $0x0, -0x2c(%rbp)
movl $0xffffffff, -0x38(%rbp) # imm = 0xFFFFFFFF
movq $0x0, -0x40(%rbp)
movq -0x8(%rbp), %rsi
movl $0xd, %edi
callq 0x28e10
movq %rax, -0x10(%rbp)
callq 0x15170
movl %eax, %ecx
leaq 0x345c0(%rip), %rax     # 0x3db80
movl %ecx, (%rax)
leaq 0x345b7(%rip), %rax     # 0x3db80
cmpl $0x20, (%rax)
je 0x95dc
leaq 0x26359(%rip), %rdi     # 0x2f92e
movb $0x0, %al
callq 0xd530
jmp 0x95de
leaq 0x3459b(%rip), %rax     # 0x3db80
cmpl $0x20, (%rax)
jne 0x97d0
leaq 0x344f3(%rip), %rax     # 0x3dae8
movq (%rax), %rax
movq %rax, -0x48(%rbp)
leaq 0x344ed(%rip), %rax     # 0x3daf0
cmpq $0x0, (%rax)
je 0x9648
leaq 0x344e0(%rip), %rax     # 0x3daf0
movq (%rax), %rax
movzwl 0x18(%rax), %eax
leaq 0x37972(%rip), %rcx     # 0x40f90
cmpl (%rcx), %eax
jne 0x9648
leaq 0x344bf(%rip), %rax     # 0x3dae8
movq (%rax), %rsi
leaq 0x344bd(%rip), %rax     # 0x3daf0
movq (%rax), %rdx
addq $0x28, %rdx
leaq 0x25ec9(%rip), %rdi     # 0x2f50a
movb $0x0, %al
callq 0xd530
leaq 0x34489(%rip), %rax     # 0x3dad8
movq (%rax), %rcx
movq %rcx, -0x58(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
callq 0x15170
movl %eax, %ecx
leaq 0x34514(%rip), %rax     # 0x3db80
movl %ecx, (%rax)
leaq 0x3450b(%rip), %rax     # 0x3db80
cmpl $0x3d, (%rax)
jne 0x9698
callq 0x15170
movl %eax, %ecx
leaq 0x344f8(%rip), %rax     # 0x3db80
movl %ecx, (%rax)
xorl %esi, %esi
movl %esi, %edi
callq 0x10420
movl %eax, -0x38(%rbp)
jmp 0x96c0
cmpl $0x7fffffff, -0x38(%rbp) # imm = 0x7FFFFFFF
jne 0x96b7
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
leaq 0x262a2(%rip), %rdi     # 0x2f952
movb $0x0, %al
callq 0xd530
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x96e5
movl -0x38(%rbp), %eax
cmpl -0x30(%rbp), %eax
jge 0x96d5
movl -0x38(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x34(%rbp), %eax
jle 0x96e3
movl -0x38(%rbp), %eax
movl %eax, -0x34(%rbp)
jmp 0x96ee
movl -0x38(%rbp), %eax
movl %eax, -0x34(%rbp)
movl %eax, -0x30(%rbp)
movq -0x48(%rbp), %rdi
leaq 0x37897(%rip), %rax     # 0x40f90
cmpl $0x5, (%rax)
setl %al
andb $0x1, %al
movzbl %al, %edx
leaq 0x31a2d(%rip), %rsi     # 0x3b138
callq 0x24720
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rcx, 0x28(%rax)
movq -0x50(%rbp), %rcx
movq %rcx, 0x30(%rax)
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rax
movb $0xd, 0x1a(%rax)
movl -0x38(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x48(%rax)
movq -0x18(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x23500
movq %rax, -0x40(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
leaq 0x344c1(%rip), %rax     # 0x3dc28
cmpl $0x2, (%rax)
jl 0x9787
cmpl $0x80, -0x2c(%rbp)
jne 0x9787
movq -0x10(%rbp), %rsi
leaq 0x26203(%rip), %rdi     # 0x2f983
movb $0x0, %al
callq 0xdba0
leaq 0x343f2(%rip), %rax     # 0x3db80
cmpl $0x2c, (%rax)
je 0x9795
jmp 0x97d0
callq 0x15170
movl %eax, %ecx
leaq 0x343dd(%rip), %rax     # 0x3db80
movl %ecx, (%rax)
leaq 0x3447c(%rip), %rax     # 0x3dc28
cmpl $0x2, (%rax)
jl 0x97cb
leaq 0x343c8(%rip), %rax     # 0x3db80
cmpl $0x7d, (%rax)
jne 0x97cb
leaq 0x261ec(%rip), %rdi     # 0x2f9b0
movb $0x0, %al
callq 0xdba0
jmp 0x95de
movl $0x7d, %edi
leaq 0x2f958(%rip), %rsi     # 0x39134
callq 0xdb30
cmpl $0x0, -0x30(%rbp)
jl 0x9807
cmpl $0xff, -0x34(%rbp)
jg 0x9807
leaq 0x3aa29(%rip), %rax     # 0x44220
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x98a8
cmpl $-0x80, -0x30(%rbp)
jl 0x9827
cmpl $0x7f, -0x34(%rbp)
jg 0x9827
leaq 0x3a9fe(%rip), %rax     # 0x44218
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x98a6
cmpl $0x0, -0x30(%rbp)
jl 0x985a
cmpl $0xffff, -0x34(%rbp)    # imm = 0xFFFF
jg 0x985a
leaq 0x3a9f3(%rip), %rax     # 0x44230
movq (%rax), %rax
cmpl $0x2, 0x8(%rax)
jl 0x985a
leaq 0x3a9e3(%rip), %rax     # 0x44230
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x98a4
cmpl $0xffff8000, -0x30(%rbp) # imm = 0xFFFF8000
jl 0x9890
cmpl $0x7fff, -0x34(%rbp)    # imm = 0x7FFF
jg 0x9890
leaq 0x3a99d(%rip), %rax     # 0x44210
movq (%rax), %rax
cmpl $0x2, 0x8(%rax)
jl 0x9890
leaq 0x3a98d(%rip), %rax     # 0x44210
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x98a2
leaq 0x3a961(%rip), %rax     # 0x441f8
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x98a4
jmp 0x98a6
jmp 0x98a8
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x8(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movw 0x4(%rax), %cx
movq -0x10(%rbp), %rax
movw %cx, 0x4(%rax)
movq -0x40(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %rdi
callq 0x23630
addl $0x1, %eax
cltq
shlq $0x3, %rax
addq $0x7, %rax
andq $-0x8, %rax
movl %eax, %ecx
leaq 0x31d47(%rip), %rax     # 0x3b640
movq (%rax), %rax
movl %ecx, (%rax)
leaq 0x31d3b(%rip), %rax     # 0x3b640
movq (%rax), %rax
movq 0x8(%rax), %rax
leaq 0x31d2d(%rip), %rcx     # 0x3b640
movq (%rcx), %rcx
movslq (%rcx), %rcx
addq %rcx, %rax
leaq 0x31d1d(%rip), %rcx     # 0x3b640
movq (%rcx), %rcx
cmpq 0x10(%rcx), %rax
jb 0x994a
leaq 0x31d0d(%rip), %rax     # 0x3b640
movq (%rax), %rax
movl (%rax), %edi
leaq 0x31d01(%rip), %rsi     # 0x3b640
callq 0x253d0
movq %rax, -0x68(%rbp)
jmp 0x9995
leaq 0x31cef(%rip), %rax     # 0x3b640
movq (%rax), %rax
movl (%rax), %edx
leaq 0x31ce3(%rip), %rax     # 0x3b640
movq (%rax), %rax
movq 0x8(%rax), %rcx
movslq %edx, %rdx
addq %rdx, %rcx
movq %rcx, 0x8(%rax)
leaq 0x31ccb(%rip), %rax     # 0x3b640
movq (%rax), %rax
movq 0x8(%rax), %rax
leaq 0x31cbd(%rip), %rcx     # 0x3b640
movq (%rcx), %rcx
movslq (%rcx), %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x23670
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rcx, 0x48(%rax)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movb 0x1b(%rax), %cl
andb $-0x2, %cl
orb $0x1, %cl
movb %cl, 0x1b(%rax)
jmp 0x9a63
movq -0x8(%rbp), %rdi
leaq 0x31b8b(%rip), %rax     # 0x3b560
movq (%rax), %rsi
callq 0x24670
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x9a2b
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
cmpl $0xd, (%rax)
jne 0x9a2b
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x9a1d
leaq 0x341fd(%rip), %rax     # 0x3dc04
cmpl $0x0, (%rax)
je 0x9a1d
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x252c0
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x9a61
movq -0x8(%rbp), %rsi
leaq 0x25fa6(%rip), %rdi     # 0x2f9dc
movb $0x0, %al
callq 0xd530
movq -0x8(%rbp), %rsi
movl $0xd, %edi
callq 0x28e10
movq %rax, -0x10(%rbp)
leaq 0x3a7a2(%rip), %rax     # 0x441f8
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x9a63
movq -0x10(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)