// File: lhydave[P]SysYCompilerLab/back/no_alloc.cpp
// Function: no_alloc::gen_array(std::shared_ptr<eeyore_AST::op_node> const&, int, int)
void gen_array(const shared_ptr<op_node> &temp, int tempid1, int tempid2)
{
	dbg_printf("gen array begin...\n");
	auto base = std::static_pointer_cast<var_node>(temp->left);
	auto temp1 = temp_prefix + to_string(tempid1);
	auto temp2 = temp_prefix + to_string(tempid2);
	if (is_global(base->eeyore_name)) // global
		tigger_dst << emit_loadaddr(
			global_prefix + to_string(global_var2no[base->eeyore_name]), temp1);
	else if (!is_param(base->eeyore_name) &&
		now_func.temps[base->eeyore_name].is_array) // array
		tigger_dst << emit_loadaddr(var2no[base->eeyore_name], temp1);
	else // variable or param
		tigger_dst << emit_load(var2no[base->eeyore_name], temp1);
	auto shift = alloc_temp_reg(temp->right, tempid2);
	tigger_dst << emit_exp_assign(temp1, temp1 + " + " + temp2);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x200, %rsp            # imm = 0x200
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x42390
movq %rax, %rsi
addq $0x30, %rsi
leaq -0x20(%rbp), %rdi
callq 0x42460
movl -0xc(%rbp), %esi
leaq -0x60(%rbp), %rdi
callq 0x13410
jmp 0x4112c
leaq 0x319dd(%rip), %rsi     # 0x72b10
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %rdx
callq 0x42130
jmp 0x41142
leaq -0x60(%rbp), %rdi
callq 0x56c0
movl -0x10(%rbp), %esi
leaq -0xb0(%rbp), %rdi
callq 0x13410
jmp 0x4115c
leaq 0x319ad(%rip), %rsi     # 0x72b10
leaq -0x90(%rbp), %rdi
leaq -0xb0(%rbp), %rdx
callq 0x42130
jmp 0x41178
leaq -0xb0(%rbp), %rdi
callq 0x56c0
leaq -0x20(%rbp), %rdi
callq 0x42500
movq %rax, %rdi
addq $0x50, %rdi
callq 0x21fd0
movb %al, -0x1d1(%rbp)
jmp 0x411a1
movb -0x1d1(%rbp), %al
testb $0x1, %al
jne 0x411b0
jmp 0x4131a
leaq -0x20(%rbp), %rdi
callq 0x42500
movq %rax, %rsi
addq $0x50, %rsi
leaq 0x319e1(%rip), %rdi     # 0x72ba8
callq 0x41ec0
movq %rax, -0x1e0(%rbp)
jmp 0x411d5
movq -0x1e0(%rbp), %rax
movl (%rax), %esi
leaq -0x110(%rbp), %rdi
callq 0x13410
jmp 0x411ec
leaq 0x3187d(%rip), %rsi     # 0x72a70
leaq -0xf0(%rbp), %rdi
leaq -0x110(%rbp), %rdx
callq 0x42130
jmp 0x41208
leaq -0xd0(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x35b10
jmp 0x41221
leaq 0x31290(%rip), %rdi     # 0x724b8
leaq -0xd0(%rbp), %rsi
callq 0x52b0
jmp 0x41236
leaq -0xd0(%rbp), %rdi
callq 0x56c0
leaq -0xf0(%rbp), %rdi
callq 0x56c0
leaq -0x110(%rbp), %rdi
callq 0x56c0
jmp 0x41482
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x415d8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x56c0
jmp 0x415d8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x415cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x56c0
jmp 0x415cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x415c3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x41309
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x412fd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x56c0
leaq -0xf0(%rbp), %rdi
callq 0x56c0
leaq -0x110(%rbp), %rdi
callq 0x56c0
jmp 0x415c3
leaq -0x20(%rbp), %rdi
callq 0x42500
movq %rax, %rdi
addq $0x50, %rdi
callq 0x22090
movb %al, -0x1e1(%rbp)
jmp 0x41337
movb -0x1e1(%rbp), %al
testb $0x1, %al
jne 0x41400
jmp 0x41347
leaq -0x20(%rbp), %rdi
callq 0x42500
movq %rax, %rsi
addq $0x50, %rsi
leaq 0x317f2(%rip), %rdi     # 0x72b50
callq 0x27e40
movq %rax, -0x1f0(%rbp)
jmp 0x4136c
movq -0x1f0(%rbp), %rax
testb $0x1, 0x24(%rax)
je 0x41400
leaq -0x20(%rbp), %rdi
callq 0x42500
movq %rax, %rsi
addq $0x50, %rsi
leaq 0x3184c(%rip), %rdi     # 0x72be0
callq 0x41ec0
movq %rax, -0x1f8(%rbp)
jmp 0x413a2
movq -0x1f8(%rbp), %rax
movl (%rax), %esi
leaq -0x130(%rbp), %rdi
leaq -0x40(%rbp), %rdx
callq 0x35ca0
jmp 0x413bd
leaq 0x310f4(%rip), %rdi     # 0x724b8
leaq -0x130(%rbp), %rsi
callq 0x52b0
jmp 0x413d2
leaq -0x130(%rbp), %rdi
callq 0x56c0
jmp 0x41480
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x56c0
jmp 0x415c3
leaq -0x20(%rbp), %rdi
callq 0x42500
movq %rax, %rsi
addq $0x50, %rsi
leaq 0x317c9(%rip), %rdi     # 0x72be0
callq 0x41ec0
movq %rax, -0x200(%rbp)
jmp 0x41425
movq -0x200(%rbp), %rax
movl (%rax), %esi
leaq -0x150(%rbp), %rdi
leaq -0x40(%rbp), %rdx
callq 0x35910
jmp 0x41440
leaq 0x31071(%rip), %rdi     # 0x724b8
leaq -0x150(%rbp), %rsi
callq 0x52b0
jmp 0x41455
leaq -0x150(%rbp), %rdi
callq 0x56c0
jmp 0x41480
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x56c0
jmp 0x415c3
jmp 0x41482
movq -0x8(%rbp), %rdi
callq 0x42390
movq %rax, %rsi
addq $0x40, %rsi
movl -0x10(%rbp), %edx
leaq -0x170(%rbp), %rdi
callq 0x40a50
jmp 0x414a3
leaq 0xc90e(%rip), %rdx      # 0x4ddb8
leaq -0x1d0(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x140a0
jmp 0x414bc
leaq -0x1b0(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
leaq -0x90(%rbp), %rdx
callq 0x132d0
jmp 0x414d8
leaq -0x190(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x1b0(%rbp), %rdx
callq 0x34ea0
jmp 0x414f1
leaq 0x30fc0(%rip), %rdi     # 0x724b8
leaq -0x190(%rbp), %rsi
callq 0x52b0
jmp 0x41506
leaq -0x190(%rbp), %rdi
callq 0x56c0
leaq -0x1b0(%rbp), %rdi
callq 0x56c0
leaq -0x1d0(%rbp), %rdi
callq 0x56c0
leaq -0x170(%rbp), %rdi
callq 0x56c0
leaq -0x90(%rbp), %rdi
callq 0x56c0
leaq -0x40(%rbp), %rdi
callq 0x56c0
leaq -0x20(%rbp), %rdi
callq 0x2b0a0
addq $0x200, %rsp            # imm = 0x200
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x415b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x415ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x4159f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x56c0
leaq -0x1b0(%rbp), %rdi
callq 0x56c0
leaq -0x1d0(%rbp), %rdi
callq 0x56c0
leaq -0x170(%rbp), %rdi
callq 0x56c0
leaq -0x90(%rbp), %rdi
callq 0x56c0
leaq -0x40(%rbp), %rdi
callq 0x56c0
leaq -0x20(%rbp), %rdi
callq 0x2b0a0
movq -0x68(%rbp), %rdi
callq 0x5610
nopw (%rax,%rax)