// File: 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
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0xe0(%rbp)
movq %rdi, %rax
movq %rax, -0xd8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xd0(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xa7e0
movq -0xd0(%rbp), %rdi
addq $0x18, %rdi
movslq -0x14(%rbp), %rsi
callq 0x3d180
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x3d080
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
callq 0x3d0b0
movq %rax, -0x50(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3d0e0
testb $0x1, %al
jne 0x15bea
jmp 0x15fdd
leaq -0x48(%rbp), %rdi
callq 0x3d120
movq -0xd0(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x54(%rbp)
movslq -0x54(%rbp), %rsi
callq 0x3d060
movq %rax, %rdi
callq 0xf940
cmpq $0x2, %rax
jbe 0x15fcd
movq -0xd0(%rbp), %rdi
movslq -0x54(%rbp), %rsi
callq 0x3d060
movq %rax, %rdi
callq 0xf940
subl $0x1, %eax
cmpl -0x18(%rbp), %eax
jl 0x15c44
cmpl $0x0, -0x18(%rbp)
jne 0x15fcd
movq -0xd0(%rbp), %rdi
movb $0x0, -0x55(%rbp)
movslq -0x54(%rbp), %rsi
callq 0x3d060
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
callq 0x3d080
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
callq 0x3d0b0
movq %rax, -0x70(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x3d0e0
testb $0x1, %al
jne 0x15c8c
jmp 0x15d21
leaq -0x68(%rbp), %rdi
callq 0x3d120
movl (%rax), %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x14(%rbp), %eax
je 0x15d11
movq -0x20(%rbp), %rax
movq %rax, -0xf0(%rbp)
movl -0x74(%rbp), %edi
callq 0x3c5a0
movl %eax, -0xe4(%rbp)
jmp 0x15cbd
movq -0xf0(%rbp), %rdi
movl -0xe4(%rbp), %eax
movl %eax, -0x78(%rbp)
leaq -0x78(%rbp), %rsi
callq 0x3d1a0
movq %rax, -0xf8(%rbp)
jmp 0x15cdf
movq -0xf8(%rbp), %rax
cmpq $0x0, %rax
jne 0x15d0f
movb $0x1, -0x55(%rbp)
jmp 0x15d21
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xab00
jmp 0x1600c
jmp 0x15d11
jmp 0x15d13
leaq -0x68(%rbp), %rdi
callq 0x3d160
jmp 0x15c76
testb $0x1, -0x55(%rbp)
jne 0x15fcb
movq -0xd0(%rbp), %rdi
movslq -0x54(%rbp), %rsi
callq 0x3d060
movq %rax, %rdi
callq 0xf940
decl %eax
movl %eax, -0x18(%rbp)
leaq -0x38(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x3d200
movq -0x100(%rbp), %rdi
leaq -0x54(%rbp), %rsi
callq 0xa8c0
jmp 0x15d6a
movq -0xd0(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x110(%rbp)
movl -0x14(%rbp), %edi
callq 0x3c5a0
movl %eax, -0x104(%rbp)
jmp 0x15d8c
movq -0x110(%rbp), %rdi
movl -0x104(%rbp), %eax
movslq %eax, %rsi
callq 0x3d180
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rdi
callq 0x3d080
movq %rax, -0x98(%rbp)
movq -0x90(%rbp), %rdi
callq 0x3d0b0
movq %rax, -0xa0(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x3d0e0
testb $0x1, %al
jne 0x15dea
jmp 0x15f71
leaq -0x98(%rbp), %rdi
callq 0x3d120
movq -0xd0(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0xa4(%rbp)
movslq -0xa4(%rbp), %rsi
callq 0x3d060
movq %rax, %rdi
callq 0xf940
cmpq $0x2, %rax
jne 0x15f5e
movq -0xd0(%rbp), %rdi
movslq -0xa4(%rbp), %rsi
callq 0x3d060
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x3c5b0
movl (%rax), %edi
callq 0x3c5a0
movl %eax, -0x114(%rbp)
jmp 0x15e51
movl -0x114(%rbp), %eax
cmpl -0x14(%rbp), %eax
jne 0x15e86
movq -0xd0(%rbp), %rdi
movslq -0xa4(%rbp), %rsi
callq 0x3d060
movq %rax, %rdi
movl $0x1, %esi
callq 0x3c5b0
movl (%rax), %eax
movl %eax, -0xa8(%rbp)
jmp 0x15ead
movq -0xd0(%rbp), %rdi
movslq -0xa4(%rbp), %rsi
callq 0x3d060
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x3c5b0
movl (%rax), %eax
movl %eax, -0xa8(%rbp)
movq -0xd0(%rbp), %rdi
movslq -0x54(%rbp), %rsi
callq 0x3d060
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x3d080
movq %rax, -0xb8(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x3d0b0
movq %rax, -0xc0(%rbp)
leaq -0xb8(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x3d0e0
testb $0x1, %al
jne 0x15f03
jmp 0x15f5c
leaq -0xb8(%rbp), %rdi
callq 0x3d120
movl (%rax), %eax
movl %eax, -0xc4(%rbp)
movl -0xc4(%rbp), %edi
callq 0x3c5a0
movl %eax, -0x118(%rbp)
jmp 0x15f2a
movl -0x118(%rbp), %eax
cmpl -0xa8(%rbp), %eax
jne 0x15f4c
leaq -0x38(%rbp), %rdi
leaq -0xa4(%rbp), %rsi
callq 0xa8c0
jmp 0x15f4a
jmp 0x15f5c
jmp 0x15f4e
leaq -0xb8(%rbp), %rdi
callq 0x3d160
jmp 0x15eea
jmp 0x15f5e
jmp 0x15f60
leaq -0x98(%rbp), %rdi
callq 0x3d160
jmp 0x15dce
leaq -0x38(%rbp), %rdi
callq 0xf940
movq -0xd0(%rbp), %rdi
movq %rax, -0x120(%rbp)
movslq -0x54(%rbp), %rsi
callq 0x3d060
movq %rax, %rdi
callq 0xf940
movq %rax, %rcx
movq -0x120(%rbp), %rax
cmpq %rcx, %rax
jb 0x15faa
jmp 0x15fc9
leaq 0x70450(%rip), %rdi     # 0x86401
leaq 0x70477(%rip), %rsi     # 0x8642f
movl $0x2d, %edx
leaq 0x70475(%rip), %rcx     # 0x86439
callq 0x4260
jmp 0x15fcb
jmp 0x15fcd
jmp 0x15fcf
leaq -0x48(%rbp), %rdi
callq 0x3d160
jmp 0x15bd4
movq -0xe0(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x18(%rbp), %rdx
callq 0x3d220
jmp 0x15ff3
leaq -0x38(%rbp), %rdi
callq 0xab00
movq -0xd8(%rbp), %rax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
movq -0x80(%rbp), %rdi
callq 0x4610
nopw %cs:(%rax,%rax)