// File: /workspace/github_cpp_makefile_star2_O1/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), %r12d
movslq %r12d, %rcx
movq 0x18(%rsi), %rax
leaq (%rcx,%rcx,2), %rcx
movq (%rax,%rcx,8), %r9
movq 0x8(%rax,%rcx,8), %r8
movb $0x1, %sil
movb $0x1, %dl
cmpq %r8, %r9
movq %rdi, 0x38(%rsp)
je 0xd084
movq (%r14), %rdx
addq $0x4, %r9
xorl %r10d, %r10d
movslq -0x4(%r9), %r11
leaq (%r11,%r11,4), %r11
movq 0x8(%rdx,%r11,8), %r15
subq (%rdx,%r11,8), %r15
xorl %r11d, %r11d
cmpq $0xc, %r15
sete %r11b
testl %r10d, %r10d
setne %bpl
addl %r11d, %r10d
testb %bpl, %r11b
jne 0xd078
leaq 0x4(%r9), %r11
cmpq %r8, %r9
movq %r11, %r9
jne 0xd041
cmpl $0x2, %r10d
setb %dl
movq 0x38(%rsp), %rdi
orl $0x1, %r12d
movslq %r12d, %r8
leaq (%r8,%r8,2), %r12
movq (%rax,%r12,8), %r8
movq 0x8(%rax,%r12,8), %r15
cmpq %r15, %r8
je 0xd0e6
movq (%r14), %rsi
addq $0x4, %r8
xorl %r9d, %r9d
movslq -0x4(%r8), %r10
leaq (%r10,%r10,4), %r10
movq 0x8(%rsi,%r10,8), %r11
subq (%rsi,%r10,8), %r11
xorl %r10d, %r10d
cmpq $0xc, %r11
sete %r10b
testl %r9d, %r9d
setne %r11b
addl %r10d, %r9d
testb %r11b, %r10b
jne 0xd0de
leaq 0x4(%r8), %r10
cmpq %r15, %r8
movq %r10, %r8
jne 0xd0a7
cmpl $0x2, %r9d
setb %sil
orb %sil, %dl
testb $0x1, %dl
je 0xd100
xorps %xmm0, %xmm0
movups %xmm0, 0xc(%rdi)
movups %xmm0, (%rdi)
movq %rdi, %rax
jmp 0xd6f5
movq %r12, 0x20(%rsp)
leaq (%rax,%rcx,8), %rax
leaq 0xc0(%rsp), %rdx
xorl %ecx, %ecx
movl %ecx, (%rdx)
movq %rcx, 0x8(%rdx)
movq %rdx, 0x10(%rdx)
movq %rdx, 0x18(%rdx)
movq %rcx, 0x20(%rdx)
leaq 0x90(%rsp), %rdx
movl %ecx, (%rdx)
movq %rcx, 0x8(%rdx)
movq %rdx, 0x10(%rdx)
movq %rdx, 0x18(%rdx)
movq %rcx, 0x20(%rdx)
movq (%rax), %rbp
movq 0x8(%rax), %r15
cmpq %r15, %rbp
je 0xd208
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 0xd1fb
movl (%rdx), %eax
movl %eax, 0x48(%rsp)
movl 0x4(%rdx), %ecx
movl %ecx, 0x8(%rsp)
movl 0x8(%rdx), %edx
movl %eax, %esi
sarl %esi
cmpl %ebx, %esi
jne 0xd193
movl %edx, 0x48(%rsp)
jmp 0xd195
movl %edx, %eax
sarl %ecx
cmpl %ebx, %ecx
jne 0xd19f
movl %eax, 0x8(%rsp)
movl 0x48(%rsp), %eax
sarl %eax
cmpl %ebx, %eax
je 0xd707
movl 0x8(%rsp), %eax
sarl %eax
cmpl %ebx, %eax
je 0xd707
leaq 0xb8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x1f858
movq %rax, %rdi
movq %r13, %rsi
callq 0x1f8bc
movl %r12d, (%rax)
leaq 0xb8(%rsp), %rdi
movq %r13, %rsi
callq 0x1f858
movq %rax, %rdi
leaq 0x48(%rsp), %rsi
callq 0x1f8bc
movl %r12d, (%rax)
addq $0x4, %rbp
cmpq %r15, %rbp
jne 0xd154
movq 0x18(%r14), %rax
movq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rbp
movq 0x8(%rax,%rcx,8), %r15
cmpq %r15, %rbp
je 0xd2dc
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 0xd2cf
movl (%rdx), %eax
movl %eax, 0x48(%rsp)
movl 0x4(%rdx), %ecx
movl %ecx, 0x8(%rsp)
movl 0x8(%rdx), %edx
movl %eax, %esi
sarl %esi
cmpl %ebx, %esi
jne 0xd267
movl %edx, 0x48(%rsp)
jmp 0xd269
movl %edx, %eax
sarl %ecx
cmpl %ebx, %ecx
jne 0xd273
movl %eax, 0x8(%rsp)
movl 0x48(%rsp), %eax
sarl %eax
cmpl %ebx, %eax
je 0xd726
movl 0x8(%rsp), %eax
sarl %eax
cmpl %ebx, %eax
je 0xd726
leaq 0x88(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x1f858
movq %rax, %rdi
movq %r13, %rsi
callq 0x1f8bc
movl %r12d, (%rax)
leaq 0x88(%rsp), %rdi
movq %r13, %rsi
callq 0x1f858
movq %rax, %rdi
leaq 0x48(%rsp), %rsi
callq 0x1f8bc
movl %r12d, (%rax)
addq $0x4, %rbp
cmpq %r15, %rbp
jne 0xd228
movq 0xd0(%rsp), %rbx
leaq 0xc0(%rsp), %rax
cmpq %rax, %rbx
je 0xd6c7
leaq 0x50(%rsp), %r14
leaq 0xb8(%rsp), %r12
movq %rsp, %r13
movl 0x20(%rbx), %eax
movl %eax, 0x48(%rsp)
leaq 0x28(%rbx), %rsi
movq %r14, %rdi
callq 0x203ea
movq %rbx, 0x80(%rsp)
movl 0x48(%rsp), %eax
movl %eax, (%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x1f858
movq %rax, %r15
movq 0x18(%rax), %rbp
addq $0x8, %r15
cmpq %r15, %rbp
je 0xd46d
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 0x1f858
movq 0x10(%rax), %rdx
addq $0x8, %rax
movq %rax, %rcx
testq %rdx, %rdx
je 0xd395
movl 0x8(%rsp), %esi
movq %rax, %rcx
xorl %edi, %edi
cmpl %esi, 0x20(%rdx)
setl %dil
cmovgeq %rdx, %rcx
movq 0x10(%rdx,%rdi,8), %rdx
testq %rdx, %rdx
jne 0xd37e
movq %rax, %rdx
cmpq %rax, %rcx
je 0xd3ab
movl 0x8(%rsp), %edx
cmpl 0x20(%rcx), %edx
cmovlq %rax, %rcx
movq %rcx, %rdx
cmpq %rax, %rdx
je 0xd457
leaq 0x88(%rsp), %rdi
movq %r13, %rsi
callq 0x1f858
movl 0x8(%rsp), %ecx
xorl $0x1, %ecx
movq 0x10(%rax), %rsi
addq $0x8, %rax
movq %rax, %rdx
testq %rsi, %rsi
je 0xd3f5
movq %rax, %rdx
xorl %edi, %edi
cmpl %ecx, 0x20(%rsi)
setl %dil
cmovgeq %rsi, %rdx
movq 0x10(%rsi,%rdi,8), %rsi
testq %rsi, %rsi
jne 0xd3de
movq %rax, %rsi
cmpq %rax, %rdx
je 0xd407
cmpl 0x20(%rdx), %ecx
cmovlq %rax, %rdx
movq %rdx, %rsi
cmpq %rax, %rsi
je 0xd457
movq %r12, %rdi
movq %r13, %rsi
callq 0x1f858
movq %rax, %rdi
leaq 0x8(%rsp), %rsi
callq 0x1f8bc
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
movq %r13, %rsi
callq 0x1f858
movl 0x8(%rsp), %ecx
xorl $0x1, %ecx
movl %ecx, 0x28(%rsp)
movq %rax, %rdi
leaq 0x28(%rsp), %rsi
callq 0x1f920
movl (%rbx), %ecx
movl %ecx, 0x20(%rsp)
movl (%rax), %ebx
movq %rbp, %rdi
callq 0x31f0
movq %rax, %rbp
cmpq %r15, %rax
jne 0xd353
jmp 0xd47a
movl $0xffffffff, 0x20(%rsp) # imm = 0xFFFFFFFF
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $-0x1, 0x20(%rsp)
je 0xd606
movl (%rsp), %eax
xorl $0x1, %eax
movl %eax, 0x8(%rsp)
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
callq 0x1f984
movq %rax, %rbp
movl %ebx, 0x40(%rsp)
movq 0x18(%rax), %r15
addq $0x8, %rbp
cmpq %rbp, %r15
je 0xd610
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movq 0x20(%r15), %rax
movq %rax, 0x8(%rsp)
movl (%rsp), %eax
xorl $0x1, %eax
movl %eax, 0x28(%rsp)
movq %r12, %rdi
leaq 0x28(%rsp), %rsi
callq 0x1f984
movq 0x10(%rax), %rdx
addq $0x8, %rax
movq %rax, %rcx
testq %rdx, %rdx
je 0xd50d
movl 0x8(%rsp), %esi
movq %rax, %rcx
xorl %edi, %edi
cmpl %esi, 0x20(%rdx)
setl %dil
cmovgeq %rdx, %rcx
movq 0x10(%rdx,%rdi,8), %rdx
testq %rdx, %rdx
jne 0xd4f6
movq %rax, %rdx
cmpq %rax, %rcx
je 0xd523
movl 0x8(%rsp), %edx
cmpl 0x20(%rcx), %edx
cmovlq %rax, %rcx
movq %rcx, %rdx
cmpq %rax, %rdx
je 0xd5f0
movl (%rsp), %eax
xorl $0x1, %eax
movl %eax, 0x4(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x1f984
movl 0x8(%rsp), %ecx
xorl $0x1, %ecx
movq 0x10(%rax), %rsi
addq $0x8, %rax
movq %rax, %rdx
testq %rsi, %rsi
je 0xd579
movq %rax, %rdx
xorl %edi, %edi
cmpl %ecx, 0x20(%rsi)
setl %dil
cmovgeq %rsi, %rdx
movq 0x10(%rsi,%rdi,8), %rsi
testq %rsi, %rsi
jne 0xd562
movq %rax, %rsi
cmpq %rax, %rdx
je 0xd58b
cmpl 0x20(%rdx), %ecx
cmovlq %rax, %rdx
movq %rdx, %rsi
cmpq %rax, %rsi
je 0xd5f0
movl (%rsp), %eax
xorl $0x1, %eax
movl %eax, 0x28(%rsp)
movq %r12, %rdi
leaq 0x28(%rsp), %rsi
callq 0x1f984
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x1f8bc
movq %rax, %rbx
movl (%rsp), %eax
xorl $0x1, %eax
movl %eax, 0x4(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x1f984
movl 0x8(%rsp), %ecx
xorl $0x1, %ecx
movl %ecx, 0x44(%rsp)
movq %rax, %rdi
leaq 0x44(%rsp), %rsi
callq 0x1f920
movl (%rbx), %ebx
movl (%rax), %r14d
movq %r15, %rdi
callq 0x31f0
movq %rax, %r15
cmpq %rbp, %rax
jne 0xd4bf
jmp 0xd61b
movl $0xb, %ebp
jmp 0xd690
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
xorl %ebp, %ebp
cmpl $0x0, 0x20(%rsp)
js 0xd690
testl %ebx, %ebx
js 0xd690
movl 0x20(%rsp), %eax
movl %eax, 0x28(%rsp)
movl 0x40(%rsp), %eax
movl %eax, 0x2c(%rsp)
movl %ebx, 0x30(%rsp)
movl %r14d, 0x34(%rsp)
movl $0x4, %edx
leaq 0x8(%rsp), %r14
movq %r14, %rdi
leaq 0x28(%rsp), %rsi
leaq 0x4(%rsp), %rcx
callq 0x1f586
movq 0x38(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1ffa6
movl $0x4, 0x18(%rbx)
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xd68b
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movl $0x1, %ebp
leaq 0x50(%rsp), %r14
movq %r14, %rdi
callq 0x205be
cmpl $0xb, %ebp
je 0xd6a6
testl %ebp, %ebp
jne 0xd6d6
movq 0x80(%rsp), %rdi
callq 0x31f0
movq %rax, %rbx
leaq 0xc0(%rsp), %rax
cmpq %rax, %rbx
jne 0xd305
xorps %xmm0, %xmm0
movq 0x38(%rsp), %rax
movups %xmm0, 0xc(%rax)
movups %xmm0, (%rax)
leaq 0x88(%rsp), %rdi
callq 0x205d2
leaq 0xb8(%rsp), %rdi
callq 0x205d2
movq 0x38(%rsp), %rax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2bdff(%rip), %rdi     # 0x3950d
leaq 0x2bd8a(%rip), %rsi     # 0x3949f
leaq 0x2be22(%rip), %rcx     # 0x3953e
movl $0x4e, %edx
callq 0x31b0
leaq 0x2bde0(%rip), %rdi     # 0x3950d
leaq 0x2bd6b(%rip), %rsi     # 0x3949f
leaq 0x2be03(%rip), %rcx     # 0x3953e
movl $0x5a, %edx
callq 0x31b0
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xd77d
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
jmp 0xd77d
jmp 0xd77a
jmp 0xd77a
jmp 0xd76b
jmp 0xd786
jmp 0xd76b
movq %rax, %rbx
jmp 0xd791
jmp 0xd77a
jmp 0xd77a
jmp 0xd77a
jmp 0xd786
jmp 0xd77a
movq %rax, %rbx
leaq 0x50(%rsp), %r14
jmp 0xd789
jmp 0xd786
movq %rax, %rbx
movq %r14, %rdi
callq 0x205be
leaq 0x88(%rsp), %rdi
callq 0x205d2
leaq 0xb8(%rsp), %rdi
callq 0x205d2
movq %rbx, %rdi
callq 0x34a0
nop