// File: /workspace/github_cpp_makefile_star2_O1/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 $0xa8, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rax
movq %rsi, %rdi
callq *0x8(%rax)
testb %al, %al
je 0x66035
movq (%r14), %rax
leaq 0x30(%rsp), %rdi
movq %r14, %rsi
callq *(%rax)
leaq 0x70(%rsp), %rsi
movq $0x0, (%rsi)
leaq 0x8(%rsp), %rdi
callq 0x3cf06
xorps %xmm0, %xmm0
leaq 0x70(%rsp), %rcx
movaps %xmm0, (%rcx)
movq $0x0, 0x10(%rcx)
movq 0x30(%rsp), %rsi
movq (%rsi), %rax
leaq 0x20(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq *(%rax)
leaq 0x8(%r14), %rcx
addq $0x28, %r14
leaq 0x58(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x50(%rsp), %rsi
leaq 0x1f(%rsp), %rdx
leaq 0x20(%rsp), %r8
movq %r14, %r9
callq 0x6849a
movq 0x50(%rsp), %rax
movq %rax, (%rbx)
xorl %eax, %eax
movq %rax, 0x8(%rbx)
movq 0x58(%rsp), %rcx
movq %rax, 0x58(%rsp)
movq %rcx, 0x8(%rbx)
leaq 0x20(%rsp), %rdi
callq 0x404da
leaq 0x70(%rsp), %rdi
callq 0x1d77a
leaq 0x8(%rsp), %rdi
callq 0x3d168
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x661fe
callq 0x1e6ee
jmp 0x661fe
movq %rbx, 0x60(%rsp)
leaq 0x78(%rsp), %rax
movl $0x0, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq %rcx, 0x40(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq 0xd0(%r14), %r12
movq %r14, 0x68(%rsp)
leaq 0xc0(%r14), %rbx
cmpq %rbx, %r12
je 0x660c9
leaq 0x8(%rsp), %r13
leaq 0x70(%rsp), %rbp
movq 0x30(%r12), %r14
movq 0x20(%r12), %rsi
movq (%rsi), %rax
movq %r13, %rdi
movq %r15, %rdx
callq *0x18(%rax)
movq %rbp, %rdi
movq %r13, %rsi
callq 0x375fa
movq %r14, (%rax)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x660b9
callq 0x1e6ee
movq %r12, %rdi
callq 0x104b0
movq %rax, %r12
cmpq %rbx, %rax
jne 0x66086
movq 0x68(%rsp), %r14
movq 0xe8(%r14), %rbx
movq 0xf0(%r14), %rbp
cmpq %rbp, %rbx
je 0x6611d
leaq 0x8(%rsp), %r12
leaq 0x30(%rsp), %r13
movq (%rbx), %rsi
movq (%rsi), %rax
movq %r12, %rdi
movq %r15, %rdx
callq *0x18(%rax)
movq %r13, %rdi
movq %r12, %rsi
callq 0x3725c
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x66114
callq 0x1e6ee
addq $0x10, %rbx
cmpq %rbp, %rbx
jne 0x660eb
movq 0xa8(%r14), %rsi
movq (%rsi), %rax
leaq 0x20(%rsp), %rdi
movq %r15, %rdx
callq *0x18(%rax)
leaq 0x8(%r14), %rcx
leaq 0x28(%r14), %rax
leaq 0x10(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x30(%rsp), %r10
leaq 0x8(%rsp), %rsi
leaq 0x50(%rsp), %rdx
leaq 0x20(%rsp), %r8
leaq 0x70(%rsp), %r9
pushq %rax
pushq %r10
callq 0x6e3ac
addq $0x10, %rsp
movq 0x60(%rsp), %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x66180
callq 0x1e6ee
movq 0x100(%r14), %rsi
testq %rsi, %rsi
je 0x661ce
movq 0x8(%rsp), %r14
movq (%rsi), %rax
leaq 0x20(%rsp), %rdi
movq %r15, %rdx
callq *0x18(%rax)
leaq 0x28(%rsp), %r15
movq -0x8(%r15), %rax
movq %rax, 0x100(%r14)
addq $0x108, %r14            # imm = 0x108
movq %r14, %rdi
movq %r15, %rsi
callq 0x37c6e
movq (%r15), %rdi
testq %rdi, %rdi
je 0x661ce
callq 0x1e6ee
movq 0x8(%rsp), %rax
movq %rax, (%rbx)
xorl %eax, %eax
movq %rax, 0x8(%rbx)
movq 0x10(%rsp), %rcx
movq %rax, 0x10(%rsp)
movq %rcx, 0x8(%rbx)
leaq 0x30(%rsp), %rdi
callq 0x37214
leaq 0x70(%rsp), %rdi
callq 0x37cb4
movq %rbx, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x66297
jmp 0x66292
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x66297
jmp 0x66292
jmp 0x66280
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x404da
jmp 0x66245
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x1d77a
leaq 0x8(%rsp), %rdi
callq 0x3d168
jmp 0x6625e
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x662ab
callq 0x1e6ee
jmp 0x662ab
jmp 0x66280
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x66297
jmp 0x66292
movq %rax, %rbx
jmp 0x66297
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x66297
callq 0x1e6ee
leaq 0x30(%rsp), %rdi
callq 0x37214
leaq 0x70(%rsp), %rdi
callq 0x37cb4
movq %rbx, %rdi
callq 0x106f0
nop