// File: Laakeri[P]maxpre/src/./LS.cpp
// Function: maxPreprocessor::Preprocessor::tryLS(int)
int Preprocessor::tryLS(int lbl) {
	assert(pi.isLabel[lbl]);
	vector<int> tc;
	if (pi.isLabel[lbl] == VAR_TRUE) {
		tc = pi.litClauses[negLit(lbl)];
	}
	else {
		tc = pi.litClauses[posLit(lbl)];
	}
	if (tc.size() == 0) return 0;
	vector<pair<int, int> > blockedClauses;
	unordered_set<int> touchedList;
	unordered_set<int> deletedClauses;
	for (int t : tc) {
		deletedClauses.insert(t);
		for(int l : pi.clauses[t].lit) {
			touchedList.insert(litVariable(l));
		}
	}
	while (touchedList.size() > 0) {
		int var = *touchedList.begin();
		touchedList.erase(var);
		if (pi.isLabel[var]) continue;
		tryLSBCE(posLit(var), deletedClauses, touchedList, blockedClauses);
		tryLSBCE(negLit(var), deletedClauses, touchedList, blockedClauses);
	}
	for (auto c : blockedClauses) {
		if (pi.isLabel[lbl] == VAR_TRUE) trace.LS(negLit(lbl), c.S, pi.clauses[c.F].lit);
		else trace.LS(posLit(lbl), c.S, pi.clauses[c.F].lit);
		
		if(pi.isLabel[lbl] == VAR_TRUE) pi.addLiteralToClause(negLit(lbl), c.F);
		else pi.addLiteralToClause(posLit(lbl), c.F);
	}
	rLog.removeLiteral(-(int)blockedClauses.size());
	return blockedClauses.size();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x200, %rsp            # imm = 0x200
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x160(%rbp)
addq $0x48, %rdi
movslq -0x14(%rbp), %rsi
callq 0xa7c0
cmpl $0x0, (%rax)
je 0x2cee1
jmp 0x2cf00
leaq 0x5a060(%rip), %rdi     # 0x86f48
leaq 0x5a069(%rip), %rsi     # 0x86f58
movl $0x23, %edx
leaq 0x5a066(%rip), %rcx     # 0x86f61
callq 0x4260
leaq -0x30(%rbp), %rdi
callq 0xa7e0
movq -0x160(%rbp), %rdi
addq $0x48, %rdi
movslq -0x14(%rbp), %rsi
callq 0xa7c0
cmpl $0x1, (%rax)
jne 0x2cf7a
movq -0x160(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x170(%rbp)
movl -0x14(%rbp), %edi
callq 0x3c5e0
movl %eax, -0x164(%rbp)
jmp 0x2cf44
movq -0x170(%rbp), %rdi
movl -0x164(%rbp), %eax
movslq %eax, %rsi
callq 0xaab0
movq %rax, %rsi
leaq -0x30(%rbp), %rdi
callq 0x3de50
jmp 0x2cf67
jmp 0x2cfc1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x2d514
movq -0x160(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x180(%rbp)
movl -0x14(%rbp), %edi
callq 0x3c5d0
movl %eax, -0x174(%rbp)
jmp 0x2cf9c
movq -0x180(%rbp), %rdi
movl -0x174(%rbp), %eax
movslq %eax, %rsi
callq 0xaab0
movq %rax, %rsi
leaq -0x30(%rbp), %rdi
callq 0x3de50
jmp 0x2cfbf
jmp 0x2cfc1
leaq -0x30(%rbp), %rdi
callq 0xf940
cmpq $0x0, %rax
jne 0x2cfe3
movl $0x0, -0x4(%rbp)
movl $0x1, -0x40(%rbp)
jmp 0x2d4ff
leaq -0x58(%rbp), %rdi
callq 0x3e9a0
leaq -0x90(%rbp), %rdi
callq 0x3f350
leaq -0xc8(%rbp), %rdi
callq 0x3f350
leaq -0x30(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rdi
callq 0xa800
movq %rax, -0xd8(%rbp)
movq -0xd0(%rbp), %rdi
callq 0xa830
movq %rax, -0xe0(%rbp)
leaq -0xd8(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x2d051
jmp 0x2d1c2
leaq -0xd8(%rbp), %rdi
callq 0xa8a0
movl (%rax), %eax
movl %eax, -0xe4(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0xe4(%rbp), %rsi
callq 0x3f3a0
movb %dl, -0x189(%rbp)
movq %rax, -0x188(%rbp)
jmp 0x2d087
movq -0x160(%rbp), %rdi
movb -0x189(%rbp), %al
movq -0x188(%rbp), %rcx
movq %rcx, -0xf8(%rbp)
movb %al, -0xf0(%rbp)
movslq -0xe4(%rbp), %rsi
callq 0x3c600
movq %rax, -0x100(%rbp)
movq -0x100(%rbp), %rdi
callq 0xa800
movq %rax, -0x108(%rbp)
movq -0x100(%rbp), %rdi
callq 0xa830
movq %rax, -0x110(%rbp)
leaq -0x108(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x2d0fd
jmp 0x2d1af
leaq -0x108(%rbp), %rdi
callq 0xa8a0
movl (%rax), %eax
movl %eax, -0x114(%rbp)
movl -0x114(%rbp), %edi
callq 0x3c880
movl %eax, -0x190(%rbp)
jmp 0x2d124
movl -0x190(%rbp), %eax
movl %eax, -0x118(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x3f400
movb %dl, -0x199(%rbp)
movq %rax, -0x198(%rbp)
jmp 0x2d152
movb -0x199(%rbp), %al
movq -0x198(%rbp), %rcx
movq %rcx, -0x128(%rbp)
movb %al, -0x120(%rbp)
leaq -0x108(%rbp), %rdi
callq 0xa930
jmp 0x2d0e1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x3f3e0
leaq -0x90(%rbp), %rdi
callq 0x3f3e0
leaq -0x58(%rbp), %rdi
callq 0x3ece0
jmp 0x2d514
jmp 0x2d1b1
leaq -0xd8(%rbp), %rdi
callq 0xa930
jmp 0x2d035
jmp 0x2d1c4
leaq -0x90(%rbp), %rdi
callq 0x3f440
cmpq $0x0, %rax
jbe 0x2d2b2
leaq -0x90(%rbp), %rdi
movq %rdi, -0x1a8(%rbp)
callq 0x3f460
movq %rax, -0x138(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x3f490
movq -0x1a8(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x12c(%rbp)
leaq -0x12c(%rbp), %rsi
callq 0x3f4c0
jmp 0x2d21d
movq -0x160(%rbp), %rdi
addq $0x48, %rdi
movslq -0x12c(%rbp), %rsi
callq 0xa7c0
cmpl $0x0, (%rax)
je 0x2d23b
jmp 0x2d1c4
movl -0x12c(%rbp), %edi
callq 0x3c5d0
movl %eax, -0x1ac(%rbp)
jmp 0x2d24e
movl -0x1ac(%rbp), %esi
movq -0x160(%rbp), %rdi
leaq -0xc8(%rbp), %rdx
leaq -0x90(%rbp), %rcx
leaq -0x58(%rbp), %r8
callq 0x2cb10
jmp 0x2d274
movl -0x12c(%rbp), %edi
callq 0x3c5e0
movl %eax, -0x1b0(%rbp)
jmp 0x2d287
movl -0x1b0(%rbp), %esi
movq -0x160(%rbp), %rdi
leaq -0xc8(%rbp), %rdx
leaq -0x90(%rbp), %rcx
leaq -0x58(%rbp), %r8
callq 0x2cb10
jmp 0x2d2ad
jmp 0x2d1c4
leaq -0x58(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x140(%rbp), %rdi
callq 0x3ebc0
movq %rax, -0x148(%rbp)
movq -0x140(%rbp), %rdi
callq 0x3ec30
movq %rax, -0x150(%rbp)
leaq -0x148(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x3ec60
testb $0x1, %al
jne 0x2d2ff
jmp 0x2d49c
leaq -0x148(%rbp), %rdi
callq 0x3eca0
movq -0x160(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x158(%rbp)
addq $0x48, %rdi
movslq -0x14(%rbp), %rsi
callq 0xa7c0
cmpl $0x1, (%rax)
jne 0x2d390
movq -0x160(%rbp), %rax
addq $0x2f0, %rax            # imm = 0x2F0
movq %rax, -0x1c0(%rbp)
movl -0x14(%rbp), %edi
callq 0x3c5e0
movl %eax, -0x1b4(%rbp)
jmp 0x2d352
movq -0x160(%rbp), %rdi
movl -0x154(%rbp), %eax
movl %eax, -0x1c4(%rbp)
movslq -0x158(%rbp), %rsi
callq 0x3c600
movq -0x1c0(%rbp), %rdi
movl -0x1b4(%rbp), %esi
movl -0x1c4(%rbp), %edx
movq %rax, %rcx
callq 0x5c890
jmp 0x2d38e
jmp 0x2d3f2
movq -0x160(%rbp), %rax
addq $0x2f0, %rax            # imm = 0x2F0
movq %rax, -0x1d0(%rbp)
movl -0x14(%rbp), %edi
callq 0x3c5d0
movl %eax, -0x1c8(%rbp)
jmp 0x2d3b4
movq -0x160(%rbp), %rdi
movl -0x154(%rbp), %eax
movl %eax, -0x1d4(%rbp)
movslq -0x158(%rbp), %rsi
callq 0x3c600
movq -0x1d0(%rbp), %rdi
movl -0x1c8(%rbp), %esi
movl -0x1d4(%rbp), %edx
movq %rax, %rcx
callq 0x5c890
jmp 0x2d3f0
jmp 0x2d3f2
movq -0x160(%rbp), %rdi
addq $0x48, %rdi
movslq -0x14(%rbp), %rsi
callq 0xa7c0
cmpl $0x1, (%rax)
jne 0x2d44a
movq -0x160(%rbp), %rax
movq %rax, -0x1e0(%rbp)
movl -0x14(%rbp), %edi
callq 0x3c5e0
movl %eax, -0x1d8(%rbp)
jmp 0x2d429
movl -0x1d8(%rbp), %esi
movq -0x1e0(%rbp), %rdi
movl -0x158(%rbp), %edx
movl $0x1, %ecx
callq 0x5fa80
jmp 0x2d448
jmp 0x2d489
movq -0x160(%rbp), %rax
movq %rax, -0x1f0(%rbp)
movl -0x14(%rbp), %edi
callq 0x3c5d0
movl %eax, -0x1e4(%rbp)
jmp 0x2d468
movl -0x1e4(%rbp), %esi
movq -0x1f0(%rbp), %rdi
movl -0x158(%rbp), %edx
movl $0x1, %ecx
callq 0x5fa80
jmp 0x2d487
jmp 0x2d489
jmp 0x2d48b
leaq -0x148(%rbp), %rdi
callq 0x3ecc0
jmp 0x2d2e3
movq -0x160(%rbp), %rax
addq $0x218, %rax            # imm = 0x218
movq %rax, -0x1f8(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x3efb0
movq -0x1f8(%rbp), %rdi
movl %eax, %esi
negl %esi
callq 0x61510
jmp 0x2d4cb
leaq -0x58(%rbp), %rdi
callq 0x3efb0
movl %eax, -0x4(%rbp)
movl $0x1, -0x40(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x3f3e0
leaq -0x90(%rbp), %rdi
callq 0x3f3e0
leaq -0x58(%rbp), %rdi
callq 0x3ece0
leaq -0x30(%rbp), %rdi
callq 0xab00
movl -0x4(%rbp), %eax
addq $0x200, %rsp            # imm = 0x200
popq %rbp
retq
leaq -0x30(%rbp), %rdi
callq 0xab00
movq -0x38(%rbp), %rdi
callq 0x4610
nopw %cs:(%rax,%rax)