// File: /workspace/github_cpp_makefile_star2_O2/Laakeri[P]maxpre/src/./FLP.cpp
// Function: maxPreprocessor::Preprocessor::tryFLP(std::vector<int, std::allocator<int>>, int)
int Preprocessor::tryFLP(vector<int> fLit, int clause) {
	bool is = false;
	for (int lit : fLit) {
		for (int c : pi.litClauses[lit]) {
			if (pi.clauses[c].lit.size() < 3) {
				is = true;
				break;
			}
		}
	}
	if (!is) return 0;
	queue<int> failQ;
	for (int lit : fLit) {
		failQ.push(lit);
	}
	vector<pair<int, int> > litRemoved;
	bool conflict = false;
	unordered_set<int> satClauses;
	unordered_set<int> used;
	vector<int> binCores;
	while (!failQ.empty()) {
		int lit = failQ.front();
		failQ.pop();
		if (used.count(lit)) continue;
		used.insert(lit);
		for (int c : pi.litClauses[litNegation(lit)]) {
			satClauses.insert(c);
		}
		vector<int> cs = pi.litClauses[lit];
		for (int c : cs) {
			if (satClauses.count(c)) continue;
			if (!pi.clauses[c].isHard()) {
				if (fLit.size() == 1) binCores.push_back(litNegation(pi.clauses[c].lit[0]));
				continue;
			}
			if (!pi.clauses[c].isHard()) continue;
			if (pi.clauses[c].lit.size() == 1) {
				conflict = true;
				break;
			}
			pi.removeLiteralFromClause(lit, c, false);
			litRemoved.push_back({lit, c});
			if (pi.clauses[c].lit.size() == 1) {
				failQ.push(litNegation(pi.clauses[c].lit[0]));
			}
		}
		if (conflict) break;
	}
	for (auto t : litRemoved) {
		pi.addLiteralToClause(t.F, t.S, false);
	}
	if (conflict) {
		if (fLit.size() == 1) {
			int rmClauses;
			if (litValue(fLit[0]) == true) {
				rmClauses = setVariable(litVariable(fLit[0]), true);
			}
			else {
				rmClauses = setVariable(litVariable(fLit[0]), false);
			}
			assert(pi.isVarRemoved(litVariable(fLit[0])));
			rLog.removeClause(rmClauses);
			if (pi.isLabel[litVariable(fLit[0])]) rLog.removeLabel(1);
			else rLog.removeVariable(1);
		}
		else {
			vector<int> teClause = pi.clauses[clause].lit;
			for (int lit : teClause) {
				if (!pi.isLabel[litVariable(lit)]) {
					pi.removeLiteralFromClause(lit, clause);
					rLog.removeLiteral(1);
				}
			}
		}
		return 1;
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rdi, %rbx
movq (%rsi), %rax
movq %rsi, 0x18(%rsp)
movq 0x8(%rsi), %rcx
movq (%rdi), %r14
movq 0x18(%rdi), %rsi
xorl %edi, %edi
cmpq %rcx, %rax
je 0x1395e
movslq (%rax), %r8
imulq $0x18, %r8, %r9
movq (%rsi,%r9), %r8
movq 0x8(%rsi,%r9), %r9
cmpq %r9, %r8
je 0x13958
movslq (%r8), %r10
imulq $0x28, %r10, %r10
movq 0x8(%r14,%r10), %r11
subq (%r14,%r10), %r11
addq $0x4, %r8
cmpq $0x8, %r11
ja 0x13936
movb $0x1, %dil
addq $0x4, %rax
jmp 0x13921
xorl %ebp, %ebp
testb $0x1, %dil
je 0x13d70
movl %edx, 0x24(%rsp)
leaq 0xe8(%rsp), %r14
movq %r14, %rdi
callq 0x1910c
movq 0x18(%rsp), %rax
movq (%rax), %r12
movq 0x8(%rax), %r13
leaq 0x78(%rsp), %r15
cmpq %r13, %r12
je 0x139ad
movl (%r12), %eax
movl %eax, 0x78(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x1cfd6
addq $0x4, %r12
jmp 0x1398f
xorps %xmm0, %xmm0
leaq 0x40(%rsp), %rax
andq $0x0, 0x10(%rax)
movaps %xmm0, (%rax)
leaq 0xa8(%rsp), %rax
movq %rax, -0x30(%rax)
pushq $0x1
popq %rcx
movq %rcx, -0x28(%rax)
movups %xmm0, -0x20(%rax)
movl $0x3f800000, %edx       # imm = 0x3F800000
movl %edx, -0x10(%rax)
movups %xmm0, -0x8(%rax)
leaq 0xe0(%rsp), %rax
movq %rax, -0x30(%rax)
movq %rcx, -0x28(%rax)
movups %xmm0, -0x20(%rax)
movl %edx, -0x10(%rax)
movups %xmm0, -0x8(%rax)
leaq 0x60(%rsp), %rax
movaps %xmm0, (%rax)
andq $0x0, 0x10(%rax)
xorl %r12d, %r12d
leaq 0xe8(%rsp), %r13
leaq 0xb0(%rsp), %r15
leaq 0x28(%rsp), %rbp
leaq 0x78(%rsp), %r14
movq 0xf8(%rsp), %rax
cmpq %rax, 0x118(%rsp)
je 0x13c0b
movl (%rax), %eax
movl %eax, 0xc(%rsp)
movq %r13, %rdi
callq 0x1d20a
movq %r15, %rdi
leaq 0xc(%rsp), %rsi
callq 0x1e0fa
testq %rax, %rax
jne 0x13a25
movl %r12d, 0x20(%rsp)
movq %r15, %rdi
leaq 0xc(%rsp), %rsi
callq 0x1e18a
movslq 0xc(%rsp), %rax
xorq $0x1, %rax
movq 0x18(%rbx), %rcx
imulq $0x18, %rax, %rax
movq (%rcx,%rax), %r15
movq 0x8(%rcx,%rax), %r12
cmpq %r12, %r15
je 0x13aa4
movl (%r15), %eax
movl %eax, 0x28(%rsp)
movq %r14, %rdi
movq %rbp, %rsi
callq 0x1e18a
addq $0x4, %r15
jmp 0x13a87
movslq 0xc(%rsp), %rax
imulq $0x18, %rax, %rsi
addq 0x18(%rbx), %rsi
movq %rbp, %rdi
callq 0x19284
movq 0x28(%rsp), %r15
movq 0x30(%rsp), %r12
cmpq %r12, %r15
je 0x13be5
movl (%r15), %eax
movl %eax, 0x8(%rsp)
movq %r14, %rdi
leaq 0x8(%rsp), %rsi
callq 0x1e0fa
testq %rax, %rax
je 0x13aeb
addq $0x4, %r15
jmp 0x13ac3
movslq 0x8(%rsp), %rax
imulq $0x28, %rax, %rdi
addq (%rbx), %rdi
callq 0x21bac
testb %al, %al
je 0x13ba2
movslq 0x8(%rsp), %rax
imulq $0x28, %rax, %rdi
addq (%rbx), %rdi
callq 0x21bac
testb %al, %al
je 0x13ae5
movslq 0x8(%rsp), %rdx
movq (%rbx), %rax
imulq $0x28, %rdx, %rcx
movq 0x8(%rax,%rcx), %rsi
subq (%rax,%rcx), %rsi
cmpq $0x4, %rsi
je 0x13c06
movl 0xc(%rsp), %esi
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x216d0
movl 0xc(%rsp), %eax
movl %eax, 0x10(%rsp)
movl 0x8(%rsp), %eax
movl %eax, 0x14(%rsp)
leaq 0x40(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x1d392
movslq 0x8(%rsp), %rax
movq (%rbx), %rcx
imulq $0x28, %rax, %rdx
movq (%rcx,%rdx), %rax
movq 0x8(%rcx,%rdx), %rcx
subq %rax, %rcx
cmpq $0x4, %rcx
jne 0x13ae5
movl (%rax), %eax
xorl $0x1, %eax
movl %eax, 0x10(%rsp)
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
callq 0x1d260
jmp 0x13ae5
movq 0x18(%rsp), %rcx
movq 0x8(%rcx), %rax
subq (%rcx), %rax
cmpq $0x4, %rax
jne 0x13ae5
movslq 0x8(%rsp), %rax
movq (%rbx), %rcx
imulq $0x28, %rax, %rax
movq (%rcx,%rax), %rax
movl (%rax), %eax
xorl $0x1, %eax
movl %eax, 0x10(%rsp)
leaq 0x60(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x19ed4
jmp 0x13ae5
movl 0x20(%rsp), %r12d
movq %rbp, %rdi
callq 0x7512
testb $0x1, %r12b
leaq 0xb0(%rsp), %r15
je 0x13a25
jmp 0x13c0b
movb $0x1, %r12b
jmp 0x13bea
movq 0x40(%rsp), %r14
movq 0x48(%rsp), %r15
movl 0x24(%rsp), %r13d
cmpq %r15, %r14
je 0x13c36
movl (%r14), %esi
movl 0x4(%r14), %edx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x21638
addq $0x8, %r14
jmp 0x13c1a
xorl %ebp, %ebp
testb $0x1, %r12b
je 0x13d38
movq 0x18(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
subq %rax, %rcx
cmpq $0x4, %rcx
jne 0x13cc2
movl (%rax), %esi
xorl %edx, %edx
testb $0x1, %sil
sete %dl
sarl %esi
movq %rbx, %rdi
callq 0x7c98
movl %eax, %ebp
movq 0x18(%rsp), %rax
movq (%rax), %rax
movl (%rax), %esi
sarl %esi
movq %rbx, %rdi
callq 0x20fae
testb %al, %al
je 0x13d84
leaq 0x218(%rbx), %r14
movq %r14, %rdi
movl %ebp, %esi
callq 0x21e84
movq 0x18(%rsp), %rax
movq (%rax), %rax
movl (%rax), %eax
sarl %eax
cltq
movq 0x48(%rbx), %rcx
cmpl $0x0, (%rcx,%rax,4)
je 0x13d2b
pushq $0x1
popq %rbp
movq %r14, %rdi
movl %ebp, %esi
callq 0x21f32
jmp 0x13d38
movslq %r13d, %rax
imulq $0x28, %rax, %rsi
addq (%rbx), %rsi
leaq 0x28(%rsp), %rdi
callq 0x19284
movq 0x28(%rsp), %r15
movq 0x30(%rsp), %r12
leaq 0x218(%rbx), %r14
pushq $0x1
popq %rbp
cmpq %r12, %r15
je 0x13d1f
movl (%r15), %esi
movl %esi, %eax
sarl %eax
cltq
movq 0x48(%rbx), %rcx
cmpl $0x0, (%rcx,%rax,4)
jne 0x13d19
movq %rbx, %rdi
movl %r13d, %edx
movl %ebp, %ecx
callq 0x216d0
movq %r14, %rdi
movl %ebp, %esi
callq 0x21ef8
addq $0x4, %r15
jmp 0x13cea
leaq 0x28(%rsp), %rdi
callq 0x7512
jmp 0x13d38
pushq $0x1
popq %rbp
movq %r14, %rdi
movl %ebp, %esi
callq 0x21ebe
leaq 0x60(%rsp), %rdi
callq 0x7512
leaq 0xb0(%rsp), %rdi
callq 0x19928
leaq 0x78(%rsp), %rdi
callq 0x19928
leaq 0x40(%rsp), %rdi
callq 0x1d322
leaq 0xe8(%rsp), %rdi
callq 0x198d0
movl %ebp, %eax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1c1dd(%rip), %rdi     # 0x2ff68
leaq 0x1c1fc(%rip), %rsi     # 0x2ff8e
leaq 0x1c1ff(%rip), %rcx     # 0x2ff98
pushq $0x3e
popq %rdx
callq 0x31c0
jmp 0x13db5
jmp 0x13db5
jmp 0x13db5
jmp 0x13db5
jmp 0x13dbf
jmp 0x13dbf
jmp 0x13dbf
jmp 0x13dbf
jmp 0x13db5
jmp 0x13db5
movq %rax, %rbx
jmp 0x13dcc
movq %rax, %rbx
jmp 0x13df7
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x7512
leaq 0x60(%rsp), %rdi
callq 0x7512
leaq 0xb0(%rsp), %rdi
callq 0x19928
leaq 0x78(%rsp), %rdi
callq 0x19928
leaq 0x40(%rsp), %rdi
callq 0x1d322
leaq 0xe8(%rsp), %rdi
callq 0x198d0
movq %rbx, %rdi
callq 0x3490