// File: /workspace/github_cpp_makefile_star2_O2/yanlinlin82[P]icpp/icpp.cpp
// Function: parse()
void parse()
{
	init_symbol();

	for (next(); !token.empty();) {
		if (token == "using") {
			next(); while (!token.empty() && token != ";") next();
			if (token.empty()) { err("missing ';' for 'using'!\n"); }
			log<3>("[DEBUG] => 'using' statement skipped\n");
			next();
		} else if (token == "typedef") {
			skip_until(";", token);
			log<3>("[DEBUG] => 'typedef' statement skipped\n");
			next();
		} else if (token == "enum") {
			parse_enum();
		} else if (token == "union" || token == "struct" || token == "class" || token == "namespace") {
			string keyword = token;
			next();
			string name = token;
			next();
			expect_token("{", keyword + " " + name);
			scopes.push_back(make_pair(keyword, name));
			log<3>("[DEBUG] => (%s %s) start\n", keyword.c_str(), name.c_str());
			next();
		} else if (token == "template") {
			skip_until(";", token);
			log<3>("[DEBUG] => 'template' statement skipped\n");
			next();
		} else if (token == ";") {
			log<3>("[DEBUG] => ';' - end of statement\n");
			next();
		} else if (token == "}") {
			string scope_type;
			string scope_name;
			if (!scopes.empty()) {
				scope_type = scopes.back().first;
				scope_name = scopes.back().second;
				scopes.pop_back();
			}
			log<3>("[DEBUG] => '}' - end of block (%s,%s)\n", scope_type.c_str(), scope_name.c_str());
			if (scope_type == "function") {
				if (returned_functions.find(scope_name) == returned_functions.end()) {
					add_assembly_code(LEAVE);
					add_assembly_code(RET, get<3>(current_function));
				}
				current_function = make_tuple("", "", "", 0);
				stack_frame_table.pop_back();
			}
			next();
		} else {
			parse_statements();
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
callq 0xcfb6
callq 0x4fdf
leaq 0x13b8b(%rip), %rbx     # 0x21290
leaq 0x98a1(%rip), %r14      # 0x16fad
leaq 0x8aff(%rip), %r12      # 0x16212
cmpq $0x0, 0x13b7d(%rip)     # 0x21298
je 0xdb90
movq %rbx, %rdi
movq %r14, %rsi
callq 0xf4c8
testb %al, %al
je 0xd77b
callq 0x4fdf
cmpq $0x0, 0x13b5b(%rip)     # 0x21298
je 0xd758
movq %rbx, %rdi
movq %r12, %rsi
callq 0xf65a
testb %al, %al
jne 0xd730
cmpq $0x0, 0x13b42(%rip)     # 0x21298
jne 0xd766
leaq 0x9854(%rip), %rdi      # 0x16fb3
xorl %eax, %eax
callq 0xf410
leaq 0x9860(%rip), %rdi      # 0x16fcd
xorl %eax, %eax
callq 0xf138
callq 0x4fdf
jmp 0xd713
movq %r12, %r13
leaq -0xb0(%rbp), %r14
movq %rbx, %rdi
leaq 0x9588(%rip), %rsi      # 0x16d17
callq 0xf4c8
testb %al, %al
leaq -0x1b0(%rbp), %r12
je 0xd7f6
leaq -0x110(%rbp), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0xf1f8
movq %r12, %rdi
movq %rbx, %rsi
callq 0x3270
movq %r12, %r15
leaq -0x110(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x5450
movq %r15, %rdi
callq 0x3368
movq %r12, %rdi
callq 0x3368
leaq 0x980b(%rip), %rdi      # 0x16ff3
xorl %eax, %eax
callq 0xf138
callq 0x4fdf
jmp 0xd80e
movq %rbx, %rdi
leaq 0x981b(%rip), %rsi      # 0x1701b
callq 0xf4c8
testb %al, %al
je 0xd81d
callq 0xc8e2
leaq 0x9798(%rip), %r14      # 0x16fad
movq %r13, %r12
jmp 0xd713
movq %rbx, %rdi
leaq 0x97f9(%rip), %rsi      # 0x17020
callq 0xf4c8
testb %al, %al
jne 0xd86d
movq %rbx, %rdi
leaq 0x97ec(%rip), %rsi      # 0x17026
callq 0xf4c8
testb %al, %al
jne 0xd86d
movq %rbx, %rdi
leaq 0x97e0(%rip), %rsi      # 0x1702d
callq 0xf4c8
testb %al, %al
jne 0xd86d
movq %rbx, %rdi
leaq 0x97d3(%rip), %rsi      # 0x17033
callq 0xf4c8
testb %al, %al
je 0xd96a
leaq -0x50(%rbp), %rdi
movq %rbx, %rsi
callq 0x3270
callq 0x4fdf
leaq 0x9728(%rip), %r14      # 0x16fad
leaq -0x70(%rbp), %rdi
movq %rbx, %rsi
callq 0x3270
movq %r13, %r12
callq 0x4fdf
leaq -0xf0(%rbp), %rdi
leaq 0x8bcb(%rip), %rsi      # 0x16472
leaq -0x29(%rbp), %rdx
callq 0xf1f8
leaq -0xb0(%rbp), %r13
movq %r13, %rdi
leaq -0x50(%rbp), %rsi
leaq 0x89bb(%rip), %rdx      # 0x16280
callq 0xf35b
leaq -0x190(%rbp), %r15
movq %r15, %rdi
movq %r13, %rsi
leaq -0x70(%rbp), %rdx
callq 0xf332
leaq -0xf0(%rbp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x540c
movq %r15, %rdi
callq 0x3368
leaq -0xb0(%rbp), %r15
movq %r15, %rdi
callq 0x3368
movq %r13, %rdi
callq 0x3368
movq %r15, %rdi
leaq -0x50(%rbp), %rsi
leaq -0x70(%rbp), %rdx
callq 0x106b2
leaq 0x13988(%rip), %rdi     # 0x212b0
movq %r15, %rsi
callq 0x13d30
movq %r15, %rdi
callq 0xf780
movq -0x50(%rbp), %rsi
movq -0x70(%rbp), %rdx
leaq 0x96f6(%rip), %rdi      # 0x1703d
xorl %eax, %eax
callq 0xf138
callq 0x4fdf
leaq -0x70(%rbp), %rdi
callq 0x3368
leaq -0x50(%rbp), %rdi
callq 0x3368
jmp 0xd713
movq %rbx, %rdi
leaq 0x96e3(%rip), %rsi      # 0x17057
callq 0xf4c8
testb %al, %al
leaq 0x962b(%rip), %r14      # 0x16fad
je 0xd9dd
leaq -0xd0(%rbp), %rdi
movq %r13, %r12
movq %r13, %rsi
leaq -0xb0(%rbp), %rdx
callq 0xf1f8
leaq -0x170(%rbp), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0x3270
leaq -0xd0(%rbp), %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0x5450
movq %r13, %rdi
callq 0x3368
movq %r15, %rdi
callq 0x3368
leaq 0x9688(%rip), %rdi      # 0x17060
jmp 0xd76d
movq %rbx, %rdi
movq %r13, %r12
movq %r13, %rsi
callq 0xf4c8
testb %al, %al
je 0xd9fb
leaq 0x9693(%rip), %rdi      # 0x17089
jmp 0xd76d
movq %rbx, %rdi
leaq 0x880b(%rip), %rsi      # 0x16210
callq 0xf4c8
testb %al, %al
je 0xdb84
leaq -0xa0(%rbp), %rsi
movq %rsi, -0xb0(%rbp)
andq $0x0, -0xa8(%rbp)
leaq -0x40(%rbp), %rdx
movq %rdx, -0x50(%rbp)
andq $0x0, -0x48(%rbp)
xorl %eax, %eax
movb %al, -0xa0(%rbp)
movb %al, -0x40(%rbp)
movq 0x13871(%rip), %rax     # 0x212b8
cmpq %rax, 0x13862(%rip)     # 0x212b0
je 0xda8e
addq $-0x40, %rax
leaq -0xb0(%rbp), %rdi
movq %rax, %rsi
callq 0x3130
movq 0x1384e(%rip), %rsi     # 0x212b8
addq $-0x20, %rsi
leaq -0x50(%rbp), %rdi
callq 0x3130
leaq 0x13832(%rip), %rdi     # 0x212b0
callq 0xf8bc
movq -0xb0(%rbp), %rsi
movq -0x50(%rbp), %rdx
leaq 0x9617(%rip), %rdi      # 0x170ac
xorl %eax, %eax
callq 0xf138
leaq -0xb0(%rbp), %rdi
leaq 0x8c82(%rip), %rsi      # 0x1672c
callq 0xf4c8
testb %al, %al
je 0xdb65
leaq 0x1380a(%rip), %rdi     # 0x212c8
leaq -0x50(%rbp), %rsi
callq 0x151d0
testq %rax, %rax
jne 0xdb32
leaq -0x150(%rbp), %r15
movq %r15, %rdi
leaq 0x99a7(%rip), %rsi      # 0x17484
leaq -0x70(%rbp), %rdx
callq 0xf1f8
pushq $0x24
popq %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x4a27
movq %r15, %rdi
callq 0x3368
movl 0x139de(%rip), %r13d    # 0x214e0
leaq -0x130(%rbp), %r15
movq %r15, %rdi
leaq 0x9971(%rip), %rsi      # 0x17484
leaq -0x70(%rbp), %rdx
callq 0xf1f8
pushq $0x26
popq %rdi
movl %r13d, %esi
movq %r15, %rdx
callq 0x4a27
movq %r15, %rdi
callq 0x3368
andl $0x0, -0x70(%rbp)
leaq 0x9947(%rip), %rax      # 0x17484
movq %rax, -0x68(%rbp)
movq %rax, -0x60(%rbp)
movq %rax, -0x58(%rbp)
leaq 0x13990(%rip), %rdi     # 0x214e0
leaq -0x70(%rbp), %rsi
callq 0x151fe
leaq 0x137e0(%rip), %rdi     # 0x21340
callq 0xf8d6
callq 0x4fdf
leaq -0x50(%rbp), %rdi
callq 0x3368
leaq -0xb0(%rbp), %rdi
callq 0x3368
jmp 0xd713
xorl %edi, %edi
callq 0xb74a
jmp 0xd713
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x130(%rbp), %rdi
jmp 0xdbba
jmp 0xdbc7
movq %rax, %rbx
leaq -0x150(%rbp), %rdi
callq 0x3368
jmp 0xdbca
jmp 0xdbc7
jmp 0xdbc7
jmp 0xdbc7
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x3368
leaq -0xb0(%rbp), %rdi
jmp 0xdc82
movq %rax, %rbx
leaq -0x170(%rbp), %rdi
callq 0x3368
jmp 0xdbf3
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
jmp 0xdc82
jmp 0xdc6d
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
callq 0xf780
jmp 0xdc75
jmp 0xdc72
movq %rax, %rbx
leaq -0x190(%rbp), %rdi
callq 0x3368
jmp 0xdc28
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
callq 0x3368
jmp 0xdc39
movq %rax, %rbx
leaq -0xf0(%rbp), %rdi
callq 0x3368
jmp 0xdc75
jmp 0xdc72
jmp 0xdc4b
movq %rax, %rbx
jmp 0xdc7e
movq %rax, %rbx
leaq -0x1b0(%rbp), %rdi
callq 0x3368
jmp 0xdc64
movq %rax, %rbx
leaq -0x110(%rbp), %rdi
jmp 0xdc82
movq %rax, %rbx
jmp 0xdc87
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x3368
leaq -0x50(%rbp), %rdi
callq 0x3368
movq %rbx, %rdi
callq 0x3310