// File: /workspace/github_cpp_makefile_star2_O3/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 $0x68, %rsp
movl %ecx, %r13d
movq %rdi, 0x48(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movslq %edx, %rax
movq 0x18(%rsi), %rcx
leaq (%rax,%rax,2), %rax
movq (%rcx,%rax,8), %r12
movq 0x8(%rcx,%rax,8), %rax
movq %rax, 0x60(%rsp)
cmpq %rax, %r12
je 0xce55
movl %edx, %ebp
movq %rsi, %r15
movq %r8, 0x58(%rsp)
leaq 0x8(%r8), %rax
movq %rax, 0x40(%rsp)
movl %edx, %eax
xorl $0x1, %eax
cltq
movq %rax, 0x50(%rsp)
movq (%rsi), %rcx
xorl %esi, %esi
movq $0x0, 0x38(%rsp)
movslq (%r12), %rdx
movl %edx, 0xc(%rsp)
leaq (%rdx,%rdx,4), %r8
movq (%rcx,%r8,8), %rdi
movq 0x8(%rcx,%r8,8), %r8
movq %r8, %rbx
subq %rdi, %rbx
sarq $0x2, %rbx
cmpq $0x3, %rbx
jb 0xce46
cmpl %ebx, %r13d
setl %r9b
testl %r13d, %r13d
setne %r10b
testb %r9b, %r10b
jne 0xce46
cmpq %r8, %rdi
je 0xcd2e
movq 0x58(%rsp), %rax
movq 0x10(%rax), %r9
movl (%rdi), %r10d
cmpl %ebp, %r10d
je 0xcd25
testq %r9, %r9
je 0xce46
xorl $0x1, %r10d
movq %r9, %r14
movq 0x40(%rsp), %r11
xorl %eax, %eax
cmpl %r10d, 0x20(%r14)
setl %al
cmovgeq %r14, %r11
movq 0x10(%r14,%rax,8), %r14
testq %r14, %r14
jne 0xccf9
cmpq 0x40(%rsp), %r11
je 0xce46
cmpl 0x20(%r11), %r10d
jl 0xce46
addq $0x4, %rdi
cmpq %r8, %rdi
jne 0xccdc
movq 0x38(%rsp), %rax
cmpq %rax, %rsi
je 0xcd40
movq %rax, 0x18(%rsp)
movq %rax, %rsi
cmpq 0x20(%rsp), %rsi
je 0xcd54
movl %edx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0xcd63
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x98f8
movq 0x18(%r15), %rax
movq 0x50(%rsp), %rcx
leaq (%rcx,%rcx,2), %rcx
movq (%rax,%rcx,8), %r13
movq 0x8(%rax,%rcx,8), %r14
cmpq %r14, %r13
je 0xce12
movslq (%r13), %rax
movl %eax, 0x34(%rsp)
movq (%r15), %rdx
leaq (%rax,%rax,4), %rcx
movq (%rdx,%rcx,8), %rsi
movq 0x8(%rdx,%rcx,8), %rcx
subq %rsi, %rcx
cmpq $0x8, %rcx
jne 0xce09
movl (%rsi), %ecx
xorl %ebp, %ecx
xorl %edi, %edi
cmpl $0x1, %ecx
sete %r8b
movslq 0xc(%rsp), %rcx
leaq (%rcx,%rcx,4), %r9
movq (%rdx,%r9,8), %rcx
movq 0x8(%rdx,%r9,8), %rdx
cmpq %rdx, %rcx
je 0xce09
movb %r8b, %dil
movl (%rsi,%rdi,4), %esi
movl (%rcx), %edi
xorl %esi, %edi
cmpl $0x1, %edi
je 0xcde1
addq $0x4, %rcx
cmpq %rdx, %rcx
jne 0xcdcd
jmp 0xce09
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0xcdfa
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0xce09
leaq 0x10(%rsp), %rdi
leaq 0x34(%rsp), %rdx
callq 0x98f8
addq $0x4, %r13
jmp 0xcd79
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rsi
movq %rsi, %rax
movq %rdx, 0x38(%rsp)
subq %rdx, %rax
movslq 0xc(%rsp), %rdx
movq (%r15), %rcx
leaq (%rdx,%rdx,4), %rdx
movq 0x8(%rcx,%rdx,8), %rdi
subq (%rcx,%rdx,8), %rdi
cmpq %rdi, %rax
jb 0xce94
decl %ebx
movl %ebx, %r13d
addq $0x4, %r12
cmpq 0x60(%rsp), %r12
jne 0xcc8e
leaq 0x10(%rsp), %rsi
movq 0x48(%rsp), %rbx
movq %rbx, %rdi
callq 0x1f3de
movl %r13d, 0x18(%rbx)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xce82
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2b686(%rip), %rdi     # 0x38521
leaq 0x2b6ad(%rip), %rsi     # 0x3854f
leaq 0x2b6b0(%rip), %rcx     # 0x38559
movl $0x2d, %edx
callq 0x31b0
jmp 0xceb7
jmp 0xceb7
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xced1
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq %rbx, %rdi
callq 0x34a0
nop