// File: Nallantli[P]Rossa/main/rossa/node/node.cpp
// Function: CallBuiltNode::fold(std::vector<std::pair<std::vector<unsigned long long, std::allocator<unsigned long long>>, symbol_t>, std::allocator<std::pair<std::vector<unsigned long long, std::allocator<unsigned long long>>, symbol_t>>> const&) const
const ptr_node_t CallBuiltNode::fold(const std::vector<std::pair<std::vector<hash_ull>, symbol_t>> &consts) const
{
	if (isConst())
	{
		auto i = genParser();
		object_t newScope(static_cast<hash_ull>(0));
		trace_t stack_trace;
		auto r = i->evaluate(&newScope, stack_trace);
		return std::make_shared<ContainerNode>(path, r, token);
	}

	std::vector<ptr_node_t> nargs;
	for (auto &c : args)
	{
		nargs.push_back(c->fold(consts));
	}

	return std::make_shared<CallBuiltNode>(path, t, nargs, token);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0xf8(%rbp)
movq %rdi, %rax
movq %rax, -0xf0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
movq (%rdi), %rax
callq *0x8(%rax)
testb $0x1, %al
jne 0xd91d2
jmp 0xd92ee
movq -0xe8(%rbp), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x28(%rbp), %rdi
callq *%rax
movq $0x0, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x7d410
jmp 0xd91fc
leaq -0x68(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x24b80
leaq -0x28(%rbp), %rdi
callq 0x2d300
movq -0x100(%rbp), %rcx
movq %rax, %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x78(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq *%rax
jmp 0xd9231
movq -0xe8(%rbp), %rcx
movq %rcx, %rsi
addq $0x8, %rsi
addq $0x28, %rcx
leaq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rdx
callq 0xe5670
jmp 0xd9255
movq -0xf8(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x571a0
leaq -0x88(%rbp), %rdi
callq 0x571d0
leaq -0x78(%rbp), %rdi
callq 0x86dc0
leaq -0x68(%rbp), %rdi
callq 0x24e60
leaq -0x38(%rbp), %rdi
callq 0x7d790
leaq -0x28(%rbp), %rdi
callq 0x2a4e0
jmp 0xd944e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xd92e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xd92ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x86dc0
leaq -0x68(%rbp), %rdi
callq 0x24e60
leaq -0x38(%rbp), %rdi
callq 0x7d790
leaq -0x28(%rbp), %rdi
callq 0x2a4e0
jmp 0xd945e
leaq -0xa0(%rbp), %rdi
callq 0x57390
movq -0xe8(%rbp), %rax
addq $0xb0, %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rdi
callq 0xe5310
movq %rax, -0xb0(%rbp)
movq -0xa8(%rbp), %rdi
callq 0xe5340
movq %rax, -0xb8(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0xe5370
testb $0x1, %al
jne 0xd9350
jmp 0xd93e2
leaq -0xb0(%rbp), %rdi
callq 0xe53b0
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rdi
callq 0x2d030
movq %rax, %rsi
movq -0x18(%rbp), %rdx
movq (%rsi), %rax
movq 0x18(%rax), %rax
leaq -0xd0(%rbp), %rdi
callq *%rax
jmp 0xd9388
leaq -0xa0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x57650
jmp 0xd939d
leaq -0xd0(%rbp), %rdi
callq 0x24b20
leaq -0xb0(%rbp), %rdi
callq 0xe5430
jmp 0xd9334
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xd9440
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x24b20
jmp 0xd9440
movq -0xe8(%rbp), %r8
movq %r8, %rsi
addq $0x8, %rsi
movq %r8, %rdx
addq $0xa8, %rdx
addq $0x28, %r8
leaq -0xe0(%rbp), %rdi
leaq -0xa0(%rbp), %rcx
callq 0xe6f30
jmp 0xd9413
movq -0xf8(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0xe6fc0
leaq -0xe0(%rbp), %rdi
callq 0x57610
leaq -0xa0(%rbp), %rdi
callq 0x574c0
jmp 0xd944e
leaq -0xa0(%rbp), %rdi
callq 0x574c0
jmp 0xd945e
movq -0xf0(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x119c0
nopw (%rax,%rax)