// File: 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
movq %rsp, %rbp
subq $0x320, %rsp            # imm = 0x320
movq %rsi, -0x288(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x280(%rbp)
movb $0x0, -0x1d(%rbp)
movq %rsi, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0xa800
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
callq 0xa830
movq %rax, -0x38(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x2bdb0
jmp 0x2be52
leaq -0x30(%rbp), %rdi
callq 0xa8a0
movq -0x280(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
addq $0x18, %rdi
movslq -0x3c(%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 0x2be03
jmp 0x2be42
leaq -0x50(%rbp), %rdi
callq 0xa8a0
movq -0x280(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x5c(%rbp)
movslq -0x5c(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
cmpq $0x3, %rax
jae 0x2be35
movb $0x1, -0x1d(%rbp)
jmp 0x2be42
jmp 0x2be37
leaq -0x50(%rbp), %rdi
callq 0xa930
jmp 0x2bdf0
jmp 0x2be44
leaq -0x30(%rbp), %rdi
callq 0xa930
jmp 0x2bd9a
testb $0x1, -0x1d(%rbp)
jne 0x2be64
movl $0x0, -0x4(%rbp)
jmp 0x2c846
leaq -0xb0(%rbp), %rdi
callq 0x3e780
movq -0x288(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rdi
callq 0xa800
movq %rax, -0xc0(%rbp)
movq -0xb8(%rbp), %rdi
callq 0xa830
movq %rax, -0xc8(%rbp)
leaq -0xc0(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x2bebd
jmp 0x2bf0d
leaq -0xc0(%rbp), %rdi
callq 0xa8a0
movl (%rax), %eax
movl %eax, -0xcc(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0xcc(%rbp), %rsi
callq 0x3e7b0
jmp 0x2bee6
jmp 0x2bee8
leaq -0xc0(%rbp), %rdi
callq 0xa930
jmp 0x2bea4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x2c838
leaq -0xf8(%rbp), %rdi
callq 0x3e9a0
movb $0x0, -0xf9(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x3f350
leaq -0x170(%rbp), %rdi
callq 0x3f350
leaq -0x188(%rbp), %rdi
callq 0xa7e0
leaq -0xb0(%rbp), %rdi
callq 0x3e7e0
movb %al, -0x289(%rbp)
jmp 0x2bf58
movb -0x289(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x2bf69
jmp 0x2c3df
leaq -0xb0(%rbp), %rdi
callq 0x3e800
movq %rax, -0x298(%rbp)
jmp 0x2bf7e
movq -0x298(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x18c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x3e820
jmp 0x2bf9b
leaq -0x170(%rbp), %rdi
leaq -0x18c(%rbp), %rsi
callq 0x3f370
movq %rax, -0x2a0(%rbp)
jmp 0x2bfb7
movq -0x2a0(%rbp), %rax
cmpq $0x0, %rax
je 0x2bfe0
jmp 0x2bf44
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x2c808
leaq -0x170(%rbp), %rdi
leaq -0x18c(%rbp), %rsi
callq 0x3f3a0
movb %dl, -0x2a9(%rbp)
movq %rax, -0x2a8(%rbp)
jmp 0x2c002
movq -0x280(%rbp), %rax
movb -0x2a9(%rbp), %cl
movq -0x2a8(%rbp), %rdx
movq %rdx, -0x1a0(%rbp)
movb %cl, -0x198(%rbp)
addq $0x18, %rax
movq %rax, -0x2b8(%rbp)
movl -0x18c(%rbp), %edi
callq 0x3c5a0
movl %eax, -0x2b0(%rbp)
jmp 0x2c041
movq -0x2b8(%rbp), %rdi
movl -0x2b0(%rbp), %eax
movslq %eax, %rsi
callq 0xaab0
movq %rax, -0x1a8(%rbp)
movq -0x1a8(%rbp), %rdi
callq 0xa800
movq %rax, -0x1b0(%rbp)
movq -0x1a8(%rbp), %rdi
callq 0xa830
movq %rax, -0x1b8(%rbp)
leaq -0x1b0(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x2c09c
jmp 0x2c0fa
leaq -0x1b0(%rbp), %rdi
callq 0xa8a0
movl (%rax), %eax
movl %eax, -0x1bc(%rbp)
leaq -0x138(%rbp), %rdi
leaq -0x1bc(%rbp), %rsi
callq 0x3f3a0
movb %dl, -0x2c1(%rbp)
movq %rax, -0x2c0(%rbp)
jmp 0x2c0d2
movb -0x2c1(%rbp), %al
movq -0x2c0(%rbp), %rcx
movq %rcx, -0x1d0(%rbp)
movb %al, -0x1c8(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0xa930
jmp 0x2c083
movq -0x280(%rbp), %rdi
addq $0x18, %rdi
movslq -0x18c(%rbp), %rsi
callq 0xaab0
movq %rax, %rsi
leaq -0x1e8(%rbp), %rdi
callq 0x3edb0
jmp 0x2c122
leaq -0x1e8(%rbp), %rax
movq %rax, -0x1f0(%rbp)
movq -0x1f0(%rbp), %rdi
callq 0xa800
movq %rax, -0x1f8(%rbp)
movq -0x1f0(%rbp), %rdi
callq 0xa830
movq %rax, -0x200(%rbp)
leaq -0x1f8(%rbp), %rdi
leaq -0x200(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x2c172
jmp 0x2c3a1
leaq -0x1f8(%rbp), %rdi
callq 0xa8a0
movl (%rax), %eax
movl %eax, -0x204(%rbp)
leaq -0x138(%rbp), %rdi
leaq -0x204(%rbp), %rsi
callq 0x3f370
movq %rax, -0x2d0(%rbp)
jmp 0x2c1a2
movq -0x2d0(%rbp), %rax
cmpq $0x0, %rax
je 0x2c1d7
jmp 0x2c390
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
leaq -0x1e8(%rbp), %rdi
callq 0xab00
jmp 0x2c808
movq -0x280(%rbp), %rdi
movslq -0x204(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0x60e90
movb %al, -0x2d1(%rbp)
jmp 0x2c1fa
movb -0x2d1(%rbp), %al
testb $0x1, %al
jne 0x2c26e
jmp 0x2c206
movq -0x288(%rbp), %rdi
callq 0xf940
cmpq $0x1, %rax
jne 0x2c269
movq -0x280(%rbp), %rdi
movslq -0x204(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa7c0
movl (%rax), %edi
callq 0x3c5a0
movl %eax, -0x2d8(%rbp)
jmp 0x2c246
movl -0x2d8(%rbp), %eax
movl %eax, -0x208(%rbp)
leaq -0x188(%rbp), %rdi
leaq -0x208(%rbp), %rsi
callq 0x3c850
jmp 0x2c267
jmp 0x2c269
jmp 0x2c390
movq -0x280(%rbp), %rdi
movslq -0x204(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0x60e90
movb %al, -0x2d9(%rbp)
jmp 0x2c291
movb -0x2d9(%rbp), %al
testb $0x1, %al
jne 0x2c2a2
jmp 0x2c29d
jmp 0x2c390
movq -0x280(%rbp), %rdi
movslq -0x204(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
cmpq $0x1, %rax
jne 0x2c2cf
movb $0x1, -0xf9(%rbp)
jmp 0x2c3a1
movq -0x280(%rbp), %rdi
movl -0x18c(%rbp), %esi
movl -0x204(%rbp), %edx
xorl %ecx, %ecx
callq 0x5fb90
jmp 0x2c2eb
leaq -0x210(%rbp), %rdi
leaq -0x18c(%rbp), %rsi
leaq -0x204(%rbp), %rdx
callq 0x3d7c0
jmp 0x2c307
leaq -0xf8(%rbp), %rdi
leaq -0x210(%rbp), %rsi
callq 0x3eac0
jmp 0x2c31c
movq -0x280(%rbp), %rdi
movslq -0x204(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
cmpq $0x1, %rax
jne 0x2c38e
movq -0x280(%rbp), %rdi
movslq -0x204(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa7c0
movl (%rax), %edi
callq 0x3c5a0
movl %eax, -0x2e0(%rbp)
jmp 0x2c36b
movl -0x2e0(%rbp), %eax
movl %eax, -0x214(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0x214(%rbp), %rsi
callq 0x3e840
jmp 0x2c38c
jmp 0x2c38e
jmp 0x2c390
leaq -0x1f8(%rbp), %rdi
callq 0xa930
jmp 0x2c156
testb $0x1, -0xf9(%rbp)
je 0x2c3b6
movl $0x9, -0x218(%rbp)
jmp 0x2c3c0
movl $0x0, -0x218(%rbp)
leaq -0x1e8(%rbp), %rdi
callq 0xab00
movl -0x218(%rbp), %eax
testl %eax, %eax
je 0x2c3da
jmp 0x2c3d8
jmp 0x2c3df
jmp 0x2bf44
leaq -0xf8(%rbp), %rax
movq %rax, -0x220(%rbp)
movq -0x220(%rbp), %rdi
callq 0x3ebc0
movq %rax, -0x228(%rbp)
movq -0x220(%rbp), %rdi
callq 0x3ec30
movq %rax, -0x230(%rbp)
leaq -0x228(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x3ec60
testb $0x1, %al
jne 0x2c42c
jmp 0x2c46e
leaq -0x228(%rbp), %rdi
callq 0x3eca0
movq -0x280(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x238(%rbp)
movl -0x238(%rbp), %esi
movl -0x234(%rbp), %edx
xorl %ecx, %ecx
callq 0x5fa80
jmp 0x2c45e
jmp 0x2c460
leaq -0x228(%rbp), %rdi
callq 0x3ecc0
jmp 0x2c413
testb $0x1, -0xf9(%rbp)
je 0x2c7b9
movq -0x288(%rbp), %rdi
callq 0xf940
cmpq $0x1, %rax
jne 0x2c665
movq -0x288(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa7c0
movl (%rax), %edi
callq 0x3c890
movl %eax, -0x2e4(%rbp)
jmp 0x2c4b0
movl -0x2e4(%rbp), %eax
cmpl $0x1, %eax
jne 0x2c507
movq -0x288(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa7c0
movl (%rax), %edi
callq 0x3c880
movl %eax, -0x2e8(%rbp)
jmp 0x2c4da
movl -0x2e8(%rbp), %esi
movq -0x280(%rbp), %rdi
movl $0x1, %edx
callq 0x10a60
movl %eax, -0x2ec(%rbp)
jmp 0x2c4f9
movl -0x2ec(%rbp), %eax
movl %eax, -0x23c(%rbp)
jmp 0x2c54e
movq -0x288(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa7c0
movl (%rax), %edi
callq 0x3c880
movl %eax, -0x2f0(%rbp)
jmp 0x2c526
movl -0x2f0(%rbp), %esi
movq -0x280(%rbp), %rdi
xorl %edx, %edx
callq 0x10a60
movl %eax, -0x2f4(%rbp)
jmp 0x2c542
movl -0x2f4(%rbp), %eax
movl %eax, -0x23c(%rbp)
movq -0x288(%rbp), %rdi
movq -0x280(%rbp), %rax
movq %rax, -0x300(%rbp)
xorl %eax, %eax
movl %eax, %esi
callq 0xa7c0
movl (%rax), %edi
callq 0x3c880
movl %eax, -0x2f8(%rbp)
jmp 0x2c57b
movl -0x2f8(%rbp), %esi
movq -0x300(%rbp), %rdi
callq 0x5ecc0
movb %al, -0x301(%rbp)
jmp 0x2c595
movb -0x301(%rbp), %al
testb $0x1, %al
jne 0x2c5a1
jmp 0x2c5a3
jmp 0x2c5c2
leaq 0x5a91e(%rip), %rdi     # 0x86ec8
leaq 0x5a93d(%rip), %rsi     # 0x86eee
movl $0x3e, %edx
leaq 0x5a93b(%rip), %rcx     # 0x86ef8
callq 0x4260
movq -0x280(%rbp), %rdi
addq $0x218, %rdi            # imm = 0x218
movl -0x23c(%rbp), %esi
callq 0x61410
jmp 0x2c5dd
movq -0x288(%rbp), %rdi
movq -0x280(%rbp), %rax
addq $0x48, %rax
movq %rax, -0x310(%rbp)
xorl %eax, %eax
movl %eax, %esi
callq 0xa7c0
movl (%rax), %edi
callq 0x3c880
movl %eax, -0x308(%rbp)
jmp 0x2c60e
movq -0x310(%rbp), %rdi
movl -0x308(%rbp), %eax
movslq %eax, %rsi
callq 0xa7c0
cmpl $0x0, (%rax)
je 0x2c644
movq -0x280(%rbp), %rdi
addq $0x218, %rdi            # imm = 0x218
movl $0x1, %esi
callq 0x61590
jmp 0x2c642
jmp 0x2c660
movq -0x280(%rbp), %rdi
addq $0x218, %rdi            # imm = 0x218
movl $0x1, %esi
callq 0x61490
jmp 0x2c65e
jmp 0x2c660
jmp 0x2c7a6
movq -0x280(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
callq 0x3c600
movq %rax, %rsi
leaq -0x258(%rbp), %rdi
callq 0x3edb0
jmp 0x2c686
leaq -0x258(%rbp), %rax
movq %rax, -0x260(%rbp)
movq -0x260(%rbp), %rdi
callq 0xa800
movq %rax, -0x268(%rbp)
movq -0x260(%rbp), %rdi
callq 0xa830
movq %rax, -0x270(%rbp)
leaq -0x268(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x2c6d6
jmp 0x2c79a
leaq -0x268(%rbp), %rdi
callq 0xa8a0
movq %rax, %rcx
movq -0x280(%rbp), %rax
movl (%rcx), %ecx
movl %ecx, -0x274(%rbp)
addq $0x48, %rax
movq %rax, -0x320(%rbp)
movl -0x274(%rbp), %edi
callq 0x3c880
movl %eax, -0x314(%rbp)
jmp 0x2c712
movq -0x320(%rbp), %rdi
movl -0x314(%rbp), %eax
movslq %eax, %rsi
callq 0xa7c0
cmpl $0x0, (%rax)
jne 0x2c787
movq -0x280(%rbp), %rdi
movl -0x274(%rbp), %esi
movl -0x1c(%rbp), %edx
movl $0x1, %ecx
callq 0x5fb90
jmp 0x2c748
movq -0x280(%rbp), %rdi
addq $0x218, %rdi            # imm = 0x218
movl $0x1, %esi
callq 0x61510
jmp 0x2c762
jmp 0x2c787
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
leaq -0x258(%rbp), %rdi
callq 0xab00
jmp 0x2c808
jmp 0x2c789
leaq -0x268(%rbp), %rdi
callq 0xa930
jmp 0x2c6ba
leaq -0x258(%rbp), %rdi
callq 0xab00
movl $0x1, -0x4(%rbp)
movl $0x1, -0x218(%rbp)
jmp 0x2c7ca
movl $0x0, -0x4(%rbp)
movl $0x1, -0x218(%rbp)
leaq -0x188(%rbp), %rdi
callq 0xab00
leaq -0x170(%rbp), %rdi
callq 0x3f3e0
leaq -0x138(%rbp), %rdi
callq 0x3f3e0
leaq -0xf8(%rbp), %rdi
callq 0x3ece0
leaq -0xb0(%rbp), %rdi
callq 0x3e870
jmp 0x2c846
leaq -0x188(%rbp), %rdi
callq 0xab00
leaq -0x170(%rbp), %rdi
callq 0x3f3e0
leaq -0x138(%rbp), %rdi
callq 0x3f3e0
leaq -0xf8(%rbp), %rdi
callq 0x3ece0
leaq -0xb0(%rbp), %rdi
callq 0x3e870
jmp 0x2c852
movl -0x4(%rbp), %eax
addq $0x320, %rsp            # imm = 0x320
popq %rbp
retq
movq -0xd8(%rbp), %rdi
callq 0x4610
nop