// File: akinanop[P]mvl-solver/src/Formula.cc
// Function: Formula::removeLiteral(int, bool, int)
inline void Formula::removeLiteral ( int var, bool equals, int val ) {

	vector<int>::iterator current;
	vector<int>::iterator end;

	// for every record of this literal reduce the number of unassigned literals in unsatisfied clauses
	// update counts

	if ( equals ) current = VARLIST[var] -> ATOMRECPOS[val].begin();
	else current = VARLIST[var] -> ATOMRECNEG[val].begin();
	if ( equals ) end = VARLIST[var] -> ATOMRECPOS[val].end();
	else end = VARLIST[var] -> ATOMRECNEG[val].end();

	while ( current != end ) {

		if( CLAUSELIST[*current] -> LEVEL == -1 ) {

			CLAUSELIST[*current]->NumUnAss--;

			//checking for units and conflicts right away:

			if ( CLAUSELIST[*current] -> NumUnAss == 1 ) {
				UNITLIST.push_front(*current);
			}

			if ( CLAUSELIST[*current] -> NumUnAss == 0 ) {

				CONFLICT = true;
				CONFLICTINGCLAUSE = *current;
			}
		}
		++current;
	}
}

// Assembly:
subq $0x78, %rsp
movb %dl, %al
movq %rdi, 0x70(%rsp)
movl %esi, 0x6c(%rsp)
andb $0x1, %al
movb %al, 0x6b(%rsp)
movl %ecx, 0x64(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x28(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x14580
leaq 0x50(%rsp), %rdi
callq 0x14580
testb $0x1, 0x6b(%rsp)
je 0x13476
movq 0x28(%rsp), %rdi
movslq 0x6c(%rsp), %rsi
callq 0xaab0
movq (%rax), %rax
movq 0x60(%rax), %rdi
movslq 0x64(%rsp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x79c0
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x58(%rsp)
jmp 0x134ac
movq 0x28(%rsp), %rdi
movslq 0x6c(%rsp), %rsi
callq 0xaab0
movq (%rax), %rax
movq 0x68(%rax), %rdi
movslq 0x64(%rsp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x79c0
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x58(%rsp)
testb $0x1, 0x6b(%rsp)
je 0x134eb
movq 0x28(%rsp), %rdi
movslq 0x6c(%rsp), %rsi
callq 0xaab0
movq (%rax), %rax
movq 0x60(%rax), %rdi
movslq 0x64(%rsp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x7840
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x50(%rsp)
jmp 0x13521
movq 0x28(%rsp), %rdi
movslq 0x6c(%rsp), %rsi
callq 0xaab0
movq (%rax), %rax
movq 0x68(%rax), %rdi
movslq 0x64(%rsp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x7840
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x50(%rsp)
jmp 0x13523
leaq 0x58(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x145a0
testb $0x1, %al
jne 0x1353b
jmp 0x13654
movq 0x28(%rsp), %rax
addq $0x18, %rax
movq %rax, 0x20(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x145e0
movq 0x20(%rsp), %rdi
movslq (%rax), %rsi
callq 0x12f20
movq (%rax), %rax
cmpl $-0x1, 0x1c(%rax)
jne 0x13645
movq 0x28(%rsp), %rax
addq $0x18, %rax
movq %rax, 0x10(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x145e0
movq 0x10(%rsp), %rdi
movslq (%rax), %rsi
callq 0x12f20
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq (%rcx), %rcx
movl 0x18(%rcx), %edx
addl $-0x1, %edx
movl %edx, 0x18(%rcx)
addq $0x18, %rax
movq %rax, 0x18(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x145e0
movq 0x18(%rsp), %rdi
movslq (%rax), %rsi
callq 0x12f20
movq (%rax), %rax
cmpl $0x1, 0x18(%rax)
jne 0x135f4
movq 0x28(%rsp), %rax
addq $0x60, %rax
movq %rax, 0x8(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x145e0
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x13ec0
movq 0x28(%rsp), %rax
addq $0x18, %rax
movq %rax, (%rsp)
leaq 0x58(%rsp), %rdi
callq 0x145e0
movq (%rsp), %rdi
movslq (%rax), %rsi
callq 0x12f20
movq (%rax), %rax
cmpl $0x0, 0x18(%rax)
jne 0x13643
movq 0x28(%rsp), %rax
movb $0x1, 0x7c(%rax)
leaq 0x58(%rsp), %rdi
callq 0x145e0
movq %rax, %rcx
movq 0x28(%rsp), %rax
movl (%rcx), %ecx
movl %ecx, 0x80(%rax)
jmp 0x13645
leaq 0x58(%rsp), %rdi
callq 0x145f0
jmp 0x13523
addq $0x78, %rsp
retq
nopl (%rax)