// File: Laakeri[P]maxpre/src/./BVA.cpp
// Function: maxPreprocessor::Preprocessor::canBVA(int, int, int)
int Preprocessor::canBVA(int c, int d, int lit) {
	if (pi.clauses[d].lit.size() != pi.clauses[c].lit.size()) return -1;
	int hc = -1;
	int hd = -1;
	unsigned i1 = 0;
	unsigned i2 = 0;
	while (i1 < pi.clauses[c].lit.size() || i2 < pi.clauses[d].lit.size()) {
		if (i1 < pi.clauses[c].lit.size() && i2 < pi.clauses[d].lit.size() && pi.clauses[c].lit[i1] == pi.clauses[d].lit[i2]) {
			i1++;
			i2++;
		}
		else if (i1 < pi.clauses[c].lit.size() && (i2 == pi.clauses[d].lit.size() || pi.clauses[d].lit[i2] > pi.clauses[c].lit[i1])) {
			if (hc != -1) {
				return -1;
			}
			hc = pi.clauses[c].lit[i1];
			if (hc != lit) {
				return -1;
			}
			i1++;
		}
		else if (i2 < pi.clauses[d].lit.size() && (i1 == pi.clauses[c].lit.size() || pi.clauses[c].lit[i1] > pi.clauses[d].lit[i2])) {
			if (hd != -1) {
				return -1;
			}
			hd = pi.clauses[d].lit[i2];
			i2++;
		}
	}
	return hd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x40(%rbp)
movslq -0x18(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
movq -0x40(%rbp), %rdi
movq %rax, -0x38(%rbp)
movslq -0x14(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
movq %rax, %rcx
movq -0x38(%rbp), %rax
cmpq %rcx, %rax
je 0x27542
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x27850
movl $0xffffffff, -0x20(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x24(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x40(%rbp), %rdi
movl -0x28(%rbp), %eax
movq %rax, -0x50(%rbp)
movslq -0x14(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
movq -0x50(%rbp), %rcx
movq %rax, %rdx
movb $0x1, %al
cmpq %rdx, %rcx
movb %al, -0x41(%rbp)
jb 0x275b7
movq -0x40(%rbp), %rdi
movl -0x2c(%rbp), %eax
movq %rax, -0x58(%rbp)
movslq -0x18(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
movq %rax, %rcx
movq -0x58(%rbp), %rax
cmpq %rcx, %rax
setb %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x275c3
jmp 0x2784a
movq -0x40(%rbp), %rdi
movl -0x28(%rbp), %eax
movq %rax, -0x60(%rbp)
movslq -0x14(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
movq %rax, %rcx
movq -0x60(%rbp), %rax
cmpq %rcx, %rax
jae 0x27671
movq -0x40(%rbp), %rdi
movl -0x2c(%rbp), %eax
movq %rax, -0x68(%rbp)
movslq -0x18(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
movq %rax, %rcx
movq -0x68(%rbp), %rax
cmpq %rcx, %rax
jae 0x27671
movq -0x40(%rbp), %rdi
movslq -0x14(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
movl -0x28(%rbp), %eax
movl %eax, %esi
callq 0xa7c0
movq -0x40(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x6c(%rbp)
movslq -0x18(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0xa7c0
movq %rax, %rcx
movl -0x6c(%rbp), %eax
cmpl (%rcx), %eax
jne 0x27671
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x27845
movq -0x40(%rbp), %rdi
movl -0x28(%rbp), %eax
movq %rax, -0x78(%rbp)
movslq -0x14(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
movq %rax, %rcx
movq -0x78(%rbp), %rax
cmpq %rcx, %rax
jae 0x27761
movq -0x40(%rbp), %rdi
movl -0x2c(%rbp), %eax
movq %rax, -0x80(%rbp)
movslq -0x18(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
movq %rax, %rcx
movq -0x80(%rbp), %rax
cmpq %rcx, %rax
je 0x2770e
movq -0x40(%rbp), %rdi
movslq -0x18(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0xa7c0
movq -0x40(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x84(%rbp)
movslq -0x14(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
movl -0x28(%rbp), %eax
movl %eax, %esi
callq 0xa7c0
movq %rax, %rcx
movl -0x84(%rbp), %eax
cmpl (%rcx), %eax
jle 0x27761
cmpl $-0x1, -0x20(%rbp)
je 0x27720
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x27850
movq -0x40(%rbp), %rdi
movslq -0x14(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
movl -0x28(%rbp), %eax
movl %eax, %esi
callq 0xa7c0
movl (%rax), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
je 0x27753
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x27850
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x27843
movq -0x40(%rbp), %rdi
movl -0x2c(%rbp), %eax
movq %rax, -0x90(%rbp)
movslq -0x18(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
movq %rax, %rcx
movq -0x90(%rbp), %rax
cmpq %rcx, %rax
jae 0x27841
movq -0x40(%rbp), %rdi
movl -0x28(%rbp), %eax
movq %rax, -0x98(%rbp)
movslq -0x14(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
movq %rax, %rcx
movq -0x98(%rbp), %rax
cmpq %rcx, %rax
je 0x2780a
movq -0x40(%rbp), %rdi
movslq -0x14(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
movl -0x28(%rbp), %eax
movl %eax, %esi
callq 0xa7c0
movq -0x40(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x9c(%rbp)
movslq -0x18(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0xa7c0
movq %rax, %rcx
movl -0x9c(%rbp), %eax
cmpl (%rcx), %eax
jle 0x27841
cmpl $-0x1, -0x24(%rbp)
je 0x27819
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x27850
movq -0x40(%rbp), %rdi
movslq -0x18(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0xa7c0
movl (%rax), %eax
movl %eax, -0x24(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x27843
jmp 0x27845
jmp 0x2755e
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)