// File: /workspace/github_cpp_makefile_star2_O1/Nallantli[P]Rossa/main/rossa/node/node.cpp
// Function: IfElseNode::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 IfElseNode::fold(const std::vector<std::pair<std::vector<hash_ull>, symbol_t>> &consts) const
{
	auto nifs = ifs->fold(consts);
	auto nbody = body->fold(consts);
	ptr_node_t nelses = nullptr;
	if (elses)
		nelses = elses->fold(consts);

	if (nifs->isConst() && nbody->isConst() && (!nelses || nelses->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);
	}

	auto ret = std::make_shared<IfElseNode>(path, nifs, nbody, token);
	if (nelses)
		ret->setElse(nelses);
	return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xa0, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq 0xa8(%rsi), %rsi
movq (%rsi), %rax
leaq 0x70(%rsp), %rdi
callq *0x18(%rax)
movq 0xb8(%r14), %rsi
movq (%rsi), %rax
leaq 0x60(%rsp), %rdi
movq %r15, %rdx
callq *0x18(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq 0xc8(%r14), %rsi
testq %rsi, %rsi
je 0x63901
movq (%rsi), %rax
leaq 0x10(%rsp), %rdi
movq %r15, %rdx
callq *0x18(%rax)
leaq 0x18(%rsp), %r15
movq -0x8(%r15), %rax
leaq 0x38(%rsp), %rdi
movq %rax, -0x8(%rdi)
movq %r15, %rsi
callq 0x37c6e
movq (%r15), %rdi
testq %rdi, %rdi
je 0x63901
callq 0x1e6ee
movq 0x70(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
testb %al, %al
je 0x63a12
movq 0x60(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
testb %al, %al
je 0x63a12
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x6393f
movq (%rdi), %rax
callq *0x8(%rax)
testb %al, %al
je 0x63a12
movq (%r14), %rax
leaq 0x50(%rsp), %rdi
movq %r14, %rsi
callq *(%rax)
leaq 0x10(%rsp), %rsi
movq $0x0, (%rsi)
leaq 0x90(%rsp), %rdi
callq 0x3cf06
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rcx
movaps %xmm0, (%rcx)
movq $0x0, 0x10(%rcx)
movq 0x50(%rsp), %rsi
movq (%rsi), %rax
leaq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq *(%rax)
leaq 0x8(%r14), %rcx
addq $0x28, %r14
leaq 0x48(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x40(%rsp), %rsi
leaq 0xf(%rsp), %rdx
leaq 0x80(%rsp), %r8
movq %r14, %r9
callq 0x6849a
movq 0x40(%rsp), %rax
movq %rax, (%rbx)
xorl %eax, %eax
movq %rax, 0x8(%rbx)
movq 0x48(%rsp), %rcx
movq %rax, 0x48(%rsp)
movq %rcx, 0x8(%rbx)
leaq 0x80(%rsp), %rdi
callq 0x404da
leaq 0x10(%rsp), %rdi
callq 0x1d77a
leaq 0x90(%rsp), %rdi
callq 0x3d168
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x63a87
callq 0x1e6ee
jmp 0x63a87
leaq 0x8(%r14), %rcx
addq $0x28, %r14
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %r14, (%rsp)
leaq 0x10(%rsp), %rsi
leaq 0x50(%rsp), %rdx
leaq 0x70(%rsp), %r8
leaq 0x60(%rsp), %r9
callq 0x6ccfe
movq 0x30(%rsp), %rax
testq %rax, %rax
je 0x63a6b
movq 0x10(%rsp), %rdi
movq %rax, 0xc8(%rdi)
addq $0xd0, %rdi
leaq 0x38(%rsp), %rsi
callq 0x37c6e
movq 0x10(%rsp), %rax
movq %rax, (%rbx)
xorl %eax, %eax
movq %rax, 0x8(%rbx)
movq 0x18(%rsp), %rcx
movq %rax, 0x18(%rsp)
movq %rcx, 0x8(%rbx)
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x63a96
callq 0x1e6ee
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x63aa5
callq 0x1e6ee
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x63ab4
callq 0x1e6ee
movq %rbx, %rax
addq $0xa0, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x404da
jmp 0x63ad9
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x1d77a
leaq 0x90(%rsp), %rdi
callq 0x3d168
jmp 0x63af5
movq %rax, %rbx
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x63b14
callq 0x1e6ee
jmp 0x63b14
jmp 0x63b11
jmp 0x63b11
jmp 0x63b11
movq %rax, %rbx
jmp 0x63b32
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x63b23
callq 0x1e6ee
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x63b32
callq 0x1e6ee
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x63b41
callq 0x1e6ee
movq %rbx, %rdi
callq 0x106f0
nop