// File: /workspace/github_cpp_makefile_star2_O1/Laakeri[P]maxpre/src/./SE.cpp
// Function: maxPreprocessor::Preprocessor::trySEHash(std::vector<int, std::allocator<int>>&, int, std::vector<int, std::allocator<int>>&)
void Preprocessor::trySEHash(vector<int>& clauses, int tLit, vector<int>& toRemove) {
	int k = 1;
	int n = clauses.size();
	while ((1<<k) < n) k++;
	vector<vector<pair<int, uint64_t> > > has(1 << k);
	for (int c : clauses) {
		uint64_t h = 0;
		int ml = pi.clauses[c].lit[0];
		for (int l : pi.clauses[c].lit) {
			h |= ((uint64_t)1 << (uint64_t)(l%k));
			if (pi.litClauses[l].size() < pi.litClauses[ml].size()) ml = l;
		}
		if (tLit == -1 || ml == tLit) {
			has[h].push_back({c, pi.clauses[c].hash});
		}
	}
	
	for (int c1 : clauses) {
		int64_t h = 0;
		uint64_t h64 = pi.clauses[c1].hash;
		for (int l : pi.clauses[c1].lit) {
			h |= ((int64_t)1 << (int64_t)(l%k));
		}
		for (int64_t sub = 0; (sub = (sub - h) & h);) {
			for (auto c2 : has[sub]) {
				if (!pi.canSubsume2(h64, c2.S)) continue;
				if (c1 == c2.F) continue;
				if (pi.clauses[c1].lit.size() == pi.clauses[c2.F].lit.size() && pi.canSubsume(c1, c2.F) && pi.canSubsume(c2.F, c1) && c1 > c2.F) {
					if (isSubsumed(pi.clauses[c1].lit, pi.clauses[c2.F].lit)) {
						if (pi.clauses[c1].isHard() && pi.clauses[c2.F].isHard()) {
							toRemove.push_back(c2.F);
						}
						else if(pi.clauses[c1].isHard()) {
							toRemove.push_back(c2.F);
						}
						else if(pi.clauses[c2.F].isHard()) {
							toRemove.push_back(c1);
						}
						else {
							pi.clauses[c1].weight += pi.clauses[c2.F].weight;
							pi.clauses[c2.F].weight = 0;
							toRemove.push_back(c2.F);
						}
					}
				}
				else if (pi.clauses[c1].lit.size() > pi.clauses[c2.F].lit.size() && pi.canSubsume(c2.F, c1) && pi.clauses[c2.F].isHard()) {
					if (isSubsumed(pi.clauses[c1].lit, pi.clauses[c2.F].lit)) {
						toRemove.push_back(c1);
					}
				}
				else if (pi.clauses[c2.F].lit.size() > pi.clauses[c1].lit.size() && pi.canSubsume(c1, c2.F) && pi.clauses[c1].isHard()) {
					if (isSubsumed(pi.clauses[c2.F].lit, pi.clauses[c1].lit)) {
						toRemove.push_back(c2.F);
					}
				}
			}
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rcx, 0x28(%rsp)
movl %edx, %r13d
movq %rdi, %r14
movq 0x8(%rsi), %rax
movq %rsi, 0x38(%rsp)
subq (%rsi), %rax
shrq $0x2, %rax
xorl %r15d, %r15d
incl %r15d
movl $0x1, %edx
movl %r15d, %ecx
shll %cl, %edx
cmpl %eax, %edx
jl 0xbce0
movslq %edx, %rsi
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x1f5cc
movq 0x38(%rsp), %rax
movq (%rax), %rbx
movq 0x8(%rax), %rax
movq %rax, 0x40(%rsp)
cmpq %rax, %rbx
movl %r15d, 0x34(%rsp)
je 0xbde3
movslq (%rbx), %rsi
movq (%r14), %rdi
leaq (%rsi,%rsi,4), %r8
movq (%rdi,%r8,8), %r11
movq 0x8(%rdi,%r8,8), %rbp
movl (%r11), %r9d
cmpq %rbp, %r11
je 0xbd85
movq 0x18(%r14), %r12
xorl %r10d, %r10d
movslq (%r11), %rcx
movl %ecx, %eax
cltd
idivl %r15d
btsq %rdx, %r10
leaq (%rcx,%rcx,2), %rax
movq 0x8(%r12,%rax,8), %rdx
subq (%r12,%rax,8), %rdx
movslq %r9d, %r9
leaq (%r9,%r9,2), %rax
movq 0x8(%r12,%rax,8), %r15
subq (%r12,%rax,8), %r15
cmpq %r15, %rdx
movl 0x34(%rsp), %r15d
cmovbl %ecx, %r9d
addq $0x4, %r11
cmpq %rbp, %r11
jne 0xbd44
jmp 0xbd88
xorl %r10d, %r10d
cmpl $-0x1, %r13d
je 0xbd93
cmpl %r13d, %r9d
jne 0xbdd4
leaq (%rdi,%r8,8), %rax
movq 0x50(%rsp), %rcx
leaq (%r10,%r10,2), %rdx
leaq (%rcx,%rdx,8), %rdi
movl %esi, 0x10(%rsp)
movq 0x20(%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0xbdca
movups 0x10(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x8(%rdi)
jmp 0xbdd4
leaq 0x10(%rsp), %rdx
callq 0x213ee
addq $0x4, %rbx
cmpq 0x40(%rsp), %rbx
jne 0xbd22
movq 0x38(%rsp), %rax
movq (%rax), %rdi
movq 0x8(%rax), %rax
movq %rax, 0x48(%rsp)
cmpq %rax, %rdi
je 0xc182
movslq (%rdi), %rax
movl %eax, 0xc(%rsp)
movq (%r14), %rdx
leaq (%rax,%rax,4), %rax
movq 0x20(%rdx,%rax,8), %r12
movq (%rdx,%rax,8), %rcx
movq 0x8(%rdx,%rax,8), %rsi
cmpq %rsi, %rcx
movq %rdi, 0x38(%rsp)
je 0xbe3a
xorl %edi, %edi
movl (%rcx), %eax
cltd
idivl %r15d
btsq %rdx, %rdi
addq $0x4, %rcx
cmpq %rsi, %rcx
jne 0xbe25
jmp 0xbe3c
xorl %edi, %edi
movq %rdi, %r15
negq %r15
andq %rdi, %r15
movq %rdi, 0x40(%rsp)
je 0xc169
movq 0x50(%rsp), %rax
leaq (%r15,%r15,2), %rcx
movq (%rax,%rcx,8), %rbp
movq 0x8(%rax,%rcx,8), %rbx
cmpq %rbx, %rbp
je 0xc158
movups (%rbp), %xmm0
movaps %xmm0, 0x10(%rsp)
movq 0x18(%rsp), %rdx
movq %r14, %rdi
movq %r12, %rsi
callq 0x28fe0
testb %al, %al
je 0xc14f
movslq 0xc(%rsp), %rsi
movslq 0x10(%rsp), %rdx
cmpl %edx, %esi
je 0xc14f
movq (%r14), %rax
leaq (%rsi,%rsi,4), %rcx
movq 0x8(%rax,%rcx,8), %rdi
subq (%rax,%rcx,8), %rdi
leaq (%rdx,%rdx,4), %rcx
movq 0x8(%rax,%rcx,8), %r8
subq (%rax,%rcx,8), %r8
cmpq %r8, %rdi
jne 0xbf7f
movq %r14, %rdi
callq 0x29028
testb %al, %al
je 0xbf7f
movl 0x10(%rsp), %esi
movl 0xc(%rsp), %edx
movq %r14, %rdi
callq 0x29028
testb %al, %al
je 0xbf7f
movslq 0xc(%rsp), %rax
movslq 0x10(%rsp), %rcx
cmpl %ecx, %eax
jle 0xbf7f
movq (%r14), %rdx
leaq (%rax,%rax,4), %rax
leaq (%rdx,%rax,8), %r13
leaq (%rcx,%rcx,4), %rax
leaq (%rdx,%rax,8), %rdx
movq %r13, %rsi
callq 0xba2c
testb %al, %al
je 0xc14f
movq %r13, %rdi
callq 0x29586
testb %al, %al
je 0xbf46
movslq 0x10(%rsp), %rax
leaq (%rax,%rax,4), %rdi
shlq $0x3, %rdi
addq (%r14), %rdi
callq 0x29586
testb %al, %al
jne 0xbf63
movslq 0xc(%rsp), %rax
leaq (%rax,%rax,4), %rdi
shlq $0x3, %rdi
addq (%r14), %rdi
callq 0x29586
testb %al, %al
je 0xc0d1
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0xc140
movl 0x10(%rsp), %eax
jmp 0xc101
movslq 0xc(%rsp), %rdx
movq (%r14), %rax
leaq (%rdx,%rdx,4), %rcx
movq 0x8(%rax,%rcx,8), %rdi
subq (%rax,%rcx,8), %rdi
movslq 0x10(%rsp), %rsi
leaq (%rsi,%rsi,4), %rcx
movq 0x8(%rax,%rcx,8), %r8
subq (%rax,%rcx,8), %r8
cmpq %r8, %rdi
jbe 0xc01e
movq %r14, %rdi
callq 0x29028
testb %al, %al
je 0xc01e
movslq 0x10(%rsp), %rax
leaq (%rax,%rax,4), %rdi
shlq $0x3, %rdi
addq (%r14), %rdi
callq 0x29586
testb %al, %al
je 0xc01e
movslq 0xc(%rsp), %r13
movq (%r14), %rax
leaq (,%r13,4), %rcx
addq %r13, %rcx
leaq (%rax,%rcx,8), %rsi
movslq 0x10(%rsp), %rcx
leaq (%rcx,%rcx,4), %rcx
leaq (%rax,%rcx,8), %rdx
callq 0xba2c
testb %al, %al
je 0xc14f
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
jne 0xc0bf
leaq 0xc(%rsp), %rdx
jmp 0xc145
movslq 0x10(%rsp), %rdx
movq (%r14), %rax
leaq (%rdx,%rdx,4), %rcx
movq 0x8(%rax,%rcx,8), %rdi
subq (%rax,%rcx,8), %rdi
movslq 0xc(%rsp), %rsi
leaq (%rsi,%rsi,4), %rcx
movq 0x8(%rax,%rcx,8), %r8
subq (%rax,%rcx,8), %r8
cmpq %r8, %rdi
jbe 0xc14f
movq %r14, %rdi
callq 0x29028
testb %al, %al
je 0xc14f
movslq 0xc(%rsp), %rax
leaq (%rax,%rax,4), %rdi
shlq $0x3, %rdi
addq (%r14), %rdi
callq 0x29586
testb %al, %al
je 0xc14f
movslq 0x10(%rsp), %r13
movq (%r14), %rax
leaq (,%r13,4), %rcx
addq %r13, %rcx
leaq (%rax,%rcx,8), %rsi
movslq 0xc(%rsp), %rcx
leaq (%rcx,%rcx,4), %rcx
leaq (%rax,%rcx,8), %rdx
callq 0xba2c
testb %al, %al
je 0xc14f
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0xc140
movl %r13d, (%rsi)
addq $0x4, %rsi
movq 0x28(%rsp), %rax
movq %rsi, 0x8(%rax)
jmp 0xc14f
movslq 0x10(%rsp), %rax
leaq (%rax,%rax,4), %rdi
shlq $0x3, %rdi
addq (%r14), %rdi
callq 0x29586
testb %al, %al
je 0xc105
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0xc014
movl 0xc(%rsp), %eax
movl %eax, (%rsi)
jmp 0xc0c2
movslq 0x10(%rsp), %rax
movq (%r14), %rcx
leaq (%rax,%rax,4), %rdx
movq 0x18(%rcx,%rdx,8), %rsi
movslq 0xc(%rsp), %rdi
leaq (%rdi,%rdi,4), %rdi
addq %rsi, 0x18(%rcx,%rdi,8)
movq $0x0, 0x18(%rcx,%rdx,8)
movq 0x28(%rsp), %rcx
movq 0x8(%rcx), %rsi
cmpq 0x10(%rcx), %rsi
je 0xc140
movl %eax, (%rsi)
jmp 0xc0c2
leaq 0x10(%rsp), %rdx
movq 0x28(%rsp), %rdi
callq 0x98e8
addq $0x10, %rbp
jmp 0xbe62
movq 0x40(%rsp), %rdi
subq %rdi, %r15
andq %rdi, %r15
jne 0xbe50
movq 0x38(%rsp), %rdi
addq $0x4, %rdi
cmpq 0x48(%rsp), %rdi
movl 0x34(%rsp), %r15d
jne 0xbdfd
leaq 0x50(%rsp), %rdi
callq 0x1f654
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xc19d
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x1f654
movq %rbx, %rdi
callq 0x34a0