// File: /workspace/github_cpp_makefile_star2_O2/Laakeri[P]maxpre/src/./BVA.cpp
// Function: maxPreprocessor::Preprocessor::doBVA()
int Preprocessor::doBVA() {
	rLog.startTechnique(Log::Technique::BVA);
	if (!rLog.requestTime(Log::Technique::BVA)) {
		rLog.stopTechnique(Log::Technique::BVA);
		return 0;
	}
	int removed = 0;
	vector<int> checkLit = pi.tl.getTouchedLiterals("BVA");
	vector<int> hClauses = pi.tl.getModClauses("BVAhash");
	for (int c : hClauses) {
		if (!rLog.requestTime(Log::Technique::BVA)) break;
		if (!pi.isClauseRemoved(c)) {
			addBVAHash(pi.clauses[c].lit, BVAHashTable);
		}
	}
	if (rLog.isTimeLimit()) {
		// The best literals to consider should be the ones that occur most
		// (at least the paper had this heuristic)
		auto cmp = [&](int lit1, int lit2) {
			return pi.litClauses[lit1].size() > pi.litClauses[lit2].size();
		};
		sort(checkLit.begin(), checkLit.end(), cmp);
	}
	for (int lit : checkLit) {
		if (!rLog.requestTime(Log::Technique::BVA)) break;
		if (pi.litClauses[lit].size() < 2) continue;
		removed += tryBVA(lit, BVAHashTable);
	}
	pi.tl.setItr("BVAhash");
	log(removed, " clauses removed by BVA");
	rLog.stopTechnique(Log::Technique::BVA);
	return removed;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %r14
leaq 0x218(%rdi), %rbx
pushq $0xa
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x21e0a
movq %rbx, %rdi
movl %ebp, %esi
callq 0x227d2
testb %al, %al
je 0x12934
leaq 0x1d662(%rip), %rsi     # 0x2fecf
leaq 0x88(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x6788
leaq 0x68(%r14), %r15
leaq 0x10(%rsp), %rdi
leaq 0x88(%rsp), %rdx
movq %r15, %rsi
callq 0x276a4
leaq 0x88(%rsp), %rdi
callq 0x3130
leaq 0x1d607(%rip), %rsi     # 0x2feb3
leaq 0x68(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x6788
leaq 0x30(%rsp), %rdi
leaq 0x68(%rsp), %rdx
movq %r15, 0x28(%rsp)
movq %r15, %rsi
callq 0x27a22
leaq 0x68(%rsp), %rdi
callq 0x3130
movq 0x30(%rsp), %r15
movq 0x38(%rsp), %r12
leaq 0x430(%r14), %rax
movq %rax, 0x8(%rsp)
pushq $0xa
popq %rbp
cmpq %r12, %r15
je 0x12946
movslq (%r15), %r13
movq %rbx, %rdi
movl %ebp, %esi
callq 0x227d2
testb %al, %al
je 0x12946
movq %r14, %rdi
movl %r13d, %esi
callq 0x20f14
testb %al, %al
jne 0x1292e
imulq $0x28, %r13, %rsi
addq (%r14), %rsi
movq %r14, %rdi
movq 0x8(%rsp), %rdx
callq 0x11940
addq $0x4, %r15
jmp 0x128f5
pushq $0xa
popq %rsi
movq %rbx, %rdi
callq 0x21e46
xorl %ebp, %ebp
jmp 0x12a77
movq %rbx, %rdi
callq 0x22ac8
testb %al, %al
je 0x129c5
movq 0x10(%rsp), %rbp
movq 0x18(%rsp), %r13
cmpq %r13, %rbp
je 0x129c5
movq %r13, %r15
subq %rbp, %r15
movq %r15, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %rbp, %rdi
movq %r13, %rsi
movq %r14, %rcx
callq 0x172ec
cmpq $0x41, %r15
jl 0x129b7
leaq 0x40(%rbp), %r15
movq %rbp, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x17638
cmpq %r13, %r15
je 0x129c5
movq %r15, %rdi
movq %r14, %rsi
callq 0x176c3
addq $0x4, %r15
jmp 0x129a1
movq %rbp, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x17638
movq 0x10(%rsp), %r12
movq 0x18(%rsp), %r13
xorl %ebp, %ebp
cmpq %r13, %r12
je 0x12a18
movslq (%r12), %r15
movq %rbx, %rdi
pushq $0xa
popq %rsi
callq 0x227d2
testb %al, %al
je 0x12a18
movq 0x18(%r14), %rax
imulq $0x18, %r15, %rcx
movq 0x8(%rax,%rcx), %rdx
subq (%rax,%rcx), %rdx
cmpq $0x5, %rdx
jb 0x12a12
movq %r14, %rdi
movl %r15d, %esi
movq 0x8(%rsp), %rdx
callq 0x11b7e
addl %eax, %ebp
addq $0x4, %r12
jmp 0x129d1
leaq 0x1d494(%rip), %rsi     # 0x2feb3
leaq 0x48(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x6788
leaq 0x48(%rsp), %rsi
movq 0x28(%rsp), %rdi
callq 0x27c28
leaq 0x48(%rsp), %rdi
callq 0x3130
leaq 0x1d46d(%rip), %rdx     # 0x2febb
movq %r14, %rdi
movl %ebp, %esi
callq 0x189d8
pushq $0xa
popq %rsi
movq %rbx, %rdi
callq 0x21e46
leaq 0x30(%rsp), %rdi
callq 0x7512
leaq 0x10(%rsp), %rdi
callq 0x7512
movl %ebp, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x3130
jmp 0x12ace
jmp 0x12acb
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x3130
jmp 0x12ad8
movq %rax, %rbx
jmp 0x12ad8
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x3130
jmp 0x12ae2
movq %rax, %rbx
jmp 0x12ae2
jmp 0x12acb
jmp 0x12acb
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x7512
leaq 0x10(%rsp), %rdi
callq 0x7512
movq %rbx, %rdi
callq 0x3490