// File: Nallantli[P]Rossa/main/rossa/node/node.cpp
// Function: MapNode::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 MapNode::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<std::pair<std::string, ptr_node_t>> nargs;
	for (auto &c : args)
		nargs.push_back({c.first, c.second->fold(consts)});
	return std::make_shared<MapNode>(path, nargs, token);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x128(%rbp)
movq %rdi, %rax
movq %rax, -0x120(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x118(%rbp)
movq (%rdi), %rax
callq *0x8(%rax)
testb $0x1, %al
jne 0xe2302
jmp 0xe241e
movq -0x118(%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 0xe232c
leaq -0x68(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0x24b80
leaq -0x28(%rbp), %rdi
callq 0x2d300
movq -0x130(%rbp), %rcx
movq %rax, %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x78(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq *%rax
jmp 0xe2361
movq -0x118(%rbp), %rcx
movq %rcx, %rsi
addq $0x8, %rsi
addq $0x28, %rcx
leaq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rdx
callq 0xe5670
jmp 0xe2385
movq -0x128(%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 0xe25c4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe2410
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe23fe
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 0xe25d4
leaq -0xa0(%rbp), %rdi
callq 0x59170
movq -0x118(%rbp), %rax
addq $0xa8, %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rdi
callq 0xe9e90
movq %rax, -0xb0(%rbp)
movq -0xa8(%rbp), %rdi
callq 0xe9ec0
movq %rax, -0xb8(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0xe9ef0
testb $0x1, %al
jne 0xe2480
jmp 0xe2562
leaq -0xb0(%rbp), %rdi
callq 0xe9f30
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rdi
movq %rdi, -0x138(%rbp)
addq $0x20, %rdi
callq 0x2d030
movq %rax, %rsi
movq -0x18(%rbp), %rdx
movq (%rsi), %rax
movq 0x18(%rax), %rax
leaq -0x100(%rbp), %rdi
callq *%rax
jmp 0xe24c3
movq -0x138(%rbp), %rsi
leaq -0xf0(%rbp), %rdi
leaq -0x100(%rbp), %rdx
callq 0xea1c0
jmp 0xe24df
leaq -0xa0(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0xea190
jmp 0xe24f4
leaq -0xf0(%rbp), %rdi
callq 0x59240
leaq -0x100(%rbp), %rdi
callq 0x24b20
leaq -0xb0(%rbp), %rdi
callq 0xea060
jmp 0xe2464
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe25b6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe2554
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x59240
leaq -0x100(%rbp), %rdi
callq 0x24b20
jmp 0xe25b6
movq -0x118(%rbp), %rcx
movq %rcx, %rsi
addq $0x8, %rsi
addq $0x28, %rcx
leaq -0x110(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
callq 0xea200
jmp 0xe2589
movq -0x128(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x592f0
leaq -0x110(%rbp), %rdi
callq 0x59320
leaq -0xa0(%rbp), %rdi
callq 0x59340
jmp 0xe25c4
leaq -0xa0(%rbp), %rdi
callq 0x59340
jmp 0xe25d4
movq -0x120(%rbp), %rax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x119c0
nopl (%rax)