// File: /workspace/github_cpp_makefile_star2_O1/Laakeri[P]maxpre/src/./BVE.cpp
// Function: maxPreprocessor::Preprocessor::tryBVEGE(int)
vector<int> Preprocessor::tryBVEGE(int var) {
	set<int> negBinaryClauseLits, posBinaryClauseLits;
	
	for (int c : pi.litClauses[negLit(var)]) {
		if (pi.clauses[c].lit.size() == 2) {
			if (litVariable(pi.clauses[c].lit[0]) == var) {
				negBinaryClauseLits.insert(pi.clauses[c].lit[1]);
			}
			else {
				negBinaryClauseLits.insert(pi.clauses[c].lit[0]);
			}
		}
	}
	for (int c : pi.litClauses[posLit(var)]) {
		if (pi.clauses[c].lit.size() == 2) {
			if (litVariable(pi.clauses[c].lit[0]) == var) {
				posBinaryClauseLits.insert(pi.clauses[c].lit[1]);
			}
			else {
				posBinaryClauseLits.insert(pi.clauses[c].lit[0]);
			}
		}
	}
	
	//Find the shortest definition
	vector<int> defClauses;
	int defVars = 0;
	if (defVars == 0) {
		auto tr = searchXor(var);
		if (tr.S > 0) {
			defVars = tr.S;
			defClauses = tr.F;
		}
	}
	if (defVars == 0) {
		auto tr = searchAndOr(posLit(var), defVars, negBinaryClauseLits);
		if (tr.S > 0) {
			defVars = tr.S;
			defClauses = tr.F;
		}
	}
	if (defVars == 0) {
		auto tr = searchAndOr(negLit(var), defVars, posBinaryClauseLits);
		if (tr.S > 0) {
			defVars = tr.S;
			defClauses = tr.F;
		}
	}
	if (defVars == 0) {
		auto tr = searchITE(var);
		if (tr.S > 0) {
			defVars = tr.S;
			defClauses = tr.F;
		}
	}
	if (defVars > 0) {
		return defClauses;
	}
	return vector<int>();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, 0x50(%rsp)
leaq 0x90(%rsp), %rax
xorl %ecx, %ecx
movl %ecx, (%rax)
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
leaq 0x60(%rsp), %rax
movl %ecx, (%rax)
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
leal 0x1(%r14,%r14), %eax
movl %eax, 0x2c(%rsp)
cltq
movq 0x18(%rsi), %rcx
leaq (%rax,%rax,2), %rax
movq (%rcx,%rax,8), %r13
movq 0x8(%rcx,%rax,8), %rbp
cmpq %rbp, %r13
je 0xe970
leaq 0x88(%rsp), %r12
movslq (%r13), %rax
movq (%r15), %rcx
leaq (%rax,%rax,4), %rdx
movq (%rcx,%rdx,8), %rax
movq 0x8(%rcx,%rdx,8), %rcx
subq %rax, %rcx
cmpq $0x8, %rcx
jne 0xe967
movl (%rax), %ecx
sarl %ecx
xorl %edx, %edx
cmpl %r14d, %ecx
sete %dl
leaq (%rax,%rdx,4), %rsi
movq %r12, %rdi
callq 0x22d60
addq $0x4, %r13
cmpq %rbp, %r13
jne 0xe932
leal (%r14,%r14), %r12d
movslq %r12d, %rax
movq 0x18(%r15), %rcx
leaq (%rax,%rax,2), %rax
movq (%rcx,%rax,8), %rbp
movq 0x8(%rcx,%rax,8), %rbx
cmpq %rbx, %rbp
je 0xe9d0
leaq 0x58(%rsp), %r13
movslq (%rbp), %rax
movq (%r15), %rcx
leaq (%rax,%rax,4), %rdx
movq (%rcx,%rdx,8), %rax
movq 0x8(%rcx,%rdx,8), %rcx
subq %rax, %rcx
cmpq $0x8, %rcx
jne 0xe9c7
movl (%rax), %ecx
sarl %ecx
xorl %edx, %edx
cmpl %r14d, %ecx
sete %dl
leaq (%rax,%rdx,4), %rsi
movq %r13, %rdi
callq 0x22d60
addq $0x4, %rbp
cmpq %rbx, %rbp
jne 0xe992
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0xd7b4
movl 0x20(%rsp), %r13d
testl %r13d, %r13d
movq 0x50(%rsp), %rbp
jle 0xea11
leaq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x1fb22
jmp 0xea14
xorl %r13d, %r13d
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xea2b
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
testl %r13d, %r13d
jne 0xea7e
leaq 0x8(%rsp), %rdi
xorl %r13d, %r13d
leaq 0x88(%rsp), %r8
movq %r15, %rsi
movl %r12d, %edx
xorl %ecx, %ecx
callq 0xcd0e
movl 0x20(%rsp), %ebx
testl %ebx, %ebx
jle 0xea67
leaq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x1fb22
movl %ebx, %r13d
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xea7e
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
testl %r13d, %r13d
jne 0xeacf
leaq 0x8(%rsp), %rdi
xorl %r13d, %r13d
leaq 0x58(%rsp), %r8
movq %r15, %rsi
movl 0x2c(%rsp), %edx
xorl %ecx, %ecx
callq 0xcd0e
movl 0x20(%rsp), %ebx
testl %ebx, %ebx
jle 0xeab8
leaq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x1fb22
movl %ebx, %r13d
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xeacf
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
testl %r13d, %r13d
jne 0xeb19
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0xcffa
movl 0x20(%rsp), %r13d
testl %r13d, %r13d
jle 0xeaff
leaq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x1fb22
jmp 0xeb02
xorl %r13d, %r13d
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xeb19
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq %rbp, %rax
testl %r13d, %r13d
jle 0xeb3d
leaq 0x30(%rsp), %rax
movq (%rax), %rcx
movq %rcx, (%rbp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rbp)
movq 0x10(%rax), %rcx
movq %rcx, 0x10(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xeb62
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
leaq 0x58(%rsp), %rdi
callq 0x2062a
leaq 0x88(%rsp), %rdi
callq 0x2062a
movq %rbp, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xeb9a
jmp 0xeb9a
jmp 0xeb9a
jmp 0xebb6
jmp 0xebb6
jmp 0xebb6
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xebb9
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
jmp 0xebb9
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xebd7
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
jmp 0xebd7
jmp 0xebd4
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x2062a
leaq 0x88(%rsp), %rdi
callq 0x2062a
movq %rbx, %rdi
callq 0x34a0