// File: /workspace/github_cpp_makefile_star2_O2/Laakeri[P]maxpre/src/./BCR.cpp
// Function: maxPreprocessor::Preprocessor::tryBCR(int, int)
bool Preprocessor::tryBCR(int c, int l11) {
	int l1 = pi.clauses[c].lit[0];
	int l2 = pi.clauses[c].lit[1];
	if (l2 == l11) swap(l1, l2);
	assert(l1 == l11);
	
	if (pi.litClauses[l1].size() < 2) return false;
	if (pi.litClauses[l2].size() < 2) return false;
	assert(pi.litClauses[litNegation(l1)].size() == 1);
	assert(pi.litClauses[litNegation(l2)].size() == 1);
	
	vector<vector<int> > newClauses;
	
	int sizeLimit = pi.litClauses[l1].size() + pi.litClauses[l2].size();
	
	for (int c1 : pi.litClauses[l1]) {
		if (c1 != c) {
			for (int l : pi.clauses[c1].lit) {
				if (l == l2) return false;
			}
		}
		for (int c2 : pi.litClauses[l2]) {
			if (c1 == c || c2 == c) continue;
			vector<int> nc;
			for (int l : pi.clauses[c1].lit) {
				if (l != l1) nc.push_back(l);
			}
			for (int l : pi.clauses[c2].lit) {
				if (l != l1) nc.push_back(l);
			}
			sort(nc.begin(), nc.end());
			nc.erase(unique(nc.begin(), nc.end()), nc.end());
			bool taut = false;
			for (unsigned i = 1; i < nc.size(); i++) {
				if (litNegation(nc[i]) == nc[i - 1]) {
					taut = true;
					break;
				}
			}
			if (taut) continue;
			if ((int)newClauses.size() >= sizeLimit) return false;
			newClauses.push_back(nc);
		}
	}
	vector<int> toRemove;
	vector<vector<int> > nClauses;
	pi.removeClause(pi.litClauses[litNegation(l1)][0]);
	for (int cc : pi.litClauses[l1]) {
		if (!pi.isClauseRemoved(cc)) {
			pi.removeClause(cc);
			rLog.removeClause(1);
		}
		if (cc != c) {
			nClauses.push_back(vector<int>());
			for (int l : pi.clauses[cc].lit) {
				nClauses.back().push_back(l);
			}
		}
	}
	for (int cc : pi.litClauses[l2]) {
		if (!pi.isClauseRemoved(cc)) {
			pi.removeClause(cc);
			rLog.removeClause(1);
		}
	}
	for (auto& nc : newClauses) {
		pi.addClause(nc);
		rLog.removeClause(-1);
	}
	rLog.removeLabel(1);
	trace.removeWeight(pi.clauses[pi.litClauses[litNegation(l2)][0]].weight);
	trace.BCR(l1, l2, nClauses);
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movslq %esi, %rax
movq (%rdi), %rcx
imulq $0x28, %rax, %rax
movq (%rcx,%rax), %rax
movl (%rax), %ecx
movl 0x4(%rax), %eax
cmpl %edx, %eax
cmovel %ecx, %eax
movl %eax, 0xc(%rsp)
sete %al
cmpl %edx, %ecx
sete %cl
orb %al, %cl
je 0xed70
movl %edx, %ebx
movq %rdi, %rbp
movslq %edx, %rcx
movq 0x18(%rdi), %rax
imulq $0x18, %rcx, %rdi
movq 0x8(%rax,%rdi), %rcx
subq (%rax,%rdi), %rcx
cmpq $0x5, %rcx
jb 0xe8b5
movl %esi, %r12d
movslq 0xc(%rsp), %rcx
imulq $0x18, %rcx, %rsi
movq 0x8(%rax,%rsi), %rcx
subq (%rax,%rsi), %rcx
cmpq $0x5, %rcx
jae 0xe8bc
xorl %eax, %eax
jmp 0xed5e
movl %ebx, %ecx
xorl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x18, %rcx, %rdx
movq 0x8(%rax,%rdx), %rcx
subq (%rax,%rdx), %rcx
cmpq $0x4, %rcx
jne 0xed8d
movq %rdx, 0x98(%rsp)
movl 0xc(%rsp), %ecx
xorl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x18, %rcx, %rdx
movq 0x8(%rax,%rdx), %rcx
movq %rdx, 0x88(%rsp)
subq (%rax,%rdx), %rcx
cmpq $0x4, %rcx
jne 0xeda6
movq %rdi, 0x90(%rsp)
leaq (%rax,%rdi), %rcx
movq %rsi, 0x68(%rsp)
addq %rsi, %rax
xorps %xmm0, %xmm0
leaq 0x70(%rsp), %rdx
movaps %xmm0, (%rdx)
andq $0x0, 0x10(%rdx)
movq (%rcx), %rdi
movq 0x8(%rcx), %r8
movq %r8, %rdx
subq %rdi, %rdx
shrq $0x2, %rdx
movq 0x8(%rax), %rcx
subq (%rax), %rcx
shrq $0x2, %rcx
addl %ecx, %edx
movq %rdx, 0xb0(%rsp)
leaq 0x20(%rsp), %r13
leaq 0x50(%rsp), %r15
movq %rbp, 0x40(%rsp)
movl %r12d, 0x1c(%rsp)
movq %r8, 0xa0(%rsp)
cmpq %r8, %rdi
sete %al
movl %eax, 0x4c(%rsp)
je 0xeb5c
movslq (%rdi), %rax
movq %rax, 0x10(%rsp)
cmpl %r12d, %eax
jne 0xeb2c
movq %rdi, 0xa8(%rsp)
movq 0x18(%rbp), %rax
movq 0x68(%rsp), %rcx
movq (%rax,%rcx), %r14
movq 0x8(%rax,%rcx), %rax
movq %rax, 0xc8(%rsp)
imulq $0x28, 0x10(%rsp), %rax
movq %rax, 0xb8(%rsp)
cmpq 0xc8(%rsp), %r14
je 0xeb13
cmpl %r12d, 0x10(%rsp)
je 0xeb0a
movl (%r14), %eax
cmpl %r12d, %eax
je 0xeb0a
cltq
movq %rax, 0xc0(%rsp)
andq $0x0, 0x30(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq (%rbp), %rax
movq 0xb8(%rsp), %rcx
movq (%rax,%rcx), %r12
movq 0x8(%rax,%rcx), %rbp
cmpq %rbp, %r12
je 0xea37
movl (%r12), %eax
movl %eax, 0x50(%rsp)
cmpl %ebx, %eax
je 0xea31
movq %r13, %rdi
movq %r15, %rsi
callq 0x68a4
addq $0x4, %r12
jmp 0xea15
movq 0x40(%rsp), %rax
movq (%rax), %rax
imulq $0x28, 0xc0(%rsp), %rcx
movq (%rax,%rcx), %rbp
movq 0x8(%rax,%rcx), %r12
cmpq %r12, %rbp
je 0xea72
movl (%rbp), %eax
movl %eax, 0x50(%rsp)
cmpl %ebx, %eax
je 0xea6c
movq %r13, %rdi
movq %r15, %rsi
callq 0x68a4
addq $0x4, %rbp
jmp 0xea51
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x1c706
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x1cd6f
movq 0x40(%rsp), %rbp
movl 0x1c(%rsp), %r12d
movq 0x28(%rsp), %rdx
movq %r13, %rdi
movq %rax, %rsi
callq 0x1902e
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
xorl %edx, %edx
leal 0x1(%rdx), %esi
cmpq %rsi, %rcx
jbe 0xead6
movl %edx, %edx
movl (%rax,%rdx,4), %edi
xorl (%rax,%rsi,4), %edi
movl %esi, %edx
cmpl $0x1, %edi
jne 0xeabd
jmp 0xeb02
movq 0x78(%rsp), %rax
subq 0x70(%rsp), %rax
cqto
pushq $0x18
popq %rcx
idivq %rcx
cmpl 0xb0(%rsp), %eax
jge 0xed46
leaq 0x70(%rsp), %rdi
movq %r13, %rsi
callq 0x18f96
movq %r13, %rdi
callq 0x7512
addq $0x4, %r14
jmp 0xe9c3
movq 0xa8(%rsp), %rdi
addq $0x4, %rdi
movq 0xa0(%rsp), %r8
jmp 0xe972
movq (%rbp), %rax
imulq $0x28, 0x10(%rsp), %rdx
movq (%rax,%rdx), %rcx
movq 0x8(%rax,%rdx), %rax
cmpq %rax, %rcx
je 0xe993
leaq 0x4(%rcx), %rdx
movl 0xc(%rsp), %esi
cmpl %esi, (%rcx)
movq %rdx, %rcx
jne 0xeb3f
jmp 0xed50
xorps %xmm0, %xmm0
andq $0x0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
andq $0x0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movq 0x18(%rbp), %rax
movq 0x98(%rsp), %rcx
movq (%rax,%rcx), %rax
movl (%rax), %esi
movq %rbp, %rdi
callq 0x21490
movq 0x18(%rbp), %rax
movq 0x90(%rsp), %rcx
movq (%rax,%rcx), %r14
movq 0x8(%rax,%rcx), %r12
leaq 0x218(%rbp), %rax
movq %rax, 0x10(%rsp)
leaq 0xd0(%rsp), %r13
cmpq %r12, %r14
je 0xec64
movl (%r14), %r15d
movq %rbp, %rdi
movl %r15d, %esi
callq 0x20f14
testb %al, %al
jne 0xebeb
movq %rbp, %rdi
movl %r15d, %esi
callq 0x21490
movq 0x10(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x21e84
cmpl 0x1c(%rsp), %r15d
jne 0xebfd
addq $0x4, %r14
movq 0x40(%rsp), %rbp
jmp 0xebb8
xorps %xmm0, %xmm0
movaps %xmm0, 0xd0(%rsp)
andq $0x0, 0xe0(%rsp)
leaq 0x50(%rsp), %rdi
movq %r13, %rsi
callq 0x1cb40
movslq %r15d, %r15
movq %r13, %rdi
callq 0x7512
movq 0x40(%rsp), %rax
movq (%rax), %rax
imulq $0x28, %r15, %rcx
movq (%rax,%rcx), %r15
movq 0x8(%rax,%rcx), %rbp
cmpq %rbp, %r15
je 0xebf2
movl (%r15), %eax
movl %eax, 0xd0(%rsp)
movq 0x58(%rsp), %rdi
addq $-0x18, %rdi
movq %r13, %rsi
callq 0x68a4
addq $0x4, %r15
jmp 0xec3e
movq 0x18(%rbp), %rax
movq 0x68(%rsp), %rcx
movq (%rax,%rcx), %r14
movq 0x8(%rax,%rcx), %r13
pushq $0x1
popq %r15
cmpq %r13, %r14
je 0xecaf
movl (%r14), %r12d
movq %rbp, %rdi
movl %r12d, %esi
callq 0x20f14
testb %al, %al
jne 0xeca9
movq %rbp, %rdi
movl %r12d, %esi
callq 0x21490
movq 0x10(%rsp), %rdi
movl %r15d, %esi
callq 0x21e84
addq $0x4, %r14
jmp 0xec7a
movq 0x70(%rsp), %r15
movq 0x78(%rsp), %r14
movabsq $-0x8000000000000000, %r12 # imm = 0x8000000000000000
pushq $-0x1
popq %r13
cmpq %r14, %r15
je 0xeced
movq %rbp, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x214e8
movq 0x10(%rsp), %rdi
movl %r13d, %esi
callq 0x21e84
addq $0x18, %r15
jmp 0xecc7
pushq $0x1
popq %rsi
movq 0x10(%rsp), %rdi
callq 0x21f32
leaq 0x2f0(%rbp), %r15
movq (%rbp), %rax
movq 0x18(%rbp), %rcx
movq 0x88(%rsp), %rdx
movq (%rcx,%rdx), %rcx
movslq (%rcx), %rcx
imulq $0x28, %rcx, %rcx
movq 0x18(%rax,%rcx), %rsi
movq %r15, %rdi
callq 0x207e0
leaq 0x50(%rsp), %rcx
movq %r15, %rdi
movl %ebx, %esi
movl 0xc(%rsp), %edx
callq 0x204ea
leaq 0x50(%rsp), %rdi
callq 0x6aa2
leaq 0x20(%rsp), %rdi
callq 0x7512
leaq 0x70(%rsp), %rdi
callq 0x6aa2
movl 0x4c(%rsp), %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x20ba8(%rip), %rdi     # 0x2f91f
leaq 0x20bab(%rip), %rsi     # 0x2f929
leaq 0x20bae(%rip), %rcx     # 0x2f933
pushq $0x5
popq %rdx
callq 0x31c0
leaq 0x20bd4(%rip), %rdi     # 0x2f968
leaq 0x20b8e(%rip), %rsi     # 0x2f929
leaq 0x20b91(%rip), %rcx     # 0x2f933
pushq $0x9
jmp 0xed87
leaq 0x20be6(%rip), %rdi     # 0x2f993
leaq 0x20b75(%rip), %rsi     # 0x2f929
leaq 0x20b78(%rip), %rcx     # 0x2f933
pushq $0xa
jmp 0xed87
jmp 0xede1
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x7512
jmp 0xede4
jmp 0xede1
jmp 0xede1
jmp 0xede1
jmp 0xedf2
jmp 0xedf2
jmp 0xedf2
jmp 0xedf2
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x6aa2
jmp 0xedf5
jmp 0xedf2
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x7512
leaq 0x70(%rsp), %rdi
callq 0x6aa2
movq %rbx, %rdi
callq 0x3490
nop