// File: /workspace/github_cpp_makefile_star2_O1/Laakeri[P]maxpre/src/./BVE.cpp
// Function: maxPreprocessor::Preprocessor::searchAndOr(int, int, std::set<int, std::less<int>, std::allocator<int>> const&) const
pair<vector<int>, int> Preprocessor::searchAndOr(int dLit, int defVars, const set<int>& binaryClauseLits) const {
	vector<int> defClauses;
	for (int c : pi.litClauses[dLit]) {
		if (pi.clauses[c].lit.size() > 2 && ((int)pi.clauses[c].lit.size() - 1 < defVars || defVars == 0)) {
			bool f = false;
			for (int lit : pi.clauses[c].lit) {
				if (lit != dLit) {
					if (binaryClauseLits.count(litNegation(lit)) == 0) {
						f = true;
						break;
					}
				}
			}
			if (!f) {
				defVars = pi.clauses[c].lit.size() - 1;
				defClauses.clear();
				defClauses.push_back(c);
				for (int cc : pi.litClauses[litNegation(dLit)]) {
					if (pi.clauses[cc].lit.size() == 2) {
						int tl;
						if (litNegation(pi.clauses[cc].lit[0]) == dLit) {
							tl = pi.clauses[cc].lit[1];
						}
						else {
							tl = pi.clauses[cc].lit[0];
						}
						for (int lit : pi.clauses[c].lit) {
							if (litNegation(lit) == tl) {
								defClauses.push_back(cc);
								break;
							}
						}
					}
				}
				assert(defClauses.size() >= pi.clauses[c].lit.size());
			}
		}
	}
	return {defClauses, defVars};
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %ecx, %r13d
movq %rdi, 0x40(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movslq %edx, %rax
movq %rsi, 0x30(%rsp)
movq 0x18(%rsi), %rcx
leaq (%rax,%rax,2), %rax
movq (%rcx,%rax,8), %r12
movq 0x8(%rcx,%rax,8), %r9
cmpq %r9, %r12
je 0xcf76
movl %edx, %ebp
leaq 0x8(%r8), %r14
movl %edx, %eax
xorl $0x1, %eax
cltq
movq %rax, 0x50(%rsp)
movq %r8, 0x48(%rsp)
movq %r9, 0x38(%rsp)
movslq (%r12), %rax
movl %eax, 0xc(%rsp)
movq 0x30(%rsp), %rcx
movq (%rcx), %rdx
leaq (%rax,%rax,4), %rsi
movq (%rdx,%rsi,8), %rcx
movq 0x8(%rdx,%rsi,8), %rdx
movq %rdx, %rbx
subq %rcx, %rbx
sarq $0x2, %rbx
cmpq $0x3, %rbx
jb 0xcf69
cmpl %ebx, %r13d
setl %sil
testl %r13d, %r13d
setne %dil
testb %sil, %dil
jne 0xcf69
cmpq %rdx, %rcx
je 0xce3b
movq 0x10(%r8), %rsi
xorl %edi, %edi
movl (%rcx), %r15d
cmpl %ebp, %r15d
je 0xce11
xorl $0x1, %r15d
movq %r14, %r9
testq %rsi, %rsi
je 0xcdf9
movq %rsi, %r10
movq %r14, %r9
xorl %r11d, %r11d
cmpl %r15d, 0x20(%r10)
setl %r11b
cmovgeq %r10, %r9
movq 0x10(%r10,%r11,8), %r10
testq %r10, %r10
jne 0xcde0
movq %r14, %r10
cmpq %r14, %r9
je 0xce0c
cmpl 0x20(%r9), %r15d
cmovlq %r14, %r9
movq %r9, %r10
cmpq %r14, %r10
je 0xce24
xorl %r9d, %r9d
testb %r9b, %r9b
jne 0xce2c
addq $0x4, %rcx
cmpq %rdx, %rcx
jne 0xcdc6
jmp 0xce2c
movb $0x1, %dil
movb $0x1, %r9b
jmp 0xce14
testb $0x1, %dil
movq 0x38(%rsp), %r9
jne 0xcf69
movq 0x10(%rsp), %rcx
cmpq %rcx, 0x18(%rsp)
je 0xce4c
movq %rcx, 0x18(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0xce65
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0xce74
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x98e8
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x50(%rsp), %rcx
leaq (%rcx,%rcx,2), %rcx
movq (%rax,%rcx,8), %r13
movq 0x8(%rax,%rcx,8), %r15
cmpq %r15, %r13
je 0xcf31
movslq (%r13), %rax
movl %eax, 0x2c(%rsp)
movq 0x30(%rsp), %rcx
movq (%rcx), %rcx
leaq (%rax,%rax,4), %rax
movq (%rcx,%rax,8), %rdx
movq 0x8(%rcx,%rax,8), %rax
subq %rdx, %rax
cmpq $0x8, %rax
jne 0xcf28
movl (%rdx), %eax
xorl %ebp, %eax
xorl %esi, %esi
cmpl $0x1, %eax
sete %dil
movslq 0xc(%rsp), %rax
leaq (%rax,%rax,4), %r8
movq (%rcx,%r8,8), %rax
movq 0x8(%rcx,%r8,8), %rcx
cmpq %rcx, %rax
je 0xcf28
movb %dil, %sil
movl (%rdx,%rsi,4), %edx
movl (%rax), %esi
xorl %edx, %esi
cmpl $0x1, %esi
je 0xcefc
addq $0x4, %rax
cmpq %rcx, %rax
jne 0xcee8
jmp 0xcf28
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0xcf19
movl 0x2c(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0xcf28
leaq 0x10(%rsp), %rdi
leaq 0x2c(%rsp), %rdx
callq 0x98e8
addq $0x4, %r13
jmp 0xce8f
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
movslq 0xc(%rsp), %rcx
movq 0x30(%rsp), %rdx
movq (%rdx), %rdx
leaq (%rcx,%rcx,4), %rcx
movq 0x8(%rdx,%rcx,8), %rsi
subq (%rdx,%rcx,8), %rsi
cmpq %rsi, %rax
jb 0xcfb5
decl %ebx
movl %ebx, %r13d
movq 0x48(%rsp), %r8
movq 0x38(%rsp), %r9
addq $0x4, %r12
cmpq %r9, %r12
jne 0xcd73
leaq 0x10(%rsp), %rsi
movq 0x40(%rsp), %rbx
movq %rbx, %rdi
callq 0x1ffa6
movl %r13d, 0x18(%rbx)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xcfa3
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2c4b5(%rip), %rdi     # 0x39471
leaq 0x2c4dc(%rip), %rsi     # 0x3949f
leaq 0x2c4df(%rip), %rcx     # 0x394a9
movl $0x2d, %edx
callq 0x31b0
jmp 0xcfd8
jmp 0xcfd8
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xcff2
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq %rbx, %rdi
callq 0x34a0