// File: /workspace/github_cpp_makefile_star2_O2/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, 0x48(%rsp)
movl %edx, %r13d
movq %rsi, %r15
movq 0x8(%rsi), %rax
subq (%rsi), %rax
movq %rdi, %r14
shrq $0x2, %rax
xorl %ecx, %ecx
pushq $0x1
popq %rdx
incl %ecx
movl %edx, %esi
shll %cl, %esi
cmpl %eax, %esi
jl 0x92ba
movl %ecx, 0x2c(%rsp)
movslq %esi, %rsi
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x18b56
movq (%r15), %rbx
movq %r15, 0x30(%rsp)
movq 0x8(%r15), %r15
cmpq %r15, %rbx
je 0x9380
movslq (%rbx), %rsi
imulq $0x28, %rsi, %rax
movq (%r14), %rcx
movq 0x18(%r14), %r10
leaq (%rcx,%rax), %r8
movq (%rcx,%rax), %r11
movq 0x8(%rcx,%rax), %rbp
movl (%r11), %edi
xorl %r9d, %r9d
cmpq %rbp, %r11
je 0x934c
movslq (%r11), %rcx
movl %ecx, %eax
cltd
idivl 0x2c(%rsp)
btsq %rdx, %r9
imulq $0x18, %rcx, %rax
movq 0x8(%r10,%rax), %rdx
subq (%r10,%rax), %rdx
movslq %edi, %rax
imulq $0x18, %rax, %rax
movq 0x8(%r10,%rax), %r12
subq (%r10,%rax), %r12
cmpq %r12, %rdx
cmovbl %ecx, %edi
addq $0x4, %r11
jmp 0x9310
cmpl $-0x1, %r13d
je 0x9357
cmpl %r13d, %edi
jne 0x9377
imulq $0x18, %r9, %rdi
addq 0x50(%rsp), %rdi
movl %esi, 0x10(%rsp)
movq 0x20(%r8), %rax
movq %rax, 0x18(%rsp)
leaq 0x10(%rsp), %rsi
callq 0x1aa0a
addq $0x4, %rbx
jmp 0x92e6
movq 0x30(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
movq %rcx, 0x38(%rsp)
cmpq 0x38(%rsp), %rax
movl 0x2c(%rsp), %edi
je 0x967b
movq %rax, 0x40(%rsp)
movslq (%rax), %rax
movl %eax, 0xc(%rsp)
movq (%r14), %rdx
imulq $0x28, %rax, %rax
movq 0x20(%rdx,%rax), %r12
movq (%rdx,%rax), %rcx
movq 0x8(%rdx,%rax), %rsi
xorl %r8d, %r8d
cmpq %rsi, %rcx
je 0x93d8
movl (%rcx), %eax
cltd
idivl %edi
btsq %rdx, %r8
addq $0x4, %rcx
jmp 0x93c4
xorl %ebx, %ebx
movq %r8, 0x30(%rsp)
subq %r8, %rbx
andq %r8, %rbx
je 0x966d
movq 0x50(%rsp), %rax
imulq $0x18, %rbx, %rcx
movq (%rax,%rcx), %rbp
movq 0x8(%rax,%rcx), %r15
cmpq %r15, %rbp
je 0x9663
movups (%rbp), %xmm0
movaps %xmm0, 0x10(%rsp)
movq 0x18(%rsp), %rdx
movq %r14, %rdi
movq %r12, %rsi
callq 0x21722
testb %al, %al
je 0x965a
movl 0xc(%rsp), %ecx
movl 0x10(%rsp), %edx
cmpl %edx, %ecx
je 0x965a
movslq %ecx, %rax
movslq %edx, %rsi
movq (%r14), %rdi
imulq $0x28, %rax, %rax
movq 0x8(%rdi,%rax), %r8
subq (%rdi,%rax), %r8
imulq $0x28, %rsi, %rax
movq 0x8(%rdi,%rax), %rsi
subq (%rdi,%rax), %rsi
cmpq %rsi, %r8
jne 0x955e
movq %r14, %rdi
movl %ecx, %esi
callq 0x2176a
movl 0xc(%rsp), %ecx
movl 0x10(%rsp), %edx
testb %al, %al
je 0x955e
movq %r14, %rdi
movl %edx, %esi
movl %ecx, %edx
callq 0x2176a
movl 0xc(%rsp), %ecx
movl 0x10(%rsp), %edx
cmpl %edx, %ecx
setg %sil
andb %sil, %al
cmpb $0x1, %al
jne 0x955e
movslq %ecx, %rax
movslq %edx, %rcx
movq (%r14), %rsi
imulq $0x28, %rax, %r13
addq %rsi, %r13
imulq $0x28, %rcx, %rdx
addq %rsi, %rdx
movq %r13, %rsi
callq 0x904c
testb %al, %al
je 0x965a
movq %r13, %rdi
callq 0x21bac
testb %al, %al
je 0x94f3
movslq 0x10(%rsp), %rax
imulq $0x28, %rax, %rdi
addq (%r14), %rdi
callq 0x21bac
leaq 0x10(%rsp), %rsi
testb %al, %al
jne 0x9650
movslq 0xc(%rsp), %rax
imulq $0x28, %rax, %rdi
addq (%r14), %rdi
callq 0x21bac
leaq 0x10(%rsp), %rsi
testb %al, %al
jne 0x9650
movslq 0x10(%rsp), %rax
imulq $0x28, %rax, %rdi
addq (%r14), %rdi
callq 0x21bac
leaq 0xc(%rsp), %rsi
testb %al, %al
jne 0x9650
movslq 0x10(%rsp), %rax
movq (%r14), %rcx
imulq $0x28, %rax, %rax
movq 0x18(%rcx,%rax), %rdx
movslq 0xc(%rsp), %rsi
imulq $0x28, %rsi, %rsi
addq %rdx, 0x18(%rcx,%rsi)
andq $0x0, 0x18(%rcx,%rax)
leaq 0x10(%rsp), %rsi
jmp 0x9650
movslq %ecx, %rax
movq (%r14), %rdi
imulq $0x28, %rax, %rax
movq 0x8(%rdi,%rax), %rsi
subq (%rdi,%rax), %rsi
movslq %edx, %rax
imulq $0x28, %rax, %rax
movq 0x8(%rdi,%rax), %r8
subq (%rdi,%rax), %r8
cmpq %r8, %rsi
jbe 0x95df
movq %r14, %rdi
movl %edx, %esi
movl %ecx, %edx
callq 0x2176a
movl 0x10(%rsp), %edx
movq (%r14), %rdi
testb %al, %al
je 0x95db
movslq %edx, %rax
imulq $0x28, %rax, %rax
addq %rax, %rdi
callq 0x21bac
movl 0x10(%rsp), %edx
movq (%r14), %rdi
movl 0xc(%rsp), %ecx
testb %al, %al
je 0x95df
movslq %edx, %rax
movslq %ecx, %rcx
imulq $0x28, %rcx, %rsi
addq %rdi, %rsi
imulq $0x28, %rax, %rdx
addq %rdi, %rdx
callq 0x904c
leaq 0xc(%rsp), %rsi
jmp 0x964c
movl 0xc(%rsp), %ecx
movslq %edx, %rax
imulq $0x28, %rax, %rax
movq 0x8(%rdi,%rax), %rsi
subq (%rdi,%rax), %rsi
movslq %ecx, %rax
imulq $0x28, %rax, %rax
movq 0x8(%rdi,%rax), %r8
subq (%rdi,%rax), %r8
cmpq %r8, %rsi
jbe 0x965a
movq %r14, %rdi
movl %ecx, %esi
callq 0x2176a
testb %al, %al
je 0x965a
movslq 0xc(%rsp), %rax
imulq $0x28, %rax, %rdi
addq (%r14), %rdi
callq 0x21bac
testb %al, %al
je 0x965a
movslq 0x10(%rsp), %rax
movq (%r14), %rcx
imulq $0x28, %rax, %rsi
addq %rcx, %rsi
movslq 0xc(%rsp), %rax
imulq $0x28, %rax, %rdx
addq %rcx, %rdx
callq 0x904c
leaq 0x10(%rsp), %rsi
testb %al, %al
je 0x965a
movq 0x48(%rsp), %rdi
callq 0x68a4
addq $0x10, %rbp
jmp 0x93fd
movq 0x30(%rsp), %r8
jmp 0x93df
movq 0x40(%rsp), %rax
addq $0x4, %rax
jmp 0x9391
leaq 0x50(%rsp), %rdi
callq 0x18ba8
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x9696
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x18ba8
movq %rbx, %rdi
callq 0x3490
nop