// File: Laakeri[P]maxpre/src/./BCR.cpp
// Function: maxPreprocessor::Preprocessor::doBCR2()
void Preprocessor::doBCR2() {
	for (int i = 0; i < pi.vars; i++) {
		if (pi.isLabel[i] && !pi.isVarRemoved(i)) {
			if (pi.isLabel[i] == VAR_TRUE) {
				assert(pi.litClauses[posLit(i)].size() == 1);
				for (int c : pi.litClauses[negLit(i)]) {
					if (pi.clauses[c].lit.size() == 2) {
						if (pi.isLabel[litVariable(pi.clauses[c].lit[0])] && pi.isLabel[litVariable(pi.clauses[c].lit[1])]) {
							if (pi.clauses[pi.litClauses[litNegation(pi.clauses[c].lit[0])][0]].weight == pi.clauses[pi.litClauses[litNegation(pi.clauses[c].lit[1])][0]].weight) {
								if (tryBCR(c, negLit(i))) {
									print("FAIL BCR ", i);
									abort();
								}
							}
						}
					}
				}
			}
			else if(pi.isLabel[i] == VAR_FALSE) {
				assert(pi.litClauses[negLit(i)].size() == 1);
				for (int c : pi.litClauses[posLit(i)]) {
					if (pi.clauses[c].lit.size() == 2) {
						if (pi.isLabel[litVariable(pi.clauses[c].lit[0])] && pi.isLabel[litVariable(pi.clauses[c].lit[1])]) {
							if (pi.clauses[pi.litClauses[litNegation(pi.clauses[c].lit[0])][0]].weight == pi.clauses[pi.litClauses[litNegation(pi.clauses[c].lit[1])][0]].weight) {
								if (tryBCR(c, posLit(i))) {
									print("FAIL BCR ", i);
									abort();
								}
							}
						}
					}
				}
			}
			else{
				assert(0);
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x58(%rbp), %rcx
movl -0xc(%rbp), %eax
cmpl 0x60(%rcx), %eax
jge 0x218f6
movq -0x58(%rbp), %rdi
addq $0x48, %rdi
movslq -0xc(%rbp), %rsi
callq 0xa7c0
cmpl $0x0, (%rax)
je 0x218e6
movq -0x58(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x5ecc0
testb $0x1, %al
jne 0x218e6
movq -0x58(%rbp), %rdi
addq $0x48, %rdi
movslq -0xc(%rbp), %rsi
callq 0xa7c0
cmpl $0x1, (%rax)
jne 0x21622
movq -0x58(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x60(%rbp)
movl -0xc(%rbp), %edi
callq 0x3c5d0
movq -0x60(%rbp), %rdi
movslq %eax, %rsi
callq 0xaab0
movq %rax, %rdi
callq 0xf940
cmpq $0x1, %rax
jne 0x213e6
jmp 0x21405
leaq 0x655c1(%rip), %rdi     # 0x869ae
leaq 0x65495(%rip), %rsi     # 0x86889
movl $0x8b, %edx
leaq 0x655d3(%rip), %rcx     # 0x869d3
callq 0x4260
movq -0x58(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x68(%rbp)
movl -0xc(%rbp), %edi
callq 0x3c5e0
movq -0x68(%rbp), %rdi
movslq %eax, %rsi
callq 0xaab0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0xa800
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0xa830
movq %rax, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x21459
jmp 0x2161d
leaq -0x20(%rbp), %rdi
callq 0xa8a0
movq -0x58(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
movslq -0x2c(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
cmpq $0x2, %rax
jne 0x2160d
movq -0x58(%rbp), %rdi
movq %rdi, %rax
addq $0x48, %rax
movq %rax, -0x70(%rbp)
movslq -0x2c(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa7c0
movl (%rax), %edi
callq 0x3c880
movq -0x70(%rbp), %rdi
movslq %eax, %rsi
callq 0xa7c0
cmpl $0x0, (%rax)
je 0x2160b
movq -0x58(%rbp), %rdi
movq %rdi, %rax
addq $0x48, %rax
movq %rax, -0x78(%rbp)
movslq -0x2c(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
movl $0x1, %esi
callq 0xa7c0
movl (%rax), %edi
callq 0x3c880
movq -0x78(%rbp), %rdi
movslq %eax, %rsi
callq 0xa7c0
cmpl $0x0, (%rax)
je 0x2160b
movq -0x58(%rbp), %rdi
movq %rdi, %rax
addq $0x18, %rax
movq %rax, -0x90(%rbp)
movslq -0x2c(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa7c0
movl (%rax), %edi
callq 0x3c5a0
movq -0x90(%rbp), %rdi
movslq %eax, %rsi
callq 0xaab0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa7c0
movq -0x58(%rbp), %rdi
movslq (%rax), %rsi
callq 0x3c600
movq -0x58(%rbp), %rdi
movq 0x18(%rax), %rax
movq %rax, -0x80(%rbp)
movq %rdi, %rax
addq $0x18, %rax
movq %rax, -0x88(%rbp)
movslq -0x2c(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
movl $0x1, %esi
callq 0xa7c0
movl (%rax), %edi
callq 0x3c5a0
movq -0x88(%rbp), %rdi
movslq %eax, %rsi
callq 0xaab0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa7c0
movq -0x58(%rbp), %rdi
movslq (%rax), %rsi
callq 0x3c600
movq %rax, %rcx
movq -0x80(%rbp), %rax
cmpq 0x18(%rcx), %rax
jne 0x21609
movl -0x2c(%rbp), %eax
movl %eax, -0x94(%rbp)
movl -0xc(%rbp), %edi
callq 0x3c5e0
movq -0x58(%rbp), %rdi
movl -0x94(%rbp), %esi
movl %eax, %edx
callq 0x1fd60
testb $0x1, %al
jne 0x215ef
jmp 0x21607
movq -0x58(%rbp), %rdi
movl -0xc(%rbp), %edx
leaq 0x65403(%rip), %rsi     # 0x86a00
callq 0x3cfa0
callq 0x41f0
jmp 0x21609
jmp 0x2160b
jmp 0x2160d
jmp 0x2160f
leaq -0x20(%rbp), %rdi
callq 0xa930
jmp 0x21443
jmp 0x218e4
movq -0x58(%rbp), %rdi
addq $0x48, %rdi
movslq -0xc(%rbp), %rsi
callq 0xa7c0
cmpl $0x2, (%rax)
jne 0x218c3
movq -0x58(%rbp), %rax
addq $0x18, %rax
movq %rax, -0xa0(%rbp)
movl -0xc(%rbp), %edi
callq 0x3c5e0
movq -0xa0(%rbp), %rdi
movslq %eax, %rsi
callq 0xaab0
movq %rax, %rdi
callq 0xf940
cmpq $0x1, %rax
jne 0x21672
jmp 0x21691
leaq 0x65391(%rip), %rdi     # 0x86a0a
leaq 0x65209(%rip), %rsi     # 0x86889
movl $0x9a, %edx
leaq 0x65347(%rip), %rcx     # 0x869d3
callq 0x4260
movq -0x58(%rbp), %rax
addq $0x18, %rax
movq %rax, -0xa8(%rbp)
movl -0xc(%rbp), %edi
callq 0x3c5d0
movq -0xa8(%rbp), %rdi
movslq %eax, %rsi
callq 0xaab0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0xa800
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rdi
callq 0xa830
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x216eb
jmp 0x218c1
leaq -0x40(%rbp), %rdi
callq 0xa8a0
movq -0x58(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x4c(%rbp)
movslq -0x4c(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
cmpq $0x2, %rax
jne 0x218b1
movq -0x58(%rbp), %rdi
movq %rdi, %rax
addq $0x48, %rax
movq %rax, -0xb0(%rbp)
movslq -0x4c(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa7c0
movl (%rax), %edi
callq 0x3c880
movq -0xb0(%rbp), %rdi
movslq %eax, %rsi
callq 0xa7c0
cmpl $0x0, (%rax)
je 0x218af
movq -0x58(%rbp), %rdi
movq %rdi, %rax
addq $0x48, %rax
movq %rax, -0xb8(%rbp)
movslq -0x4c(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
movl $0x1, %esi
callq 0xa7c0
movl (%rax), %edi
callq 0x3c880
movq -0xb8(%rbp), %rdi
movslq %eax, %rsi
callq 0xa7c0
cmpl $0x0, (%rax)
je 0x218af
movq -0x58(%rbp), %rdi
movq %rdi, %rax
addq $0x18, %rax
movq %rax, -0xd0(%rbp)
movslq -0x4c(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa7c0
movl (%rax), %edi
callq 0x3c5a0
movq -0xd0(%rbp), %rdi
movslq %eax, %rsi
callq 0xaab0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa7c0
movq -0x58(%rbp), %rdi
movslq (%rax), %rsi
callq 0x3c600
movq -0x58(%rbp), %rdi
movq 0x18(%rax), %rax
movq %rax, -0xc0(%rbp)
movq %rdi, %rax
addq $0x18, %rax
movq %rax, -0xc8(%rbp)
movslq -0x4c(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
movl $0x1, %esi
callq 0xa7c0
movl (%rax), %edi
callq 0x3c5a0
movq -0xc8(%rbp), %rdi
movslq %eax, %rsi
callq 0xaab0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa7c0
movq -0x58(%rbp), %rdi
movslq (%rax), %rsi
callq 0x3c600
movq %rax, %rcx
movq -0xc0(%rbp), %rax
cmpq 0x18(%rcx), %rax
jne 0x218ad
movl -0x4c(%rbp), %eax
movl %eax, -0xd4(%rbp)
movl -0xc(%rbp), %edi
callq 0x3c5d0
movq -0x58(%rbp), %rdi
movl -0xd4(%rbp), %esi
movl %eax, %edx
callq 0x1fd60
testb $0x1, %al
jne 0x21893
jmp 0x218ab
movq -0x58(%rbp), %rdi
movl -0xc(%rbp), %edx
leaq 0x6515f(%rip), %rsi     # 0x86a00
callq 0x3cfa0
callq 0x41f0
jmp 0x218ad
jmp 0x218af
jmp 0x218b1
jmp 0x218b3
leaq -0x40(%rbp), %rdi
callq 0xa930
jmp 0x216d5
jmp 0x218e2
leaq 0x66358(%rip), %rdi     # 0x87c22
leaq 0x64fb8(%rip), %rsi     # 0x86889
movl $0xa9, %edx
leaq 0x650f6(%rip), %rcx     # 0x869d3
callq 0x4260
jmp 0x218e4
jmp 0x218e6
jmp 0x218e8
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x2135e
addq $0xe0, %rsp
popq %rbp
retq
nop