// File: /workspace/github_cpp_makefile_star2_O3/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, %r12d
movq %rdi, %r14
movl %esi, %r15d
sarl %r15d
movl %r15d, %esi
callq 0x278a0
xorl %ebp, %ebp
testb %al, %al
je 0x13147
movl %ebp, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movslq %r12d, %rax
movq 0x18(%r14), %rcx
leaq (%rax,%rax,2), %r13
movq (%rcx,%r13,8), %rax
movq 0x8(%rcx,%r13,8), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x2, %rdx
je 0x131a5
cmpq $0x1, %rdx
jne 0x131c5
movslq (%rax), %rax
movq (%r14), %rcx
leaq (%rax,%rax,4), %rax
movq (%rcx,%rax,8), %rbx
movq 0x8(%rcx,%rax,8), %r15
cmpq %r15, %rbx
je 0x13136
movl (%rbx), %esi
cmpl %r12d, %esi
je 0x1319f
movq %r14, %rdi
movl %r12d, %edx
callq 0x12f02
testl %eax, %eax
jg 0x13514
addq $0x4, %rbx
jmp 0x13180
andl $0x1, %r12d
movq %r14, %rdi
movl %r15d, %esi
movl %r12d, %edx
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa026
cmpq %rcx, %rax
je 0x1351b
movq (%r14), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0x3b9aca00, %r8d       # imm = 0x3B9ACA00
movl $0x3b9aca00, %r9d       # imm = 0x3B9ACA00
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movslq (%rax), %r11
leaq (%r11,%r11,4), %rbx
movq 0x8(%rdi,%rbx,8), %r10
subq (%rdi,%rbx,8), %r10
sarq $0x2, %r10
movl %r8d, %ebx
cmpq %rbx, %r10
jae 0x13210
movl %esi, %edx
movl %r8d, %r9d
movl %r11d, %esi
movl %r10d, %r8d
jmp 0x13221
movl %r9d, %ebx
cmpq %rbx, %r10
cmovbl %r11d, %edx
cmovael %r9d, %r10d
movl %r10d, %r9d
addq $0x4, %rax
cmpq %rcx, %rax
jne 0x131e7
cmpl %edx, %esi
je 0x1351b
movq %r13, 0x68(%rsp)
movl %esi, %eax
orl %edx, %eax
js 0x1353a
movl %r12d, 0xc(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movl %esi, %ecx
movq (%r14), %rax
leaq (%rcx,%rcx,4), %r12
movq (%rax,%r12,8), %rcx
cmpq %rcx, 0x8(%rax,%r12,8)
je 0x13367
movl %edx, %esi
xorl %edx, %edx
leaq (%rsi,%rsi,4), %rbp
leaq 0x10(%rsp), %rbx
xorl %r15d, %r15d
xorl %r13d, %r13d
movl %r13d, %esi
movq (%rax,%rbp,8), %r8
movq 0x8(%rax,%rbp,8), %rdi
subq %r8, %rdi
sarq $0x2, %rdi
cmpq %rsi, %rdi
jbe 0x132f6
movl (%rcx,%rdx,4), %edi
cmpl (%r8,%rsi,4), %edi
jne 0x132c2
cmpl 0xc(%rsp), %edi
je 0x132d8
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x132c9
movl %edi, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x132d8
jge 0x132db
incl %r15d
jmp 0x132de
leaq (%rcx,%rdx,4), %rdx
movq %rbx, %rdi
callq 0x98f8
movq (%r14), %rax
incl %r15d
incl %r13d
movl %r15d, %edx
movq (%rax,%r12,8), %rcx
movq 0x8(%rax,%r12,8), %rsi
subq %rcx, %rsi
sarq $0x2, %rsi
cmpq %rdx, %rsi
ja 0x13282
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r13
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
cmpq %r13, %rbx
je 0x13375
leaq 0x30(%rsp), %r15
leaq 0x50(%rsp), %r12
movl (%rbx), %ebp
movl %ebp, 0x50(%rsp)
movq %r14, %rdi
movl %ebp, %esi
movl 0xc(%rsp), %edx
callq 0x12e70
testb %al, %al
je 0x1335c
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0x13351
movl %ebp, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x38(%rsp)
jmp 0x1335c
movq %r15, %rdi
movq %r12, %rdx
callq 0x98f8
addq $0x4, %rbx
cmpq %r13, %rbx
jne 0x13320
jmp 0x13375
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x1ef50
movq 0x18(%r14), %rax
movq 0x68(%rsp), %rcx
movq (%rax,%rcx,8), %rbp
movq 0x8(%rax,%rcx,8), %rax
movq %rax, 0x68(%rsp)
cmpq %rax, %rbp
movl 0xc(%rsp), %r12d
je 0x134b3
leaq 0x50(%rsp), %r15
movslq (%rbp), %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
movq 0x18(%rsp), %rsi
subq 0x10(%rsp), %rsi
sarq $0x2, %rsi
movq %r15, %rdi
callq 0x1f18c
movq (%r14), %rax
leaq (%rbx,%rbx,4), %rcx
movq (%rax,%rcx,8), %r12
movq 0x8(%rax,%rcx,8), %r13
cmpq %r13, %r12
je 0x1346b
xorl %ebx, %ebx
movl (%r12), %eax
movl %eax, 0x74(%rsp)
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %rdx
subq %rcx, %rdx
shrq $0x2, %rdx
cmpl %edx, %ebx
jge 0x13430
movslq %ebx, %r8
movslq %edx, %rsi
leaq (%rcx,%r8,4), %rdi
subq %r8, %rsi
xorl %r8d, %r8d
cmpl %eax, (%rdi,%r8,4)
jge 0x1342d
incq %r8
cmpq %r8, %rsi
jne 0x1341d
jmp 0x1346b
addl %r8d, %ebx
cmpl %edx, %ebx
je 0x1346b
movslq %ebx, %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0x13462
movq 0x58(%rsp), %rsi
cmpq 0x60(%rsp), %rsi
je 0x13455
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x58(%rsp)
jmp 0x13462
movq %r15, %rdi
leaq 0x74(%rsp), %rdx
callq 0x98f8
addq $0x4, %r12
cmpq %r13, %r12
jne 0x133f0
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x1ef50
movq 0x18(%rsp), %rbx
subq 0x10(%rsp), %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
movl 0xc(%rsp), %r12d
je 0x1349e
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
cmpq $0x5, %rbx
jb 0x134b3
addq $0x4, %rbp
cmpq 0x68(%rsp), %rbp
jne 0x133ae
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r15
xorl %ebp, %ebp
cmpq %r15, %rbx
je 0x134dd
movl (%rbx), %esi
movq %r14, %rdi
movl %r12d, %edx
callq 0x12f02
testl %eax, %eax
jg 0x134db
addq $0x4, %rbx
jmp 0x134bf
movl %eax, %ebp
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x134f4
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x13136
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
jmp 0x13136
movl %eax, %ebp
jmp 0x13136
leaq 0x256b2(%rip), %rdi     # 0x38bd4
leaq 0x25649(%rip), %rsi     # 0x38b72
leaq 0x256b1(%rip), %rcx     # 0x38be1
movl $0x5e, %edx
callq 0x31b0
leaq 0x256cf(%rip), %rdi     # 0x38c10
leaq 0x2562a(%rip), %rsi     # 0x38b72
leaq 0x25692(%rip), %rcx     # 0x38be1
movl $0x5f, %edx
callq 0x31b0
movq %rax, %rbx
jmp 0x1359c
jmp 0x13564
jmp 0x13564
jmp 0x1356b
movq %rax, %rbx
jmp 0x13585
jmp 0x1356b
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x13585
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1359c
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x135b3
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq %rbx, %rdi
callq 0x34a0
nop