// File: /workspace/github_cpp_makefile_star2_O2/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 0x26761(%rip), %rsi     # 0x2f46f
leaq 0x58(%rsp), %rdi
movq %rsp, %rdx
callq 0x6788
leaq 0x68(%rbx), %rsi
leaq 0x40(%rsp), %rdi
leaq 0x58(%rsp), %rdx
callq 0x274f2
leaq 0x58(%rsp), %rdi
callq 0x3130
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
andq $0x0, 0x10(%rsp)
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %rcx
movq %rcx, 0x30(%rsp)
subq %rdi, %rcx
shrq $0x2, %rcx
movl 0x60(%rbx), %eax
pushq $0x2
popq %rsi
cltd
idivl %esi
cmpl %ecx, %eax
jge 0x8e37
leaq 0x2f0(%rbx), %r14
xorl %r15d, %r15d
pushq $0x28
popq %rbp
leaq 0x20(%rsp), %r13
movq 0x8(%rbx), %rax
subq (%rbx), %rax
cqto
idivq %rbp
cltq
cmpq %rax, %r15
jge 0x8f66
movq %rbx, %rdi
movl %r15d, %esi
callq 0x20f14
testb %al, %al
jne 0x8e2f
movq (%rbx), %rax
imulq $0x28, %r15, %r12
leaq (%rax,%r12), %rdi
movq 0x8(%rax,%r12), %rcx
cmpq (%rax,%r12), %rcx
je 0x8df4
callq 0x21bac
testb %al, %al
je 0x8e2f
movq (%rbx), %rcx
movq (%rcx,%r12), %rax
movq 0x8(%rcx,%r12), %rcx
movq 0x328(%rbx), %rdx
xorl %esi, %esi
cmpq %rcx, %rax
je 0x8e1a
movslq (%rax), %rdi
imulq %rdx, %rsi
addq %rdi, %rsi
incq %rsi
addq $0x4, %rax
jmp 0x8ddc
callq 0x21bac
testb %al, %al
jne 0x8e2f
movq (%rbx), %rax
movq 0x18(%rax,%r12), %rsi
movq %r14, %rdi
callq 0x207e0
movq %rbx, %rdi
movl %r15d, %esi
callq 0x21490
jmp 0x8e2f
movq %rsi, 0x20(%rsp)
movl %r15d, 0x28(%rsp)
movq %rsp, %rdi
movq %r13, %rsi
callq 0x1a104
incq %r15
jmp 0x8d7e
xorl %ecx, %ecx
xorl %eax, %eax
xorl %ebp, %ebp
cmpq 0x30(%rsp), %rdi
je 0x8fe9
movq %rdi, 0x38(%rsp)
movslq (%rdi), %rdx
cmpq %rax, %rcx
je 0x8e5a
movq %rax, 0x8(%rsp)
movq 0x18(%rbx), %rax
imulq $0x18, %rdx, %rcx
movq (%rax,%rcx), %r13
movq 0x8(%rax,%rcx), %r12
cmpq %r12, %r13
je 0x8ed4
movl (%r13), %r14d
movslq %r14d, %rax
imulq $0x28, %rax, %r15
movq (%rbx), %rdi
addq %r15, %rdi
callq 0x21bac
testb %al, %al
je 0x8ece
movq (%rbx), %rcx
movq (%rcx,%r15), %rax
movq 0x8(%rcx,%r15), %rcx
movq 0x328(%rbx), %rdx
xorl %esi, %esi
cmpq %rcx, %rax
je 0x8eb7
movslq (%rax), %rdi
imulq %rdx, %rsi
addq %rdi, %rsi
incq %rsi
addq $0x4, %rax
jmp 0x8e9f
movq %rsi, 0x20(%rsp)
movl %r14d, 0x28(%rsp)
movq %rsp, %rdi
leaq 0x20(%rsp), %rsi
callq 0x1a104
addq $0x4, %r13
jmp 0x8e6b
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x1a283
xorl %edx, %edx
leal 0x1(%rdx), %r13d
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movq %rcx, %rsi
subq %rax, %rsi
sarq $0x4, %rsi
cmpq %r13, %rsi
jbe 0x8f58
movq %r13, %r14
shlq $0x4, %r14
movq (%rax,%r14), %rsi
movl %edx, %ecx
shlq $0x4, %rcx
cmpq (%rax,%rcx), %rsi
jne 0x8f53
leaq (%rax,%r14), %rdx
addq %rax, %rcx
movslq 0x8(%rdx), %rax
movq (%rbx), %rdx
imulq $0x28, %rax, %rdi
addq %rdx, %rdi
movslq 0x8(%rcx), %rax
imulq $0x28, %rax, %rsi
addq %rdx, %rsi
callq 0x18b2c
testb %al, %al
je 0x8f53
movq (%rsp), %rax
movl 0x8(%rax,%r14), %esi
movq %rbx, %rdi
callq 0x21490
incl %ebp
movl %r13d, %edx
jmp 0x8ee4
movq 0x38(%rsp), %rdi
addq $0x4, %rdi
jmp 0x8e3d
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x1a283
xorl %eax, %eax
xorl %ebp, %ebp
leal 0x1(%rax), %r14d
movq (%rsp), %rcx
movq 0x8(%rsp), %rdx
subq %rcx, %rdx
sarq $0x4, %rdx
cmpq %r14, %rdx
jbe 0x8fe9
movq %r14, %r15
shlq $0x4, %r15
movq (%rcx,%r15), %rdx
movl %eax, %eax
shlq $0x4, %rax
cmpq (%rcx,%rax), %rdx
jne 0x8fe4
leaq (%rcx,%r15), %rdx
addq %rcx, %rax
movslq 0x8(%rdx), %rcx
movq (%rbx), %rdx
imulq $0x28, %rcx, %rdi
addq %rdx, %rdi
movslq 0x8(%rax), %rax
imulq $0x28, %rax, %rsi
addq %rdx, %rsi
callq 0x18b2c
testb %al, %al
je 0x8fe4
movq (%rsp), %rax
movl 0x8(%rax,%r15), %esi
movq %rbx, %rdi
callq 0x21490
incl %ebp
movl %r14d, %eax
jmp 0x8f78
movq %rsp, %rdi
callq 0x1a0d0
leaq 0x40(%rsp), %rdi
callq 0x7512
movl %ebp, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x902e
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x3130
jmp 0x9043
movq %rax, %rbx
jmp 0x9043
jmp 0x902e
jmp 0x902e
jmp 0x902e
jmp 0x902e
jmp 0x902e
jmp 0x902e
movq %rax, %rbx
movq %rsp, %rdi
callq 0x1a0d0
leaq 0x40(%rsp), %rdi
callq 0x7512
movq %rbx, %rdi
callq 0x3490
nop