// File: akinanop[P]mvl-solver/src/Formula.cc
// Function: Formula::chooseLiteralVSIDS()
Literal Formula::chooseLiteralVSIDS () {

	/*  Pick a literal which is not yet satisfied, and which has a maximal vsids counter
	 *
	 *  Positive and negative literals have separate scores
	 */


	double max = -1;
	double tmax = -1;
	int tvar = -1;
	int tval = -1;
	UNITCLAUSE = -1;
	bool equals = false;

	for ( int i = 0; i < VARLIST.size(); i++ ) {
		if ( VARLIST[i] -> VAL == -1 ) {
			for ( int j = 0; j < VARLIST[i] -> DOMAINSIZE; j++ ) {
				if ( VARLIST[i] -> ATOMASSIGN[j] == 0 ) {
					// get score for i=j
					tmax = VARLIST[i]->VSIDS_SCORE[j];
					if (max < tmax) {
						max = tmax;
						tvar = i;
						tval = j;
						equals = true;
					}
					//get score for i!=j
					tmax = VARLIST[i]->VSIDS_SCORE_NEG[j];
					if (max < tmax) {
						max = tmax;
						tvar = i;
						tval = j;
						equals = false;
					}
				}
			}
		}
	}
	return Literal ( tvar, equals, tval );
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x50(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x10(%rsp)
movsd 0x9b0d(%rip), %xmm0     # 0x17bf8
movsd %xmm0, 0x48(%rsp)
movsd 0x9aff(%rip), %xmm0     # 0x17bf8
movsd %xmm0, 0x40(%rsp)
movl $0xffffffff, 0x3c(%rsp) # imm = 0xFFFFFFFF
movl $0xffffffff, 0x38(%rsp) # imm = 0xFFFFFFFF
movl $0xffffffff, 0x78(%rax) # imm = 0xFFFFFFFF
movb $0x0, 0x37(%rsp)
movl $0x0, 0x30(%rsp)
movq 0x10(%rsp), %rdi
movslq 0x30(%rsp), %rax
movq %rax, 0x8(%rsp)
callq 0xaa90
movq %rax, %rcx
movq 0x8(%rsp), %rax
cmpq %rcx, %rax
jae 0xe295
movq 0x10(%rsp), %rdi
movslq 0x30(%rsp), %rsi
callq 0xaab0
movq (%rax), %rax
cmpl $-0x1, 0x4(%rax)
jne 0xe283
movl $0x0, 0x2c(%rsp)
movq 0x10(%rsp), %rdi
movl 0x2c(%rsp), %eax
movl %eax, 0x4(%rsp)
movslq 0x30(%rsp), %rsi
callq 0xaab0
movq %rax, %rcx
movl 0x4(%rsp), %eax
movq (%rcx), %rcx
cmpl 0x8(%rcx), %eax
jge 0xe281
movq 0x10(%rsp), %rdi
movslq 0x30(%rsp), %rsi
callq 0xaab0
movq (%rax), %rax
movq 0x20(%rax), %rax
movslq 0x2c(%rsp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0xe26f
movq 0x10(%rsp), %rdi
movslq 0x30(%rsp), %rsi
callq 0xaab0
movq (%rax), %rax
movq 0x38(%rax), %rax
movslq 0x2c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x48(%rsp), %xmm1
movsd 0x40(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xe214
movsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
movl 0x30(%rsp), %eax
movl %eax, 0x3c(%rsp)
movl 0x2c(%rsp), %eax
movl %eax, 0x38(%rsp)
movb $0x1, 0x37(%rsp)
movq 0x10(%rsp), %rdi
movslq 0x30(%rsp), %rsi
callq 0xaab0
movq (%rax), %rax
movq 0x40(%rax), %rax
movslq 0x2c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x48(%rsp), %xmm1
movsd 0x40(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xe26d
movsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
movl 0x30(%rsp), %eax
movl %eax, 0x3c(%rsp)
movl 0x2c(%rsp), %eax
movl %eax, 0x38(%rsp)
movb $0x0, 0x37(%rsp)
jmp 0xe26f
jmp 0xe271
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0xe16c
jmp 0xe283
jmp 0xe285
movl 0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x30(%rsp)
jmp 0xe123
movl 0x3c(%rsp), %esi
movl 0x38(%rsp), %ecx
movzbl 0x37(%rsp), %edx
andl $0x1, %edx
leaq 0x5c(%rsp), %rdi
callq 0x12f70
movl 0x64(%rsp), %eax
movl %eax, 0x20(%rsp)
movq 0x5c(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movb 0x20(%rsp), %dl
addq $0x68, %rsp
retq
nop