// File: /workspace/github_cpp_makefile_star2_O1/lhydave[P]SysYCompilerLab/front/node.cpp
// Function: sysY_AST::vardef_node::vardef_node(char const*, bool, bool, bool, sysY_AST::exp_node*, sysY_AST::exp_node*)
vardef_node::vardef_node(const char *_name, bool _is_const, bool _is_pt,
	bool _is_param, exp_node *first_dim, exp_node *first_val)
{
	name = string(_name);
	dbg_printf("var %s, ", _name);
	is_const = _is_const;
	is_pt = _is_pt;
	is_param = _is_param;

	set_shape(first_dim);
	is_array = (dim.size() != 0);
	dbg_printf("is_array: %d, is_param: %d, is_const: %d\n", is_array, is_param,
		is_const);
	if (first_val) // initialize
	{
		if (is_array && first_val->exp_type != EXP_INITVAL)
		{
			auto msg = "array '" + name + "' must be initialized by a list";
			yyerror(msg.c_str());
		}
		if (is_array)
			val = set_val(dim, first_val->child);
		else
			val = set_val(dim, first_val);
	}
	vector<int> int_val;
	for (auto i : val)
	{
		int_val.push_back(i->num);
		dbg_printf("%d ", *int_val.rbegin());
	}
	int_val.insert(int_val.end(), size - int_val.size(), 0);
	reg_var(name, is_const, is_array, is_param, dim, int_val);
	gen_code();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %r9, 0x50(%rsp)
movl %r8d, %ebp
movl %ecx, %r12d
movl %edx, %r15d
movq %rdi, %rbx
leaq 0x2c1c6(%rip), %rax     # 0x345d8
movq %rax, (%rdi)
leaq 0x28(%rdi), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
movq %rax, 0x40(%rsp)
movq %rax, 0x18(%rdi)
xorl %eax, %eax
movq %rax, 0x20(%rdi)
movb %al, 0x28(%rdi)
leaq 0x2ce77(%rip), %rcx     # 0x352b0
movl (%rcx), %ecx
movl %ecx, 0x38(%rdi)
leaq 0x2bf7b(%rip), %rcx     # 0x343c0
movq %rcx, (%rdi)
movq %rax, 0x40(%rdi)
leaq 0x48(%rdi), %r13
leaq 0x58(%rdi), %rcx
movq %rcx, 0x38(%rsp)
movq %rcx, 0x48(%rdi)
movq %rax, 0x50(%rdi)
movb %al, 0x58(%rdi)
leaq 0x70(%rdi), %rax
movq %rax, 0x28(%rsp)
leaq 0x88(%rdi), %rax
movq %rax, 0x30(%rsp)
movups %xmm0, 0x70(%rdi)
movups %xmm0, 0x80(%rdi)
movups %xmm0, 0x90(%rdi)
movq %rsp, %rdi
leaq 0x58(%rsp), %rdx
movq %r13, 0x48(%rsp)
callq 0x6eb8
movq %rsp, %r14
movq %r13, %rdi
movq %r14, %rsi
callq 0x5310
movq (%r14), %rdi
leaq 0x10(%rsp), %r14
cmpq %r14, %rdi
je 0x84c5
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x5240
movb %r15b, 0x68(%rbx)
movb %r12b, 0xa0(%rbx)
movb %bpl, 0xa1(%rbx)
movq %rbx, %rdi
movq 0x50(%rsp), %rsi
callq 0x87ba
movq 0xb0(%rsp), %r13
movq 0x70(%rbx), %rax
movq 0x78(%rbx), %rcx
cmpq %rax, %rcx
setne 0x6a(%rbx)
testq %r13, %r13
movq 0x48(%rsp), %rbp
je 0x861c
cmpq %rax, %rcx
je 0x85c8
cmpl $0x5, 0x98(%r13)
je 0x85c8
leaq 0x203a2(%rip), %rsi     # 0x288c9
leaq 0x58(%rsp), %rdi
movq %rbp, %rdx
callq 0x11eb4
leaq 0x20396(%rip), %rsi     # 0x288d1
leaq 0x58(%rsp), %rdi
callq 0x5510
movq %r14, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x8566
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x856d
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x85a0
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x5240
movq (%rsp), %rdi
leaq 0x2cd05(%rip), %rax     # 0x352b0
movl (%rax), %esi
callq 0x81dc
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x85c8
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x5240
cmpb $0x1, 0x6a(%rbx)
jne 0x85e4
movq 0x48(%r13), %rcx
movq %rsp, %rdi
movq %rbx, %rsi
movq 0x28(%rsp), %rdx
callq 0x88ac
jmp 0x85f7
movq %rsp, %rdi
movq %rbx, %rsi
movq 0x28(%rsp), %rdx
movq %r13, %rcx
callq 0x88ac
movq %rsp, %r14
movq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0x1253a
movq (%r14), %rdi
testq %rdi, %rdi
je 0x861c
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x5240
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq 0x88(%rbx), %r14
movq 0x90(%rbx), %r12
cmpq %r12, %r14
je 0x867a
movl $0x94, %r13d
movq %rsp, %r15
movq (%r14), %rdx
addq %r13, %rdx
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x8669
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x8671
movq %r15, %rdi
callq 0x1257a
addq $0x8, %r14
cmpq %r12, %r14
jne 0x8648
movq %rsp, %rdi
movq 0x8(%rdi), %rsi
movslq 0xa4(%rbx), %rdx
movq %rsi, %rax
subq (%rdi), %rax
sarq $0x2, %rax
subq %rax, %rdx
leaq 0x58(%rsp), %rcx
movl $0x0, (%rcx)
callq 0x126b6
movzbl 0x68(%rbx), %esi
movzbl 0x6a(%rbx), %edx
movzbl 0xa1(%rbx), %ecx
movq %rsp, %r9
movq %rbp, %rdi
movq 0x28(%rsp), %r8
callq 0x14a32
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x86e2
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x5240
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r13
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8736
movq 0x68(%rsp), %rsi
incq %rsi
jmp 0x8731
jmp 0x8716
jmp 0x8716
jmp 0x8716
jmp 0x871d
jmp 0x8716
movq %rax, %r13
jmp 0x8736
jmp 0x871d
movq %rax, %r13
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x8736
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x5240
movq 0x30(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x8752
movq 0x98(%rbx), %rsi
subq %rdi, %rsi
callq 0x5240
movq 0x28(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x876e
movq 0x80(%rbx), %rsi
subq %rdi, %rsi
callq 0x5240
movq 0x48(%rsp), %rax
movq (%rax), %rdi
cmpq 0x38(%rsp), %rdi
je 0x878d
movq 0x38(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x5240
leaq 0x2be44(%rip), %rax     # 0x345d8
movq %rax, (%rbx)
movq 0x18(%rbx), %rdi
cmpq 0x40(%rsp), %rdi
je 0x87b2
movq 0x40(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x5240
movq %r13, %rdi
callq 0x54c0