// File: /workspace/github_cpp_makefile_star2_O3/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 0x65321
movq (%r14), %rax
leaq 0x30(%rsp), %rdi
movq %r14, %rsi
callq *(%rax)
leaq 0x70(%rsp), %rsi
movq $0x0, (%rsi)
leaq 0x10(%rsp), %rdi
callq 0x3c8de
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 0x10(%rsp), %rdx
callq *(%rax)
leaq 0x8(%r14), %rcx
addq $0x28, %r14
leaq 0x58(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x50(%rsp), %rsi
leaq 0xf(%rsp), %rdx
leaq 0x20(%rsp), %r8
movq %r14, %r9
callq 0x676e2
movaps 0x50(%rsp), %xmm0
movups %xmm0, (%rbx)
leaq 0x20(%rsp), %rdi
callq 0x3fe06
leaq 0x70(%rsp), %rdi
callq 0x1d632
leaq 0x10(%rsp), %rdi
callq 0x3cb40
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x654d6
callq 0x1e5bc
jmp 0x654d6
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 0x653b5
leaq 0x10(%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 0x370ea
movq %r14, (%rax)
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x653a5
callq 0x1e5bc
movq %r12, %rdi
callq 0x104b0
movq %rax, %r12
cmpq %rbx, %rax
jne 0x65372
movq 0x68(%rsp), %r14
movq 0xe8(%r14), %rbx
movq 0xf0(%r14), %rbp
cmpq %rbp, %rbx
je 0x65409
leaq 0x10(%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 0x36d3e
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x65400
callq 0x1e5bc
addq $0x10, %rbx
cmpq %rbp, %rbx
jne 0x653d7
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 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x30(%rsp), %r10
leaq 0x10(%rsp), %rsi
leaq 0x50(%rsp), %rdx
leaq 0x20(%rsp), %r8
leaq 0x70(%rsp), %r9
pushq %rax
pushq %r10
callq 0x6d450
addq $0x10, %rsp
movq 0x60(%rsp), %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x6546c
callq 0x1e5bc
movq 0x100(%r14), %rsi
testq %rsi, %rsi
je 0x654ba
movq 0x10(%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 0x3775e
movq (%r15), %rdi
testq %rdi, %rdi
je 0x654ba
callq 0x1e5bc
movaps 0x10(%rsp), %xmm0
movups %xmm0, (%rbx)
leaq 0x30(%rsp), %rdi
callq 0x36cf0
leaq 0x70(%rsp), %rdi
callq 0x377a8
movq %rbx, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x6556f
jmp 0x6556a
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x6556f
jmp 0x6556a
jmp 0x65558
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x3fe06
jmp 0x6551d
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x1d632
leaq 0x10(%rsp), %rdi
callq 0x3cb40
jmp 0x65536
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x65583
callq 0x1e5bc
jmp 0x65583
jmp 0x65558
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x6556f
jmp 0x6556a
movq %rax, %rbx
jmp 0x6556f
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x6556f
callq 0x1e5bc
leaq 0x30(%rsp), %rdi
callq 0x36cf0
leaq 0x70(%rsp), %rdi
callq 0x377a8
movq %rbx, %rdi
callq 0x106f0
nop