// File: /workspace/github_cpp_makefile_star2_O2/lhydave[P]SysYCompilerLab/front/node.cpp
// Function: sysY_AST::vardef_node::gen_code()
void vardef_node::gen_code()
{
	if (is_param) // do nothing for parameters
		return;
	var_entry query;
	find_var(name, query);
	if (blk_id == 0) // only declare global variables
		code = gen_vardecl(query, false);
	else if (!val.empty()) // generate initial values
	{
		if (!is_array) // variable
		{
			code += val[0]->code;
			code +=
				"\t" + query.eeyore_name + " = " + val[0]->eeyore_name + "\n";
		}
		else // an array
			for (auto i = 0; i < val.size(); i++)
			{
				code += val[i]->code;
				code += "\t" + query.eeyore_name + "[" +
					to_string(i * int_size) + "] = " + val[i]->eeyore_name +
					"\n";
			}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
cmpb $0x0, 0xa1(%rdi)
jne 0x8670
movq %rdi, %rbx
leaq 0xf0(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0x110(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rax)
movups %xmm0, 0x28(%rax)
movups %xmm0, 0x38(%rax)
addq $0x48, %rdi
leaq 0xe0(%rsp), %rsi
callq 0xe814
leaq 0x25fbe(%rip), %rax     # 0x2e3e0
cmpl $0x0, (%rax)
je 0x8593
movq 0x88(%rbx), %rax
movq 0x90(%rbx), %rcx
cmpq %rcx, %rax
je 0x8663
cmpb $0x1, 0x6a(%rbx)
jne 0x85bf
leaq 0x18(%rbx), %r14
xorl %r15d, %r15d
xorl %ebp, %ebp
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbp, %rcx
jbe 0x8663
movq (%rax,%rbp,8), %rsi
addq $0x18, %rsi
movq %r14, %rdi
callq 0x5530
leaq 0xc0(%rsp), %r12
movq %r12, %rdi
leaq 0x17494(%rip), %rsi     # 0x1f91b
leaq 0xe0(%rsp), %rdx
callq 0xc598
leaq 0x80(%rsp), %rdi
movq %r12, %rsi
leaq 0x16ee9(%rip), %rdx     # 0x1f38f
callq 0xc579
leaq 0xa0(%rsp), %r12
movq %r12, %rdi
movl %r15d, %esi
callq 0xc6d2
leaq 0x20(%rsp), %r13
movq %r13, %rdi
leaq 0x80(%rsp), %rsi
movq %r12, %rdx
callq 0xc66b
leaq 0x40(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
leaq 0x16442(%rip), %rdx     # 0x1e92a
callq 0xc579
movq 0x88(%rbx), %rax
movq (%rax,%rbp,8), %rdx
addq $0x70, %rdx
leaq 0x60(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0xc64c
movq %rsp, %r12
movq %r12, %rdi
movq %r13, %rsi
leaq 0x164c0(%rip), %rdx     # 0x1e9dc
callq 0xc579
movq %r14, %rdi
movq %r12, %rsi
callq 0x5530
movq %r12, %rdi
callq 0x5548
leaq 0x60(%rsp), %rdi
callq 0x5548
leaq 0x40(%rsp), %rdi
callq 0x5548
leaq 0x20(%rsp), %rdi
callq 0x5548
leaq 0xa0(%rsp), %rdi
callq 0x5548
leaq 0x80(%rsp), %rdi
callq 0x5548
leaq 0xc0(%rsp), %rdi
callq 0x5548
incq %rbp
movq 0x88(%rbx), %rax
movq 0x90(%rbx), %rcx
addl $0x4, %r15d
jmp 0x8455
movq %rsp, %rdi
leaq 0xe0(%rsp), %rsi
xorl %edx, %edx
callq 0x8747
addq $0x18, %rbx
movq %rsp, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5300
movq %r14, %rdi
jmp 0x865e
movq (%rax), %rsi
addq $0x18, %rsi
leaq 0x18(%rbx), %r14
movq %r14, %rdi
callq 0x5530
leaq 0x17342(%rip), %rsi     # 0x1f91b
leaq 0x20(%rsp), %rdi
leaq 0xe0(%rsp), %rdx
callq 0xc598
leaq 0x16339(%rip), %rdx     # 0x1e92b
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0xc579
movq 0x88(%rbx), %rax
movq (%rax), %rdx
addq $0x70, %rdx
leaq 0x60(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xc64c
leaq 0x163b7(%rip), %rdx     # 0x1e9dc
movq %rsp, %rdi
leaq 0x60(%rsp), %rsi
callq 0xc579
movq %rsp, %rsi
movq %r14, %rdi
callq 0x5530
movq %rsp, %rdi
callq 0x5548
leaq 0x60(%rsp), %rdi
callq 0x5548
leaq 0x40(%rsp), %rdi
callq 0x5548
leaq 0x20(%rsp), %rdi
callq 0x5548
leaq 0xe0(%rsp), %rdi
callq 0xc72c
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x5548
jmp 0x8692
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x5548
jmp 0x86a1
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x5548
jmp 0x86b0
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
jmp 0x872d
jmp 0x86f9
jmp 0x86f9
jmp 0x86f9
movq %rax, %rbx
jmp 0x86eb
movq %rax, %rbx
jmp 0x86e1
movq %rax, %rbx
jmp 0x86d7
movq %rax, %rbx
movq %rsp, %rdi
callq 0x5548
leaq 0x60(%rsp), %rdi
callq 0x5548
leaq 0x40(%rsp), %rdi
callq 0x5548
leaq 0x20(%rsp), %rdi
callq 0x5548
jmp 0x870b
jmp 0x86f9
movq %rax, %rbx
jmp 0x8732
movq %rax, %rbx
jmp 0x8725
movq %rax, %rbx
jmp 0x8718
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x5548
leaq 0x80(%rsp), %rdi
callq 0x5548
leaq 0xc0(%rsp), %rdi
callq 0x5548
leaq 0xe0(%rsp), %rdi
callq 0xc72c
movq %rbx, %rdi
callq 0x54c0