// File: /workspace/github_cpp_makefile_star2_O3/Laakeri[P]maxpre/src/./BVE.cpp
// Function: maxPreprocessor::Preprocessor::searchITE(int) const
pair<vector<int>, int> Preprocessor::searchITE(int var) const {
	vector<int> defClauses;
	int p3 = 0;
	int n3 = 0;
	for (int c : pi.litClauses[posLit(var)]) {
		if (pi.clauses[c].lit.size() == 3) {
			p3++;
			if (p3 >= 2) break;
		}
	}
	for (int c : pi.litClauses[negLit(var)]) {
		if (pi.clauses[c].lit.size() == 3) {
			n3++;
			if (n3 >= 2) break;
		}
	}
	if (p3 < 2 || n3 < 2) return {vector<int>(), 0};
	map<int, map<int, int> > pMap;
	map<int, map<int, int> > nMap;
	for (int c1 : pi.litClauses[posLit(var)]) {
		if (pi.clauses[c1].lit.size() == 3) {
			int l1 = pi.clauses[c1].lit[0];
			int l2 = pi.clauses[c1].lit[1];
			int l3 = pi.clauses[c1].lit[2];
			if (litVariable(l1) == var) swap(l1, l3);
			if (litVariable(l2) == var) swap(l2, l3);
			assert(litVariable(l1) != var && litVariable(l2) != var);
			pMap[l1][l2] = c1;
			pMap[l2][l1] = c1;
		}
	}
	for (int c1 : pi.litClauses[negLit(var)]) {
		if (pi.clauses[c1].lit.size() == 3) {
			int l1 = pi.clauses[c1].lit[0];
			int l2 = pi.clauses[c1].lit[1];
			int l3 = pi.clauses[c1].lit[2];
			if (litVariable(l1) == var) swap(l1, l3);
			if (litVariable(l2) == var) swap(l2, l3);
			assert(litVariable(l1) != var && litVariable(l2) != var);
			nMap[l1][l2] = c1;
			nMap[l2][l1] = c1;
		}
	}
	for (auto k : pMap) {
		int c = k.F;
		pair<int, int> tf = {-1, -1};
		pair<int, int> ff = {-1, -1};
		for (auto h : pMap[c]) {
			if (pMap[c].count(h.F) > 0 && nMap[c].count(litNegation(h.F)) > 0) {
				tf = {pMap[c][h.F], nMap[c][litNegation(h.F)]};
			}
		}
		if (tf.F == -1) continue;
		for (auto h : pMap[litNegation(c)]) {
			if (pMap[litNegation(c)].count(h.F) > 0 && nMap[litNegation(c)].count(litNegation(h.F)) > 0) {
				ff = {pMap[litNegation(c)][h.F], nMap[litNegation(c)][litNegation(h.F)]};
			}
		}
		if (tf.F >= 0 && ff.F >= 0) {
			return {{tf.F, tf.S, ff.F, ff.S}, 4};
		}
	}
	return {vector<int>(), 0};
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movl %edx, %ebx
movq %rsi, %r14
leal (%rbx,%rbx), %edx
movslq %edx, %rcx
movq 0x18(%rsi), %rax
leaq (%rcx,%rcx,2), %rcx
movq (%rax,%rcx,8), %rbp
movq 0x8(%rax,%rcx,8), %r15
cmpq %r15, %rbp
movq %rdi, 0x30(%rsp)
je 0xcf4b
movq (%r14), %rsi
xorl %ecx, %ecx
movq %rbp, %r10
movslq (%r10), %r8
leaq (%r8,%r8,4), %r8
movq 0x8(%rsi,%r8,8), %r9
subq (%rsi,%r8,8), %r9
cmpq $0xc, %r9
jne 0xcf3a
leal 0x1(%rcx), %r8d
testl %ecx, %ecx
movl %r8d, %ecx
jg 0xcf43
addq $0x4, %r10
cmpq %r15, %r10
jne 0xcf19
cmpl $0x2, %ecx
setl %cl
jmp 0xcf4d
movb $0x1, %cl
orl $0x1, %edx
movslq %edx, %rdx
leaq (%rdx,%rdx,2), %rdx
movq (%rax,%rdx,8), %r12
movq %rdx, 0x20(%rsp)
movq 0x8(%rax,%rdx,8), %r13
cmpq %r13, %r12
je 0xcfa7
movq (%r14), %rdx
xorl %eax, %eax
movq %r12, %rsi
movslq (%rsi), %rdi
leaq (%rdi,%rdi,4), %rdi
movq 0x8(%rdx,%rdi,8), %r8
subq (%rdx,%rdi,8), %r8
cmpq $0xc, %r8
jne 0xcf91
leal 0x1(%rax), %edi
testl %eax, %eax
movl %edi, %eax
jg 0xcf9a
addq $0x4, %rsi
cmpq %r13, %rsi
jne 0xcf72
cmpl $0x2, %eax
setl %al
orb %al, %cl
cmpb $0x1, %cl
jne 0xcfbb
xorps %xmm0, %xmm0
movq 0x30(%rsp), %rax
movups %xmm0, 0xc(%rax)
movups %xmm0, (%rax)
jmp 0xd4cf
xorl %eax, %eax
leaq 0xc0(%rsp), %rcx
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0x90(%rsp), %rcx
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
cmpq %r15, %rbp
je 0xd0c5
leaq 0x8(%rsp), %r13
movslq (%rbp), %r12
movq (%r14), %rax
leaq (%r12,%r12,4), %rcx
movq (%rax,%rcx,8), %rdx
movq 0x8(%rax,%rcx,8), %rax
subq %rdx, %rax
cmpq $0xc, %rax
jne 0xd0a6
movl (%rdx), %ecx
movl %ecx, 0x50(%rsp)
movl 0x4(%rdx), %eax
movl %eax, 0x8(%rsp)
movl 0x8(%rdx), %esi
movl %ecx, %edx
sarl %edx
cmpl %ebx, %edx
jne 0xd040
movl %esi, 0x50(%rsp)
movl %esi, %edx
jmp 0xd044
movl %ecx, %edx
movl %esi, %ecx
movl %eax, %esi
sarl %esi
cmpl %ebx, %esi
jne 0xd052
movl %ecx, 0x8(%rsp)
movl %ecx, %eax
sarl %edx
cmpl %ebx, %edx
je 0xd553
sarl %eax
cmpl %ebx, %eax
je 0xd553
leaq 0xb8(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x1ec78
movq %rax, %rdi
movq %r13, %rsi
callq 0x1ecde
movl %r12d, (%rax)
leaq 0xb8(%rsp), %rdi
movq %r13, %rsi
callq 0x1ec78
movq %rax, %rdi
leaq 0x50(%rsp), %rsi
callq 0x1ecde
movl %r12d, (%rax)
addq $0x4, %rbp
cmpq %r15, %rbp
jne 0xcfff
movq 0x18(%r14), %rax
movq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %r12
movq 0x8(%rax,%rcx,8), %r13
cmpq %r13, %r12
je 0xd18c
leaq 0x8(%rsp), %r15
movslq (%r12), %rbp
movq (%r14), %rax
leaq (,%rbp,4), %rcx
addq %rbp, %rcx
movq (%rax,%rcx,8), %rdx
movq 0x8(%rax,%rcx,8), %rax
subq %rdx, %rax
cmpq $0xc, %rax
jne 0xd17f
movl (%rdx), %ecx
movl %ecx, 0x50(%rsp)
movl 0x4(%rdx), %eax
movl %eax, 0x8(%rsp)
movl 0x8(%rdx), %esi
movl %ecx, %edx
sarl %edx
cmpl %ebx, %edx
jne 0xd11b
movl %esi, 0x50(%rsp)
movl %esi, %edx
jmp 0xd11f
movl %ecx, %edx
movl %esi, %ecx
movl %eax, %esi
sarl %esi
cmpl %ebx, %esi
jne 0xd12d
movl %ecx, 0x8(%rsp)
movl %ecx, %eax
sarl %edx
cmpl %ebx, %edx
je 0xd572
sarl %eax
cmpl %ebx, %eax
je 0xd572
leaq 0x88(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x1ec78
movq %rax, %rdi
movq %r15, %rsi
callq 0x1ecde
movl %ebp, (%rax)
leaq 0x88(%rsp), %rdi
movq %r15, %rsi
callq 0x1ec78
movq %rax, %rdi
leaq 0x50(%rsp), %rsi
callq 0x1ecde
movl %ebp, (%rax)
addq $0x4, %r12
cmpq %r13, %r12
jne 0xd0d3
movq 0xd0(%rsp), %r15
leaq 0xc0(%rsp), %rax
cmpq %rax, %r15
je 0xd4a3
leaq 0x58(%rsp), %rbx
leaq 0xb8(%rsp), %r12
movq %rsp, %r13
movl 0x20(%r15), %eax
movl %eax, 0x50(%rsp)
leaq 0x28(%r15), %rsi
movq %rbx, %rdi
callq 0x1f818
movl 0x50(%rsp), %eax
movl %eax, (%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x1ec78
movq %rax, %r14
movq 0x18(%rax), %rbp
addq $0x8, %r14
cmpq %r14, %rbp
je 0xd47a
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl $0xffffffff, 0x20(%rsp) # imm = 0xFFFFFFFF
movq 0x20(%rbp), %rax
movq %rax, 0x8(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x1ec78
movq 0x10(%rax), %rcx
testq %rcx, %rcx
je 0xd2e4
addq $0x8, %rax
movl 0x8(%rsp), %edx
movq %rax, %rsi
xorl %edi, %edi
cmpl %edx, 0x20(%rcx)
setl %dil
cmovgeq %rcx, %rsi
movq 0x10(%rcx,%rdi,8), %rcx
testq %rcx, %rcx
jne 0xd228
cmpq %rax, %rsi
je 0xd2e4
cmpl 0x20(%rsi), %edx
jl 0xd2e4
leaq 0x88(%rsp), %rdi
movq %r13, %rsi
callq 0x1ec78
movq 0x10(%rax), %rdx
testq %rdx, %rdx
je 0xd2e4
movl 0x8(%rsp), %ecx
xorl $0x1, %ecx
addq $0x8, %rax
movq %rax, %rsi
xorl %edi, %edi
cmpl %ecx, 0x20(%rdx)
setl %dil
cmovgeq %rdx, %rsi
movq 0x10(%rdx,%rdi,8), %rdx
testq %rdx, %rdx
jne 0xd278
cmpq %rax, %rsi
je 0xd2e4
cmpl 0x20(%rsi), %ecx
jl 0xd2e4
movq %r12, %rdi
movq %r13, %rsi
callq 0x1ec78
movq %rax, %rdi
leaq 0x8(%rsp), %rsi
callq 0x1ecde
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
movq %r13, %rsi
callq 0x1ec78
movl 0x8(%rsp), %ecx
xorl $0x1, %ecx
movl %ecx, 0x40(%rsp)
movq %rax, %rdi
leaq 0x40(%rsp), %rsi
callq 0x1ed44
movl (%rbx), %ecx
movl %ecx, 0x20(%rsp)
movl (%rax), %ebx
movq %rbp, %rdi
callq 0x31f0
movq %rax, %rbp
cmpq %r14, %rax
jne 0xd1fc
movl %ebx, 0x38(%rsp)
cmpl $-0x1, 0x20(%rsp)
je 0xd47a
movl (%rsp), %eax
xorl $0x1, %eax
movl %eax, 0x8(%rsp)
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
callq 0x1edaa
movq %rax, %r14
movq 0x18(%rax), %rbp
addq $0x8, %r14
cmpq %r14, %rbp
je 0xd47a
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl $0xffffffff, 0x2c(%rsp) # imm = 0xFFFFFFFF
movq 0x20(%rbp), %rax
movq %rax, 0x8(%rsp)
movl (%rsp), %eax
xorl $0x1, %eax
movl %eax, 0x40(%rsp)
movq %r12, %rdi
leaq 0x40(%rsp), %rsi
callq 0x1edaa
movq 0x10(%rax), %rcx
testq %rcx, %rcx
je 0xd45b
addq $0x8, %rax
movl 0x8(%rsp), %edx
movq %rax, %rsi
xorl %edi, %edi
cmpl %edx, 0x20(%rcx)
setl %dil
cmovgeq %rcx, %rsi
movq 0x10(%rcx,%rdi,8), %rcx
testq %rcx, %rcx
jne 0xd377
cmpq %rax, %rsi
je 0xd45b
cmpl 0x20(%rsi), %edx
jl 0xd45b
movl (%rsp), %eax
xorl $0x1, %eax
movl %eax, 0x4(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x1edaa
movq 0x10(%rax), %rdx
testq %rdx, %rdx
je 0xd45b
movl 0x8(%rsp), %ecx
xorl $0x1, %ecx
addq $0x8, %rax
movq %rax, %rsi
xorl %edi, %edi
cmpl %ecx, 0x20(%rdx)
setl %dil
cmovgeq %rdx, %rsi
movq 0x10(%rdx,%rdi,8), %rdx
testq %rdx, %rdx
jne 0xd3d7
cmpq %rax, %rsi
je 0xd45b
cmpl 0x20(%rsi), %ecx
jl 0xd45b
movl (%rsp), %eax
xorl $0x1, %eax
movl %eax, 0x40(%rsp)
movq %r12, %rdi
leaq 0x40(%rsp), %rsi
callq 0x1edaa
movq %rax, %rdi
leaq 0x8(%rsp), %rsi
callq 0x1ecde
movq %rax, %rbx
movl (%rsp), %eax
xorl $0x1, %eax
movl %eax, 0x4(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x1edaa
movl 0x8(%rsp), %ecx
xorl $0x1, %ecx
movl %ecx, 0x3c(%rsp)
movq %rax, %rdi
leaq 0x3c(%rsp), %rsi
callq 0x1ed44
movl (%rbx), %ebx
movl (%rax), %eax
movl %eax, 0x2c(%rsp)
movq %rbp, %rdi
callq 0x31f0
movq %rax, %rbp
cmpq %r14, %rax
jne 0xd33f
cmpl $0x0, 0x20(%rsp)
js 0xd47a
testl %ebx, %ebx
jns 0xd4e1
leaq 0x58(%rsp), %rbx
movq %rbx, %rdi
callq 0x1f9ec
movq %r15, %rdi
callq 0x31f0
movq %rax, %r15
leaq 0xc0(%rsp), %rax
cmpq %rax, %r15
jne 0xd1b5
xorps %xmm0, %xmm0
movq 0x30(%rsp), %rbx
movups %xmm0, 0xc(%rbx)
movups %xmm0, (%rbx)
leaq 0x88(%rsp), %rdi
callq 0x1fa00
leaq 0xb8(%rsp), %rdi
callq 0x1fa00
movq %rbx, %rax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x40(%rsp), %rsi
movl 0x20(%rsp), %eax
movl %eax, (%rsi)
movl 0x38(%rsp), %eax
movl %eax, 0x4(%rsi)
movl %ebx, 0x8(%rsi)
movl 0x2c(%rsp), %eax
movl %eax, 0xc(%rsi)
leaq 0x8(%rsp), %rdi
leaq 0x4(%rsp), %rcx
movl $0x4, %edx
callq 0x1e9a8
leaq 0x8(%rsp), %rsi
movq 0x30(%rsp), %rbx
movq %rbx, %rdi
callq 0x1f3de
movl $0x4, 0x18(%rbx)
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
leaq 0x58(%rsp), %r14
je 0xd546
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq %r14, %rdi
callq 0x1f9ec
jmp 0xd4b2
leaq 0x2b063(%rip), %rdi     # 0x385bd
leaq 0x2afee(%rip), %rsi     # 0x3854f
leaq 0x2b086(%rip), %rcx     # 0x385ee
movl $0x4e, %edx
callq 0x31b0
leaq 0x2b044(%rip), %rdi     # 0x385bd
leaq 0x2afcf(%rip), %rsi     # 0x3854f
leaq 0x2b067(%rip), %rcx     # 0x385ee
movl $0x5a, %edx
callq 0x31b0
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xd5cd
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
jmp 0xd5cd
jmp 0xd5ca
jmp 0xd5ca
jmp 0xd5ca
jmp 0xd5ca
jmp 0xd5ca
jmp 0xd5ca
jmp 0xd5ca
jmp 0xd5c3
jmp 0xd5ca
jmp 0xd5ca
jmp 0xd5c3
movq %rax, %rbx
jmp 0xd5d7
jmp 0xd5ca
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x1f9ec
leaq 0x88(%rsp), %rdi
callq 0x1fa00
leaq 0xb8(%rsp), %rdi
callq 0x1fa00
movq %rbx, %rdi
callq 0x34a0
nop