// File: lhydave[P]SysYCompilerLab/front/symtab.cpp
// Function: sysY_AST::reg_var(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool, bool, bool, std::vector<int, std::allocator<int>> const&, std::vector<int, std::allocator<int>> const&)
void reg_var(const string &name, bool is_const, bool is_array, bool is_param,
	const vector<int> &dim, const vector<int> &val)
{
	assert(!name.empty());
	if (defined(name))
	{
		string msg = "identifier '" + name + "' was already defined";
		yyerror(msg.c_str());
	}
	var_entry new_entry(is_array, is_const, is_param, dim, val, name);
	if (is_param)
		new_entry.eeyore_name = "p" + to_string(param_id++);
	else if (name[0] != '#')
		new_entry.eeyore_name = "T" + to_string(var_id++);
	else
		new_entry.eeyore_name = name.substr(1);
	if (blk_id) // defined in the function!
	{
		assert(!now_func_name.empty());
		func_table[now_func_name].func_var_table.push_back(new_entry);
		if (is_param) // a parameter!
			func_table[now_func_name].params.push_back(new_entry);
	}
	var_stack[blk_id][name] = new_entry;
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movb %cl, %al
movb %dl, %cl
movb %sil, %dl
movq %rdi, -0x8(%rbp)
andb $0x1, %dl
movb %dl, -0x9(%rbp)
andb $0x1, %cl
movb %cl, -0xa(%rbp)
andb $0x1, %al
movb %al, -0xb(%rbp)
movq %r8, -0x18(%rbp)
movq %r9, -0x20(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1bff0
testb $0x1, %al
jne 0x1c181
jmp 0x1c219
movq -0x8(%rbp), %rdx
leaq 0x31b5c(%rip), %rsi     # 0x4dce8
leaq -0x60(%rbp), %rdi
movq %rdi, -0x190(%rbp)
callq 0x12d60
movq -0x190(%rbp), %rsi
leaq 0x31f84(%rip), %rdx     # 0x4e12e
leaq -0x40(%rbp), %rdi
callq 0x12d10
jmp 0x1c1b5
leaq -0x60(%rbp), %rdi
callq 0x56c0
leaq -0x40(%rbp), %rdi
callq 0x5160
movq %rax, %rdi
leaq 0x5619f(%rip), %rax     # 0x72370
movl (%rax), %esi
callq 0xa6c0
jmp 0x1c1da
leaq -0x40(%rbp), %rdi
callq 0x56c0
jmp 0x1c219
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x56c0
jmp 0x1c4ac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x56c0
jmp 0x1c4ac
movb -0xa(%rbp), %sil
movb -0x9(%rbp), %dl
movb -0xb(%rbp), %cl
movq -0x18(%rbp), %r8
movq -0x20(%rbp), %r9
movq -0x8(%rbp), %rax
leaq -0xe8(%rbp), %rdi
andb $0x1, %sil
andb $0x1, %dl
andb $0x1, %cl
movzbl %sil, %esi
movzbl %dl, %edx
movzbl %cl, %ecx
movq %rax, (%rsp)
callq 0x1ac60
testb $0x1, -0xb(%rbp)
je 0x1c2f5
movl 0x56239(%rip), %esi     # 0x7249c
movl %esi, %eax
incl %eax
movl %eax, 0x5622f(%rip)     # 0x7249c
leaq -0x128(%rbp), %rdi
callq 0x13410
jmp 0x1c27b
leaq 0x31ec2(%rip), %rsi     # 0x4e144
leaq -0x108(%rbp), %rdi
leaq -0x128(%rbp), %rdx
callq 0x14000
jmp 0x1c297
leaq -0xe8(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x5410
leaq -0x108(%rbp), %rdi
callq 0x56c0
leaq -0x128(%rbp), %rdi
callq 0x56c0
jmp 0x1c3d1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x1c4a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x56c0
jmp 0x1c4a0
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5390
movsbl (%rax), %eax
cmpl $0x23, %eax
je 0x1c392
movl 0x5618c(%rip), %esi     # 0x724a0
movl %esi, %eax
incl %eax
movl %eax, 0x56182(%rip)     # 0x724a0
leaq -0x168(%rbp), %rdi
callq 0x13410
jmp 0x1c32c
leaq 0x31e13(%rip), %rsi     # 0x4e146
leaq -0x148(%rbp), %rdi
leaq -0x168(%rbp), %rdx
callq 0x14000
jmp 0x1c348
leaq -0xe8(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x5410
leaq -0x148(%rbp), %rdi
callq 0x56c0
leaq -0x168(%rbp), %rdi
callq 0x56c0
jmp 0x1c3cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x56c0
jmp 0x1c4a0
movq -0x8(%rbp), %rsi
leaq -0x188(%rbp), %rdi
movl $0x1, %edx
movq $-0x1, %rcx
callq 0x5340
jmp 0x1c3b0
leaq -0xe8(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0x5410
leaq -0x188(%rbp), %rdi
callq 0x56c0
jmp 0x1c3d1
cmpl $0x0, 0x560c0(%rip)     # 0x72498
je 0x1c44e
leaq 0x5605f(%rip), %rdi     # 0x72440
leaq 0x56090(%rip), %rsi     # 0x72478
callq 0x13a90
movq %rax, -0x198(%rbp)
jmp 0x1c3f6
movq -0x198(%rbp), %rdi
addq $0x38, %rdi
leaq -0xe8(%rbp), %rsi
callq 0x1cc40
jmp 0x1c40f
testb $0x1, -0xb(%rbp)
je 0x1c44c
leaq 0x56024(%rip), %rdi     # 0x72440
leaq 0x56055(%rip), %rsi     # 0x72478
callq 0x13a90
movq %rax, -0x1a0(%rbp)
jmp 0x1c431
movq -0x1a0(%rbp), %rdi
addq $0x20, %rdi
leaq -0xe8(%rbp), %rsi
callq 0x1cc40
jmp 0x1c44a
jmp 0x1c44c
jmp 0x1c44e
movslq 0x56043(%rip), %rsi     # 0x72498
leaq 0x55fcc(%rip), %rdi     # 0x72428
callq 0x13e00
movq %rax, %rdi
movq -0x8(%rbp), %rsi
callq 0x1cdc0
movq %rax, -0x1a8(%rbp)
jmp 0x1c476
movq -0x1a8(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x1cdf0
jmp 0x1c48b
leaq -0xe8(%rbp), %rdi
callq 0x13530
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
leaq -0xe8(%rbp), %rdi
callq 0x13530
movq -0x68(%rbp), %rdi
callq 0x5610
nopw %cs:(%rax,%rax)