// File: /workspace/github_cpp_makefile_star2_O3/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 0xbbc8
movslq %edx, %rsi
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x1e9ee
movq 0x38(%rsp), %rax
movq (%rax), %rbx
movq 0x8(%rax), %rax
movq %rax, 0x40(%rsp)
cmpq %rax, %rbx
je 0xc081
movl %r15d, 0x34(%rsp)
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 0xbc6d
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 0xbc2c
jmp 0xbc70
xorl %r10d, %r10d
cmpl $-0x1, %r13d
je 0xbc7b
cmpl %r13d, %r9d
jne 0xbcbc
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 0xbcb2
movups 0x10(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x8(%rdi)
jmp 0xbcbc
leaq 0x10(%rsp), %rdx
callq 0x2082e
addq $0x4, %rbx
cmpq 0x40(%rsp), %rbx
jne 0xbc0a
movq 0x38(%rsp), %rax
movq (%rax), %rdi
movq 0x8(%rax), %rax
movq %rax, 0x48(%rsp)
cmpq %rax, %rdi
je 0xc081
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 0xbd22
xorl %edi, %edi
movl (%rcx), %eax
cltd
idivl %r15d
btsq %rdx, %rdi
addq $0x4, %rcx
cmpq %rsi, %rcx
jne 0xbd0d
jmp 0xbd24
xorl %edi, %edi
movq %rdi, %r15
negq %r15
andq %rdi, %r15
movq %rdi, 0x40(%rsp)
je 0xc068
movq 0x50(%rsp), %rax
leaq (%r15,%r15,2), %rcx
movq (%rax,%rcx,8), %rbp
movq 0x8(%rax,%rcx,8), %rbx
cmpq %rbx, %rbp
je 0xc057
movups (%rbp), %xmm0
movaps %xmm0, 0x10(%rsp)
movq 0x18(%rsp), %rdx
movq %r14, %rdi
movq %r12, %rsi
callq 0x282b8
testb %al, %al
je 0xc04e
movl 0xc(%rsp), %r13d
movl 0x10(%rsp), %edx
cmpl %edx, %r13d
je 0xc04e
movslq %r13d, %rax
movslq %edx, %rcx
movq (%r14), %rsi
leaq (%rax,%rax,4), %rax
movq 0x8(%rsi,%rax,8), %rdi
subq (%rsi,%rax,8), %rdi
leaq (%rcx,%rcx,4), %rax
movq 0x8(%rsi,%rax,8), %rcx
subq (%rsi,%rax,8), %rcx
cmpq %rcx, %rdi
jne 0xbe7b
movq %r14, %rdi
movl %r13d, %esi
callq 0x28300
movl 0xc(%rsp), %r13d
movl 0x10(%rsp), %edx
testb %al, %al
je 0xbe7b
movq %r14, %rdi
movl %edx, %esi
movl %r13d, %edx
callq 0x28300
movl 0xc(%rsp), %r13d
movl 0x10(%rsp), %edx
cmpl %edx, %r13d
setg %cl
andb %cl, %al
cmpb $0x1, %al
jne 0xbe7b
movslq %r13d, %rax
movslq %edx, %rcx
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 0xb912
testb %al, %al
je 0xc04e
movq %r13, %rdi
callq 0x2883e
testb %al, %al
je 0xbe42
movslq 0x10(%rsp), %rax
leaq (%rax,%rax,4), %rdi
shlq $0x3, %rdi
addq (%r14), %rdi
callq 0x2883e
testb %al, %al
jne 0xbe5f
movslq 0xc(%rsp), %rax
leaq (%rax,%rax,4), %rdi
shlq $0x3, %rdi
addq (%r14), %rdi
callq 0x2883e
testb %al, %al
je 0xbfc0
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0xc03f
movl 0x10(%rsp), %eax
jmp 0xbfec
movslq %r13d, %rax
movq (%r14), %rcx
leaq (%rax,%rax,4), %rax
movq 0x8(%rcx,%rax,8), %rsi
subq (%rcx,%rax,8), %rsi
movslq %edx, %rax
leaq (%rax,%rax,4), %rax
movq 0x8(%rcx,%rax,8), %rdi
subq (%rcx,%rax,8), %rdi
cmpq %rdi, %rsi
jbe 0xbf1e
movq %r14, %rdi
movl %edx, %esi
movl %r13d, %edx
callq 0x28300
movl 0x10(%rsp), %edx
movq (%r14), %rcx
testb %al, %al
je 0xbf19
movslq %edx, %rax
leaq (%rax,%rax,4), %rax
leaq (%rcx,%rax,8), %rdi
callq 0x2883e
movl 0x10(%rsp), %edx
movq (%r14), %rcx
movl 0xc(%rsp), %r13d
testb %al, %al
je 0xbf1e
movslq %edx, %rax
movslq %r13d, %rdx
leaq (%rdx,%rdx,4), %rdx
leaq (%rcx,%rdx,8), %rsi
leaq (%rax,%rax,4), %rax
leaq (%rcx,%rax,8), %rdx
callq 0xb912
testb %al, %al
je 0xc04e
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0xbffd
movl %r13d, (%rsi)
jmp 0xbfee
movl 0xc(%rsp), %r13d
movslq %edx, %rax
leaq (%rax,%rax,4), %rax
movq 0x8(%rcx,%rax,8), %rsi
subq (%rcx,%rax,8), %rsi
movslq %r13d, %rax
leaq (%rax,%rax,4), %rax
movq 0x8(%rcx,%rax,8), %rdi
subq (%rcx,%rax,8), %rdi
cmpq %rdi, %rsi
jbe 0xc04e
movq %r14, %rdi
movl %r13d, %esi
callq 0x28300
testb %al, %al
je 0xc04e
movslq 0xc(%rsp), %rax
leaq (%rax,%rax,4), %rdi
shlq $0x3, %rdi
addq (%r14), %rdi
callq 0x2883e
testb %al, %al
je 0xc04e
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 0xb912
testb %al, %al
je 0xc04e
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0xc03f
movl %r13d, (%rsi)
jmp 0xbfee
movslq 0x10(%rsp), %rax
leaq (%rax,%rax,4), %rdi
shlq $0x3, %rdi
addq (%r14), %rdi
callq 0x2883e
testb %al, %al
je 0xc004
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0xbffd
movl 0xc(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq 0x28(%rsp), %rax
movq %rsi, 0x8(%rax)
jmp 0xc04e
leaq 0xc(%rsp), %rdx
jmp 0xc044
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 0xc03f
movl %eax, (%rsi)
jmp 0xbfee
leaq 0x10(%rsp), %rdx
movq 0x28(%rsp), %rdi
callq 0x98f8
addq $0x10, %rbp
jmp 0xbd4a
movq 0x40(%rsp), %rdi
subq %rdi, %r15
andq %rdi, %r15
jne 0xbd38
movq 0x38(%rsp), %rdi
addq $0x4, %rdi
cmpq 0x48(%rsp), %rdi
movl 0x34(%rsp), %r15d
jne 0xbce5
leaq 0x50(%rsp), %rdi
callq 0x1ea6c
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xc09c
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x1ea6c
movq %rbx, %rdi
callq 0x34a0
nop