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

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

	int lit_var = -1;
	bool lit_equal = false;
	int lit_val = -1;

	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 > level ) {

			for ( int i = 0; i < CLAUSELIST[*current] -> ATOM_LIST.size(); i++ ) {

				lit_var = CLAUSELIST[*current]->ATOM_LIST[i].VAR;
				lit_equal = CLAUSELIST[*current]->ATOM_LIST[i].EQUAL;
				lit_val = CLAUSELIST[*current]->ATOM_LIST[i].VAL;

				if ( ( VARLIST[lit_var] -> ATOMLEVEL[lit_val] > level )
						|| ( VARLIST[lit_var] -> ATOMASSIGN[lit_val] == 0 ) ) {

					CLAUSELIST[*current] -> NumUnAss++;

					if (heuristic==Heuristic::BK) {
						if ( lit_equal )
							VARLIST[lit_var]->ATOMCNTPOS[lit_val]++;
						else
							VARLIST[lit_var]->ATOMCNTNEG[lit_val]++;
					}

				}
			}

			CLAUSELIST[*current]->LEVEL = -1;
		}
		++current;
	}
}

// Assembly:
subq $0xa8, %rsp
movb %dl, %al
movq %rdi, 0xa0(%rsp)
movl %esi, 0x9c(%rsp)
andb $0x1, %al
movb %al, 0x9b(%rsp)
movl %ecx, 0x94(%rsp)
movl %r8d, 0x90(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x14580
leaq 0x80(%rsp), %rdi
callq 0x14580
movl $0xffffffff, 0x7c(%rsp) # imm = 0xFFFFFFFF
movb $0x0, 0x7b(%rsp)
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
testb $0x1, 0x9b(%rsp)
je 0x139a7
movq 0x40(%rsp), %rdi
movslq 0x9c(%rsp), %rsi
callq 0xaab0
movq (%rax), %rax
movq 0x60(%rax), %rdi
movslq 0x94(%rsp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x79c0
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x88(%rsp)
jmp 0x139e6
movq 0x40(%rsp), %rdi
movslq 0x9c(%rsp), %rsi
callq 0xaab0
movq (%rax), %rax
movq 0x68(%rax), %rdi
movslq 0x94(%rsp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x79c0
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x88(%rsp)
testb $0x1, 0x9b(%rsp)
je 0x13a31
movq 0x40(%rsp), %rdi
movslq 0x9c(%rsp), %rsi
callq 0xaab0
movq (%rax), %rax
movq 0x60(%rax), %rdi
movslq 0x94(%rsp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x7840
movq %rax, 0x58(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x80(%rsp)
jmp 0x13a70
movq 0x40(%rsp), %rdi
movslq 0x9c(%rsp), %rsi
callq 0xaab0
movq (%rax), %rax
movq 0x68(%rax), %rdi
movslq 0x94(%rsp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x7840
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x80(%rsp)
jmp 0x13a72
leaq 0x88(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x145a0
testb $0x1, %al
jne 0x13a90
jmp 0x13d14
movq 0x40(%rsp), %rax
addq $0x18, %rax
movq %rax, 0x38(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x145e0
movq 0x38(%rsp), %rdi
movslq (%rax), %rsi
callq 0x12f20
movq (%rax), %rax
movl 0x1c(%rax), %eax
cmpl 0x90(%rsp), %eax
jle 0x13d02
movl $0x0, 0x4c(%rsp)
movq 0x40(%rsp), %rax
movslq 0x4c(%rsp), %rcx
movq %rcx, 0x30(%rsp)
addq $0x18, %rax
movq %rax, 0x28(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x145e0
movq 0x28(%rsp), %rdi
movslq (%rax), %rsi
callq 0x12f20
movq (%rax), %rdi
callq 0xb890
movq %rax, %rcx
movq 0x30(%rsp), %rax
cmpq %rcx, %rax
jae 0x13cd2
movq 0x40(%rsp), %rax
addq $0x18, %rax
movq %rax, 0x10(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x145e0
movq 0x10(%rsp), %rdi
movslq (%rax), %rsi
callq 0x12f20
movq (%rax), %rdi
movslq 0x4c(%rsp), %rsi
callq 0xb8b0
movq %rax, %rcx
movq 0x40(%rsp), %rax
movl (%rcx), %ecx
movl %ecx, 0x7c(%rsp)
addq $0x18, %rax
movq %rax, 0x18(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x145e0
movq 0x18(%rsp), %rdi
movslq (%rax), %rsi
callq 0x12f20
movq (%rax), %rdi
movslq 0x4c(%rsp), %rsi
callq 0xb8b0
movq %rax, %rcx
movq 0x40(%rsp), %rax
movb 0x8(%rcx), %cl
andb $0x1, %cl
movb %cl, 0x7b(%rsp)
addq $0x18, %rax
movq %rax, 0x20(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x145e0
movq 0x20(%rsp), %rdi
movslq (%rax), %rsi
callq 0x12f20
movq (%rax), %rdi
movslq 0x4c(%rsp), %rsi
callq 0xb8b0
movq 0x40(%rsp), %rdi
movl 0x4(%rax), %eax
movl %eax, 0x74(%rsp)
movslq 0x7c(%rsp), %rsi
callq 0xaab0
movq (%rax), %rax
movq 0x18(%rax), %rax
movslq 0x74(%rsp), %rcx
movl (%rax,%rcx,4), %eax
cmpl 0x90(%rsp), %eax
jg 0x13c26
movq 0x40(%rsp), %rdi
movslq 0x7c(%rsp), %rsi
callq 0xaab0
movq (%rax), %rax
movq 0x20(%rax), %rax
movslq 0x74(%rsp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x13cc0
movq 0x40(%rsp), %rax
addq $0x18, %rax
movq %rax, 0x8(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x145e0
movq 0x8(%rsp), %rdi
movslq (%rax), %rsi
callq 0x12f20
movq %rax, %rcx
movq 0x40(%rsp), %rax
movq (%rcx), %rcx
movl 0x18(%rcx), %edx
addl $0x1, %edx
movl %edx, 0x18(%rcx)
cmpl $0x0, 0xa8(%rax)
jne 0x13cbe
testb $0x1, 0x7b(%rsp)
je 0x13c98
movq 0x40(%rsp), %rdi
movslq 0x7c(%rsp), %rsi
callq 0xaab0
movq (%rax), %rax
movq 0x28(%rax), %rax
movslq 0x74(%rsp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
jmp 0x13cbc
movq 0x40(%rsp), %rdi
movslq 0x7c(%rsp), %rsi
callq 0xaab0
movq (%rax), %rax
movq 0x30(%rax), %rax
movslq 0x74(%rsp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
jmp 0x13cbe
jmp 0x13cc0
jmp 0x13cc2
movl 0x4c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4c(%rsp)
jmp 0x13ad3
movq 0x40(%rsp), %rax
addq $0x18, %rax
movq %rax, (%rsp)
leaq 0x88(%rsp), %rdi
callq 0x145e0
movq (%rsp), %rdi
movslq (%rax), %rsi
callq 0x12f20
movq (%rax), %rax
movl $0xffffffff, 0x1c(%rax) # imm = 0xFFFFFFFF
leaq 0x88(%rsp), %rdi
callq 0x145f0
jmp 0x13a72
addq $0xa8, %rsp
retq
nopl (%rax)