// File: yanlinlin82[P]icpp/icpp.cpp
// Function: parse_pointer_derefer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, bool, bool, int)
string parse_pointer_derefer(string name, string symbol_type_name,
		int offset, bool is_global, bool generate_code, int depth)
{
	assert(symbol_type_name.substr(symbol_type_name.size() - 1) == "*");
	string type_name = symbol_type_name;
	if (is_global) {
		if (generate_code) add_assembly_code(GET, offset, name + "\t" + type_name);
	} else {
		if (generate_code) add_assembly_code(LGET, offset, name + "\t" + type_name);
	}
	for (size_t i = 0; ; ++i) {
		if (generate_code) add_assembly_code(PUSH);
		next();
		parse_expression(";", depth, generate_code);
		if (type_name.substr(type_name.size() - 1) != "*") {
			err("too many level of dereferencing on a pointer!\n");
		}
		type_name = type_name.substr(0, type_name.size() - 1);
		int element_size = get_type_size(type_name);
		if (element_size != sizeof(int)) {
			if (generate_code) add_assembly_code(PUSH);
			if (generate_code) add_assembly_code(MOV, element_size / sizeof(int));
			if (generate_code) add_assembly_code(MUL);
		}
		if (generate_code) add_assembly_code(ADD);
		if (generate_code) add_assembly_code(PUSH);
		if (generate_code) add_assembly_code(SGET);
		expect_token("]", "[");
		next();
		if (token != "[") break;
	}
	return type_name;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3a0, %rsp            # imm = 0x3A0
movl %r8d, -0x320(%rbp)
movl %ecx, %eax
movl -0x320(%rbp), %ecx
movl %eax, -0x31c(%rbp)
movq %rdx, %rax
movl -0x31c(%rbp), %edx
movq %rax, -0x300(%rbp)
movq %rsi, -0x318(%rbp)
movq %rdi, %r8
movq -0x300(%rbp), %rdi
movq %r8, -0x310(%rbp)
movb %r9b, %al
movq %r8, %r9
movq %r9, -0x308(%rbp)
movl 0x10(%rbp), %r9d
movq %r8, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
andb $0x1, %cl
movb %cl, -0x1d(%rbp)
andb $0x1, %al
movb %al, -0x1e(%rbp)
callq 0x31c0
movq -0x300(%rbp), %rsi
movq %rax, %rdx
decq %rdx
leaq -0x40(%rbp), %rdi
movq %rdi, -0x2f8(%rbp)
movq $-0x1, %rcx
callq 0x3280
movq -0x2f8(%rbp), %rdi
leaq 0x290c7(%rip), %rsi     # 0x37111
callq 0x1a9c0
movb %al, -0x2ea(%rbp)
jmp 0xe057
movb -0x2ea(%rbp), %al
testb $0x1, %al
jne 0xe063
jmp 0xe065
jmp 0xe09e
leaq 0x2966a(%rip), %rdi     # 0x376d6
leaq 0x29304(%rip), %rsi     # 0x37377
movl $0x2e0, %edx            # imm = 0x2E0
leaq 0x29693(%rip), %rcx     # 0x37712
callq 0x31a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x34d8
jmp 0xea31
leaq -0x40(%rbp), %rdi
callq 0x34d8
movq -0x310(%rbp), %rdi
movq -0x300(%rbp), %rsi
movb $0x0, -0x4d(%rbp)
callq 0x3120
testb $0x1, -0x1d(%rbp)
je 0xe187
testb $0x1, -0x1e(%rbp)
je 0xe182
movq -0x318(%rbp), %rsi
movl -0x1c(%rbp), %eax
movl %eax, -0x324(%rbp)
leaq 0x2a2da(%rip), %rdx     # 0x383c3
leaq -0x90(%rbp), %rdi
callq 0x1a540
jmp 0xe0f7
movq -0x310(%rbp), %rdx
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x1a4f0
jmp 0xe110
movl -0x324(%rbp), %esi
movl $0x6, %edi
leaq -0x70(%rbp), %rdx
callq 0x56e0
jmp 0xe126
leaq -0x70(%rbp), %rdi
callq 0x34d8
leaq -0x90(%rbp), %rdi
callq 0x34d8
jmp 0xe182
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xea25
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe171
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x34d8
leaq -0x90(%rbp), %rdi
callq 0x34d8
jmp 0xea25
jmp 0xe23e
testb $0x1, -0x1e(%rbp)
je 0xe23c
movq -0x318(%rbp), %rsi
movl -0x1c(%rbp), %eax
movl %eax, -0x328(%rbp)
leaq 0x2a21b(%rip), %rdx     # 0x383c3
leaq -0xd0(%rbp), %rdi
callq 0x1a540
jmp 0xe1b6
movq -0x310(%rbp), %rdx
leaq -0xb0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x1a4f0
jmp 0xe1d2
movl -0x328(%rbp), %esi
movl $0x9, %edi
leaq -0xb0(%rbp), %rdx
callq 0x56e0
jmp 0xe1eb
leaq -0xb0(%rbp), %rdi
callq 0x34d8
leaq -0xd0(%rbp), %rdi
callq 0x34d8
jmp 0xe23c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe22b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x34d8
leaq -0xd0(%rbp), %rdi
callq 0x34d8
jmp 0xea25
jmp 0xe23e
movq $0x0, -0xd8(%rbp)
testb $0x1, -0x1e(%rbp)
je 0xe2e8
leaq -0xf9(%rbp), %rdi
movq %rdi, -0x330(%rbp)
callq 0x3470
movq -0x330(%rbp), %rdx
leaq 0x2a150(%rip), %rsi     # 0x383c4
leaq -0xf8(%rbp), %rdi
callq 0x199b0
jmp 0xe282
movl $0x1, %edi
xorl %esi, %esi
leaq -0xf8(%rbp), %rdx
callq 0x56e0
jmp 0xe297
leaq -0xf8(%rbp), %rdi
callq 0x34d8
leaq -0xf9(%rbp), %rdi
callq 0x32b0
jmp 0xe2e8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe2d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x34d8
leaq -0xf9(%rbp), %rdi
callq 0x32b0
jmp 0xea25
callq 0x6030
jmp 0xe2ef
leaq -0x141(%rbp), %rdi
movq %rdi, -0x338(%rbp)
callq 0x3470
movq -0x338(%rbp), %rdx
leaq 0x28e42(%rip), %rsi     # 0x37152
leaq -0x140(%rbp), %rdi
callq 0x199b0
jmp 0xe31e
movl 0x10(%rbp), %edx
movzbl -0x1e(%rbp), %ecx
andl $0x1, %ecx
leaq -0x120(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0xa530
jmp 0xe33d
leaq -0x120(%rbp), %rdi
callq 0x34d8
leaq -0x140(%rbp), %rdi
callq 0x34d8
leaq -0x141(%rbp), %rdi
callq 0x32b0
movq -0x310(%rbp), %rdi
callq 0x31c0
movq -0x310(%rbp), %rsi
movq %rax, %rdx
decq %rdx
leaq -0x168(%rbp), %rdi
movq $-0x1, %rcx
callq 0x3280
jmp 0xe38f
leaq 0x28d7b(%rip), %rsi     # 0x37111
leaq -0x168(%rbp), %rdi
callq 0x1b450
movb %al, -0x339(%rbp)
jmp 0xe3aa
leaq -0x168(%rbp), %rdi
callq 0x34d8
movb -0x339(%rbp), %al
testb $0x1, %al
jne 0xe3c2
jmp 0xe428
leaq 0x2938c(%rip), %rdi     # 0x37755
xorl %eax, %eax
callq 0x1a780
jmp 0xe3d2
jmp 0xe428
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe3fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x34d8
leaq -0x141(%rbp), %rdi
callq 0x32b0
jmp 0xea25
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x34d8
jmp 0xea25
movq -0x310(%rbp), %rdi
callq 0x31c0
movq -0x310(%rbp), %rsi
movq %rax, %rcx
decq %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x188(%rbp), %rdi
callq 0x3280
jmp 0xe453
movq -0x310(%rbp), %rdi
leaq -0x188(%rbp), %rsi
movq %rsi, -0x348(%rbp)
callq 0x3300
movq -0x348(%rbp), %rdi
callq 0x34d8
movq -0x310(%rbp), %rsi
leaq -0x1b0(%rbp), %rdi
callq 0x3120
jmp 0xe48e
leaq -0x1b0(%rbp), %rdi
callq 0xdf00
movl %eax, -0x34c(%rbp)
jmp 0xe4a2
leaq -0x1b0(%rbp), %rdi
callq 0x34d8
movl -0x34c(%rbp), %eax
movl %eax, -0x18c(%rbp)
movslq -0x18c(%rbp), %rax
cmpq $0x4, %rax
je 0xe6dc
testb $0x1, -0x1e(%rbp)
je 0xe587
leaq -0x1d1(%rbp), %rdi
movq %rdi, -0x358(%rbp)
callq 0x3470
movq -0x358(%rbp), %rdx
leaq 0x29ece(%rip), %rsi     # 0x383c4
leaq -0x1d0(%rbp), %rdi
callq 0x199b0
jmp 0xe504
movl $0x1, %edi
xorl %esi, %esi
leaq -0x1d0(%rbp), %rdx
callq 0x56e0
jmp 0xe519
leaq -0x1d0(%rbp), %rdi
callq 0x34d8
leaq -0x1d1(%rbp), %rdi
callq 0x32b0
jmp 0xe587
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x34d8
jmp 0xea25
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe576
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x34d8
leaq -0x1d1(%rbp), %rdi
callq 0x32b0
jmp 0xea25
testb $0x1, -0x1e(%rbp)
je 0xe63b
movslq -0x18c(%rbp), %rax
shrq $0x2, %rax
movl %eax, -0x364(%rbp)
leaq -0x1f9(%rbp), %rdi
movq %rdi, -0x360(%rbp)
callq 0x3470
movq -0x360(%rbp), %rdx
leaq 0x29e01(%rip), %rsi     # 0x383c4
leaq -0x1f8(%rbp), %rdi
callq 0x199b0
jmp 0xe5d1
movl -0x364(%rbp), %esi
movl $0x4, %edi
leaq -0x1f8(%rbp), %rdx
callq 0x56e0
jmp 0xe5ea
leaq -0x1f8(%rbp), %rdi
callq 0x34d8
leaq -0x1f9(%rbp), %rdi
callq 0x32b0
jmp 0xe63b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe62a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x34d8
leaq -0x1f9(%rbp), %rdi
callq 0x32b0
jmp 0xea25
testb $0x1, -0x1e(%rbp)
je 0xe6da
leaq -0x221(%rbp), %rdi
movq %rdi, -0x370(%rbp)
callq 0x3470
movq -0x370(%rbp), %rdx
leaq 0x29d5e(%rip), %rsi     # 0x383c4
leaq -0x220(%rbp), %rdi
callq 0x199b0
jmp 0xe674
movl $0xf, %edi
xorl %esi, %esi
leaq -0x220(%rbp), %rdx
callq 0x56e0
jmp 0xe689
leaq -0x220(%rbp), %rdi
callq 0x34d8
leaq -0x221(%rbp), %rdi
callq 0x32b0
jmp 0xe6da
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe6c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x34d8
leaq -0x221(%rbp), %rdi
callq 0x32b0
jmp 0xea25
jmp 0xe6dc
testb $0x1, -0x1e(%rbp)
je 0xe77b
leaq -0x249(%rbp), %rdi
movq %rdi, -0x378(%rbp)
callq 0x3470
movq -0x378(%rbp), %rdx
leaq 0x29cbd(%rip), %rsi     # 0x383c4
leaq -0x248(%rbp), %rdi
callq 0x199b0
jmp 0xe715
movl $0xd, %edi
xorl %esi, %esi
leaq -0x248(%rbp), %rdx
callq 0x56e0
jmp 0xe72a
leaq -0x248(%rbp), %rdi
callq 0x34d8
leaq -0x249(%rbp), %rdi
callq 0x32b0
jmp 0xe77b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe76a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x34d8
leaq -0x249(%rbp), %rdi
callq 0x32b0
jmp 0xea25
testb $0x1, -0x1e(%rbp)
je 0xe81a
leaq -0x271(%rbp), %rdi
movq %rdi, -0x380(%rbp)
callq 0x3470
movq -0x380(%rbp), %rdx
leaq 0x29c1e(%rip), %rsi     # 0x383c4
leaq -0x270(%rbp), %rdi
callq 0x199b0
jmp 0xe7b4
movl $0x1, %edi
xorl %esi, %esi
leaq -0x270(%rbp), %rdx
callq 0x56e0
jmp 0xe7c9
leaq -0x270(%rbp), %rdi
callq 0x34d8
leaq -0x271(%rbp), %rdi
callq 0x32b0
jmp 0xe81a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe809
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x270(%rbp), %rdi
callq 0x34d8
leaq -0x271(%rbp), %rdi
callq 0x32b0
jmp 0xea25
testb $0x1, -0x1e(%rbp)
je 0xe8b9
leaq -0x299(%rbp), %rdi
movq %rdi, -0x388(%rbp)
callq 0x3470
movq -0x388(%rbp), %rdx
leaq 0x29b7f(%rip), %rsi     # 0x383c4
leaq -0x298(%rbp), %rdi
callq 0x199b0
jmp 0xe853
movl $0xb, %edi
xorl %esi, %esi
leaq -0x298(%rbp), %rdx
callq 0x56e0
jmp 0xe868
leaq -0x298(%rbp), %rdi
callq 0x34d8
leaq -0x299(%rbp), %rdi
callq 0x32b0
jmp 0xe8b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe8a8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x298(%rbp), %rdi
callq 0x34d8
leaq -0x299(%rbp), %rdi
callq 0x32b0
jmp 0xea25
leaq -0x2c1(%rbp), %rdi
movq %rdi, -0x390(%rbp)
callq 0x3470
movq -0x390(%rbp), %rdx
leaq 0x28874(%rip), %rsi     # 0x3714e
leaq -0x2c0(%rbp), %rdi
callq 0x199b0
jmp 0xe8e8
leaq -0x2e9(%rbp), %rdi
movq %rdi, -0x398(%rbp)
callq 0x3470
movq -0x398(%rbp), %rdx
leaq 0x29199(%rip), %rsi     # 0x37aa2
leaq -0x2e8(%rbp), %rdi
callq 0x199b0
jmp 0xe917
leaq -0x2c0(%rbp), %rdi
leaq -0x2e8(%rbp), %rsi
callq 0x6790
jmp 0xe92c
leaq -0x2e8(%rbp), %rdi
callq 0x34d8
leaq -0x2e9(%rbp), %rdi
callq 0x32b0
leaq -0x2c0(%rbp), %rdi
callq 0x34d8
leaq -0x2c1(%rbp), %rdi
callq 0x32b0
callq 0x6030
jmp 0xe963
leaq 0x41b7e(%rip), %rdi     # 0x504e8
leaq 0x29131(%rip), %rsi     # 0x37aa2
callq 0x1b450
movb %al, -0x399(%rbp)
jmp 0xe97e
movb -0x399(%rbp), %al
testb $0x1, %al
jne 0xe98a
jmp 0xe9e6
jmp 0xe9ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe9d8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe9c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x2e8(%rbp), %rdi
callq 0x34d8
leaq -0x2e9(%rbp), %rdi
callq 0x32b0
leaq -0x2c0(%rbp), %rdi
callq 0x34d8
leaq -0x2c1(%rbp), %rdi
callq 0x32b0
jmp 0xea25
jmp 0xe9e8
movq -0xd8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xd8(%rbp)
jmp 0xe249
movb $0x1, -0x4d(%rbp)
testb $0x1, -0x4d(%rbp)
jne 0xea15
movq -0x310(%rbp), %rdi
callq 0x34d8
movq -0x308(%rbp), %rax
addq $0x3a0, %rsp            # imm = 0x3A0
popq %rbp
retq
movq -0x310(%rbp), %rdi
callq 0x34d8
movq -0x48(%rbp), %rdi
callq 0x3460
nopw (%rax,%rax)