// File: /workspace/github_cpp_makefile_star2_O2/biotomas[P]ipasir/sat/picosat961/picosat-961/picosat.c
// Function: init
static PS *
init (void * pmgr, 
      picosat_malloc pnew, picosat_realloc presize, picosat_free pdelete)
{
  PS * ps;

#if 0
  int count = 3 - !pnew - !presize - !pdelete;

  ABORTIF (count && !pnew, "API usage: missing 'picosat_set_new'");
  ABORTIF (count && !presize, "API usage: missing 'picosat_set_resize'");
  ABORTIF (count && !pdelete, "API usage: missing 'picosat_set_delete'");
#endif

  ps = pnew ? pnew (pmgr, sizeof *ps) : malloc (sizeof *ps);
  ABORTIF (!ps, "failed to allocate memory for PicoSAT manager");
  memset (ps, 0, sizeof *ps);

  ps->emgr = pmgr;
  ps->enew = pnew;
  ps->eresize = presize;
  ps->edelete = pdelete;

  ps->size_vars = 1;
  ps->state = RESET;
  ps->defaultphase = JWLPHASE;
#ifdef TRACE
  ps->ocore = -1;
#endif
  ps->lastrheader = -2;
#ifndef NADC
  ps->adoconflictlimit = UINT_MAX;
#endif
  ps->min_flipped = UINT_MAX;

  NEWN (ps->lits, 2 * ps->size_vars);
  NEWN (ps->jwh, 2 * ps->size_vars);
  NEWN (ps->htps, 2 * ps->size_vars);
#ifndef NDSC
  NEWN (ps->dhtps, 2 * ps->size_vars);
#endif
  NEWN (ps->impls, 2 * ps->size_vars);
  NEWN (ps->vars, ps->size_vars);
  NEWN (ps->rnks, ps->size_vars);

  /* because '0' pos denotes not on heap
   */
  ENLARGE (ps->heap, ps->hhead, ps->eoh); 
  ps->hhead = ps->heap + 1;

  ps->vinc = base2flt (1, 0);		/* initial var activity */
  ps->ifvinc = ascii2flt ("1.05");	/* var score rescore factor */
#ifdef VISCORES
  ps->fvinc = ascii2flt ("0.9523809");	/*     1/f =     1/1.05 */
  ps->nvinc = ascii2flt ("0.0476191");	/* 1 - 1/f = 1 - 1/1.05 */
#endif
  ps->lscore = base2flt (1, 90);	/* var activity rescore limit */
  ps->ilvinc = base2flt (1, -90);	/* inverse of 'lscore' */

  ps->cinc = base2flt (1, 0);		/* initial clause activity */
  ps->fcinc = ascii2flt ("1.001");	/* cls activity rescore factor */
  ps->lcinc = base2flt (1, 90);		/* cls activity rescore limit */
  ps->ilcinc = base2flt (1, -90);	/* inverse of 'ilcinc' */

  ps->lreduceadjustcnt = ps->lreduceadjustinc = 100;
  ps->lpropagations = ~0ull;

  ps->out = stdout;
  new_prefix (ps, "c ");
  ps->verbosity = 0;
  ps->plain = 0;

#ifdef NO_BINARY_CLAUSES
  memset (&ps->impl, 0, sizeof (ps->impl));
  ps->impl.size = 2;

  memset (&ps->cimpl, 0, sizeof (ps->impl));
  ps->cimpl.size = 2;
#endif

#ifdef VISCORES
  ps->fviscores = popen (
    "/usr/bin/gnuplot -background black"
    " -xrm 'gnuplot*textColor:white'"
    " -xrm 'gnuplot*borderColor:white'"
    " -xrm 'gnuplot*axisColor:white'"
    , "w");
  fprintf (ps->fviscores, "unset key\n");
  // fprintf (ps->fviscores, "set log y\n");
  fflush (ps->fviscores);
  system ("rm -rf /tmp/picosat-viscores");
  system ("mkdir /tmp/picosat-viscores");
  system ("mkdir /tmp/picosat-viscores/data");
#ifdef WRITEGIF
  system ("mkdir /tmp/picosat-viscores/gif");
  fprintf (ps->fviscores,
           "set terminal gif giant animate opt size 1024,768 x000000 xffffff"
	   "\n");

  fprintf (ps->fviscores, 
           "set output \"/tmp/picosat-viscores/gif/animated.gif\"\n");
#endif
#endif
  ps->defaultphase = JWLPHASE;
  ps->state = READY;
  ps->last_sat_call_result = 0;

  return ps;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
testq %rsi, %rsi
je 0x337f
movl $0x4d0, %esi            # imm = 0x4D0
movq %r13, %rdi
callq *%r12
jmp 0x3389
movl $0x4d0, %edi            # imm = 0x4D0
callq 0x1160
movq %rax, %rbx
testq %rax, %rax
je 0x35f7
leaq 0x8(%rbx), %rdi
movl $0x4c8, %edx            # imm = 0x4C8
xorl %esi, %esi
callq 0x10d0
movq %r13, 0x4a0(%rbx)
movq %r12, 0x4a8(%rbx)
movq %r15, 0x4b0(%rbx)
movq %r14, 0x4b8(%rbx)
movl $0x1, 0x30(%rbx)
movabsq $0x200000000, %rax      # imm = 0x200000000
movq %rax, (%rbx)
movl $0xfffffffe, 0x388(%rbx) # imm = 0xFFFFFFFE
orl $-0x1, 0x49c(%rbx)
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x8f50
movq %rax, 0x38(%rbx)
movl 0x30(%rbx), %esi
addl %esi, %esi
shlq $0x2, %rsi
movq %rbx, %rdi
callq 0x8f50
movq %rax, 0x50(%rbx)
movl 0x30(%rbx), %esi
addl %esi, %esi
shlq $0x3, %rsi
movq %rbx, %rdi
callq 0x8f50
movq %rax, 0x58(%rbx)
movl 0x30(%rbx), %esi
addl %esi, %esi
shlq $0x3, %rsi
movq %rbx, %rdi
callq 0x8f50
movq %rax, 0x60(%rbx)
movl 0x30(%rbx), %esi
addl %esi, %esi
shlq $0x4, %rsi
movq %rbx, %rdi
callq 0x8f50
movq %rax, 0x68(%rbx)
movl 0x30(%rbx), %esi
shlq $0x4, %rsi
movq %rbx, %rdi
callq 0x8f50
movq %rax, 0x40(%rbx)
movl 0x30(%rbx), %esi
shlq $0x3, %rsi
movq %rbx, %rdi
callq 0x8f50
movq %rax, 0x48(%rbx)
movq 0x1c8(%rbx), %rsi
movq 0x1d8(%rbx), %rax
cmpq %rax, %rsi
ja 0x3612
subq %rsi, %rax
movq %rax, %rcx
shrq $0x2, %rcx
movabsq $0x7fffffff8, %rdx      # imm = 0x7FFFFFFF8
andq %rax, %rdx
movl %ecx, %eax
pushq $0x1
popq %r14
cmovneq %rax, %r14
leaq (,%r14,8), %rcx
movq %rbx, %rdi
callq 0x3e40
movq %rax, 0x1c8(%rbx)
leaq (%rax,%r14,8), %rcx
movq %rcx, 0x1d8(%rbx)
addq $0x8, %rax
movq %rax, 0x1d0(%rbx)
pushq $0x1
popq %rbp
movl %ebp, %edi
xorl %esi, %esi
callq 0xb4b4
movl %eax, 0x300(%rbx)
leaq 0xeacc(%rip), %rdi      # 0x11fb9
callq 0xb501
movl %eax, 0x30c(%rbx)
pushq $0x5a
popq %r14
movl %ebp, %edi
movl %r14d, %esi
callq 0xb4b4
movl %eax, 0x304(%rbx)
pushq $-0x5a
popq %r15
movl %ebp, %edi
movl %r15d, %esi
callq 0xb4b4
movl %eax, 0x308(%rbx)
movl %ebp, %edi
xorl %esi, %esi
callq 0xb4b4
movl %eax, 0x310(%rbx)
leaq 0xea88(%rip), %rdi      # 0x11fbe
callq 0xb501
movl %eax, 0x31c(%rbx)
movl %ebp, %edi
movl %r14d, %esi
callq 0xb4b4
movl %eax, 0x314(%rbx)
movl %ebp, %edi
movl %r15d, %esi
callq 0xb4b4
movl %eax, 0x318(%rbx)
movabsq $0x6400000064, %rax     # imm = 0x6400000064
movq %rax, 0x3ac(%rbx)
orq $-0x1, 0x3e0(%rbx)
movq 0x14a4f(%rip), %rax     # 0x17fd0
movq (%rax), %rax
movq %rax, 0x10(%rbx)
leaq 0xff34(%rip), %rsi      # 0x134c3
movq %rbx, %rdi
callq 0x5d8a
andq $0x0, 0x20(%rbx)
xorps %xmm0, %xmm0
andq $0x0, 0x90(%rbx)
movups %xmm0, 0x70(%rbx)
movups %xmm0, 0x80(%rbx)
pushq $0x2
popq %rax
movl %eax, 0x70(%rbx)
movups %xmm0, 0x98(%rbx)
andq $0x0, 0xb8(%rbx)
movups %xmm0, 0xa8(%rbx)
movl %eax, 0x98(%rbx)
movabsq $0x200000001, %rax      # imm = 0x200000001
movq %rax, (%rbx)
andl $0x0, 0x8(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x149fa(%rip), %rax     # 0x17ff8
movq (%rax), %rsi
leaq 0xe91d(%rip), %rdi      # 0x11f25
callq 0x10c0
callq 0x1060
leaq 0xe948(%rip), %rdi      # 0x11f61
leaq 0xdc54(%rip), %rsi      # 0x11274
leaq 0xe952(%rip), %rcx      # 0x11f79
movl $0x4b2, %edx            # imm = 0x4B2
callq 0x10b0