// File: /workspace/github_cpp_makefile_star2_O3/Nallantli[P]Rossa/main/rossa/node/node.cpp
// Function: IDNode::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 IDNode::fold(const std::vector<std::pair<std::vector<hash_ull>, symbol_t>> &consts) const
{
	bool flag = true;
	for (auto &p : path)
	{
		if (std::find(p.var_ids.begin(), p.var_ids.end(), key) != p.var_ids.end())
		{
			flag = false;
			break;
		}
	}

	if (flag)
	{
		for (auto &c : consts)
		{
			std::vector<hash_ull> tpath;
			for (auto &p : path)
				tpath.push_back(p.id);
			while (true)
			{
				auto temp = tpath;
				temp.push_back({key});

				if (c.first == temp)
					return std::make_shared<ContainerNode>(path, c.second, token);
				if (tpath.empty())
					break;
				tpath.pop_back();
			}
		}
	}

	return std::make_shared<IDNode>(path, key, token);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, %rbx
movq %rdi, 0x38(%rsp)
leaq 0x8(%rsi), %rax
movq %rax, 0x58(%rsp)
movq 0x8(%rsi), %r15
movq %rsi, 0x30(%rsp)
movq 0x10(%rsi), %r12
cmpq %r12, %r15
je 0x5a60f
movq 0x30(%rsp), %rax
leaq 0xa8(%rax), %r14
movq 0x8(%r15), %rdi
movq 0x10(%r15), %rsi
movq %r14, %rdx
callq 0x67ac2
cmpq 0x10(%r15), %rax
jne 0x5a7be
addq $0x20, %r15
cmpq %r12, %r15
jne 0x5a5ec
movq (%rbx), %r13
movq 0x8(%rbx), %rax
movq %rax, 0x70(%rsp)
cmpq %rax, %r13
je 0x5a7be
movq 0x30(%rsp), %rax
leaq 0xa8(%rax), %r12
addq $0x28, %rax
movq %rax, 0x78(%rsp)
leaq 0x10(%rsp), %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rbx
movq 0x10(%rax), %r15
cmpq %r15, %rbx
je 0x5a68f
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x5a67e
movq (%rbx), %rax
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x5a689
movq %r14, %rdi
movq %rbx, %rdx
callq 0x3bf30
addq $0x20, %rbx
jmp 0x5a65c
leaq 0x18(%r13), %rax
movq %rax, 0x80(%rsp)
leaq 0x40(%rsp), %rdi
movq %r14, %rsi
callq 0x20fee
movq 0x48(%rsp), %rsi
cmpq 0x50(%rsp), %rsi
je 0x5a6c6
movq (%r12), %rax
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x48(%rsp)
jmp 0x5a6d8
leaq 0x40(%rsp), %rdi
movq %r12, %rdx
callq 0x3bf30
movq 0x48(%rsp), %rsi
movq (%r13), %rdi
movq 0x8(%r13), %rax
movq %rax, %rdx
subq %rdi, %rdx
movq 0x40(%rsp), %r15
subq %r15, %rsi
cmpq %rsi, %rdx
jne 0x5a704
cmpq %rdi, %rax
je 0x5a71f
movq %r15, %rsi
callq 0x10400
testl %eax, %eax
je 0x5a71f
movq 0x18(%rsp), %rax
xorl %ebp, %ebp
cmpq %rax, 0x10(%rsp)
je 0x5a769
addq $-0x8, %rax
movq %rax, 0x18(%rsp)
movb $0x1, %bl
jmp 0x5a770
movq $0x0, 0x60(%rsp)
leaq 0x68(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0xf(%rsp), %rdx
movq 0x58(%rsp), %rcx
movq 0x80(%rsp), %r8
movq 0x78(%rsp), %r9
callq 0x672e2
movaps 0x60(%rsp), %xmm0
movq 0x38(%rsp), %rax
movups %xmm0, (%rax)
movl $0x1, %ebp
xorl %ebx, %ebx
movq 0x40(%rsp), %r15
jmp 0x5a770
movl $0x9, %ebp
xorl %ebx, %ebx
testq %r15, %r15
je 0x5a785
movq 0x50(%rsp), %rsi
subq %r15, %rsi
movq %r15, %rdi
callq 0x103d0
testl %ebp, %ebp
je 0x5a69b
cmpl $0x9, %ebp
jne 0x5a794
movb $0x1, %bl
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x5a7ab
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x103d0
testb %bl, %bl
je 0x5a7fd
addq $0x28, %r13
cmpq 0x70(%rsp), %r13
jne 0x5a63e
movq 0x30(%rsp), %r9
leaq 0xa8(%r9), %r8
addq $0x28, %r9
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x10(%rsp), %rbx
leaq 0x40(%rsp), %rdx
movq %rbx, %rsi
movq 0x58(%rsp), %rcx
callq 0x67b6e
movaps (%rbx), %xmm0
movq 0x38(%rsp), %rax
movups %xmm0, (%rax)
movq 0x38(%rsp), %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5a816
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x5a837
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x103d0
jmp 0x5a837
jmp 0x5a834
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x5a84e
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x103d0
movq %rbx, %rdi
callq 0x106f0