// File: /workspace/github_cpp_makefile_star2_O2/Nallantli[P]Rossa/main/rossa/node/node.cpp
// Function: SwitchNode::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 SwitchNode::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::map<ptr_node_t, size_t> ncases;
	std::vector<ptr_node_t> ngotos;
	for (auto &c : cases)
		ncases[c.first->fold(consts)] = c.second;
	for (auto &e : gotos)
		ngotos.push_back(e->fold(consts));
	auto ret = std::make_shared<SwitchNode>(path, switchs->fold(consts), ncases, ngotos, token);
	if (elses)
		ret->setElse(elses->fold(consts));
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq (%rsi), %rax
movq %rsi, %rdi
callq *0x8(%rax)
testb %al, %al
je 0x5788b
movq (%rbx), %rax
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
callq *(%rax)
leaq 0x50(%rsp), %rsi
andq $0x0, (%rsi)
movq %rsp, %rdi
callq 0x361aa
leaq 0x50(%rsp), %rcx
andq $0x0, 0x10(%rcx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rcx)
movq 0x20(%rsp), %rsi
movq (%rsi), %rax
leaq 0x10(%rsp), %rdi
movq %rsp, %rdx
callq *(%rax)
leaq 0x8(%rbx), %rsi
addq $0x28, %rbx
leaq 0x80(%rsp), %rdi
leaq 0x10(%rsp), %rdx
movq %rbx, %rcx
callq 0x58a65
leaq 0x88(%rsp), %rdi
movaps -0x8(%rdi), %xmm0
andq $0x0, (%rdi)
movups %xmm0, (%r14)
andq $0x0, -0x8(%rdi)
callq 0x1d786
leaq 0x10(%rsp), %rdi
callq 0x39102
leaq 0x50(%rsp), %rdi
callq 0x1cb1a
movq %rsp, %rdi
callq 0x363f2
leaq 0x28(%rsp), %rdi
callq 0x1d786
jmp 0x57a11
movq %r14, 0x48(%rsp)
leaq 0x58(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
andq $0x0, 0x30(%rsp)
movq 0xd0(%rbx), %rbp
movq %rbx, 0x40(%rsp)
leaq 0xc0(%rbx), %r14
movq %rsp, %r13
leaq 0x50(%rsp), %rbx
cmpq %r14, %rbp
je 0x57911
movq 0x30(%rbp), %r12
movq 0x20(%rbp), %rsi
movq (%rsi), %rax
movq %r13, %rdi
movq %r15, %rdx
callq *0x18(%rax)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2efe8
movq %r12, (%rax)
leaq 0x8(%rsp), %rdi
callq 0x1d786
movq %rbp, %rdi
callq 0x104a0
movq %rax, %rbp
jmp 0x578d3
movq 0x40(%rsp), %rax
movq 0xe8(%rax), %r14
movq 0xf0(%rax), %rbp
leaq 0x8(%rsp), %r12
movq %rsp, %rbx
leaq 0x20(%rsp), %r13
cmpq %rbp, %r14
je 0x5795e
movq (%r14), %rsi
movq (%rsi), %rax
movq %rbx, %rdi
movq %r15, %rdx
callq *0x18(%rax)
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2e880
movq %r12, %rdi
callq 0x1d786
addq $0x10, %r14
jmp 0x57931
movq 0x40(%rsp), %rbx
movq 0xa8(%rbx), %rsi
movq (%rsi), %rax
leaq 0x10(%rsp), %rdi
movq %r15, %rdx
callq *0x18(%rax)
leaq 0x8(%rbx), %rsi
leaq 0x28(%rbx), %r9
movq %rsp, %rdi
leaq 0x10(%rsp), %rdx
leaq 0x50(%rsp), %rcx
leaq 0x20(%rsp), %r8
callq 0x59a7d
movq 0x48(%rsp), %r14
leaq 0x18(%rsp), %rdi
callq 0x1d786
movq 0x100(%rbx), %rsi
testq %rsi, %rsi
je 0x579e2
movq (%rsp), %rbx
movq (%rsi), %rax
leaq 0x10(%rsp), %rdi
movq %r15, %rdx
callq *0x18(%rax)
addq $0x100, %rbx            # imm = 0x100
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x2fc8e
leaq 0x18(%rsp), %rdi
callq 0x1d786
leaq 0x8(%rsp), %rdi
movaps -0x8(%rdi), %xmm0
andq $0x0, (%rdi)
movups %xmm0, (%r14)
andq $0x0, -0x8(%rdi)
callq 0x1d786
leaq 0x20(%rsp), %rdi
callq 0x2e838
leaq 0x50(%rsp), %rdi
callq 0x2fcf4
movq %r14, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x57a78
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
jmp 0x57a80
jmp 0x57a73
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x39102
jmp 0x57a46
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x1cb1a
movq %rsp, %rdi
callq 0x363f2
jmp 0x57a5d
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x1d786
jmp 0x57a99
jmp 0x57a73
movq %rax, %rbx
movq %r12, %rdi
jmp 0x57a80
movq %rax, %rbx
jmp 0x57a85
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x1d786
leaq 0x20(%rsp), %rdi
callq 0x2e838
leaq 0x50(%rsp), %rdi
callq 0x2fcf4
movq %rbx, %rdi
callq 0x106f0
nop