// File: /workspace/github_cpp_makefile_star2_O3/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 $0xa8, %rsp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x80(%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 0x50(%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, 0x3c(%rsp)
movslq %eax, %rcx
movq 0x18(%rsi), %rax
leaq (%rcx,%rcx,2), %rcx
movq (%rax,%rcx,8), %r13
movq 0x8(%rax,%rcx,8), %rbp
cmpq %rbp, %r13
je 0xe6b0
leaq 0x78(%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 0xe6a3
movl (%rax), %ecx
sarl %ecx
xorl %edx, %edx
cmpl %r14d, %ecx
sete %dl
leaq (%rax,%rdx,4), %rsi
movq %r12, %rdi
callq 0x22126
addq $0x4, %r13
cmpq %rbp, %r13
jne 0xe66e
movq 0x18(%r15), %rax
movq %rbx, 0x40(%rsp)
leal (%r14,%r14), %r12d
movslq %r12d, %rcx
leaq (%rcx,%rcx,2), %rcx
movq (%rax,%rcx,8), %rbp
movq 0x8(%rax,%rcx,8), %rbx
cmpq %rbx, %rbp
je 0xe711
leaq 0x48(%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 0xe708
movl (%rax), %ecx
sarl %ecx
xorl %edx, %edx
cmpl %r14d, %ecx
sete %dl
leaq (%rax,%rdx,4), %rsi
movq %r13, %rdi
callq 0x22126
addq $0x4, %rbp
cmpq %rbx, %rbp
jne 0xe6d3
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
movq %rsp, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0xd5fa
movl 0x18(%rsp), %ebx
testl %ebx, %ebx
jle 0xe745
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x1ef50
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xe75b
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
testl %ebx, %ebx
jg 0xe82d
movq %rsp, %rdi
leaq 0x78(%rsp), %r8
movq %r15, %rsi
movl %r12d, %edx
xorl %ecx, %ecx
callq 0xcc18
movl 0x18(%rsp), %ebx
testl %ebx, %ebx
jle 0xe78d
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x1ef50
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xe7a3
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
testl %ebx, %ebx
jg 0xe82d
movq %rsp, %rdi
leaq 0x48(%rsp), %r8
movq %r15, %rsi
movl 0x3c(%rsp), %edx
xorl %ecx, %ecx
callq 0xcc18
movl 0x18(%rsp), %ebx
testl %ebx, %ebx
jle 0xe7d6
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x1ef50
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xe7ec
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
testl %ebx, %ebx
jg 0xe82d
movq %rsp, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0xceda
movl 0x18(%rsp), %ebx
testl %ebx, %ebx
jle 0xe813
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x1ef50
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xe829
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
testl %ebx, %ebx
jle 0xe86c
movaps 0x20(%rsp), %xmm0
movq 0x40(%rsp), %rbx
movups %xmm0, (%rbx)
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rbx)
leaq 0x48(%rsp), %rdi
callq 0x1fa58
leaq 0x78(%rsp), %rdi
callq 0x1fa58
movq %rbx, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorps %xmm0, %xmm0
movq 0x40(%rsp), %rbx
movups %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0xe843
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
jmp 0xe843
jmp 0xe8a4
jmp 0xe8bf
jmp 0xe8a4
jmp 0xe8bf
jmp 0xe8a4
jmp 0xe8bf
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xe8c2
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
jmp 0xe8c2
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0xe8e0
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
jmp 0xe8e0
jmp 0xe8dd
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x1fa58
leaq 0x78(%rsp), %rdi
callq 0x1fa58
movq %rbx, %rdi
callq 0x34a0