// File: Nallantli[P]Rossa/main/rossa/instruction/instruction.cpp
// Function: VargDefineI::evaluate(object_t const*, std::vector<std::pair<token_t, function_t>, std::allocator<std::pair<token_t, function_t>>>&) const
const symbol_t VargDefineI::evaluate(const object_t *scope, trace_t &stack_trace) const
{
	std::map<const hash_ull, const symbol_t> capturedVars;
	for (const hash_ull &e : captures)
	{
		capturedVars[e].set(&scope->getVariable(e, &token, stack_trace), &token, stack_trace);
	}
	ptr_function_t f = std::make_shared<function_t>(key, scope->getPtr(), body, capturedVars);
	if (key > 0)
	{
		return scope->createVariable(key, symbol_t::FunctionVARG(static_cast<ptr_function_t>(f)), &token);
	}
	return symbol_t::FunctionVARG(static_cast<ptr_function_t>(f));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0xe8(%rbp)
movq %rdi, %rax
movq %rax, -0xe0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xd8(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x824e0
movq -0xd8(%rbp), %rax
addq $0xa8, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
callq 0x2e5d0
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rdi
callq 0x2e600
movq %rax, -0x68(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0xe4f20
testb $0x1, %al
jne 0x1287f1
jmp 0x12887e
leaq -0x60(%rbp), %rdi
callq 0xe4f60
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x82550
movq %rax, -0xf0(%rbp)
jmp 0x128814
movq -0xd8(%rbp), %rdx
movq -0x18(%rbp), %rdi
movq -0x70(%rbp), %rsi
addq $0x8, %rdx
movq -0x20(%rbp), %rcx
callq 0x7ddd0
movq %rax, -0xf8(%rbp)
jmp 0x128839
movq -0xf8(%rbp), %rsi
movq -0xf0(%rbp), %rdi
movq -0xd8(%rbp), %rdx
addq $0x8, %rdx
movq -0x20(%rbp), %rcx
callq 0x870e0
jmp 0x12885d
jmp 0x12885f
leaq -0x60(%rbp), %rdi
callq 0xe4f80
jmp 0x1287db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x128a76
movq -0xd8(%rbp), %rax
addq $0x90, %rax
movq %rax, -0x108(%rbp)
movq -0x18(%rbp), %rdi
callq 0x7df60
movq %rax, -0x100(%rbp)
jmp 0x1288a4
movq -0x108(%rbp), %rsi
movq -0xd8(%rbp), %rcx
movq -0x100(%rbp), %rax
movq %rax, -0x98(%rbp)
addq $0x98, %rcx
leaq -0x90(%rbp), %rdi
leaq -0x98(%rbp), %rdx
leaq -0x50(%rbp), %r8
callq 0x136620
jmp 0x1288e0
movq -0xd8(%rbp), %rax
cmpq $0x0, 0x90(%rax)
jbe 0x1289e4
movq -0xd8(%rbp), %rax
movq -0x18(%rbp), %rcx
movq %rcx, -0x120(%rbp)
addq $0x90, %rax
movq %rax, -0x118(%rbp)
leaq -0xb8(%rbp), %rdi
movq %rdi, -0x110(%rbp)
leaq -0x90(%rbp), %rsi
callq 0x85e40
movq -0x110(%rbp), %rsi
leaq -0xa8(%rbp), %rdi
callq 0x86cf0
jmp 0x128943
movq -0x118(%rbp), %rsi
movq -0x120(%rbp), %rdi
movq -0xd8(%rbp), %rcx
addq $0x8, %rcx
leaq -0xa8(%rbp), %rdx
callq 0x7de40
movq %rax, -0x128(%rbp)
jmp 0x128971
movq -0x128(%rbp), %rsi
movq -0xe8(%rbp), %rdi
callq 0x86d80
jmp 0x128986
leaq -0xa8(%rbp), %rdi
callq 0x86dc0
leaq -0xb8(%rbp), %rdi
callq 0x85eb0
movl $0x1, -0xbc(%rbp)
jmp 0x128a45
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x1289d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x86dc0
leaq -0xb8(%rbp), %rdi
callq 0x85eb0
jmp 0x128a6a
leaq -0xd0(%rbp), %rdi
movq %rdi, -0x130(%rbp)
leaq -0x90(%rbp), %rsi
callq 0x85e40
movq -0xe8(%rbp), %rdi
movq -0x130(%rbp), %rsi
callq 0x86cf0
jmp 0x128a13
leaq -0xd0(%rbp), %rdi
callq 0x85eb0
movl $0x1, -0xbc(%rbp)
jmp 0x128a45
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x85eb0
jmp 0x128a6a
leaq -0x90(%rbp), %rdi
callq 0x85eb0
leaq -0x50(%rbp), %rdi
callq 0x2a4c0
movq -0xe0(%rbp), %rax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
leaq -0x90(%rbp), %rdi
callq 0x85eb0
leaq -0x50(%rbp), %rdi
callq 0x2a4c0
movq -0x78(%rbp), %rdi
callq 0x119c0
nopl (%rax,%rax)