// File: /workspace/github_cpp_makefile_star2_O2/akinanop[P]mvl-solver/src/SolveFinite.cc
// Function: SolveFinite(CommandLine*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void SolveFinite(CommandLine * cline, string type)
{
  //local variable
  double difftime = 0;
  double totaltime = 0;
  int result = -1;
  Formula * fobj;

  //Creating object
  fobj = new Formula(cline);
  //Building database
  fobj->BuildFormula(cline);
  //Compute Buildtime
  difftime = fobj->TIME_E - fobj->TIME_S;
  totaltime += difftime;
  printf("%s \t%2.4f\t", cline->FILE, fabs(difftime));
  //reinitialize the TIME_S and TIME_E
  fobj->TIME_S = GetTime();
  fobj->TIME_E = GetTime();
  //call the algorithm
  // fobj->checkUnit(); // move this check to the algo

  // *** Extended DPLL Algorithm Options

 if(type == "ch")

 {
      // 1. Chronological Backtracking
     result = fobj->ChronoBacktrack(0); // The function defined in FDSolver/Formula.cc
    }

  // 2. NonChronological Backtracking with Clause learning
 else
    {
	 if ( cline -> WATCH  ) {


    	  result = fobj-> WatchedLiterals ( cline -> RESTARTS );

      }
      else if (cline->RESTARTS != 0) {
        result = fobj->NonChronoBacktrack(cline->RESTARTS);
      }
      else  {

     result = fobj->NonChronoBacktrack(0);
      }
    }

  // compute the search time
  difftime = fobj->TIME_E - fobj->TIME_S;
  totaltime += difftime;
  //cout<<"Solving time: "<<endl;
  printf("%2.4f\t %2.4f\t", difftime, totaltime);
  cout<<endl;
  cout<<endl;
  cout << '\a';
  if(result == 0)
    cout<<"SAT"<<endl;
  else if(result == 1)
    cout<<"TIMEOUT"<<endl;
  else
    cout<<"UNSAT"<<endl;
  fobj->PrintInfo();
  if(result == 0)
   { if(cline->MODEL) { cout<<"The model: "<<endl;
     fobj->PrintModel(); }
      cout<<"Verifying model ... ";
       if(fobj->verifyModel())
 	cout<<"model is CORRECT"<<endl;
       else
 	cout<<"model is INCORRECT"<<endl;
     }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %r14
movl $0xb0, %edi
callq 0x2220
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
callq 0x5fb4
movq %rbx, %rdi
movq %r14, %rsi
callq 0x609a
movsd 0x40(%rbx), %xmm0
subsd 0x38(%rbx), %xmm0
xorpd %xmm1, %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movq 0x20(%r14), %rsi
andpd 0x18c1(%rip), %xmm0     # 0xae50
leaq 0x18ca(%rip), %rdi      # 0xae60
movb $0x1, %al
callq 0x2050
callq 0x290a
movsd %xmm0, 0x38(%rbx)
callq 0x290a
movsd %xmm0, 0x40(%rbx)
leaq 0xad2(%rip), %rsi       # 0xa08a
movq %r15, %rdi
callq 0x970e
testb %al, %al
je 0x95d0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x8878
jmp 0x95f3
movl 0x34(%r14), %esi
cmpb $0x1, 0x1(%r14)
jne 0x95e5
movq %rbx, %rdi
callq 0x81e0
jmp 0x95f3
movq %rbx, %rdi
testl %esi, %esi
jne 0x95ee
xorl %esi, %esi
callq 0x84fe
movl %eax, %ebp
movsd 0x40(%rbx), %xmm0
subsd 0x38(%rbx), %xmm0
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
leaq 0x185c(%rip), %rdi      # 0xae6b
movb $0x2, %al
callq 0x2050
movq 0x59b3(%rip), %r15      # 0xefd0
movq %r15, %rdi
callq 0x2140
movq %r15, %rdi
callq 0x2140
pushq $0x7
popq %rsi
movq %r15, %rdi
callq 0x2270
cmpl $0x1, %ebp
leaq 0x1837(%rip), %rax      # 0xae79
leaq 0x17a0(%rip), %rcx      # 0xade9
cmoveq %rax, %rcx
testl %ebp, %ebp
leaq 0x1795(%rip), %rsi      # 0xadeb
cmovneq %rcx, %rsi
movq %r15, %rdi
callq 0x2210
movq %rax, %rdi
callq 0x2140
movq %rbx, %rdi
callq 0x6650
testl %ebp, %ebp
je 0x9681
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x1, (%r14)
jne 0x96aa
movq 0x5942(%rip), %rdi      # 0xefd0
leaq 0x17ec(%rip), %rsi      # 0xae81
callq 0x2210
movq %rax, %rdi
callq 0x2140
movq %rbx, %rdi
callq 0x65ea
movq 0x591f(%rip), %r14      # 0xefd0
leaq 0x17d5(%rip), %rsi      # 0xae8d
movq %r14, %rdi
callq 0x2210
movq %rbx, %rdi
callq 0x6702
leaq 0x17d3(%rip), %rcx      # 0xaea2
leaq 0x17dd(%rip), %rsi      # 0xaeb3
testb %al, %al
cmovneq %rcx, %rsi
movq %r14, %rdi
callq 0x2210
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2140
movq %rax, %r14
movl $0xb0, %esi
movq %rbx, %rdi
callq 0x2230
movq %r14, %rdi
callq 0x2390