// File: yanlinlin82[P]icpp/icpp.cpp
// Function: add_variable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
auto add_variable(string name, int size, string type) -> pair<bool, size_t> // { is-global, offset }
{
	log<3>("[DEBUG] add variable '%s', size = %d, type = '%s'\n",
			name.c_str(), size, type.c_str());
	if (stack_frame_table.empty()) {
		size_t offset = data_sec.size();
		add_symbol(name, false, offset, size, type, "", 0);
		data_sec.resize(data_sec.size() + size);
		return make_pair(true, offset);
	} else {
		size_t stack_frame_offset = stack_frame_table.back().first;
		code_sec[stack_frame_offset] += size;
		size_t symbol_offset = -code_sec[stack_frame_offset];
		stack_frame_table.back().second.insert(make_pair(name, make_tuple(symbol_offset, size, type)));
		return make_pair(false, symbol_offset);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rdi, -0x168(%rbp)
movq %rdx, -0x160(%rbp)
movq %rdi, -0x18(%rbp)
movl %esi, -0x1c(%rbp)
movq %rdx, -0x28(%rbp)
callq 0x3110
movq -0x160(%rbp), %rdi
movq %rax, -0x158(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x150(%rbp)
callq 0x3110
movq -0x158(%rbp), %rsi
movl -0x150(%rbp), %edx
movq %rax, %rcx
leaq 0x324e7(%rip), %rdi     # 0x37243
movb $0x0, %al
callq 0x19760
leaq 0x4b82e(%rip), %rdi     # 0x50598
callq 0x19bb0
testb $0x1, %al
jne 0x4d78
jmp 0x4ee4
leaq 0x4b7f1(%rip), %rdi     # 0x50570
callq 0x19990
movq -0x168(%rbp), %rsi
movq %rax, -0x30(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x3120
movq -0x160(%rbp), %rsi
movq -0x30(%rbp), %rax
movq %rax, -0x178(%rbp)
movslq -0x1c(%rbp), %rax
movq %rax, -0x170(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x3120
jmp 0x4dc0
leaq -0xa1(%rbp), %rdi
movq %rdi, -0x180(%rbp)
callq 0x3470
movq -0x180(%rbp), %rdx
leaq 0x335e3(%rip), %rsi     # 0x383c4
leaq -0xa0(%rbp), %rdi
callq 0x199b0
jmp 0x4def
movq -0x170(%rbp), %rcx
movq -0x178(%rbp), %rdx
movq %rsp, %rax
movl $0x0, (%rax)
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
leaq -0x70(%rbp), %r8
leaq -0xa0(%rbp), %r9
callq 0x4840
jmp 0x4e1e
leaq -0xa0(%rbp), %rdi
callq 0x34d8
leaq -0xa1(%rbp), %rdi
callq 0x32b0
leaq -0x70(%rbp), %rdi
callq 0x34d8
leaq -0x50(%rbp), %rdi
callq 0x34d8
leaq 0x4b721(%rip), %rdi     # 0x50570
callq 0x19990
movq %rax, %rsi
movslq -0x1c(%rbp), %rax
addq %rax, %rsi
leaq 0x4b70b(%rip), %rdi     # 0x50570
callq 0x19bf0
movb $0x1, -0xa2(%rbp)
leaq -0xa2(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x19c80
movb %al, -0x10(%rbp)
movq %rdx, -0x8(%rbp)
jmp 0x5053
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x4ed6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x4ec1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x34d8
leaq -0xa1(%rbp), %rdi
callq 0x32b0
leaq -0x70(%rbp), %rdi
callq 0x34d8
leaq -0x50(%rbp), %rdi
callq 0x34d8
jmp 0x5063
leaq 0x4b6ad(%rip), %rdi     # 0x50598
movq %rdi, -0x198(%rbp)
callq 0x19cb0
movslq (%rax), %rax
movq %rax, -0xb0(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x1a4(%rbp)
movq -0xb0(%rbp), %rsi
leaq 0x4b640(%rip), %rdi     # 0x50558
movq %rdi, -0x1a0(%rbp)
callq 0x19cf0
movl -0x1a4(%rbp), %edx
movq -0x1a0(%rbp), %rdi
movl (%rax), %ecx
addl %edx, %ecx
movl %ecx, (%rax)
movq -0xb0(%rbp), %rsi
callq 0x19cf0
movq -0x198(%rbp), %rdi
movl (%rax), %eax
negl %eax
cltq
movq %rax, -0xb8(%rbp)
callq 0x19cb0
movq -0x160(%rbp), %rcx
addq $0x8, %rax
movq %rax, -0x190(%rbp)
leaq -0x138(%rbp), %rdi
movq %rdi, -0x188(%rbp)
leaq -0xb8(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
callq 0x19d90
movq -0x168(%rbp), %rsi
movq -0x188(%rbp), %rdx
leaq -0x108(%rbp), %rdi
callq 0x19d50
jmp 0x4fa8
movq -0x190(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x19d10
movb %dl, -0x1b1(%rbp)
movq %rax, -0x1b0(%rbp)
jmp 0x4fca
movb -0x1b1(%rbp), %al
movq -0x1b0(%rbp), %rcx
movq %rcx, -0x148(%rbp)
movb %al, -0x140(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x19dd0
leaq -0x138(%rbp), %rdi
callq 0x19e00
movb $0x0, -0x149(%rbp)
leaq -0x149(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x19c80
movb %al, -0x10(%rbp)
movq %rdx, -0x8(%rbp)
jmp 0x5053
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x5045
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x19dd0
leaq -0x138(%rbp), %rdi
callq 0x19e00
jmp 0x5063
movb -0x10(%rbp), %al
movq -0x8(%rbp), %rdx
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq
movq -0x78(%rbp), %rdi
callq 0x3460
nopl (%rax)