// File: Nallantli[P]Rossa/main/rossa/node/node.cpp
// Function: DefineNode::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 DefineNode::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);
	}

	return std::make_shared<DefineNode>(path, key, ftype, params, body->fold(consts), captures, token);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0xc0(%rbp)
movq %rdi, %rax
movq %rax, -0xb8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
movq (%rdi), %rax
callq *0x8(%rax)
testb $0x1, %al
jne 0xd4c92
jmp 0xd4dae
movq -0xb0(%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 0xd4cbc
leaq -0x68(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x24b80
leaq -0x28(%rbp), %rdi
callq 0x2d300
movq -0xc8(%rbp), %rcx
movq %rax, %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x78(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq *%rax
jmp 0xd4cf1
movq -0xb0(%rbp), %rcx
movq %rcx, %rsi
addq $0x8, %rsi
addq $0x28, %rcx
leaq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rdx
callq 0xe5670
jmp 0xd4d15
movq -0xc0(%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 0xd4eb4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xd4da0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xd4d8e
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 0xd4ec4
movq -0xb0(%rbp), %rdi
movq %rdi, %rax
addq $0x8, %rax
movq %rax, -0xf0(%rbp)
movq %rdi, %rax
addq $0xa8, %rax
movq %rax, -0xe8(%rbp)
movq %rdi, %rax
addq $0xb0, %rax
movq %rax, -0xe0(%rbp)
movq %rdi, %rax
addq $0xc8, %rax
movq %rax, -0xd8(%rbp)
addq $0xe0, %rdi
callq 0x2d030
movq %rax, %rsi
movq -0x18(%rbp), %rdx
movq (%rsi), %rax
movq 0x18(%rax), %rax
leaq -0xa8(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq *%rax
movq -0xb0(%rbp), %r10
movq -0xf0(%rbp), %rsi
movq -0xe8(%rbp), %rdx
movq -0xe0(%rbp), %rcx
movq -0xd8(%rbp), %r8
movq -0xd0(%rbp), %r9
movq %r10, %rdi
addq $0xf0, %rdi
addq $0x28, %r10
movq %rsp, %rax
movq %r10, 0x8(%rax)
movq %rdi, (%rax)
leaq -0x98(%rbp), %rdi
callq 0xe5ea0
jmp 0xd4e6d
movq -0xc0(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x58440
leaq -0x98(%rbp), %rdi
callq 0x58470
leaq -0xa8(%rbp), %rdi
callq 0x24b20
jmp 0xd4eb4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x24b20
jmp 0xd4ec4
movq -0xb8(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x119c0
nopl (%rax)