// File: /workspace/github_cpp_makefile_star2_O1/Laakeri[P]maxpre/src/./SSR.cpp
// Function: maxPreprocessor::Preprocessor::trySSRHash(int)
int Preprocessor::trySSRHash(int var) {
	uint64_t bmP = ((uint64_t)1 << (uint64_t)(posLit(var)&63));
	uint64_t bmN = ((uint64_t)1 << (uint64_t)(negLit(var)&63));
	
	vector<int>& pc = pi.litClauses[posLit(var)];
	vector<int>& nc = pi.litClauses[negLit(var)];
	uint64_t k = 1;
	while ((1<<k) < max((int)pc.size(), (int)nc.size())) k++;
	
	vector<vector<pair<int, uint64_t> > > hp(1<<k);
	vector<vector<pair<int, uint64_t> > > hn(1<<k);
	
	for (int c : pc) {
		// do UP to avoid special case
		if (pi.clauses[c].lit.size() == 1){
			return setVariable(var, true);
		}
		uint64_t h = 0;
		for (int l : pi.clauses[c].lit) {
			if (litVariable(l) != var) h |= ((uint64_t)1 << (uint64_t)(l%k));
		}
		hp[h].push_back({c, pi.clauses[c].hash});
	}
	
	for (int c : nc) {
		// do UP to avoid special case
		if (pi.clauses[c].lit.size() == 1){
			return setVariable(var, false);
		}
		uint64_t h = 0;
		for (int l : pi.clauses[c].lit) {
			if (litVariable(l) != var) h |= ((uint64_t)1 << (uint64_t)(l%k));
		}
		hn[h].push_back({c, pi.clauses[c].hash});
	}
	
	int removed = 0;
	bool f  = true;
	while (f) {
		f = false;
		for (int c1 : pi.litClauses[posLit(var)]) {
			int64_t h = 0;
			for (int l : pi.clauses[c1].lit) {
				if (litVariable(l) != var) h |= ((int64_t)1 << (int64_t)(l%k));
			}
			for (int64_t sub = 0; (sub = (sub - h) & h);) {
				for (auto c2 : hn[sub]) {
					if ((((pi.clauses[c1].hash ^ bmP) | c2.S) != c2.S) && (((c2.S ^ bmN) | pi.clauses[c1].hash) != pi.clauses[c1].hash)) continue;
					if ((c2.S & bmN) == 0) continue;
					if (pi.isClauseRemoved(c2.F)) continue;
					if (!binary_search(pi.clauses[c2.F].lit.begin(), pi.clauses[c2.F].lit.end(), negLit(var))) continue;
					if (SSRC(c1, c2.F, var)) {
						f = true;
						removed++;
						break;
					}
				}
				if (f) break;
			}
			if (f) break;
		}
	}
	f = true;
	while (f) {
		f = false;
		for (int c2 : pi.litClauses[negLit(var)]) {
			int64_t h = 0;
			for (int l : pi.clauses[c2].lit) {
				if (litVariable(l) != var) h |= ((int64_t)1 << (int64_t)(l%k));
			}
			for (int64_t sub = 0; (sub = (sub - h) & h);) {
				for (auto c1 : hp[sub]) {
					if ((((c1.S ^ bmP) | pi.clauses[c2].hash) != pi.clauses[c2].hash) && (((pi.clauses[c2].hash ^ bmN) | c1.S) != c1.S)) continue;
					if ((c1.S & bmP) == 0) continue;
					if (pi.isClauseRemoved(c1.F)) continue;
					if (!binary_search(pi.clauses[c1.F].lit.begin(), pi.clauses[c1.F].lit.end(), posLit(var))) continue;
					if (SSRC(c1.F, c2, var)) {
						f = true;
						removed++;
						break;
					}
				}
				if (f) break;
			}
			if (f) break;
		}
	}
	return removed;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdi, %r14
leal (%rsi,%rsi), %r15d
movl %r15d, %eax
andl $0x3e, %eax
movq %rsi, 0x18(%rsp)
leal 0x1(,%rsi,2), %edi
movl %edi, %edx
andl $0x3f, %edx
movslq %r15d, %rcx
movq 0x18(%r14), %rsi
leaq (%rcx,%rcx,2), %rcx
movq %rcx, 0x78(%rsp)
leaq (%rsi,%rcx,8), %rbx
movl %edi, 0x58(%rsp)
movslq %edi, %rcx
leaq (%rcx,%rcx,2), %rcx
movq %rcx, 0x70(%rsp)
leaq (%rsi,%rcx,8), %rdi
movq 0x8(%rbx), %rcx
subq (%rbx), %rcx
shrq $0x2, %rcx
movq 0x8(%rdi), %rsi
movq %rdi, 0x28(%rsp)
subq (%rdi), %rsi
shrq $0x2, %rsi
cmpl %esi, %ecx
cmovgl %ecx, %esi
xorl %ecx, %ecx
incq %rcx
movl $0x1, %edi
shll %cl, %edi
cmpl %esi, %edi
jl 0x10a3f
movq %rcx, 0x20(%rsp)
movl $0x1, %esi
movl $0x1, %r8d
movl %eax, %ecx
shlq %cl, %r8
movq %r8, 0x68(%rsp)
movl %edx, %ecx
shlq %cl, %rsi
movq %rsi, 0x60(%rsp)
movslq %edi, %rbp
leaq 0xa0(%rsp), %rdi
leaq 0x88(%rsp), %rdx
movq %rbp, %rsi
callq 0x1f5cc
leaq 0x88(%rsp), %rdi
leaq 0x30(%rsp), %rdx
movq %rbp, %rsi
callq 0x1f5cc
movq (%rbx), %r13
movq 0x8(%rbx), %rbp
cmpq %rbp, %r13
sete %r12b
je 0x10b76
movq %rax, 0x10(%rsp)
movslq (%r13), %rcx
movq (%r14), %rsi
leaq (%rcx,%rcx,4), %rdi
movq (%rsi,%rdi,8), %r8
movq 0x8(%rsi,%rdi,8), %r9
movq %r9, %rbx
subq %r8, %rbx
cmpq $0x4, %rbx
jne 0x10af3
movq %r14, %rdi
movq 0x18(%rsp), %rsi
movl $0x1, %edx
callq 0xa016
movq %rax, 0x10(%rsp)
jmp 0x10b5d
xorl %r10d, %r10d
cmpq %r9, %r8
je 0x10b19
movslq (%r8), %rax
movl %eax, %edx
sarl %edx
cmpl 0x18(%rsp), %edx
je 0x10b13
xorl %edx, %edx
divq 0x20(%rsp)
btsq %rdx, %r10
addq $0x4, %r8
jmp 0x10af6
leaq (%rsi,%rdi,8), %rax
movq 0xa0(%rsp), %rdx
leaq (%r10,%r10,2), %rsi
leaq (%rdx,%rsi,8), %rdi
movl %ecx, 0x30(%rsp)
movq 0x20(%rax), %rax
movq %rax, 0x38(%rsp)
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x10b53
movups 0x30(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x8(%rdi)
jmp 0x10b5d
leaq 0x30(%rsp), %rdx
callq 0x213ee
cmpq $0x4, %rbx
je 0x10b7b
addq $0x4, %r13
cmpq %rbp, %r13
sete %r12b
jne 0x10aba
jmp 0x10b7b
movq %rax, 0x10(%rsp)
testb $0x1, %r12b
je 0x1104c
movq 0x28(%rsp), %rax
movq (%rax), %r12
movq 0x8(%rax), %r13
cmpq %r13, %r12
sete %bl
je 0x10c4c
movslq (%r12), %rcx
movq (%r14), %rsi
leaq (%rcx,%rcx,4), %rdi
movq (%rsi,%rdi,8), %r8
movq 0x8(%rsi,%rdi,8), %r9
movq %r9, %rbp
subq %r8, %rbp
cmpq $0x4, %rbp
jne 0x10bd3
movq %r14, %rdi
movq 0x18(%rsp), %rsi
xorl %edx, %edx
callq 0xa016
movq %rax, 0x10(%rsp)
jmp 0x10c3d
xorl %r10d, %r10d
cmpq %r9, %r8
je 0x10bf9
movslq (%r8), %rax
movl %eax, %edx
sarl %edx
cmpl 0x18(%rsp), %edx
je 0x10bf3
xorl %edx, %edx
divq 0x20(%rsp)
btsq %rdx, %r10
addq $0x4, %r8
jmp 0x10bd6
leaq (%rsi,%rdi,8), %rax
movq 0x88(%rsp), %rdx
leaq (%r10,%r10,2), %rsi
leaq (%rdx,%rsi,8), %rdi
movl %ecx, 0x30(%rsp)
movq 0x20(%rax), %rax
movq %rax, 0x38(%rsp)
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x10c33
movups 0x30(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x8(%rdi)
jmp 0x10c3d
leaq 0x30(%rsp), %rdx
callq 0x213ee
cmpq $0x4, %rbp
je 0x10c4c
addq $0x4, %r12
jmp 0x10b91
testb $0x1, %bl
movq 0x20(%rsp), %rdi
je 0x1104c
movq $0x0, 0x10(%rsp)
movq 0x18(%r14), %rax
movq 0x78(%rsp), %rcx
movq (%rax,%rcx,8), %r9
movq 0x8(%rax,%rcx,8), %rax
movq %rax, 0x80(%rsp)
xorl %r8d, %r8d
cmpq %rax, %r9
je 0x10e52
movslq (%r9), %rcx
movq (%r14), %rax
movq %rcx, 0x50(%rsp)
leaq (%rcx,%rcx,4), %rdx
movq (%rax,%rdx,8), %rcx
movq %rdx, 0x28(%rsp)
movq 0x8(%rax,%rdx,8), %rsi
xorl %r10d, %r10d
cmpq %rsi, %rcx
je 0x10cca
movslq (%rcx), %rax
movl %eax, %edx
sarl %edx
cmpl 0x18(%rsp), %edx
je 0x10cc4
xorl %edx, %edx
divq %rdi
btsq %rdx, %r10
addq $0x4, %rcx
jmp 0x10ca9
movq %r9, 0x40(%rsp)
xorl %r12d, %r12d
movq %r10, 0x48(%rsp)
subq %r10, %r12
andq %r10, %r12
je 0x10e30
movl %r8d, 0xc(%rsp)
movq 0x88(%rsp), %rax
leaq (%r12,%r12,2), %rcx
movq (%rax,%rcx,8), %r13
movq 0x8(%rax,%rcx,8), %rbx
cmpq %rbx, %r13
je 0x10e1c
movslq (%r13), %rbp
movq 0x8(%r13), %rax
movq (%r14), %rcx
movq 0x28(%rsp), %rdx
movq 0x20(%rcx,%rdx,8), %rdx
movq %rdx, %rcx
xorq 0x68(%rsp), %rcx
movq %rax, %rsi
notq %rsi
testq %rcx, %rsi
jne 0x10d3f
testq %rax, 0x60(%rsp)
jne 0x10d64
movl $0x15, %ecx
jmp 0x10e0a
movq %rax, %rsi
movq 0x60(%rsp), %rdi
xorq %rdi, %rsi
notq %rdx
movl $0x15, %ecx
testq %rsi, %rdx
jne 0x10e0a
andq %rdi, %rax
je 0x10e0a
movq %r14, %rdi
movl %ebp, %esi
callq 0x284dc
movl $0x15, %ecx
testb %al, %al
jne 0x10e0a
movq (%r14), %rdx
leaq (,%rbp,4), %rsi
addq %rbp, %rsi
movq (%rdx,%rsi,8), %rax
movq 0x8(%rdx,%rsi,8), %rdx
movq %rdx, %rsi
subq %rax, %rsi
sarq $0x2, %rsi
testq %rsi, %rsi
jle 0x10dcc
movq %rsi, %rdi
shrq %rdi
movq %rdi, %r8
notq %r8
addq %rsi, %r8
leaq (%rax,%rdi,4), %rsi
addq $0x4, %rsi
cmpl %r15d, -0x4(%rsi)
cmovleq %rsi, %rax
cmovgq %rdi, %r8
movq %r8, %rsi
testq %r8, %r8
jg 0x10da1
cmpq %rdx, %rax
je 0x10e0a
movl 0x58(%rsp), %edx
cmpl (%rax), %edx
jl 0x10e0a
movq %r14, %rdi
movq 0x50(%rsp), %rsi
movl %ebp, %edx
movq 0x18(%rsp), %rcx
callq 0x104e2
xorl %ecx, %ecx
testb %al, %al
je 0x10e0a
movq 0x10(%rsp), %rax
incl %eax
movq %rax, 0x10(%rsp)
movl $0x14, %ecx
movb $0x1, %al
movl %eax, 0xc(%rsp)
cmpl $0x15, %ecx
je 0x10e13
testl %ecx, %ecx
jne 0x10e1c
addq $0x10, %r13
jmp 0x10cfd
movl 0xc(%rsp), %r8d
testb $0x1, %r8b
movq 0x48(%rsp), %r10
je 0x10cd7
testb $0x1, %r8b
movq 0x20(%rsp), %rdi
movq 0x40(%rsp), %r9
jne 0x10e52
addq $0x4, %r9
cmpq 0x80(%rsp), %r9
jne 0x10c89
testb $0x1, %r8b
jne 0x10c63
movq 0x18(%r14), %rax
movq 0x70(%rsp), %rcx
movq (%rax,%rcx,8), %r9
movq 0x8(%rax,%rcx,8), %rax
movq %rax, 0x40(%rsp)
xorl %r8d, %r8d
cmpq %rax, %r9
je 0x11042
movslq (%r9), %rcx
movq (%r14), %rax
movq %rcx, 0x58(%rsp)
leaq (%rcx,%rcx,4), %rdx
movq (%rax,%rdx,8), %rcx
movq %rdx, 0x28(%rsp)
movq 0x8(%rax,%rdx,8), %rsi
xorl %r10d, %r10d
cmpq %rsi, %rcx
je 0x10ec0
movslq (%rcx), %rax
movl %eax, %edx
sarl %edx
cmpl 0x18(%rsp), %edx
je 0x10eba
xorl %edx, %edx
divq %rdi
btsq %rdx, %r10
addq $0x4, %rcx
jmp 0x10e9f
movq %r9, 0x48(%rsp)
xorl %r12d, %r12d
movq %r10, 0x50(%rsp)
subq %r10, %r12
andq %r10, %r12
je 0x11023
movl %r8d, 0xc(%rsp)
movq 0xa0(%rsp), %rax
leaq (%r12,%r12,2), %rcx
movq (%rax,%rcx,8), %r13
movq 0x8(%rax,%rcx,8), %rbx
cmpq %rbx, %r13
je 0x1100f
movslq (%r13), %rbp
movq 0x8(%r13), %rax
movq %rax, %rcx
movq 0x68(%rsp), %rdi
xorq %rdi, %rcx
movq (%r14), %rdx
movq 0x28(%rsp), %rsi
movq 0x20(%rdx,%rsi,8), %rdx
movq %rdx, %rsi
notq %rsi
testq %rcx, %rsi
jne 0x10f36
testq %rdi, %rax
jne 0x10f5a
movl $0x1f, %ecx
jmp 0x10ffd
xorq 0x60(%rsp), %rdx
movq %rax, %rsi
notq %rsi
movl $0x1f, %ecx
testq %rdx, %rsi
jne 0x10ffd
andq 0x68(%rsp), %rax
je 0x10ffd
movq %r14, %rdi
movl %ebp, %esi
callq 0x284dc
movl $0x1f, %ecx
testb %al, %al
jne 0x10ffd
movq (%r14), %rdx
leaq (,%rbp,4), %rsi
addq %rbp, %rsi
movq (%rdx,%rsi,8), %rax
movq 0x8(%rdx,%rsi,8), %rdx
movq %rdx, %rsi
subq %rax, %rsi
sarq $0x2, %rsi
testq %rsi, %rsi
jle 0x10fc2
movq %rsi, %rdi
shrq %rdi
movq %rdi, %r8
notq %r8
addq %rsi, %r8
leaq (%rax,%rdi,4), %rsi
addq $0x4, %rsi
cmpl %r15d, -0x4(%rsi)
cmovlq %rsi, %rax
cmovgeq %rdi, %r8
movq %r8, %rsi
testq %r8, %r8
jg 0x10f97
cmpq %rdx, %rax
je 0x10ffd
cmpl (%rax), %r15d
jl 0x10ffd
movq %r14, %rdi
movl %ebp, %esi
movq 0x58(%rsp), %rdx
movq 0x18(%rsp), %rcx
callq 0x104e2
xorl %ecx, %ecx
testb %al, %al
je 0x10ffd
movq 0x10(%rsp), %rax
incl %eax
movq %rax, 0x10(%rsp)
movl $0x1e, %ecx
movb $0x1, %al
movl %eax, 0xc(%rsp)
cmpl $0x1f, %ecx
je 0x11006
testl %ecx, %ecx
jne 0x1100f
addq $0x10, %r13
jmp 0x10ef3
movl 0xc(%rsp), %r8d
testb $0x1, %r8b
movq 0x50(%rsp), %r10
je 0x10ecd
testb $0x1, %r8b
movq 0x20(%rsp), %rdi
movq 0x48(%rsp), %r9
jne 0x11042
addq $0x4, %r9
cmpq 0x40(%rsp), %r9
jne 0x10e7f
testb $0x1, %r8b
jne 0x10e5c
leaq 0x88(%rsp), %rdi
callq 0x1f654
leaq 0xa0(%rsp), %rdi
callq 0x1f654
movq 0x10(%rsp), %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1108c
movq %rax, %rbx
jmp 0x1109c
jmp 0x1108c
jmp 0x1108c
jmp 0x1108c
jmp 0x1108c
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x1f654
leaq 0xa0(%rsp), %rdi
callq 0x1f654
movq %rbx, %rdi
callq 0x34a0
nop