// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movslq %esi, %r12
movq 0x48(%rdi), %rax
movl (%rax,%r12,4), %eax
testl %eax, %eax
je 0x143e7
movl %esi, %r14d
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x50(%rsp), %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
xorl %ecx, %ecx
cmpl $0x1, %eax
sete %cl
leal (%rcx,%r14,2), %eax
cltq
imulq $0x18, %rax, %rsi
addq 0x18(%rbx), %rsi
callq 0x18ea4
movq 0x50(%rsp), %r15
movq 0x58(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq %r15, %rax
je 0x143c7
movq %r12, 0x48(%rsp)
movq %r14, 0x10(%rsp)
andq $0x0, 0x30(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
leaq 0x98(%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 0xd0(%rsp), %rax
movq %rax, -0x30(%rax)
movq %rcx, -0x28(%rax)
movups %xmm0, -0x20(%rax)
movl %edx, -0x10(%rax)
movups %xmm0, -0x8(%rax)
leaq 0x68(%rsp), %r13
leaq 0x1c(%rsp), %rbp
cmpq 0x8(%rsp), %r15
je 0x14271
movl (%r15), %eax
movl %eax, 0x4(%rsp)
leaq 0xa0(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x1e18a
movslq 0x4(%rsp), %rax
movq (%rbx), %rcx
imulq $0x28, %rax, %rax
movq (%rcx,%rax), %r14
movq 0x8(%rcx,%rax), %r12
cmpq %r12, %r14
je 0x1426b
movl (%r14), %eax
sarl %eax
movl %eax, 0x1c(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1e470
addq $0x4, %r14
jmp 0x1424c
addq $0x4, %r15
jmp 0x14217
leaq 0x68(%rsp), %r15
leaq 0x4(%rsp), %r12
leaq 0xa0(%rsp), %r13
leaq 0x20(%rsp), %rbp
cmpq $0x0, 0x80(%rsp)
je 0x142ea
movq 0x78(%rsp), %rax
movl 0x8(%rax), %eax
movl %eax, 0x4(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x1e54a
movslq 0x4(%rsp), %rsi
movq 0x48(%rbx), %rax
cmpl $0x0, (%rax,%rsi,4)
jne 0x14288
addl %esi, %esi
movq %rbx, %rdi
movq %r13, %rdx
movq %r15, %rcx
movq %rbp, %r8
callq 0x13fce
movl 0x4(%rsp), %eax
leal 0x1(,%rax,2), %esi
movq %rbx, %rdi
movq %r13, %rdx
movq %r15, %rcx
movq %rbp, %r8
callq 0x13fce
jmp 0x14288
movq 0x20(%rsp), %r13
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x2f0(%rbx), %rax
movq %rax, 0x40(%rsp)
movq 0x10(%rsp), %rcx
movl %ecx, %eax
addl %ecx, %ecx
movq %rcx, 0x10(%rsp)
leal 0x1(,%rax,2), %r14d
movq 0x48(%rsp), %rbp
movq 0x10(%rsp), %r15
cmpq 0x8(%rsp), %r13
je 0x14377
movslq (%r13), %r12
movq 0x48(%rbx), %rax
imulq $0x28, %r12, %rcx
addq (%rbx), %rcx
cmpl $0x1, (%rax,%rbp,4)
movl 0x4(%r13), %edx
movl %r15d, %esi
cmovel %r14d, %esi
movq 0x40(%rsp), %rdi
callq 0x2068e
movq 0x48(%rbx), %rax
cmpl $0x1, (%rax,%rbp,4)
movl %r15d, %esi
cmovel %r14d, %esi
movq %rbx, %rdi
movl %r12d, %edx
pushq $0x1
popq %rcx
callq 0x21638
addq $0x8, %r13
jmp 0x14325
addq $0x218, %rbx            # imm = 0x218
movq 0x28(%rsp), %rsi
subq 0x20(%rsp), %rsi
shrq $0x3, %rsi
negl %esi
movq %rbx, %rdi
callq 0x21ef8
leaq 0x20(%rsp), %r14
movq 0x8(%r14), %rbx
subq (%r14), %rbx
shrq $0x3, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x19928
leaq 0x68(%rsp), %rdi
callq 0x19928
movq %r14, %rdi
callq 0x1d322
jmp 0x143c9
xorl %ebx, %ebx
leaq 0x50(%rsp), %rdi
callq 0x7512
movl %ebx, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1bbfa(%rip), %rdi     # 0x2ffe8
leaq 0x1bc03(%rip), %rsi     # 0x2fff8
leaq 0x1bc05(%rip), %rcx     # 0x30001
pushq $0x23
popq %rdx
callq 0x31c0
jmp 0x14411
movq %rax, %rbx
jmp 0x14435
jmp 0x14411
jmp 0x14411
jmp 0x14411
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x19928
leaq 0x68(%rsp), %rdi
callq 0x19928
leaq 0x20(%rsp), %rdi
callq 0x1d322
leaq 0x50(%rsp), %rdi
callq 0x7512
movq %rbx, %rdi
callq 0x3490
nop