// File: /workspace/github_cpp_makefile_star2_O2/yanlinlin82[P]icpp/icpp.cpp
// Function: parse_enum()
void parse_enum()
{
	next(); // skip 'enum'

	if (type != symbol) {
		err("missing symbol for 'enum' name!\n");
	}
	string name = token;
	next(); // skip name

	expect_token("{", "enum " + name);
	next(); // skip '{'

	int value = 0;
	while (!token.empty() && token != "}") {
		if (type != symbol) {
			err("invalid token '%s' for 'enum' value!\n", token.c_str());
		}
		string enum_key = token;
		next(); // skip

		string value_txt;
		if (token == "=") {
			next(); // skip '='
			if (type != symbol && type != number) {
				err("invalid token '%s' for 'enum' declearation!\n", token.c_str());
			}
			value_txt = token;
			value = eval_number(value_txt);
			next();
		}
		log<3>("[DEBUG] enum '%s': %s%s%s\n", name.c_str(), enum_key.c_str(),
				(value_txt.empty() ? "" : " = "), value_txt.c_str());

		auto it = enum_values.find(name);
		if (it == enum_values.end()) {
			enum_values.insert(make_pair(name, unordered_map<string, int>()));
			it = enum_values.find(name);
		}
		auto it2 = it->second.find(enum_key);
		if (it2 != it->second.end()) {
			err("duplidated enum key '%s'!\n", enum_key.c_str());
		}
		it->second.insert(make_pair(enum_key, value++));
		auto it3 = enum_types.find(enum_key);
		if (it3 != enum_types.end()) {
			err("symbol '%s' has existed!\n", enum_key.c_str());
		}
		enum_types.insert(make_pair(enum_key, make_pair(name, value)));

		if (token == "}") break;
		expect_token(",", "enum " + name);
		next();
	}
	expect_token("}", "enum " + name);
	next(); // skip '}'
	expect_token(";", "enum " + name);
	next(); // skip ';'
	log<3>("[DEBUG] end of enum %s\n", name.c_str());
	if (verbose >= 4) dump_enum();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
callq 0x4fdf
cmpl $0x1, 0x14986(%rip)     # 0x21288
je 0xc912
leaq 0xa480(%rip), %rdi      # 0x16d8b
xorl %eax, %eax
callq 0xf410
leaq 0x14977(%rip), %rsi     # 0x21290
leaq -0x48(%rbp), %rdi
callq 0x3270
callq 0x4fdf
leaq 0x9b44(%rip), %rsi      # 0x16472
leaq -0x180(%rbp), %rdi
leaq -0x218(%rbp), %rdx
callq 0xf1f8
leaq 0xa464(%rip), %rsi      # 0x16dac
leaq -0x160(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0xf5e4
leaq -0x180(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x540c
leaq -0x160(%rbp), %rdi
callq 0x3368
leaq -0x180(%rbp), %rdi
callq 0x3368
callq 0x4fdf
leaq -0xc0(%rbp), %r15
leaq -0x218(%rbp), %r13
xorl %r12d, %r12d
cmpq $0x0, 0x148f7(%rip)     # 0x21298
je 0xcc9f
leaq 0x148e2(%rip), %rdi     # 0x21290
leaq 0x985b(%rip), %rsi      # 0x16210
callq 0xf65a
testb %al, %al
je 0xcc9f
cmpl $0x1, 0x148bf(%rip)     # 0x21288
je 0xc9e0
movq 0x148be(%rip), %rsi     # 0x21290
leaq 0xa3d9(%rip), %rdi      # 0x16db2
xorl %eax, %eax
callq 0xf410
movq %r15, %rdi
leaq 0x148a6(%rip), %rsi     # 0x21290
callq 0x3270
callq 0x4fdf
leaq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
andq $0x0, -0x60(%rbp)
movb $0x0, -0x58(%rbp)
leaq 0x14884(%rip), %rdi     # 0x21290
leaq 0x97d3(%rip), %rsi      # 0x161e6
callq 0xf4c8
testb %al, %al
je 0xca83
callq 0x4fdf
movl 0x14861(%rip), %eax     # 0x21288
addl $-0x3, %eax
cmpl $-0x3, %eax
ja 0xca44
movq 0x1485a(%rip), %rsi     # 0x21290
leaq 0xa39b(%rip), %rdi      # 0x16dd8
xorl %eax, %eax
callq 0xf410
leaq -0x68(%rbp), %rdi
leaq 0x14841(%rip), %rsi     # 0x21290
callq 0x3130
leaq -0x1c0(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x3270
leaq -0x1c0(%rbp), %r14
movq %r14, %rdi
callq 0x5650
movl %eax, %r12d
movq %r14, %rdi
callq 0x3368
callq 0x4fdf
movq -0x48(%rbp), %rsi
movq -0xc0(%rbp), %rdx
cmpq $0x0, -0x60(%rbp)
leaq 0xa386(%rip), %rcx      # 0x16e20
leaq 0xa9e3(%rip), %rax      # 0x17484
cmoveq %rax, %rcx
movq -0x68(%rbp), %r8
leaq 0xa355(%rip), %rdi      # 0x16e05
xorl %eax, %eax
callq 0xf138
leaq 0x14aa2(%rip), %rdi     # 0x21560
leaq -0x48(%rbp), %rsi
callq 0x1493c
movq %rax, %r14
testq %rax, %rax
jne 0xcb44
andq $0x0, -0x80(%rbp)
leaq -0x70(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq $0x1, -0x98(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x80(%rbp) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
movq %r13, %rdi
leaq -0x48(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
callq 0x10a98
leaq 0x14a4a(%rip), %r14     # 0x21560
movq %r14, %rdi
movq %r13, %rsi
callq 0x14a1a
movq %r13, %rdi
callq 0xf87c
leaq -0xa0(%rbp), %rdi
callq 0xfa18
movq %r14, %rdi
leaq -0x48(%rbp), %rsi
callq 0x1493c
movq %rax, %r14
addq $0x28, %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x133c2
testq %rax, %rax
je 0xcb6d
movq -0xc0(%rbp), %rsi
leaq 0xa2be(%rip), %rdi      # 0x16e24
xorl %eax, %eax
callq 0xf410
movq %r13, %rdi
movq %r15, %rsi
callq 0x3270
movl %r12d, -0x1f8(%rbp)
movq %r14, %rdi
movq %r13, %rsi
callq 0x14d78
movq %r13, %rdi
callq 0x3368
leaq 0x149ff(%rip), %rdi     # 0x21598
movq %r15, %rsi
callq 0x13a18
testq %rax, %rax
je 0xcbbb
movq -0xc0(%rbp), %rsi
leaq 0xa28b(%rip), %rdi      # 0x16e3f
xorl %eax, %eax
callq 0xf410
leaq -0xa0(%rbp), %r14
movq %r14, %rdi
leaq -0x48(%rbp), %rsi
callq 0x3270
incl %r12d
movl %r12d, -0x80(%rbp)
movq %r13, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x10b6a
leaq 0x149ae(%rip), %rdi     # 0x21598
movq %r13, %rsi
callq 0x14e72
movq %r13, %rdi
callq 0xf89c
leaq -0xa0(%rbp), %rdi
callq 0x3368
leaq 0x14683(%rip), %rdi     # 0x21290
leaq 0x95fc(%rip), %rsi      # 0x16210
callq 0xf4c8
testb %al, %al
jne 0xcc8a
leaq -0x1a0(%rbp), %rdi
leaq 0x95e1(%rip), %rsi      # 0x1620c
movq %r13, %rdx
callq 0xf1f8
leaq -0x238(%rbp), %rbx
movq %rbx, %rdi
leaq 0xa168(%rip), %rsi      # 0x16dac
leaq -0x48(%rbp), %rdx
callq 0xf5e4
leaq -0x1a0(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x540c
movq %rbx, %rdi
callq 0x3368
movq %r14, %rdi
callq 0x3368
callq 0x4fdf
leaq -0x68(%rbp), %rdi
callq 0x3368
movq %r15, %rdi
callq 0x3368
jmp 0xc999
leaq -0x68(%rbp), %rdi
callq 0x3368
leaq -0xc0(%rbp), %rdi
callq 0x3368
leaq 0x956a(%rip), %rsi      # 0x16210
leaq -0x140(%rbp), %rdi
leaq -0x218(%rbp), %rdx
callq 0xf1f8
leaq 0xa0ec(%rip), %rsi      # 0x16dac
leaq -0x120(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0xf5e4
leaq -0x140(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x540c
leaq -0x120(%rbp), %rdi
callq 0x3368
leaq -0x140(%rbp), %rdi
callq 0x3368
callq 0x4fdf
leaq 0x950b(%rip), %rsi      # 0x16212
leaq -0x100(%rbp), %rdi
leaq -0x218(%rbp), %rdx
callq 0xf1f8
leaq 0xa08b(%rip), %rsi      # 0x16dac
leaq -0xe0(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0xf5e4
leaq -0x100(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x540c
leaq -0xe0(%rbp), %rdi
callq 0x3368
leaq -0x100(%rbp), %rdi
callq 0x3368
callq 0x4fdf
movq -0x48(%rbp), %rsi
leaq 0xa0ed(%rip), %rdi      # 0x16e59
xorl %eax, %eax
callq 0xf138
cmpl $0x4, 0x14856(%rip)     # 0x215d0
jl 0xcd81
callq 0x3fcc
leaq -0x48(%rbp), %rdi
callq 0x3368
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0xe0(%rbp), %rdi
callq 0x3368
jmp 0xcdb0
movq %rax, %rbx
leaq -0x100(%rbp), %rdi
jmp 0xceb2
jmp 0xce5d
movq %rax, %rbx
leaq -0x120(%rbp), %rdi
callq 0x3368
jmp 0xcdd5
movq %rax, %rbx
leaq -0x140(%rbp), %rdi
jmp 0xceb2
jmp 0xce5d
movq %rax, %rbx
leaq -0x160(%rbp), %rdi
callq 0x3368
jmp 0xcdf7
movq %rax, %rbx
leaq -0x180(%rbp), %rdi
jmp 0xceb2
jmp 0xce5d
jmp 0xce5d
jmp 0xce5d
jmp 0xce9f
movq %rax, %rbx
leaq -0x218(%rbp), %rdi
callq 0xf87c
jmp 0xce22
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
callq 0xfa18
jmp 0xcea2
movq %rax, %rbx
leaq -0x1c0(%rbp), %rdi
jmp 0xce94
jmp 0xce5d
movq %rax, %rbx
leaq -0x238(%rbp), %rdi
callq 0x3368
jmp 0xce52
movq %rax, %rbx
leaq -0x1a0(%rbp), %rdi
jmp 0xce94
jmp 0xce9f
movq %rax, %rbx
jmp 0xceb7
jmp 0xce9f
movq %rax, %rbx
leaq -0x218(%rbp), %rdi
callq 0xf89c
jmp 0xce78
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
jmp 0xce94
jmp 0xce9f
movq %rax, %rbx
jmp 0xceab
jmp 0xce9f
movq %rax, %rbx
leaq -0x218(%rbp), %rdi
callq 0x3368
jmp 0xcea2
jmp 0xce9f
jmp 0xce9f
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x3368
leaq -0xc0(%rbp), %rdi
callq 0x3368
leaq -0x48(%rbp), %rdi
callq 0x3368
movq %rbx, %rdi
callq 0x3310