// File: /workspace/github_cpp_makefile_star2_O1/Laakeri[P]maxpre/src/./SIE.cpp
// Function: maxPreprocessor::Preprocessor::trySIE(int)
int Preprocessor::trySIE(int lit) {
	if (pi.isVarRemoved(litVariable(lit))) return 0;
	if (pi.litClauses[lit].size() == 0) {
		int rm = setVariable(litVariable(lit), !litValue(lit));
		return rm;
	}
	if (pi.litClauses[lit].size() == 1){
		int c = pi.litClauses[lit][0];
		for (int l : pi.clauses[c].lit) {
			if (l != lit) {
				int rm = try2SIE(l, lit);
				if (rm > 0) {
					return rm;
				}
			}
		}
		return 0;
	}
	unsigned mi1 = 1e9;
	int mi1c = -1;
	unsigned mi2 = 1e9;
	int mi2c = -1;
	for (int c : pi.litClauses[lit]) {
		if (pi.clauses[c].lit.size() < mi1) {
			mi2 = mi1;
			mi2c = mi1c;
			mi1 = pi.clauses[c].lit.size();
			mi1c = c;
		}
		else if(pi.clauses[c].lit.size() < mi2) {
			mi2 = pi.clauses[c].lit.size();
			mi2c = c;
		}
	}
	assert(mi1c != mi2c);
	assert(mi1c >= 0 && mi2c >= 0);
	unsigned i1 = 0;
	unsigned i2 = 0;
	vector<int> cands;
	while (i1 < pi.clauses[mi1c].lit.size() && i2 < pi.clauses[mi2c].lit.size()) {
		if (pi.clauses[mi1c].lit[i1] == pi.clauses[mi2c].lit[i2]) {
			if (pi.clauses[mi1c].lit[i1] != lit) {
				cands.push_back(pi.clauses[mi1c].lit[i1]);
			}
			i1++;
			i2++;
		}
		else if(pi.clauses[mi1c].lit[i1] < pi.clauses[mi2c].lit[i2]) {
			i1++;
		}
		else {
			i2++;
		}
	}
	vector<int> newCands;
	for (int l : cands) {
		if (SIErndCheck(l, lit)) newCands.push_back(l);
	}
	cands = newCands;
	for (int c : pi.litClauses[lit]) {
		vector<int> nCands;
		nCands.reserve(cands.size());
		int ci = 0;
		for (int l : pi.clauses[c].lit) {
			while (ci < (int)cands.size() && cands[ci] < l) ci++;
			if (ci == (int)cands.size()) break;
			if (l == cands[ci]) nCands.push_back(l);
		}
		cands = nCands;
		if (cands.size() < 2) break;
	}
	for (int l : cands) {
		int rm = try2SIE(l, lit);
		if (rm > 0) {
			return rm;
		}
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %esi, %r13d
movq %rdi, %r14
movl %esi, %r15d
sarl %r15d
movl %r15d, %esi
callq 0x2859c
xorl %ebp, %ebp
testb %al, %al
je 0x13951
movl %ebp, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movslq %r13d, %rax
movq 0x18(%r14), %rdx
leaq (%rax,%rax,2), %r12
movq (%rdx,%r12,8), %rcx
movq 0x8(%rdx,%r12,8), %rdx
movq %rdx, %rax
subq %rcx, %rax
sarq $0x2, %rax
je 0x139bf
cmpq $0x1, %rax
jne 0x139df
movslq (%rcx), %rax
movq (%r14), %rcx
leaq (%rax,%rax,4), %rax
movq (%rcx,%rax,8), %rbx
movq 0x8(%rcx,%rax,8), %r15
cmpq %r15, %rbx
je 0x13940
movl (%rbx), %esi
movb $0x1, %cl
cmpl %r13d, %esi
je 0x139ac
movq %r14, %rdi
movl %r13d, %edx
callq 0x136ea
testl %eax, %eax
setle %cl
cmovgl %eax, %r12d
testb %cl, %cl
je 0x13cfb
addq $0x4, %rbx
cmpq %r15, %rbx
jne 0x1398f
jmp 0x13940
andl $0x1, %r13d
movq %r14, %rdi
movl %r15d, %esi
movl %r13d, %edx
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa016
cmpq %rdx, %rcx
je 0x13a46
movq (%r14), %rsi
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
movl $0x3b9aca00, %r8d       # imm = 0x3B9ACA00
movl $0x3b9aca00, %r9d       # imm = 0x3B9ACA00
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movslq (%rcx), %rdi
leaq (%rdi,%rdi,4), %rbx
movq 0x8(%rsi,%rbx,8), %r11
subq (%rsi,%rbx,8), %r11
sarq $0x2, %r11
movl %r8d, %ebx
cmpq %rbx, %r11
jae 0x13a25
movl %r10d, %eax
movl %r8d, %r9d
movl %r11d, %r8d
jmp 0x13a38
movl %r9d, %ebx
cmpq %rbx, %r11
cmovbl %edi, %eax
cmovael %r9d, %r11d
movl %r11d, %r9d
movl %r10d, %edi
addq $0x4, %rcx
movl %edi, %r10d
cmpq %rdx, %rcx
jne 0x139fe
jmp 0x13a50
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
cmpl %eax, %edi
je 0x13d3d
movq %r12, 0x50(%rsp)
movl %r13d, 0xc(%rsp)
movl %edi, %ecx
orl %eax, %ecx
js 0x13d5c
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movl %edi, %ecx
movq (%r14), %rdx
leaq (%rcx,%rcx,4), %r12
movq (%rdx,%r12,8), %rcx
cmpq %rcx, 0x8(%rdx,%r12,8)
je 0x13b1b
movl %eax, %esi
xorl %eax, %eax
leaq (%rsi,%rsi,4), %rbp
leaq 0x10(%rsp), %rbx
xorl %r15d, %r15d
xorl %r13d, %r13d
movl %r13d, %esi
movq (%rdx,%rbp,8), %rdi
movq 0x8(%rdx,%rbp,8), %rdx
subq %rdi, %rdx
sarq $0x2, %rdx
cmpq %rsi, %rdx
jbe 0x13b1b
movl (%rcx,%rax,4), %edx
cmpl (%rdi,%rsi,4), %edx
jne 0x13ae7
cmpl 0xc(%rsp), %edx
je 0x13afa
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x13aee
movl %edx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x13afa
jge 0x13afd
incl %r15d
jmp 0x13b00
leaq (%rcx,%rax,4), %rdx
movq %rbx, %rdi
callq 0x98e8
incl %r15d
incl %r13d
movl %r15d, %eax
movq (%r14), %rdx
movq (%rdx,%r12,8), %rcx
movq 0x8(%rdx,%r12,8), %rsi
subq %rcx, %rsi
sarq $0x2, %rsi
cmpq %rax, %rsi
ja 0x13aa8
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
movq $0x0, 0x70(%rsp)
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r13
cmpq %r13, %rbx
je 0x13b8a
leaq 0x60(%rsp), %r15
leaq 0x30(%rsp), %r12
movl (%rbx), %ebp
movl %ebp, 0x30(%rsp)
movq %r14, %rdi
movl %ebp, %esi
movl 0xc(%rsp), %edx
callq 0x1363a
testb %al, %al
je 0x13b81
movq 0x68(%rsp), %rsi
cmpq 0x70(%rsp), %rsi
je 0x13b76
movl %ebp, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x68(%rsp)
jmp 0x13b81
movq %r15, %rdi
movq %r12, %rdx
callq 0x98e8
addq $0x4, %rbx
cmpq %r13, %rbx
jne 0x13b45
leaq 0x10(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x1fb22
movq 0x18(%r14), %rax
movq 0x50(%rsp), %rcx
movq (%rax,%rcx,8), %rbp
movq 0x8(%rax,%rcx,8), %rax
movq %rax, 0x50(%rsp)
cmpq %rax, %rbp
movl 0xc(%rsp), %r13d
je 0x13cca
leaq 0x30(%rsp), %r15
movslq (%rbp), %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movq 0x18(%rsp), %rsi
subq 0x10(%rsp), %rsi
sarq $0x2, %rsi
movq %r15, %rdi
callq 0x1fd50
movq (%r14), %rax
leaq (%rbx,%rbx,4), %rcx
movq (%rax,%rcx,8), %r13
movq 0x8(%rax,%rcx,8), %r12
cmpq %r12, %r13
je 0x13c82
xorl %ebx, %ebx
movl (%r13), %eax
movl %eax, 0x5c(%rsp)
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %rdx
subq %rcx, %rdx
shrq $0x2, %rdx
cmpl %edx, %ebx
jge 0x13c47
movslq %ebx, %r8
movslq %edx, %rsi
leaq (%rcx,%r8,4), %rdi
subq %r8, %rsi
xorl %r8d, %r8d
cmpl %eax, (%rdi,%r8,4)
jge 0x13c44
incq %r8
cmpq %r8, %rsi
jne 0x13c32
movl %edx, %ebx
jmp 0x13c47
addl %r8d, %ebx
cmpl %edx, %ebx
je 0x13c82
movslq %ebx, %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0x13c79
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0x13c6c
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x38(%rsp)
jmp 0x13c79
movq %r15, %rdi
leaq 0x5c(%rsp), %rdx
callq 0x98e8
addq $0x4, %r13
cmpq %r12, %r13
jne 0x13c05
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x1fb22
movq 0x18(%rsp), %rbx
subq 0x10(%rsp), %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
movl 0xc(%rsp), %r13d
je 0x13cb5
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
cmpq $0x5, %rbx
jb 0x13cca
addq $0x4, %rbp
cmpq 0x50(%rsp), %rbp
jne 0x13bc3
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r15
xorl %ebp, %ebp
cmpq %r15, %rbx
je 0x13d06
movl (%rbx), %esi
movq %r14, %rdi
movl %r13d, %edx
callq 0x136ea
testl %eax, %eax
cmovgl %eax, %r12d
jg 0x13d03
addq $0x4, %rbx
cmpq %r15, %rbx
jne 0x13cdb
jmp 0x13d06
movl %r12d, %ebp
jmp 0x13940
movl %r12d, %ebp
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x13d1d
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x13940
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
jmp 0x13940
leaq 0x25de0(%rip), %rdi     # 0x39b24
leaq 0x25d77(%rip), %rsi     # 0x39ac2
leaq 0x25ddf(%rip), %rcx     # 0x39b31
movl $0x5e, %edx
callq 0x31b0
leaq 0x25dfd(%rip), %rdi     # 0x39b60
leaq 0x25d58(%rip), %rsi     # 0x39ac2
leaq 0x25dc0(%rip), %rcx     # 0x39b31
movl $0x5f, %edx
callq 0x31b0
movq %rax, %rbx
jmp 0x13dbe
jmp 0x13d84
jmp 0x13d84
movq %rax, %rbx
jmp 0x13da7
jmp 0x13d8d
jmp 0x13d8d
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x13da7
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x13dbe
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x13dd5
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq %rbx, %rdi
callq 0x34a0
nop