// File: /workspace/github_cpp_makefile_star2_O1/lhydave[P]SysYCompilerLab/back/no_alloc.cpp
// Function: no_alloc::alloc_temp_reg[abi:cxx11](std::shared_ptr<eeyore_AST::op_node> const&, int)
string alloc_temp_reg(const shared_ptr<op_node> &temp, int tempid)
{
	auto reg = temp_prefix + to_string(tempid);
	if (temp->exp_type == EXP_NUM)
	{
		tigger_dst << emit_exp_assign(
			reg, to_string(std::static_pointer_cast<num_node>(temp)->val));
		return reg;
	}
	auto var = std::static_pointer_cast<var_node>(temp);
	dbg_printf("temp reg alloc for %s\n", var->eeyore_name.c_str());
	if (is_global(var->eeyore_name)) // global
	{
		if (func_table[""].temps[var->eeyore_name].is_array) // pointer
			tigger_dst << emit_loadaddr(
				global_prefix + to_string(global_var2no[var->eeyore_name]),
				reg);
		else // variable
			tigger_dst << emit_load(
				global_prefix + to_string(global_var2no[var->eeyore_name]),
				reg);
	}
	else if (!is_param(var->eeyore_name) &&
		now_func.temps[var->eeyore_name].is_array) // array
		tigger_dst << emit_loadaddr(var2no[var->eeyore_name], reg);
	else // variable or param
		tigger_dst << emit_load(var2no[var->eeyore_name], reg);
	return reg;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %edx, %r15d
movq %rsi, %r14
movq %rdi, %rbx
movl %edx, %ebp
negl %ebp
cmovsl %edx, %ebp
movl $0x1, %r12d
cmpl $0xa, %ebp
jb 0x20e97
movl $0x4, %r12d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0x20e8e
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x20e94
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x20e97
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r12d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x20e5b
addl $-0x3, %r12d
jmp 0x20e97
addl $-0x2, %r12d
jmp 0x20e97
decl %r12d
shrl $0x1f, %r15d
leal (%r12,%r15), %esi
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x8(%rsp), %r13
movq %r13, %rdi
movl $0x2d, %edx
callq 0x52b0
addq (%r13), %r15
movq %r15, %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x1230e
movq 0x14b7e(%rip), %rcx     # 0x35a50
movq 0x14b7f(%rip), %r8      # 0x35a58
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5290
leaq 0x10(%rbx), %r13
movq %r13, (%rbx)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x20f07
movq %rdx, (%rbx)
movq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
jmp 0x20f0f
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rbx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x20f42
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5240
movq (%r14), %r15
cmpl $0x4, 0x8(%r15)
jne 0x20f67
movq 0x8(%r14), %r14
testq %r14, %r14
je 0x20f8b
movq 0x14074(%rip), %rax     # 0x34fd0
cmpb $0x0, (%rax)
je 0x20f86
incl 0x8(%r14)
jmp 0x20f8b
movq 0x8(%r14), %r14
testq %r14, %r14
je 0x20ffb
movq 0x14055(%rip), %rax     # 0x34fd0
cmpb $0x0, (%rax)
je 0x20ff6
incl 0x8(%r14)
jmp 0x20ffb
lock
incl 0x8(%r14)
movl 0x50(%r15), %r15d
movl %r15d, %ebp
negl %ebp
cmovsl %r15d, %ebp
movl $0x1, %r12d
cmpl $0xa, %ebp
jb 0x2121f
movl $0x4, %r12d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0x21216
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x2121c
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x2121f
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r12d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x20fb4
addl $-0x3, %r12d
jmp 0x2121f
lock
incl 0x8(%r14)
addq $0x50, %r15
movq %r15, %rdi
callq 0x16830
testb %al, %al
je 0x210f5
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
leaq 0x88b6(%rip), %rdx      # 0x298d9
movq %rdx, %rsi
movq %rbx, 0x28(%rsp)
movq %r13, 0x30(%rsp)
callq 0x6ef6
leaq 0x146b4(%rip), %rdi     # 0x356f0
leaq 0x8(%rsp), %rsi
callq 0x1b130
addq $0x20, %rax
movq %rax, %rdi
movq %r15, %rsi
callq 0x18d04
movb 0x24(%rax), %bl
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x21074
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5240
testb %bl, %bl
je 0x2119d
leaq 0x14a65(%rip), %rdi     # 0x35ae8
movq %r15, %rsi
callq 0x231ea
movl (%rax), %r15d
movl %r15d, %ebp
negl %ebp
cmovsl %r15d, %ebp
movl $0x1, %r12d
cmpl $0xa, %ebp
jb 0x212f0
movl $0x4, %r12d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0x212de
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x212ed
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x212f0
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r12d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x210b3
addl $-0x3, %r12d
jmp 0x212f0
movq %r15, %rdi
callq 0x168c2
testb %al, %al
jne 0x2114c
leaq 0x14988(%rip), %rdi     # 0x35a90
movq %r15, %rsi
callq 0x18d04
cmpb $0x1, 0x24(%rax)
jne 0x2114c
leaq 0x14a03(%rip), %rdi     # 0x35b20
movq %r15, %rsi
callq 0x231ea
movl (%rax), %esi
leaq 0x8(%rsp), %rdi
movq %rbx, %rdx
callq 0x1db94
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x142b3(%rip), %rdi     # 0x353f8
callq 0x52a0
jmp 0x21180
leaq 0x149cd(%rip), %rdi     # 0x35b20
movq %r15, %rsi
callq 0x231ea
movl (%rax), %esi
leaq 0x8(%rsp), %rdi
movq %rbx, %rdx
callq 0x1d4fe
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x1427d(%rip), %rdi     # 0x353f8
callq 0x52a0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x214c8
movq 0x18(%rsp), %rsi
jmp 0x214c0
leaq 0x14944(%rip), %rdi     # 0x35ae8
movq %r15, %rsi
callq 0x231ea
movl (%rax), %r15d
movl %r15d, %ebp
negl %ebp
cmovsl %r15d, %ebp
movl $0x1, %r12d
cmpl $0xa, %ebp
jb 0x213b6
movl $0x4, %r12d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0x212e4
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x213b3
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x213b6
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r12d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x211d4
addl $-0x3, %r12d
jmp 0x213b6
addl $-0x2, %r12d
jmp 0x2121f
decl %r12d
movq %r13, 0x30(%rsp)
movq %rbx, 0x28(%rsp)
shrl $0x1f, %r15d
leal (%r12,%r15), %esi
leaq 0x48(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x38(%rsp), %rdi
movl $0x2d, %edx
callq 0x52b0
leaq 0x38(%rsp), %r13
addq (%r13), %r15
movq %r15, %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x1230e
leaq 0x8(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq %r13, %rdx
callq 0x1c354
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x14176(%rip), %rdi     # 0x353f8
callq 0x52a0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x212a3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5240
movq 0x38(%rsp), %rdi
cmpq %rbx, %rdi
je 0x212ba
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x5240
testq %r14, %r14
movq 0x28(%rsp), %rbx
je 0x212cc
movq %r14, %rdi
callq 0x18722
movq %rbx, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addl $-0x2, %r12d
jmp 0x212f0
addl $-0x2, %r12d
jmp 0x213b6
decl %r12d
shrl $0x1f, %r15d
leal (%r12,%r15), %esi
leaq 0x68(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x58(%rsp), %rdi
movl $0x2d, %edx
callq 0x52b0
leaq 0x58(%rsp), %r13
addq (%r13), %r15
movq %r15, %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x1230e
movq 0x14683(%rip), %rcx     # 0x359b0
movq 0x14684(%rip), %r8      # 0x359b8
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5290
leaq 0x48(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x21367
movq %rdx, 0x38(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x48(%rsp)
jmp 0x2136d
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
movq 0x8(%rax), %rdx
leaq 0x38(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x8(%rsp), %rdi
movq 0x28(%rsp), %rdx
callq 0x1d932
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x1404f(%rip), %rdi     # 0x353f8
callq 0x52a0
jmp 0x21474
decl %r12d
shrl $0x1f, %r15d
leal (%r12,%r15), %esi
leaq 0x68(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x58(%rsp), %rdi
movl $0x2d, %edx
callq 0x52b0
leaq 0x58(%rsp), %r13
addq (%r13), %r15
movq %r15, %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x1230e
movq 0x145bd(%rip), %rcx     # 0x359b0
movq 0x145be(%rip), %r8      # 0x359b8
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5290
leaq 0x48(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2142d
movq %rdx, 0x38(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x48(%rsp)
jmp 0x21433
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
movq 0x8(%rax), %rdx
leaq 0x38(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x8(%rsp), %rdi
movq 0x28(%rsp), %rdx
callq 0x1d29c
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x13f89(%rip), %rdi     # 0x353f8
callq 0x52a0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x21490
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5240
movq 0x38(%rsp), %rdi
cmpq %rbx, %rdi
je 0x214a7
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x5240
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
movq 0x28(%rsp), %rbx
je 0x214c8
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x5240
testq %r14, %r14
jne 0x212c4
jmp 0x212cc
jmp 0x2153a
jmp 0x214da
movq %rax, %r15
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x21500
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5240
jmp 0x21500
jmp 0x214fd
movq %rax, %r15
movq 0x38(%rsp), %rdi
cmpq %rbx, %rdi
je 0x2151e
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x5240
jmp 0x2151e
jmp 0x2151b
movq %rax, %r15
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x215b3
movq 0x68(%rsp), %rsi
jmp 0x2159a
jmp 0x215a6
movq %r13, 0x30(%rsp)
movq %rbx, 0x28(%rsp)
jmp 0x2154e
jmp 0x215b0
jmp 0x215b0
jmp 0x215b0
jmp 0x215a6
movq %rax, %r15
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x215b3
movq 0x18(%rsp), %rsi
jmp 0x2159a
movq %rax, %r15
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2158b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5240
jmp 0x2158b
movq %rax, %r15
movq 0x38(%rsp), %rdi
cmpq %rbx, %rdi
je 0x215b3
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x5240
jmp 0x215b3
jmp 0x215b0
movq %r13, 0x30(%rsp)
movq %rbx, 0x28(%rsp)
movq %rax, %r15
testq %r14, %r14
je 0x215c0
movq %r14, %rdi
callq 0x18722
movq 0x28(%rsp), %rax
movq (%rax), %rdi
cmpq 0x30(%rsp), %rdi
je 0x215df
movq 0x30(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x5240
movq %r15, %rdi
callq 0x54c0
movq %rax, %r15
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x215df
movq 0x18(%rsp), %rsi
jmp 0x215d7