// File: /workspace/github_cpp_makefile_star2_O3/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 $0x68, %rsp
movq %r9, 0x40(%rsp)
movl %r8d, %ebp
movl %ecx, %r13d
movl %edx, %r15d
movq %rdi, %rbx
leaq 0x28(%rdi), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
movq %rax, 0x30(%rsp)
movq %rax, 0x18(%rdi)
xorl %eax, %eax
movq %rax, 0x20(%rdi)
movb %al, 0x28(%rdi)
leaq 0x2d02d(%rip), %rcx     # 0x352b0
movl (%rcx), %ecx
movl %ecx, 0x38(%rdi)
leaq 0x2c169(%rip), %rcx     # 0x343f8
movq %rcx, (%rdi)
movq %rax, 0x40(%rdi)
leaq 0x48(%rdi), %r12
leaq 0x58(%rdi), %rcx
movq %rcx, 0x28(%rsp)
movq %rcx, 0x48(%rdi)
movq %rax, 0x50(%rdi)
movb %al, 0x58(%rdi)
leaq 0x70(%rdi), %rax
movq %rax, 0x20(%rsp)
movups %xmm0, 0x70(%rdi)
movups %xmm0, 0x80(%rdi)
movups %xmm0, 0x90(%rdi)
movq %rsp, %rdi
leaq 0x48(%rsp), %rdx
movq %r12, 0x38(%rsp)
callq 0x6d4c
movq %rsp, %r14
movq %r12, %rdi
movq %r14, %rsi
callq 0x5310
movq (%r14), %rdi
leaq 0x10(%rsp), %r14
cmpq %r14, %rdi
je 0x8303
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x5240
movb %r15b, 0x68(%rbx)
movb %r13b, 0xa0(%rbx)
movb %bpl, 0xa1(%rbx)
movq %rbx, %rdi
movq 0x40(%rsp), %rsi
callq 0x8638
movq 0xa0(%rsp), %r12
movq 0x70(%rbx), %rax
movq 0x78(%rbx), %rcx
cmpq %rax, %rcx
setne 0x6a(%rbx)
testq %r12, %r12
movq 0x38(%rsp), %rbp
je 0x848f
cmpq %rax, %rcx
je 0x8424
cmpl $0x5, 0x98(%r12)
je 0x840d
leaq 0x2059a(%rip), %rsi     # 0x28900
leaq 0x48(%rsp), %rdi
movq %rbp, %rdx
callq 0x11c02
leaq 0x2058e(%rip), %rsi     # 0x28908
leaq 0x48(%rsp), %rdi
callq 0x5510
movq %r14, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x83a5
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x83ac
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 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x83df
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x5240
movq (%rsp), %rdi
leaq 0x2cec6(%rip), %rax     # 0x352b0
movl (%rax), %esi
callq 0x8030
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x8407
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x5240
testb $0x1, 0x6a(%rbx)
je 0x8424
movq 0x48(%r12), %rcx
movq %rsp, %rdi
movq %rbx, %rsi
movq 0x20(%rsp), %rdx
callq 0x872a
jmp 0x8437
movq %rsp, %rdi
movq %rbx, %rsi
movq 0x20(%rsp), %rdx
movq %r12, %rcx
callq 0x872a
movq 0x88(%rbx), %rdi
movq 0x98(%rbx), %rsi
movaps (%rsp), %xmm0
movups %xmm0, 0x88(%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x98(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
testq %rdi, %rdi
je 0x848f
subq %rdi, %rsi
callq 0x5240
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x848f
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 0x84f8
movl $0x94, %r13d
movq %rsp, %r15
movq (%r14), %rdx
addq %r13, %rdx
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x84dc
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x84e4
movq %r15, %rdi
callq 0x1228e
addq $0x8, %r14
cmpq %r12, %r14
jne 0x84bb
movq (%rsp), %rax
movq 0x8(%rsp), %rsi
jmp 0x84fc
xorl %eax, %eax
xorl %esi, %esi
movslq 0xa4(%rbx), %rdx
movq %rsi, %rcx
subq %rax, %rcx
sarq $0x2, %rcx
subq %rcx, %rdx
leaq 0x48(%rsp), %rcx
movl $0x0, (%rcx)
movq %rsp, %rdi
callq 0x123ca
movzbl 0x68(%rbx), %esi
movzbl 0x6a(%rbx), %edx
movzbl 0xa1(%rbx), %ecx
movq %rsp, %r9
movq %rbp, %rdi
movq 0x20(%rsp), %r8
callq 0x14cbe
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x8560
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x5240
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r12
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x85b4
movq 0x58(%rsp), %rsi
incq %rsi
jmp 0x85af
jmp 0x8594
jmp 0x8594
jmp 0x8594
jmp 0x859b
jmp 0x8594
movq %rax, %r12
jmp 0x85b4
jmp 0x859b
movq %rax, %r12
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x85b4
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x5240
movq 0x88(%rbx), %rdi
testq %rdi, %rdi
je 0x85cf
movq 0x98(%rbx), %rsi
subq %rdi, %rsi
callq 0x5240
movq 0x20(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x85eb
movq 0x80(%rbx), %rsi
subq %rdi, %rsi
callq 0x5240
movq 0x38(%rsp), %rax
movq (%rax), %rdi
cmpq 0x28(%rsp), %rdi
je 0x860a
movq 0x28(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x5240
leaq 0x2bfff(%rip), %rax     # 0x34610
movq %rax, (%rbx)
movq 0x18(%rbx), %rdi
cmpq 0x30(%rsp), %rdi
je 0x862f
movq 0x30(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x5240
movq %r12, %rdi
callq 0x54c0
nop