// File: /workspace/github_cpp_makefile_star2_O3/Laakeri[P]maxpre/src/preprocessor.cpp
// Function: maxPreprocessor::Preprocessor::removeDuplicateClauses()
int Preprocessor::removeDuplicateClauses() {
	int removed = 0;
	vector<int> checkLit = pi.tl.getModLiterals("DPCLRM");
	vector<pair<uint64_t, int> > has;
	if ((int)checkLit.size() > pi.vars/2) { // magic constant
		for (int c = 0; c < (int)pi.clauses.size(); c++) {
			if (!pi.isClauseRemoved(c)) {
				if (pi.clauses[c].lit.size() == 0) {
					if (!pi.clauses[c].isHard()) {
						trace.removeWeight(pi.clauses[c].weight);
						pi.removeClause(c);
					}
				}
				else {
					if (pi.clauses[c].isHard()) {
						uint64_t h = 0;
						for (int l : pi.clauses[c].lit) {
							h *= polyHashMul;
							h += (uint64_t)(l + 1);
						}
						has.push_back({h, c});
					}
				}
			}
		}
		sort(has.begin(), has.end());
		for (unsigned i = 1; i < has.size(); i++) {
			if (has[i].F == has[i - 1].F) {
				if (pi.clauses[has[i].S].lit == pi.clauses[has[i - 1].S].lit) {
					pi.removeClause(has[i].S);
					removed++;
				}
			}
		}
	}
	else {
		for (int lit : checkLit) {
			has.clear();
			for (int c : pi.litClauses[lit]) {
				if (pi.clauses[c].isHard()) {
					uint64_t h = 0;
					for (int l : pi.clauses[c].lit) {
						h *= polyHashMul;
						h += (uint64_t)(l + 1);
					}
					has.push_back({h, c});
				}
			}
			sort(has.begin(), has.end());
			for (unsigned i = 1; i < has.size(); i++) {
				if (has[i].F == has[i - 1].F) {
					if (pi.clauses[has[i].S].lit == pi.clauses[has[i - 1].S].lit) {
						pi.removeClause(has[i].S);
						removed++;
					}
				}
			}
		}
	}
	return removed;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
leaq 0x68(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x2d0f0(%rip), %rsi     # 0x384ef
leaq 0x2d0ef(%rip), %rdx     # 0x384f5
leaq 0x58(%rsp), %r14
movq %r14, %rdi
callq 0x9466
leaq 0x68(%rbx), %rsi
leaq 0x38(%rsp), %rdi
movq %r14, %rdx
callq 0x2f5c4
movq 0x58(%rsp), %rdi
cmpq %r15, %rdi
je 0xb43b
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x32b0
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x38(%rsp), %r12
movq 0x40(%rsp), %rsi
movq %rsi, %rax
subq %r12, %rax
shrq $0x2, %rax
movl 0x60(%rbx), %ecx
movl %ecx, %edx
shrl $0x1f, %edx
addl %ecx, %edx
sarl %edx
cmpl %eax, %edx
jge 0xb5ce
movq 0x8(%rbx), %rax
subq (%rbx), %rax
shrq $0x3, %rax
imull $0xcccccccd, %eax, %eax # imm = 0xCCCCCCCD
testl %eax, %eax
jle 0xb7ac
leaq 0x2f0(%rbx), %r14
xorl %r15d, %r15d
leaq 0x10(%rsp), %r12
leaq 0x28(%rsp), %r13
movq %rbx, %rdi
movl %r15d, %esi
callq 0x27804
testb %al, %al
jne 0xb560
movq (%rbx), %rax
leaq (%r15,%r15,4), %rbp
leaq (%rax,%rbp,8), %rdi
movq 0x8(%rdi), %rax
cmpq (%rdi), %rax
je 0xb507
callq 0x2883e
testb %al, %al
je 0xb560
movq (%rbx), %rcx
movq (%rcx,%rbp,8), %rax
movq 0x8(%rcx,%rbp,8), %rcx
cmpq %rcx, %rax
je 0xb52d
movq 0x328(%rbx), %rsi
xorl %edx, %edx
movslq (%rax), %rdi
imulq %rsi, %rdx
addq %rdi, %rdx
incq %rdx
addq $0x4, %rax
cmpq %rcx, %rax
jne 0xb4ef
jmp 0xb52f
callq 0x2883e
testb %al, %al
jne 0xb560
movq (%rbx), %rax
movq 0x18(%rax,%rbp,8), %rsi
movq %r14, %rdi
callq 0x27030
movq %rbx, %rdi
movl %r15d, %esi
callq 0x27f28
jmp 0xb560
xorl %edx, %edx
movq %rdx, 0x28(%rsp)
movl %r15d, 0x30(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0xb555
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x18(%rsp)
jmp 0xb560
movq %r12, %rdi
movq %r13, %rdx
callq 0x201be
incq %r15
movq 0x8(%rbx), %rax
subq (%rbx), %rax
shrq $0x3, %rax
imull $0xcccccccd, %eax, %eax # imm = 0xCCCCCCCD
cltq
cmpq %rax, %r15
jl 0xb4a1
movq 0x10(%rsp), %r14
movq 0x18(%rsp), %r15
cmpq %r15, %r14
je 0xb7b2
movq %r15, %rax
subq %r14, %rax
sarq $0x4, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x202fd
movq %r14, %rdi
movq %r15, %rsi
callq 0x203b0
movq 0x10(%rsp), %r14
movq 0x18(%rsp), %r15
jmp 0xb7b2
cmpq %rsi, %r12
je 0xb8af
xorl %r14d, %r14d
xorl %r13d, %r13d
movl $0x0, 0xc(%rsp)
movq %rsi, 0x50(%rsp)
movslq (%r12), %rax
cmpq %r14, %r13
je 0xb5fb
movq %r14, 0x18(%rsp)
movq %r14, %r13
movq 0x18(%rbx), %rcx
leaq (%rax,%rax,2), %rax
movq (%rcx,%rax,8), %r15
movq 0x8(%rcx,%rax,8), %rbp
cmpq %rbp, %r15
je 0xb6b3
movl (%r15), %r14d
movslq %r14d, %rax
leaq (%rax,%rax,4), %r13
leaq (,%r13,8), %rdi
addq (%rbx), %rdi
callq 0x2883e
testb %al, %al
je 0xb69c
movq (%rbx), %rcx
movq (%rcx,%r13,8), %rax
movq 0x8(%rcx,%r13,8), %rcx
cmpq %rcx, %rax
je 0xb665
movq 0x328(%rbx), %rsi
xorl %edx, %edx
movslq (%rax), %rdi
imulq %rsi, %rdx
addq %rdi, %rdx
incq %rdx
addq $0x4, %rax
cmpq %rcx, %rax
jne 0xb64d
jmp 0xb667
xorl %edx, %edx
movq %rdx, 0x28(%rsp)
movl %r14d, 0x30(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0xb68d
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x18(%rsp)
jmp 0xb69c
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x201be
addq $0x4, %r15
cmpq %rbp, %r15
jne 0xb615
movq 0x10(%rsp), %r14
movq 0x18(%rsp), %r13
cmpq %r13, %r14
je 0xb6ef
movq %r13, %rax
subq %r14, %rax
sarq $0x4, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r14, %rdi
movq %r13, %rsi
callq 0x202fd
movq %r14, %rdi
movq %r13, %rsi
callq 0x203b0
movq 0x10(%rsp), %r14
movq 0x18(%rsp), %r13
movq %r13, %rax
subq %r14, %rax
cmpq $0x11, %rax
jb 0xb795
movl $0x1, %eax
movl $0x2, %ebp
shlq $0x4, %rax
movq (%r14,%rax), %rdx
leal -0x2(%rbp), %ecx
shlq $0x4, %rcx
cmpq (%r14,%rcx), %rdx
jne 0xb77e
addq %r14, %rax
addq %r14, %rcx
movslq 0x8(%rax), %r15
movq (%rbx), %r8
leaq (%r15,%r15,4), %rax
movslq 0x8(%rcx), %rcx
leaq (%rcx,%rcx,4), %rcx
movq (%r8,%rax,8), %rdi
movq 0x8(%r8,%rax,8), %rax
movq %rax, %rdx
subq %rdi, %rdx
movq (%r8,%rcx,8), %rsi
movq 0x8(%r8,%rcx,8), %rcx
subq %rsi, %rcx
cmpq %rcx, %rdx
jne 0xb77e
cmpq %rdi, %rax
je 0xb765
callq 0x32c0
testl %eax, %eax
jne 0xb77e
movq %rbx, %rdi
movl %r15d, %esi
callq 0x27f28
incl 0xc(%rsp)
movq 0x10(%rsp), %r14
movq 0x18(%rsp), %r13
movl %ebp, %eax
movq %r13, %rcx
subq %r14, %rcx
sarq $0x4, %rcx
incl %ebp
cmpq %rax, %rcx
ja 0xb709
addq $0x4, %r12
movq 0x50(%rsp), %rsi
cmpq %rsi, %r12
jne 0xb5ea
jmp 0xb86e
xorl %r14d, %r14d
xorl %r15d, %r15d
movq %r15, %rax
subq %r14, %rax
cmpq $0x11, %rax
jb 0xb866
movl $0x0, 0xc(%rsp)
movl $0x1, %eax
movl $0x2, %r13d
shlq $0x4, %rax
movq (%r14,%rax), %rdx
leal -0x2(%r13), %ecx
shlq $0x4, %rcx
cmpq (%r14,%rcx), %rdx
jne 0xb84b
addq %r14, %rax
addq %r14, %rcx
movslq 0x8(%rax), %r12
movq (%rbx), %r8
leaq (%r12,%r12,4), %rax
movslq 0x8(%rcx), %rcx
leaq (%rcx,%rcx,4), %rcx
movq (%r8,%rax,8), %rdi
movq 0x8(%r8,%rax,8), %rax
movq %rax, %rdx
subq %rdi, %rdx
movq (%r8,%rcx,8), %rsi
movq 0x8(%r8,%rcx,8), %rcx
subq %rsi, %rcx
cmpq %rcx, %rdx
jne 0xb84b
cmpq %rdi, %rax
je 0xb832
callq 0x32c0
testl %eax, %eax
jne 0xb84b
movq %rbx, %rdi
movl %r12d, %esi
callq 0x27f28
incl 0xc(%rsp)
movq 0x10(%rsp), %r14
movq 0x18(%rsp), %r15
movl %r13d, %eax
movq %r15, %rcx
subq %r14, %rcx
sarq $0x4, %rcx
incl %r13d
cmpq %rax, %rcx
ja 0xb7d5
jmp 0xb86e
movl $0x0, 0xc(%rsp)
testq %r14, %r14
je 0xb883
movq 0x20(%rsp), %rsi
subq %r14, %rsi
movq %r14, %rdi
callq 0x32b0
movl 0xc(%rsp), %ebx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0xb89e
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebx, %ebx
jmp 0xb887
jmp 0xb8d8
jmp 0xb8d8
movq %rax, %rbx
movq 0x58(%rsp), %rdi
cmpq %r15, %rdi
je 0xb909
movq 0x68(%rsp), %rsi
incq %rsi
jmp 0xb904
jmp 0xb8d8
jmp 0xb8d8
jmp 0xb8d8
jmp 0xb8d8
jmp 0xb8d8
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xb8f2
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0xb909
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq %rbx, %rdi
callq 0x34a0
nop