// File: 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
movq %rsp, %rbp
subq $0x2c0, %rsp            # imm = 0x2C0
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x228(%rbp)
movslq -0x14(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa7c0
movq -0x228(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
movslq -0x14(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
movl $0x1, %esi
callq 0xa7c0
movl (%rax), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x18(%rbp), %eax
jne 0x1fdd1
leaq -0x1c(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x3d2c0
movl -0x1c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jne 0x1fddb
jmp 0x1fdfa
leaq 0x66a9d(%rip), %rdi     # 0x8687f
leaq 0x66aa0(%rip), %rsi     # 0x86889
movl $0x5, %edx
leaq 0x66a9e(%rip), %rcx     # 0x86893
callq 0x4260
movq -0x228(%rbp), %rdi
addq $0x18, %rdi
movslq -0x1c(%rbp), %rsi
callq 0xaab0
movq %rax, %rdi
callq 0xf940
cmpq $0x2, %rax
jae 0x1fe25
movb $0x0, -0x1(%rbp)
jmp 0x2096b
movq -0x228(%rbp), %rdi
addq $0x18, %rdi
movslq -0x20(%rbp), %rsi
callq 0xaab0
movq %rax, %rdi
callq 0xf940
cmpq $0x2, %rax
jae 0x1fe50
movb $0x0, -0x1(%rbp)
jmp 0x2096b
movq -0x228(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x230(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3c5a0
movq -0x230(%rbp), %rdi
movslq %eax, %rsi
callq 0xaab0
movq %rax, %rdi
callq 0xf940
cmpq $0x1, %rax
jne 0x1fe89
jmp 0x1fea8
leaq 0x66a38(%rip), %rdi     # 0x868c8
leaq 0x669f2(%rip), %rsi     # 0x86889
movl $0x9, %edx
leaq 0x669f0(%rip), %rcx     # 0x86893
callq 0x4260
movq -0x228(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x238(%rbp)
movl -0x20(%rbp), %edi
callq 0x3c5a0
movq -0x238(%rbp), %rdi
movslq %eax, %rsi
callq 0xaab0
movq %rax, %rdi
callq 0xf940
cmpq $0x1, %rax
jne 0x1fee1
jmp 0x1ff00
leaq 0x66a0b(%rip), %rdi     # 0x868f3
leaq 0x6699a(%rip), %rsi     # 0x86889
movl $0xa, %edx
leaq 0x66998(%rip), %rcx     # 0x86893
callq 0x4260
leaq -0x38(%rbp), %rdi
callq 0xb2e0
movq -0x228(%rbp), %rdi
addq $0x18, %rdi
movslq -0x1c(%rbp), %rsi
callq 0xaab0
movq %rax, %rdi
callq 0xf940
movq -0x228(%rbp), %rdi
movq %rax, -0x240(%rbp)
addq $0x18, %rdi
movslq -0x20(%rbp), %rsi
callq 0xaab0
movq %rax, %rdi
callq 0xf940
movq -0x228(%rbp), %rdi
movq %rax, %rcx
movq -0x240(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x3c(%rbp)
addq $0x18, %rdi
movslq -0x1c(%rbp), %rsi
callq 0xaab0
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0xa800
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rdi
callq 0xa830
movq %rax, -0x58(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x1ffa0
jmp 0x20461
leaq -0x50(%rbp), %rdi
callq 0xa8a0
movl (%rax), %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x14(%rbp), %eax
je 0x2002c
movq -0x228(%rbp), %rdi
movslq -0x5c(%rbp), %rsi
callq 0x3c600
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
callq 0xa800
movq %rax, -0x70(%rbp)
movq -0x68(%rbp), %rdi
callq 0xa830
movq %rax, -0x78(%rbp)
leaq -0x70(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x1fff7
jmp 0x2002a
leaq -0x70(%rbp), %rdi
callq 0xa8a0
movl (%rax), %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jne 0x2001d
movb $0x0, -0x1(%rbp)
movl $0x1, -0x80(%rbp)
jmp 0x20955
jmp 0x2001f
leaq -0x70(%rbp), %rdi
callq 0xa930
jmp 0x1ffe4
jmp 0x2002c
movq -0x228(%rbp), %rdi
addq $0x18, %rdi
movslq -0x20(%rbp), %rsi
callq 0xaab0
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rdi
callq 0xa800
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rdi
callq 0xa830
movq %rax, -0x98(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x20089
jmp 0x20451
leaq -0x90(%rbp), %rdi
callq 0xa8a0
movl (%rax), %eax
movl %eax, -0x9c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x14(%rbp), %eax
je 0x200b0
movl -0x9c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jne 0x200b5
jmp 0x20440
leaq -0xb8(%rbp), %rdi
callq 0xa7e0
movq -0x228(%rbp), %rdi
movslq -0x5c(%rbp), %rsi
callq 0x3c600
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rdi
callq 0xa800
movq %rax, -0xc8(%rbp)
movq -0xc0(%rbp), %rdi
callq 0xa830
movq %rax, -0xd0(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x20117
jmp 0x20183
leaq -0xc8(%rbp), %rdi
callq 0xa8a0
movl (%rax), %eax
movl %eax, -0xd4(%rbp)
movl -0xd4(%rbp), %eax
cmpl -0x1c(%rbp), %eax
je 0x20170
leaq -0xb8(%rbp), %rdi
leaq -0xd4(%rbp), %rsi
callq 0xa8c0
jmp 0x2014b
jmp 0x20170
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe0(%rbp)
movl %eax, -0xe4(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0xab00
jmp 0x20960
jmp 0x20172
leaq -0xc8(%rbp), %rdi
callq 0xa930
jmp 0x200fe
movq -0x228(%rbp), %rdi
movslq -0x9c(%rbp), %rsi
callq 0x3c600
movq %rax, -0xf0(%rbp)
movq -0xf0(%rbp), %rdi
callq 0xa800
movq %rax, -0xf8(%rbp)
movq -0xf0(%rbp), %rdi
callq 0xa830
movq %rax, -0x100(%rbp)
leaq -0xf8(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x201dc
jmp 0x20222
leaq -0xf8(%rbp), %rdi
callq 0xa8a0
movl (%rax), %eax
movl %eax, -0x104(%rbp)
movl -0x104(%rbp), %eax
cmpl -0x1c(%rbp), %eax
je 0x20212
leaq -0xb8(%rbp), %rdi
leaq -0x104(%rbp), %rsi
callq 0xa8c0
jmp 0x20210
jmp 0x20212
jmp 0x20214
leaq -0xf8(%rbp), %rdi
callq 0xa930
jmp 0x201c3
leaq -0xb8(%rbp), %rdi
movq %rdi, -0x248(%rbp)
callq 0xa800
movq -0x248(%rbp), %rdi
movq %rax, -0x110(%rbp)
callq 0xa830
movq %rax, -0x118(%rbp)
movq -0x110(%rbp), %rdi
movq -0x118(%rbp), %rsi
callq 0x3e130
jmp 0x20264
leaq -0xb8(%rbp), %rdi
movq %rdi, -0x258(%rbp)
callq 0xa800
movq -0x258(%rbp), %rdi
movq %rax, -0x130(%rbp)
callq 0xa830
movq %rax, -0x138(%rbp)
movq -0x130(%rbp), %rdi
movq -0x138(%rbp), %rsi
callq 0x3e5a0
movq %rax, -0x250(%rbp)
jmp 0x202ad
movq -0x250(%rbp), %rax
movq %rax, -0x128(%rbp)
leaq -0x120(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x3e5e0
leaq -0xb8(%rbp), %rdi
movq %rdi, -0x268(%rbp)
callq 0xa830
movq %rax, -0x148(%rbp)
leaq -0x140(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x3e5e0
movq -0x268(%rbp), %rdi
movq -0x120(%rbp), %rsi
movq -0x140(%rbp), %rdx
callq 0x3e510
movq %rax, -0x260(%rbp)
jmp 0x2031e
movq -0x260(%rbp), %rax
movq %rax, -0x150(%rbp)
movb $0x0, -0x151(%rbp)
movl $0x1, -0x158(%rbp)
movl -0x158(%rbp), %eax
movq %rax, -0x270(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0xf940
movq %rax, %rcx
movq -0x270(%rbp), %rax
cmpq %rcx, %rax
jae 0x203cd
movl -0x158(%rbp), %eax
movl %eax, %esi
leaq -0xb8(%rbp), %rdi
callq 0xa7c0
movl (%rax), %edi
callq 0x3c5a0
movl %eax, -0x274(%rbp)
jmp 0x20388
movl -0x158(%rbp), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
leaq -0xb8(%rbp), %rdi
callq 0xa7c0
movq %rax, %rcx
movl -0x274(%rbp), %eax
cmpl (%rcx), %eax
jne 0x203b7
movb $0x1, -0x151(%rbp)
jmp 0x203cd
jmp 0x203b9
movl -0x158(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x158(%rbp)
jmp 0x2033d
testb $0x1, -0x151(%rbp)
je 0x203df
movl $0x7, -0x80(%rbp)
jmp 0x20413
leaq -0x38(%rbp), %rdi
callq 0xfd70
cmpl -0x3c(%rbp), %eax
jl 0x203fa
movb $0x0, -0x1(%rbp)
movl $0x1, -0x80(%rbp)
jmp 0x20413
leaq -0x38(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x3e2b0
jmp 0x2040c
movl $0x0, -0x80(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0xab00
movl -0x80(%rbp), %eax
movl %eax, -0x278(%rbp)
testl %eax, %eax
je 0x2043e
jmp 0x2042e
movl -0x278(%rbp), %eax
subl $0x7, %eax
je 0x20440
jmp 0x20955
jmp 0x20440
leaq -0x90(%rbp), %rdi
callq 0xa930
jmp 0x2006d
jmp 0x20453
leaq -0x50(%rbp), %rdi
callq 0xa930
jmp 0x1ff8a
leaq -0x170(%rbp), %rdi
callq 0xa7e0
leaq -0x188(%rbp), %rdi
callq 0xb2e0
movq -0x228(%rbp), %rax
movq %rax, %rcx
movq %rcx, -0x290(%rbp)
addq $0x18, %rax
movq %rax, -0x288(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3c5a0
movl %eax, -0x27c(%rbp)
jmp 0x204a5
movq -0x288(%rbp), %rdi
movl -0x27c(%rbp), %eax
movslq %eax, %rsi
callq 0xaab0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa7c0
movq -0x290(%rbp), %rdi
movl (%rax), %esi
callq 0x5f7f0
jmp 0x204d6
movq -0x228(%rbp), %rdi
addq $0x18, %rdi
movslq -0x1c(%rbp), %rsi
callq 0xaab0
movq %rax, -0x190(%rbp)
movq -0x190(%rbp), %rdi
callq 0xa800
movq %rax, -0x198(%rbp)
movq -0x190(%rbp), %rdi
callq 0xa830
movq %rax, -0x1a0(%rbp)
leaq -0x198(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x20533
jmp 0x206de
leaq -0x198(%rbp), %rdi
callq 0xa8a0
movq -0x228(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x1a4(%rbp)
movl -0x1a4(%rbp), %esi
callq 0x5eb70
movb %al, -0x291(%rbp)
jmp 0x20561
movb -0x291(%rbp), %al
testb $0x1, %al
jne 0x205b4
jmp 0x2056d
movq -0x228(%rbp), %rdi
movl -0x1a4(%rbp), %esi
callq 0x5f7f0
jmp 0x20581
movq -0x228(%rbp), %rdi
addq $0x218, %rdi            # imm = 0x218
movl $0x1, %esi
callq 0x61410
jmp 0x2059b
jmp 0x205b4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe0(%rbp)
movl %eax, -0xe4(%rbp)
jmp 0x2093b
movl -0x1a4(%rbp), %eax
cmpl -0x14(%rbp), %eax
je 0x206cb
xorps %xmm0, %xmm0
movaps %xmm0, -0x1c0(%rbp)
movq $0x0, -0x1b0(%rbp)
leaq -0x1c0(%rbp), %rdi
movq %rdi, -0x2a0(%rbp)
callq 0xa7e0
movq -0x2a0(%rbp), %rsi
leaq -0x188(%rbp), %rdi
callq 0x3e200
jmp 0x20600
leaq -0x1c0(%rbp), %rdi
callq 0xab00
movq -0x228(%rbp), %rdi
movslq -0x1a4(%rbp), %rsi
callq 0x3c600
movq %rax, -0x1c8(%rbp)
movq -0x1c8(%rbp), %rdi
callq 0xa800
movq %rax, -0x1d0(%rbp)
movq -0x1c8(%rbp), %rdi
callq 0xa830
movq %rax, -0x1d8(%rbp)
leaq -0x1d0(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x20665
jmp 0x206c9
leaq -0x1d0(%rbp), %rdi
callq 0xa8a0
movl (%rax), %eax
movl %eax, -0x1dc(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x3e230
movq %rax, %rdi
leaq -0x1dc(%rbp), %rsi
callq 0xa8c0
jmp 0x20696
jmp 0x20698
leaq -0x1d0(%rbp), %rdi
callq 0xa930
jmp 0x2064c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe0(%rbp)
movl %eax, -0xe4(%rbp)
leaq -0x1c0(%rbp), %rdi
callq 0xab00
jmp 0x2093b
jmp 0x206cb
jmp 0x206cd
leaq -0x198(%rbp), %rdi
callq 0xa930
jmp 0x20517
movq -0x228(%rbp), %rdi
addq $0x18, %rdi
movslq -0x20(%rbp), %rsi
callq 0xaab0
movq %rax, -0x1e8(%rbp)
movq -0x1e8(%rbp), %rdi
callq 0xa800
movq %rax, -0x1f0(%rbp)
movq -0x1e8(%rbp), %rdi
callq 0xa830
movq %rax, -0x1f8(%rbp)
leaq -0x1f0(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x20738
jmp 0x207b5
leaq -0x1f0(%rbp), %rdi
callq 0xa8a0
movq -0x228(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x1fc(%rbp)
movl -0x1fc(%rbp), %esi
callq 0x5eb70
movb %al, -0x2a1(%rbp)
jmp 0x20766
movb -0x2a1(%rbp), %al
testb $0x1, %al
jne 0x207a2
jmp 0x20772
movq -0x228(%rbp), %rdi
movl -0x1fc(%rbp), %esi
callq 0x5f7f0
jmp 0x20786
movq -0x228(%rbp), %rdi
addq $0x218, %rdi            # imm = 0x218
movl $0x1, %esi
callq 0x61410
jmp 0x207a0
jmp 0x207a2
jmp 0x207a4
leaq -0x1f0(%rbp), %rdi
callq 0xa930
jmp 0x2071f
leaq -0x38(%rbp), %rax
movq %rax, -0x208(%rbp)
movq -0x208(%rbp), %rdi
callq 0x3e320
movq %rax, -0x210(%rbp)
movq -0x208(%rbp), %rdi
callq 0x3e350
movq %rax, -0x218(%rbp)
leaq -0x210(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x3e380
testb $0x1, %al
jne 0x207ff
jmp 0x2085b
leaq -0x210(%rbp), %rdi
callq 0x3e3c0
movq -0x228(%rbp), %rdi
movq %rax, -0x220(%rbp)
movq -0x220(%rbp), %rsi
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
callq 0x5f880
jmp 0x20831
movq -0x228(%rbp), %rdi
addq $0x218, %rdi            # imm = 0x218
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x61410
jmp 0x2084b
jmp 0x2084d
leaq -0x210(%rbp), %rdi
callq 0x3e3e0
jmp 0x207e6
movq -0x228(%rbp), %rdi
addq $0x218, %rdi            # imm = 0x218
movl $0x1, %esi
callq 0x61590
jmp 0x20875
movq -0x228(%rbp), %rax
movq %rax, %rcx
addq $0x2f0, %rcx            # imm = 0x2F0
movq %rcx, -0x2c0(%rbp)
movq %rax, %rcx
movq %rcx, -0x2b8(%rbp)
addq $0x18, %rax
movq %rax, -0x2b0(%rbp)
movl -0x20(%rbp), %edi
callq 0x3c5a0
movl %eax, -0x2a8(%rbp)
jmp 0x208b2
movq -0x2b0(%rbp), %rdi
movl -0x2a8(%rbp), %eax
movslq %eax, %rsi
callq 0xaab0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa7c0
movq -0x2b8(%rbp), %rdi
movslq (%rax), %rsi
callq 0x3c600
movq -0x2c0(%rbp), %rdi
movq 0x18(%rax), %rsi
callq 0x5cae0
jmp 0x208f4
movq -0x228(%rbp), %rdi
addq $0x2f0, %rdi            # imm = 0x2F0
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
leaq -0x188(%rbp), %rcx
callq 0x5c560
jmp 0x20916
movb $0x1, -0x1(%rbp)
movl $0x1, -0x80(%rbp)
leaq -0x188(%rbp), %rdi
callq 0xb3b0
leaq -0x170(%rbp), %rdi
callq 0xab00
jmp 0x20955
leaq -0x188(%rbp), %rdi
callq 0xb3b0
leaq -0x170(%rbp), %rdi
callq 0xab00
jmp 0x20960
leaq -0x38(%rbp), %rdi
callq 0xb3b0
jmp 0x2096b
leaq -0x38(%rbp), %rdi
callq 0xb3b0
jmp 0x20979
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x2c0, %rsp            # imm = 0x2C0
popq %rbp
retq
movq -0xe0(%rbp), %rdi
callq 0x4610
nopw %cs:(%rax,%rax)