// File: 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
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x160(%rbp)
movl -0x14(%rbp), %edi
callq 0x3c880
movq -0x160(%rbp), %rdi
movl %eax, %esi
callq 0x5ecc0
testb $0x1, %al
jne 0x21eb9
jmp 0x21ec5
movl $0x0, -0x4(%rbp)
jmp 0x227e3
movq -0x160(%rbp), %rdi
addq $0x18, %rdi
movslq -0x14(%rbp), %rsi
callq 0xaab0
movq %rax, %rdi
callq 0xf940
cmpq $0x0, %rax
jne 0x21f2b
movl -0x14(%rbp), %edi
callq 0x3c880
movl %eax, -0x164(%rbp)
movl -0x14(%rbp), %edi
callq 0x3c890
movq -0x160(%rbp), %rdi
movl -0x164(%rbp), %esi
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movzbl %al, %edx
andl $0x1, %edx
callq 0x10a60
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x227e3
movq -0x160(%rbp), %rdi
addq $0x18, %rdi
movslq -0x14(%rbp), %rsi
callq 0xaab0
movq %rax, %rdi
callq 0xf940
cmpq $0x1, %rax
jne 0x2200e
movq -0x160(%rbp), %rdi
addq $0x18, %rdi
movslq -0x14(%rbp), %rsi
callq 0xaab0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa7c0
movq -0x160(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
movslq -0x1c(%rbp), %rsi
callq 0x3c600
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0xa800
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
callq 0xa830
movq %rax, -0x38(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x21fb7
jmp 0x22002
leaq -0x30(%rbp), %rdi
callq 0xa8a0
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x14(%rbp), %eax
je 0x21ff5
movq -0x160(%rbp), %rdi
movl -0x3c(%rbp), %esi
movl -0x14(%rbp), %edx
callq 0x21aa0
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x40(%rbp)
jle 0x21ff3
movl -0x40(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x227e3
jmp 0x21ff5
jmp 0x21ff7
leaq -0x30(%rbp), %rdi
callq 0xa930
jmp 0x21fa4
movl $0x0, -0x4(%rbp)
jmp 0x227e3
movq -0x160(%rbp), %rdi
movl $0x3b9aca00, -0x44(%rbp) # imm = 0x3B9ACA00
movl $0xffffffff, -0x48(%rbp) # imm = 0xFFFFFFFF
movl $0x3b9aca00, -0x4c(%rbp) # imm = 0x3B9ACA00
movl $0xffffffff, -0x50(%rbp) # imm = 0xFFFFFFFF
addq $0x18, %rdi
movslq -0x14(%rbp), %rsi
callq 0xaab0
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
callq 0xa800
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rdi
callq 0xa830
movq %rax, -0x68(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x22072
jmp 0x22122
leaq -0x60(%rbp), %rdi
callq 0xa8a0
movq -0x160(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x6c(%rbp)
movslq -0x6c(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
movl -0x44(%rbp), %ecx
cmpq %rcx, %rax
jae 0x220cf
movq -0x160(%rbp), %rdi
movl -0x44(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0x50(%rbp)
movslq -0x6c(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
movl %eax, -0x44(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x48(%rbp)
jmp 0x22112
movq -0x160(%rbp), %rdi
movslq -0x6c(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
movl -0x4c(%rbp), %ecx
cmpq %rcx, %rax
jae 0x22110
movq -0x160(%rbp), %rdi
movslq -0x6c(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
movl %eax, -0x4c(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x50(%rbp)
jmp 0x22112
jmp 0x22114
leaq -0x60(%rbp), %rdi
callq 0xa930
jmp 0x2205c
movl -0x48(%rbp), %eax
cmpl -0x50(%rbp), %eax
je 0x2212c
jmp 0x2214b
leaq 0x64981(%rip), %rdi     # 0x86ab4
leaq 0x64918(%rip), %rsi     # 0x86a52
movl $0x5e, %edx
leaq 0x6497b(%rip), %rcx     # 0x86ac1
callq 0x4260
xorl %eax, %eax
cmpl $0x0, -0x48(%rbp)
movb %al, -0x165(%rbp)
jl 0x22166
cmpl $0x0, -0x50(%rbp)
setge %al
movb %al, -0x165(%rbp)
movb -0x165(%rbp), %al
testb $0x1, %al
jne 0x22172
jmp 0x22174
jmp 0x22193
leaq 0x64975(%rip), %rdi     # 0x86af0
leaq 0x648d0(%rip), %rsi     # 0x86a52
movl $0x5f, %edx
leaq 0x64933(%rip), %rcx     # 0x86ac1
callq 0x4260
movl $0x0, -0x70(%rbp)
movl $0x0, -0x74(%rbp)
leaq -0x90(%rbp), %rdi
callq 0xa7e0
movq -0x160(%rbp), %rdi
movl -0x70(%rbp), %eax
movq %rax, -0x170(%rbp)
movslq -0x48(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
movq -0x170(%rbp), %rcx
movq %rax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x166(%rbp)
jae 0x2221e
movq -0x160(%rbp), %rdi
movl -0x74(%rbp), %eax
movq %rax, -0x178(%rbp)
movslq -0x50(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
movq %rax, %rcx
movq -0x178(%rbp), %rax
cmpq %rcx, %rax
setb %al
movb %al, -0x166(%rbp)
movb -0x166(%rbp), %al
testb $0x1, %al
jne 0x2222d
jmp 0x22365
movq -0x160(%rbp), %rdi
movslq -0x48(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
movl -0x70(%rbp), %eax
movl %eax, %esi
callq 0xa7c0
movq -0x160(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x17c(%rbp)
movslq -0x50(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
movl -0x74(%rbp), %eax
movl %eax, %esi
callq 0xa7c0
movq %rax, %rcx
movl -0x17c(%rbp), %eax
cmpl (%rcx), %eax
jne 0x222fb
movq -0x160(%rbp), %rdi
movslq -0x48(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
movl -0x70(%rbp), %eax
movl %eax, %esi
callq 0xa7c0
movl (%rax), %eax
cmpl -0x14(%rbp), %eax
je 0x222e7
movq -0x160(%rbp), %rdi
movslq -0x48(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
movl -0x70(%rbp), %eax
movl %eax, %esi
callq 0xa7c0
movq %rax, %rsi
leaq -0x90(%rbp), %rdi
callq 0xa8c0
jmp 0x222ce
jmp 0x222e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x227d5
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x22360
movq -0x160(%rbp), %rdi
movslq -0x48(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
movl -0x70(%rbp), %eax
movl %eax, %esi
callq 0xa7c0
movq -0x160(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x180(%rbp)
movslq -0x50(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
movl -0x74(%rbp), %eax
movl %eax, %esi
callq 0xa7c0
movq %rax, %rcx
movl -0x180(%rbp), %eax
cmpl (%rcx), %eax
jge 0x22355
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x2235e
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x22360
jmp 0x221ad
leaq -0xb8(%rbp), %rdi
callq 0xa7e0
leaq -0x90(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rdi
callq 0xa800
movq %rax, -0xc8(%rbp)
movq -0xc0(%rbp), %rdi
callq 0xa830
movq %rax, -0xd0(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x223be
jmp 0x2243c
leaq -0xc8(%rbp), %rdi
callq 0xa8a0
movq -0x160(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0xd4(%rbp)
movl -0xd4(%rbp), %esi
movl -0x14(%rbp), %edx
callq 0x21900
movb %al, -0x181(%rbp)
jmp 0x223ef
movb -0x181(%rbp), %al
testb $0x1, %al
jne 0x223fb
jmp 0x22429
leaq -0xb8(%rbp), %rdi
leaq -0xd4(%rbp), %rsi
callq 0xa8c0
jmp 0x22410
jmp 0x22429
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x227c9
jmp 0x2242b
leaq -0xc8(%rbp), %rdi
callq 0xa930
jmp 0x223a5
leaq -0x90(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x3de50
jmp 0x22451
movq -0x160(%rbp), %rdi
addq $0x18, %rdi
movslq -0x14(%rbp), %rsi
callq 0xaab0
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rdi
callq 0xa800
movq %rax, -0xe8(%rbp)
movq -0xe0(%rbp), %rdi
callq 0xa830
movq %rax, -0xf0(%rbp)
leaq -0xe8(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x224ae
jmp 0x226e3
leaq -0xe8(%rbp), %rdi
callq 0xa8a0
movl (%rax), %eax
movl %eax, -0xf4(%rbp)
leaq -0x110(%rbp), %rdi
movq %rdi, -0x190(%rbp)
callq 0xa7e0
leaq -0x90(%rbp), %rdi
callq 0xf940
movq -0x190(%rbp), %rdi
movq %rax, %rsi
callq 0x3e620
jmp 0x224f2
movq -0x160(%rbp), %rdi
movl $0x0, -0x114(%rbp)
movslq -0xf4(%rbp), %rsi
callq 0x3c600
movq %rax, -0x120(%rbp)
movq -0x120(%rbp), %rdi
callq 0xa800
movq %rax, -0x128(%rbp)
movq -0x120(%rbp), %rdi
callq 0xa830
movq %rax, -0x130(%rbp)
leaq -0x128(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x22558
jmp 0x22679
leaq -0x128(%rbp), %rdi
callq 0xa8a0
movl (%rax), %eax
movl %eax, -0x134(%rbp)
movl -0x114(%rbp), %eax
movl %eax, -0x198(%rbp)
leaq -0x90(%rbp), %rdi
callq 0xf940
movl -0x198(%rbp), %ecx
movl %eax, %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x191(%rbp)
jge 0x225bc
movslq -0x114(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0xa7c0
movl (%rax), %eax
cmpl -0x134(%rbp), %eax
setl %al
movb %al, -0x191(%rbp)
movb -0x191(%rbp), %al
testb $0x1, %al
jne 0x225c8
jmp 0x225fc
movl -0x114(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x114(%rbp)
jmp 0x2256c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x110(%rbp), %rdi
callq 0xab00
jmp 0x227c9
movl -0x114(%rbp), %eax
movl %eax, -0x19c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0xf940
movq %rax, %rcx
movl -0x19c(%rbp), %eax
cmpl %ecx, %eax
jne 0x22623
jmp 0x22679
movl -0x134(%rbp), %eax
movl %eax, -0x1a0(%rbp)
movslq -0x114(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0xa7c0
movq %rax, %rcx
movl -0x1a0(%rbp), %eax
cmpl (%rcx), %eax
jne 0x22666
leaq -0x110(%rbp), %rdi
leaq -0x134(%rbp), %rsi
callq 0xa8c0
jmp 0x22664
jmp 0x22666
jmp 0x22668
leaq -0x128(%rbp), %rdi
callq 0xa930
jmp 0x2253c
leaq -0x90(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x3de50
jmp 0x2268e
leaq -0x90(%rbp), %rdi
callq 0xf940
cmpq $0x2, %rax
jae 0x226ac
movl $0xa, -0x138(%rbp)
jmp 0x226b6
movl $0x0, -0x138(%rbp)
leaq -0x110(%rbp), %rdi
callq 0xab00
movl -0x138(%rbp), %eax
testl %eax, %eax
je 0x226d0
jmp 0x226ce
jmp 0x226e3
jmp 0x226d2
leaq -0xe8(%rbp), %rdi
callq 0xa930
jmp 0x22492
leaq -0x90(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x140(%rbp), %rdi
callq 0xa800
movq %rax, -0x148(%rbp)
movq -0x140(%rbp), %rdi
callq 0xa830
movq %rax, -0x150(%rbp)
leaq -0x148(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x22730
jmp 0x2279e
leaq -0x148(%rbp), %rdi
callq 0xa8a0
movq -0x160(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x154(%rbp)
movl -0x154(%rbp), %esi
movl -0x14(%rbp), %edx
callq 0x21aa0
movl %eax, -0x1a4(%rbp)
jmp 0x22761
movl -0x1a4(%rbp), %eax
movl %eax, -0x158(%rbp)
cmpl $0x0, -0x158(%rbp)
jle 0x2278b
movl -0x158(%rbp), %eax
movl %eax, -0x4(%rbp)
movl $0x1, -0x138(%rbp)
jmp 0x227af
jmp 0x2278d
leaq -0x148(%rbp), %rdi
callq 0xa930
jmp 0x22717
movl $0x0, -0x4(%rbp)
movl $0x1, -0x138(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0xab00
leaq -0x90(%rbp), %rdi
callq 0xab00
jmp 0x227e3
leaq -0xb8(%rbp), %rdi
callq 0xab00
leaq -0x90(%rbp), %rdi
callq 0xab00
jmp 0x227ef
movl -0x4(%rbp), %eax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
movq -0x98(%rbp), %rdi
callq 0x4610
nopl (%rax,%rax)