// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movl %r9d, -0x30(%rbp)
movl %r8d, %r12d
movl %ecx, -0x2c(%rbp)
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %rbx
movq 0x8(%rdx), %rdx
decq %rdx
leaq -0x58(%rbp), %r14
pushq $-0x1
popq %rcx
movq %r14, %rdi
movq %r13, %rsi
callq 0x3200
leaq 0xcc71(%rip), %rsi      # 0x161d1
movq %r14, %rdi
callq 0xf4c8
testb %al, %al
je 0x9855
leaq -0x58(%rbp), %rdi
callq 0x3368
movq %rbx, %rdi
movq %r13, %rsi
callq 0x3270
testb %r12b, %r12b
je 0x95d7
movl -0x30(%rbp), %r12d
testb %r12b, %r12b
je 0x9624
leaq 0xdee6(%rip), %rdx      # 0x17483
leaq -0x58(%rbp), %rdi
movq %r15, %rsi
callq 0xf35b
leaq -0x98(%rbp), %rdi
leaq -0x58(%rbp), %rsi
movq %rbx, %rdx
callq 0xf332
pushq $0x6
popq %rdi
leaq -0x98(%rbp), %rdx
movl -0x2c(%rbp), %esi
callq 0x4a27
leaq -0x98(%rbp), %rdi
jmp 0x9616
movl -0x30(%rbp), %r12d
testb %r12b, %r12b
je 0x9624
leaq 0xde9c(%rip), %rdx      # 0x17483
leaq -0x58(%rbp), %rdi
movq %r15, %rsi
callq 0xf35b
leaq -0x78(%rbp), %rdi
leaq -0x58(%rbp), %rsi
movq %rbx, %rdx
callq 0xf332
pushq $0x9
popq %rdi
leaq -0x78(%rbp), %rdx
movl -0x2c(%rbp), %esi
callq 0x4a27
leaq -0x78(%rbp), %rdi
callq 0x3368
leaq -0x58(%rbp), %rdi
callq 0x3368
leaq -0x58(%rbp), %r15
movzbl %r12b, %eax
movl %eax, -0x2c(%rbp)
leaq -0xf8(%rbp), %r13
testb %r12b, %r12b
je 0x9669
leaq -0x198(%rbp), %r12
movq %r12, %rdi
leaq 0xde38(%rip), %rsi      # 0x17484
movq %r15, %rdx
callq 0xf1f8
pushq $0x1
popq %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x4a27
movq %r12, %rdi
callq 0x3368
callq 0x4fdf
leaq -0x178(%rbp), %r12
movq %r12, %rdi
leaq 0xcb93(%rip), %rsi      # 0x16212
movq %r15, %rdx
callq 0xf1f8
leaq -0x1b8(%rbp), %r14
movq %r14, %rdi
movq %r12, %rsi
movl 0x10(%rbp), %edx
movl -0x2c(%rbp), %ecx
callq 0x7431
movq %r14, %rdi
callq 0x3368
movq %r12, %rdi
callq 0x3368
movq 0x8(%rbx), %rdx
decq %rdx
movq %r15, %rdi
movq %rbx, %rsi
pushq $-0x1
popq %rcx
callq 0x3200
movq %r15, %rdi
leaq 0xcb03(%rip), %rsi      # 0x161d1
callq 0xf65a
movl %eax, %r12d
movq %r15, %rdi
callq 0x3368
testb %r12b, %r12b
movl -0x30(%rbp), %r12d
je 0x96f5
leaq 0xd127(%rip), %rdi      # 0x16815
xorl %eax, %eax
callq 0xf410
movq 0x8(%rbx), %rcx
decq %rcx
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x3200
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3230
movq %r15, %rdi
callq 0x3368
leaq -0xd8(%rbp), %rdi
movq %rbx, %rsi
callq 0x3270
leaq -0xd8(%rbp), %r14
movq %r14, %rdi
callq 0x94d6
movq %r14, %rdi
callq 0x3368
testb %r12b, %r12b
je 0x97d5
leaq -0x158(%rbp), %r14
movq %r14, %rdi
leaq 0xdd28(%rip), %rsi      # 0x17484
movq %r15, %rdx
callq 0xf1f8
pushq $0xd
popq %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x4a27
movq %r14, %rdi
callq 0x3368
leaq -0x138(%rbp), %r14
movq %r14, %rdi
leaq 0xdcfa(%rip), %rsi      # 0x17484
movq %r15, %rdx
callq 0xf1f8
pushq $0x1
popq %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x4a27
movq %r14, %rdi
callq 0x3368
leaq -0x118(%rbp), %r14
movq %r14, %rdi
leaq 0xdccc(%rip), %rsi      # 0x17484
movq %r15, %rdx
callq 0xf1f8
pushq $0xb
popq %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x4a27
movq %r14, %rdi
callq 0x3368
leaq -0xb8(%rbp), %rdi
leaq 0xca2b(%rip), %rsi      # 0x1620e
movq %r15, %rdx
callq 0xf1f8
movq %r13, %rdi
leaq 0xd36d(%rip), %rsi      # 0x16b62
leaq -0x31(%rbp), %rdx
callq 0xf1f8
leaq -0xb8(%rbp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x540c
movq %r13, %rdi
callq 0x3368
movq %r14, %rdi
callq 0x3368
callq 0x4fdf
leaq 0x17a64(%rip), %rdi     # 0x21290
leaq 0xd32f(%rip), %rsi      # 0x16b62
callq 0xf65a
testb %al, %al
je 0x9636
movq %rbx, %rax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xcf3a(%rip), %rdi      # 0x16796
leaq 0xcbd4(%rip), %rsi      # 0x16437
leaq 0xcf68(%rip), %rcx      # 0x167d2
movl $0x2e0, %edx            # imm = 0x2E0
callq 0x3150
movq %rax, %r14
leaq -0x78(%rbp), %rdi
jmp 0x9887
movq %rax, %r14
leaq -0x98(%rbp), %rdi
callq 0x3368
jmp 0x9893
jmp 0x9890
movq %rax, %r14
leaq -0x58(%rbp), %rdi
jmp 0x9910
jmp 0x9919
jmp 0x9919
movq %rax, %r14
leaq -0x198(%rbp), %rdi
jmp 0x9910
jmp 0x9919
jmp 0x9919
jmp 0x9919
jmp 0x9919
movq %rax, %r14
leaq -0x158(%rbp), %rdi
jmp 0x9910
movq %rax, %r14
leaq -0x138(%rbp), %rdi
jmp 0x9910
movq %rax, %r14
leaq -0x118(%rbp), %rdi
jmp 0x9910
jmp 0x9919
movq %rax, %r14
leaq -0x178(%rbp), %rdi
jmp 0x9910
jmp 0x9919
jmp 0x9919
movq %rax, %r14
leaq -0xd8(%rbp), %rdi
jmp 0x9910
jmp 0x9919
movq %rax, %r14
jmp 0x9909
movq %rax, %r14
leaq -0xf8(%rbp), %rdi
callq 0x3368
leaq -0xb8(%rbp), %rdi
callq 0x3368
jmp 0x991c
jmp 0x9919
movq %rax, %r14
movq %rbx, %rdi
callq 0x3368
movq %r14, %rdi
callq 0x3310