// File: /workspace/github_cpp_makefile_star2_O2/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 $0x108, %rsp            # imm = 0x108
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, 0x48(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0xc0(%rsp)
andq $0x0, 0xd0(%rsp)
leal (%rbx,%rbx), %esi
movslq %esi, %rcx
movq (%r14), %rax
movq 0x18(%r14), %rdx
imulq $0x18, %rcx, %rcx
movq (%rdx,%rcx), %rbp
movq 0x8(%rdx,%rcx), %r15
xorl %edi, %edi
movq %rbp, %r8
cmpq %r15, %r8
je 0xa2fc
movslq (%r8), %rcx
imulq $0x28, %rcx, %rcx
movq 0x8(%rax,%rcx), %r9
subq (%rax,%rcx), %r9
cmpq $0xc, %r9
jne 0xa2f6
leal 0x1(%rdi), %ecx
testl %edi, %edi
movl %ecx, %edi
jg 0xa2fe
addq $0x4, %r8
jmp 0xa2d2
movl %edi, %ecx
orl $0x1, %esi
movslq %esi, %rsi
imulq $0x18, %rsi, %r10
movq (%rdx,%r10), %rsi
movq 0x8(%rdx,%r10), %rdx
xorl %edi, %edi
cmpq %rdx, %rsi
je 0xa33f
movslq (%rsi), %r8
imulq $0x28, %r8, %r8
movq 0x8(%rax,%r8), %r9
subq (%rax,%r8), %r9
cmpq $0xc, %r9
jne 0xa339
leal 0x1(%rdi), %r8d
testl %edi, %edi
movl %r8d, %edi
jg 0xa342
addq $0x4, %rsi
jmp 0xa313
movl %edi, %r8d
cmpl $0x2, %ecx
setl %al
cmpl $0x2, %r8d
setl %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0xa381
xorps %xmm0, %xmm0
movq 0x48(%rsp), %rbx
movups %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
leaq 0x50(%rsp), %rdi
andq $0x0, 0x10(%rdi)
movaps %xmm0, (%rdi)
andl $0x0, 0x18(%rbx)
callq 0x7512
jmp 0xa857
movq %r10, 0x30(%rsp)
leaq 0xe0(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq 0x98(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq 0x10(%rsp), %r13
cmpq %r15, %rbp
je 0xa47e
movslq (%rbp), %r12
movq (%r14), %rax
imulq $0x28, %r12, %rcx
movq (%rax,%rcx), %rdx
movq 0x8(%rax,%rcx), %rax
subq %rdx, %rax
cmpq $0xc, %rax
jne 0xa475
movl (%rdx), %ecx
movl %ecx, 0x50(%rsp)
movl 0x4(%rdx), %eax
movl %eax, 0x10(%rsp)
movl 0x8(%rdx), %esi
movl %ecx, %edx
sarl %edx
cmpl %ebx, %edx
jne 0xa40f
movl %esi, 0x50(%rsp)
movl %esi, %edx
jmp 0xa413
movl %ecx, %edx
movl %esi, %ecx
movl %eax, %esi
sarl %esi
cmpl %ebx, %esi
jne 0xa421
movl %ecx, 0x10(%rsp)
movl %ecx, %eax
sarl %edx
cmpl %ebx, %edx
je 0xa879
sarl %eax
cmpl %ebx, %eax
je 0xa879
leaq 0xd8(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x18ca0
movq %rax, %rdi
movq %r13, %rsi
callq 0x18cee
movl %r12d, (%rax)
leaq 0xd8(%rsp), %rdi
movq %r13, %rsi
callq 0x18ca0
movq %rax, %rdi
leaq 0x50(%rsp), %rsi
callq 0x18cee
movl %r12d, (%rax)
addq $0x4, %rbp
jmp 0xa3c5
movq 0x18(%r14), %rax
movq 0x30(%rsp), %rcx
movq (%rax,%rcx), %rbp
movq 0x8(%rax,%rcx), %r15
leaq 0x10(%rsp), %r13
cmpq %r15, %rbp
je 0xa54e
movslq (%rbp), %r12
movq (%r14), %rax
imulq $0x28, %r12, %rcx
movq (%rax,%rcx), %rdx
movq 0x8(%rax,%rcx), %rax
subq %rdx, %rax
cmpq $0xc, %rax
jne 0xa545
movl (%rdx), %ecx
movl %ecx, 0x50(%rsp)
movl 0x4(%rdx), %eax
movl %eax, 0x10(%rsp)
movl 0x8(%rdx), %esi
movl %ecx, %edx
sarl %edx
cmpl %ebx, %edx
jne 0xa4df
movl %esi, 0x50(%rsp)
movl %esi, %edx
jmp 0xa4e3
movl %ecx, %edx
movl %esi, %ecx
movl %eax, %esi
sarl %esi
cmpl %ebx, %esi
jne 0xa4f1
movl %ecx, 0x10(%rsp)
movl %ecx, %eax
sarl %edx
cmpl %ebx, %edx
je 0xa892
sarl %eax
cmpl %ebx, %eax
je 0xa892
leaq 0x90(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x18ca0
movq %rax, %rdi
movq %r13, %rsi
callq 0x18cee
movl %r12d, (%rax)
leaq 0x90(%rsp), %rdi
movq %r13, %rsi
callq 0x18ca0
movq %rax, %rdi
leaq 0x50(%rsp), %rsi
callq 0x18cee
movl %r12d, (%rax)
addq $0x4, %rbp
jmp 0xa495
leaq 0xd8(%rsp), %r15
movq 0x18(%r15), %r14
leaq 0x4(%rsp), %rbp
leaq 0x10(%rsp), %rbx
leaq 0xe0(%rsp), %rax
cmpq %rax, %r14
je 0xa7b9
leaq 0x20(%r14), %rsi
leaq 0x50(%rsp), %rdi
callq 0x18d3c
movl 0x50(%rsp), %eax
movl %eax, 0x4(%rsp)
movq %r15, %rdi
movq %rbp, %rsi
callq 0x18ca0
movq %rax, %r12
movq %r14, 0x88(%rsp)
movq 0x18(%rax), %r13
addq $0x8, %r12
pushq $-0x1
popq %rax
movl %eax, %r14d
movl %eax, 0x30(%rsp)
cmpq %r12, %r13
je 0xa667
movq 0x20(%r13), %rax
movq %rax, 0x10(%rsp)
movq %r15, %rdi
movq %rbp, %rsi
callq 0x18ca0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x18d4e
testq %rax, %rax
je 0xa657
leaq 0x90(%rsp), %rdi
movq %rbp, %rsi
callq 0x18ca0
movl 0x10(%rsp), %ecx
xorl $0x1, %ecx
movl %ecx, 0x38(%rsp)
movq %rax, %rdi
leaq 0x38(%rsp), %rsi
callq 0x18d4e
testq %rax, %rax
je 0xa657
movq %r15, %rdi
movq %rbp, %rsi
callq 0x18ca0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x18cee
movq %rax, %r14
leaq 0x90(%rsp), %rdi
movq %rbp, %rsi
callq 0x18ca0
movl 0x10(%rsp), %ecx
xorl $0x1, %ecx
movl %ecx, 0x38(%rsp)
movq %rax, %rdi
leaq 0x38(%rsp), %rsi
callq 0x18d68
movl (%r14), %r14d
movl (%rax), %eax
movl %eax, 0x30(%rsp)
movq %r13, %rdi
callq 0x3200
movq %rax, %r13
jmp 0xa5b3
movl %r14d, 0x28(%rsp)
cmpl $-0x1, %r14d
je 0xa79a
movl 0x4(%rsp), %eax
xorl $0x1, %eax
movl %eax, 0x10(%rsp)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x18db6
movq %rax, %r13
movq 0x18(%rax), %r12
addq $0x8, %r13
pushq $-0x1
popq %rax
movl %eax, %r14d
movl %eax, 0x2c(%rsp)
cmpq %r13, %r12
je 0xa78e
movq 0x20(%r12), %rax
movq %rax, 0x10(%rsp)
movl 0x4(%rsp), %eax
xorl $0x1, %eax
movl %eax, 0x38(%rsp)
movq %r15, %rdi
leaq 0x38(%rsp), %rsi
callq 0x18db6
movq %rax, %rdi
movq %rbx, %rsi
callq 0x18d4e
testq %rax, %rax
je 0xa77e
movl 0x4(%rsp), %eax
xorl $0x1, %eax
movl %eax, 0x8(%rsp)
leaq 0x90(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x18db6
movl 0x10(%rsp), %ecx
xorl $0x1, %ecx
movl %ecx, 0xc(%rsp)
movq %rax, %rdi
leaq 0xc(%rsp), %rsi
callq 0x18d4e
testq %rax, %rax
je 0xa77e
movl 0x4(%rsp), %eax
xorl $0x1, %eax
movl %eax, 0x38(%rsp)
movq %r15, %rdi
leaq 0x38(%rsp), %rsi
callq 0x18db6
movq %rax, %rdi
movq %rbx, %rsi
callq 0x18cee
movq %rax, %r14
movl 0x4(%rsp), %eax
xorl $0x1, %eax
movl %eax, 0x8(%rsp)
leaq 0x90(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x18db6
movl 0x10(%rsp), %ecx
xorl $0x1, %ecx
movl %ecx, 0xc(%rsp)
movq %rax, %rdi
leaq 0xc(%rsp), %rsi
callq 0x18d68
movl (%r14), %r14d
movl (%rax), %eax
movl %eax, 0x2c(%rsp)
movq %r12, %rdi
callq 0x3200
movq %rax, %r12
jmp 0xa6a1
cmpl $0x0, 0x28(%rsp)
js 0xa79a
testl %r14d, %r14d
jns 0xa7e1
leaq 0x58(%rsp), %rdi
callq 0x19800
movq 0x88(%rsp), %rdi
callq 0x3200
movq %rax, %r14
jmp 0xa564
xorps %xmm0, %xmm0
movq 0x48(%rsp), %rbx
movups %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
leaq 0x50(%rsp), %rdi
andq $0x0, 0x10(%rdi)
movaps %xmm0, (%rdi)
andl $0x0, 0x18(%rbx)
callq 0x7512
jmp 0xa83d
leaq 0x38(%rsp), %rsi
movl 0x28(%rsp), %eax
movl %eax, (%rsi)
movl 0x30(%rsp), %eax
movl %eax, 0x4(%rsi)
movl %r14d, 0x8(%rsi)
movl 0x2c(%rsp), %eax
movl %eax, 0xc(%rsi)
leaq 0x10(%rsp), %rdi
pushq $0x4
popq %rdx
leaq 0x8(%rsp), %rcx
callq 0x18af6
leaq 0x10(%rsp), %rsi
movq 0x48(%rsp), %rbx
movq %rbx, %rdi
callq 0x19284
movl $0x4, 0x18(%rbx)
leaq 0x10(%rsp), %rdi
callq 0x7512
leaq 0x58(%rsp), %rdi
callq 0x19800
leaq 0x90(%rsp), %rdi
callq 0x19814
leaq 0xd8(%rsp), %rdi
callq 0x19814
leaq 0xc0(%rsp), %rdi
callq 0x7512
movq %rbx, %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x24cbd(%rip), %rdi     # 0x2f53d
leaq 0x24c48(%rip), %rsi     # 0x2f4cf
leaq 0x24ce0(%rip), %rcx     # 0x2f56e
pushq $0x4e
jmp 0xa8a9
leaq 0x24ca4(%rip), %rdi     # 0x2f53d
leaq 0x24c2f(%rip), %rsi     # 0x2f4cf
leaq 0x24cc7(%rip), %rcx     # 0x2f56e
pushq $0x5a
popq %rdx
callq 0x31c0
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x7512
jmp 0xa8e2
jmp 0xa8df
jmp 0xa8df
jmp 0xa8c8
jmp 0xa8df
jmp 0xa8c8
movq %rax, %rbx
jmp 0xa8ec
jmp 0xa8df
jmp 0xa8df
jmp 0xa8df
jmp 0xa8df
jmp 0xa8df
jmp 0xa8df
jmp 0xa8df
jmp 0xa8df
jmp 0xa8df
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x19800
leaq 0x90(%rsp), %rdi
callq 0x19814
leaq 0xd8(%rsp), %rdi
callq 0x19814
leaq 0xc0(%rsp), %rdi
callq 0x7512
movq %rbx, %rdi
callq 0x3490
nop