// File: /workspace/github_cpp_makefile_star2_O1/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 0x2def2(%rip), %rsi     # 0x3943f
leaq 0x2def1(%rip), %rdx     # 0x39445
leaq 0x58(%rsp), %r14
movq %r14, %rdi
callq 0x945c
leaq 0x68(%rbx), %rsi
leaq 0x30(%rsp), %rdi
movq %r14, %rdx
callq 0x304cc
movq 0x58(%rsp), %rdi
cmpq %r15, %rdi
je 0xb589
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x32b0
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq 0x30(%rsp), %r15
movq 0x38(%rsp), %rsi
movq %rsi, %rax
subq %r15, %rax
shrq $0x2, %rax
movl 0x60(%rbx), %ecx
movl %ecx, %edx
shrl $0x1f, %edx
addl %ecx, %edx
sarl %edx
cmpl %eax, %edx
jge 0xb7b9
movq 0x8(%rbx), %rax
subq (%rbx), %rax
shrq $0x3, %rax
imull $0xcccccccd, %eax, %eax # imm = 0xCCCCCCCD
testl %eax, %eax
jle 0xb6ca
leaq 0x2f0(%rbx), %r14
xorl %r15d, %r15d
movq %rsp, %r12
leaq 0x20(%rsp), %r13
movq %rbx, %rdi
movl %r15d, %esi
callq 0x284dc
testb %al, %al
jne 0xb6ab
movq (%rbx), %rax
leaq (%r15,%r15,4), %rbp
leaq (%rax,%rbp,8), %rdi
movq 0x8(%rdi), %rax
cmpq (%rdi), %rax
je 0xb652
callq 0x29586
testb %al, %al
je 0xb6ab
movq (%rbx), %rcx
movq (%rcx,%rbp,8), %rax
movq 0x8(%rcx,%rbp,8), %rcx
cmpq %rcx, %rax
je 0xb678
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 0xb63a
jmp 0xb67a
callq 0x29586
testb %al, %al
jne 0xb6ab
movq (%rbx), %rax
movq 0x18(%rax,%rbp,8), %rsi
movq %r14, %rdi
callq 0x27d0c
movq %rbx, %rdi
movl %r15d, %esi
callq 0x28c34
jmp 0xb6ab
xorl %edx, %edx
movq %rdx, 0x20(%rsp)
movl %r15d, 0x28(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0xb6a0
movups 0x20(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x8(%rsp)
jmp 0xb6ab
movq %r12, %rdi
movq %r13, %rdx
callq 0x20d9c
incq %r15
movq 0x8(%rbx), %rax
subq (%rbx), %rax
shrq $0x3, %rax
imull $0xcccccccd, %eax, %eax # imm = 0xCCCCCCCD
cltq
cmpq %rax, %r15
jl 0xb5ec
movq (%rsp), %r14
movq 0x8(%rsp), %r15
cmpq %r15, %r14
je 0xb705
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 0x20edb
movq %r14, %rdi
movq %r15, %rsi
callq 0x20f8e
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
subq %rax, %rcx
cmpq $0x11, %rcx
jb 0xb98d
xorl %r14d, %r14d
movl $0x1, %ecx
movl $0x2, %r12d
shlq $0x4, %rcx
movq (%rax,%rcx), %rsi
leal -0x2(%r12), %edx
shlq $0x4, %rdx
cmpq (%rax,%rdx), %rsi
jne 0xb795
addq %rax, %rcx
addq %rax, %rdx
movslq 0x8(%rcx), %r15
movq (%rbx), %rcx
leaq (%r15,%r15,4), %rax
movslq 0x8(%rdx), %rdx
leaq (%rdx,%rdx,4), %r8
movq (%rcx,%rax,8), %rdi
movq 0x8(%rcx,%rax,8), %rax
movq %rax, %rdx
subq %rdi, %rdx
movq (%rcx,%r8,8), %rsi
movq 0x8(%rcx,%r8,8), %rcx
subq %rsi, %rcx
cmpq %rcx, %rdx
jne 0xb795
cmpq %rdi, %rax
je 0xb787
callq 0x32c0
testl %eax, %eax
jne 0xb795
movq %rbx, %rdi
movl %r15d, %esi
callq 0x28c34
incl %r14d
movl %r12d, %ecx
movq (%rsp), %rax
movq 0x8(%rsp), %rdx
subq %rax, %rdx
sarq $0x4, %rdx
incl %r12d
cmpq %rcx, %rdx
ja 0xb729
jmp 0xb990
cmpq %rsi, %r15
je 0xb98d
xorl %r14d, %r14d
movq %rsi, 0x48(%rsp)
movq %r14, 0x50(%rsp)
movslq (%r15), %rax
movq (%rsp), %rcx
cmpq %rcx, 0x8(%rsp)
je 0xb7e2
movq %rcx, 0x8(%rsp)
movq 0x18(%rbx), %rcx
leaq (%rax,%rax,2), %rax
movq (%rcx,%rax,8), %r13
movq 0x8(%rcx,%rax,8), %rbp
cmpq %rbp, %r13
je 0xb88b
movl (%r13), %r12d
movslq %r12d, %rax
leaq (%rax,%rax,4), %r14
leaq (,%r14,8), %rdi
addq (%rbx), %rdi
callq 0x29586
testb %al, %al
je 0xb882
movq (%rbx), %rcx
movq (%rcx,%r14,8), %rax
movq 0x8(%rcx,%r14,8), %rcx
cmpq %rcx, %rax
je 0xb84d
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 0xb835
jmp 0xb84f
xorl %edx, %edx
movq %rdx, 0x20(%rsp)
movl %r12d, 0x28(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0xb875
movups 0x20(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x8(%rsp)
jmp 0xb882
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
callq 0x20d9c
addq $0x4, %r13
jmp 0xb7f3
movq (%rsp), %r13
movq 0x8(%rsp), %rbp
cmpq %rbp, %r13
je 0xb8c6
movq %rbp, %rax
subq %r13, %rax
sarq $0x4, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r13, %rdi
movq %rbp, %rsi
callq 0x20edb
movq %r13, %rdi
movq %rbp, %rsi
callq 0x20f8e
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
subq %rax, %rcx
cmpq $0x11, %rcx
movq 0x50(%rsp), %r14
jb 0xb979
movl $0x1, %ecx
movl $0x2, %ebp
shlq $0x4, %rcx
movq (%rax,%rcx), %rsi
leal -0x2(%rbp), %edx
shlq $0x4, %rdx
cmpq (%rax,%rdx), %rsi
jne 0xb95c
addq %rax, %rcx
addq %rax, %rdx
movslq 0x8(%rcx), %r13
movq (%rbx), %rcx
leaq (,%r13,4), %rax
addq %r13, %rax
movslq 0x8(%rdx), %rdx
leaq (%rdx,%rdx,4), %r8
movq (%rcx,%rax,8), %rdi
movq 0x8(%rcx,%rax,8), %rax
movq %rax, %rdx
subq %rdi, %rdx
movq (%rcx,%r8,8), %rsi
movq 0x8(%rcx,%r8,8), %rcx
subq %rsi, %rcx
cmpq %rcx, %rdx
jne 0xb95c
cmpq %rdi, %rax
je 0xb94e
callq 0x32c0
testl %eax, %eax
jne 0xb95c
movq %rbx, %rdi
movl %r13d, %esi
callq 0x28c34
incl %r14d
movl %ebp, %ecx
movq (%rsp), %rax
movq 0x8(%rsp), %rdx
subq %rax, %rdx
sarq $0x4, %rdx
incl %ebp
cmpq %rcx, %rdx
ja 0xb8eb
addq $0x4, %r15
movq 0x48(%rsp), %rsi
cmpq %rsi, %r15
jne 0xb7ca
jmp 0xb990
xorl %r14d, %r14d
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xb9a6
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xb9bd
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movl %r14d, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb9f4
jmp 0xb9f4
movq %rax, %rbx
movq 0x58(%rsp), %rdi
cmpq %r15, %rdi
je 0xba24
movq 0x68(%rsp), %rsi
incq %rsi
jmp 0xba1f
jmp 0xb9f4
jmp 0xb9f4
jmp 0xb9f4
jmp 0xb9f4
jmp 0xb9f4
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xba0d
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xba24
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq %rbx, %rdi
callq 0x34a0