// File: Laakeri[P]maxpre/src/./BVA.cpp
// Function: maxPreprocessor::Preprocessor::addBVAHash(std::vector<int, std::allocator<int>>&, std::unordered_map<unsigned long, int, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<std::pair<unsigned long const, int>>>&)
void Preprocessor::addBVAHash(vector<int>& lits, unordered_map<uint64_t, int>& hashes) {
	if (lits.size() <= 1) return;
	if (sfH.size() < lits.size() + 1) sfH.resize(lits.size() + 1);
	if (tMul.size() < lits.size() + 1) tMul.resize(lits.size() + 1);
	tMul[lits.size()] = 1;
	sfH[lits.size()] = 0;
	uint64_t mul = 1;
	for (int i = (int)lits.size() - 1; i >= 0; i--) {
		sfH[i] = sfH[i + 1];
		sfH[i] += mul * (uint64_t)lits[i];
		mul *= polyHashMul;
		tMul[i] = mul;
	}
	hashes[sfH[1]]++;
	uint64_t preH = 0;
	for (int i = 0; i < (int)lits.size() - 1; i++) {
		preH *= polyHashMul;
		preH += (uint64_t)lits[i];
		uint64_t mHash = preH * tMul[i + 2] + sfH[i + 2];
		hashes[mHash]++;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
callq 0xf940
cmpq $0x1, %rax
ja 0x271c3
jmp 0x274d2
movq -0x48(%rbp), %rdi
addq $0x400, %rdi            # imm = 0x400
callq 0x3f1b0
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
callq 0xf940
movq %rax, %rcx
movq -0x50(%rbp), %rax
addq $0x1, %rcx
cmpq %rcx, %rax
jae 0x27217
movq -0x48(%rbp), %rax
addq $0x400, %rax            # imm = 0x400
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
callq 0xf940
movq -0x58(%rbp), %rdi
movq %rax, %rsi
addq $0x1, %rsi
callq 0x3f1d0
movq -0x48(%rbp), %rdi
addq $0x418, %rdi            # imm = 0x418
callq 0x3f1b0
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rdi
callq 0xf940
movq %rax, %rcx
movq -0x60(%rbp), %rax
addq $0x1, %rcx
cmpq %rcx, %rax
jae 0x2726b
movq -0x48(%rbp), %rax
addq $0x418, %rax            # imm = 0x418
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rdi
callq 0xf940
movq -0x68(%rbp), %rdi
movq %rax, %rsi
addq $0x1, %rsi
callq 0x3f1d0
movq -0x48(%rbp), %rax
addq $0x418, %rax            # imm = 0x418
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rdi
callq 0xf940
movq -0x78(%rbp), %rdi
movq %rax, %rsi
callq 0x3d140
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq $0x1, (%rcx)
addq $0x400, %rax            # imm = 0x400
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rdi
callq 0xf940
movq -0x70(%rbp), %rdi
movq %rax, %rsi
callq 0x3d140
movq $0x0, (%rax)
movq $0x1, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0xf940
subl $0x1, %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jl 0x273b6
movq -0x48(%rbp), %rdi
addq $0x400, %rdi            # imm = 0x400
movl -0x24(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x3d140
movq -0x48(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x98(%rbp)
addq $0x400, %rdi            # imm = 0x400
movslq -0x24(%rbp), %rsi
callq 0x3d140
movq -0x98(%rbp), %rcx
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x24(%rbp), %rsi
callq 0xa7c0
movq -0x48(%rbp), %rdi
movq %rax, %rcx
movq -0x90(%rbp), %rax
movslq (%rcx), %rcx
imulq %rcx, %rax
movq %rax, -0x88(%rbp)
addq $0x400, %rdi            # imm = 0x400
movslq -0x24(%rbp), %rsi
callq 0x3d140
movq -0x88(%rbp), %rcx
movq -0x48(%rbp), %rdi
addq (%rax), %rcx
movq %rcx, (%rax)
movq 0x328(%rdi), %rax
imulq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x80(%rbp)
addq $0x418, %rdi            # imm = 0x418
movslq -0x24(%rbp), %rsi
callq 0x3d140
movq -0x80(%rbp), %rcx
movq %rcx, (%rax)
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x272d9
movq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rax
movq %rax, -0xa0(%rbp)
addq $0x400, %rdi            # imm = 0x400
movl $0x1, %esi
callq 0x3d140
movq -0xa0(%rbp), %rdi
movq %rax, %rsi
callq 0x3f260
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0xa4(%rbp)
movq -0x10(%rbp), %rdi
callq 0xf940
movq %rax, %rcx
movl -0xa4(%rbp), %eax
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x274d2
movq -0x48(%rbp), %rax
movq 0x328(%rax), %rax
imulq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x34(%rbp), %rsi
callq 0xa7c0
movq -0x48(%rbp), %rdi
movslq (%rax), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0xb8(%rbp)
addq $0x418, %rdi            # imm = 0x418
movl -0x34(%rbp), %eax
addl $0x2, %eax
movslq %eax, %rsi
callq 0x3d140
movq -0x48(%rbp), %rdi
movq %rax, %rcx
movq -0xb8(%rbp), %rax
imulq (%rcx), %rax
movq %rax, -0xb0(%rbp)
addq $0x400, %rdi            # imm = 0x400
movl -0x34(%rbp), %eax
addl $0x2, %eax
movslq %eax, %rsi
callq 0x3d140
movq %rax, %rcx
movq -0xb0(%rbp), %rax
addq (%rcx), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x3f260
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x273fb
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax,%rax)