// File: 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
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdi, -0x178(%rbp)
movq %rdi, %rax
movq %rax, -0x170(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x168(%rbp)
movq (%rdi), %rax
callq *0x8(%rax)
testb $0x1, %al
jne 0xe3322
jmp 0xe343e
movq -0x168(%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 0xe334c
leaq -0x68(%rbp), %rdi
movq %rdi, -0x180(%rbp)
callq 0x24b80
leaq -0x28(%rbp), %rdi
callq 0x2d300
movq -0x180(%rbp), %rcx
movq %rax, %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x78(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq *%rax
jmp 0xe3381
movq -0x168(%rbp), %rcx
movq %rcx, %rsi
addq $0x8, %rsi
addq $0x28, %rcx
leaq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rdx
callq 0xe5670
jmp 0xe33a5
movq -0x178(%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 0xe37c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe3430
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe341e
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 0xe37d2
leaq -0xb8(%rbp), %rdi
callq 0x593a0
leaq -0xd0(%rbp), %rdi
callq 0x57390
movq -0x168(%rbp), %rax
addq $0xb8, %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rdi
callq 0xea2f0
movq %rax, -0xe0(%rbp)
movq -0xd8(%rbp), %rdi
callq 0xea320
movq %rax, -0xe8(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0xea350
testb $0x1, %al
jne 0xe34ac
jmp 0xe3567
leaq -0xe0(%rbp), %rdi
callq 0xea380
movq %rax, -0xf0(%rbp)
movq -0xf0(%rbp), %rdi
movq 0x10(%rdi), %rax
movq %rax, -0x188(%rbp)
callq 0x2d030
movq %rax, %rsi
movq -0x18(%rbp), %rdx
movq (%rsi), %rax
movq 0x18(%rax), %rax
leaq -0x100(%rbp), %rdi
callq *%rax
jmp 0xe34ef
leaq -0xb8(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x594c0
movq %rax, -0x190(%rbp)
jmp 0xe350b
movq -0x190(%rbp), %rax
movq -0x188(%rbp), %rcx
movq %rcx, (%rax)
leaq -0x100(%rbp), %rdi
callq 0x24b20
leaq -0xe0(%rbp), %rdi
callq 0xea570
jmp 0xe3490
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe37a8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x24b20
jmp 0xe37a8
movq -0x168(%rbp), %rax
addq $0xe8, %rax
movq %rax, -0x108(%rbp)
movq -0x108(%rbp), %rdi
callq 0xe5310
movq %rax, -0x110(%rbp)
movq -0x108(%rbp), %rdi
callq 0xe5340
movq %rax, -0x118(%rbp)
leaq -0x110(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0xe5370
testb $0x1, %al
jne 0xe35bd
jmp 0xe3644
leaq -0x110(%rbp), %rdi
callq 0xe53b0
movq %rax, -0x120(%rbp)
movq -0x120(%rbp), %rdi
callq 0x2d030
movq %rax, %rsi
movq -0x18(%rbp), %rdx
movq (%rsi), %rax
movq 0x18(%rax), %rax
leaq -0x130(%rbp), %rdi
callq *%rax
jmp 0xe35f5
leaq -0xd0(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x57650
jmp 0xe360a
leaq -0x130(%rbp), %rdi
callq 0x24b20
leaq -0x110(%rbp), %rdi
callq 0xe5430
jmp 0xe35a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x24b20
jmp 0xe37a8
movq -0x168(%rbp), %rdi
movq %rdi, %rax
addq $0x8, %rax
movq %rax, -0x198(%rbp)
addq $0xa8, %rdi
callq 0x2d030
movq %rax, %rsi
movq -0x18(%rbp), %rdx
movq (%rsi), %rax
movq 0x18(%rax), %rax
leaq -0x150(%rbp), %rdi
callq *%rax
jmp 0xe367e
movq -0x198(%rbp), %rsi
movq -0x168(%rbp), %r9
addq $0x28, %r9
leaq -0x140(%rbp), %rdi
leaq -0x150(%rbp), %rdx
leaq -0xb8(%rbp), %rcx
leaq -0xd0(%rbp), %r8
callq 0xea7b0
jmp 0xe36b3
leaq -0x150(%rbp), %rdi
callq 0x24b20
movq -0x168(%rbp), %rdi
addq $0x100, %rdi            # imm = 0x100
callq 0x57630
testb $0x1, %al
jne 0xe36db
jmp 0xe376f
leaq -0x140(%rbp), %rdi
callq 0x59660
movq -0x168(%rbp), %rdi
movq %rax, -0x1a0(%rbp)
addq $0x100, %rdi            # imm = 0x100
callq 0x2d030
movq %rax, %rsi
movq -0x18(%rbp), %rdx
movq (%rsi), %rax
movq 0x18(%rax), %rax
leaq -0x160(%rbp), %rdi
callq *%rax
jmp 0xe371a
movq -0x1a0(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0xe2d10
leaq -0x160(%rbp), %rdi
callq 0x24b20
jmp 0xe376f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x24b20
jmp 0xe37a8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x596b0
jmp 0xe37a8
movq -0x178(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x59680
leaq -0x140(%rbp), %rdi
callq 0x596b0
leaq -0xd0(%rbp), %rdi
callq 0x574c0
leaq -0xb8(%rbp), %rdi
callq 0x596d0
jmp 0xe37c2
leaq -0xd0(%rbp), %rdi
callq 0x574c0
leaq -0xb8(%rbp), %rdi
callq 0x596d0
jmp 0xe37d2
movq -0x170(%rbp), %rax
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x119c0
nopl (%rax,%rax)