// File: biotomas[P]ipasir/sat/picosat961/picosat-961/picosat.c
// Function: sat
static int
sat (PS * ps, int l)
{
  int count = 0, backtracked;

  if (!ps->conflict)
    bcp (ps);

  if (ps->conflict)
    backtrack (ps);

  if (ps->mtcls)
    return PICOSAT_UNSATISFIABLE;

  if (satisfied (ps))
    goto SATISFIED;

  if (ps->lsimplify <= ps->propagations)
    simplify (ps, 0);

  if (ps->mtcls)
    return PICOSAT_UNSATISFIABLE;

  if (satisfied (ps))
    goto SATISFIED;

  init_restart (ps);

  if (!ps->lreduce)
    init_reduce (ps);

  ps->isimplify = ps->fixed;
  backtracked = 0;

  for (;;)
    {
      if (!ps->conflict)
	bcp (ps);

      if (ps->conflict)
	{
	  incincs (ps);
	  backtrack (ps);

	  if (ps->mtcls)
	    return PICOSAT_UNSATISFIABLE;
	  backtracked = 1;
	  continue;
	}

      if (satisfied (ps))
	{
SATISFIED:
#ifndef NDEBUG
	  original_clauses_satisfied (ps);
	  assumptions_satisfied (ps);
#endif
	  return PICOSAT_SATISFIABLE;
	}

      if (backtracked)
	{
	  backtracked = 0;
	  if (!ps->LEVEL && ps->isimplify < ps->fixed)
	    iteration (ps);
	}

      if (l >= 0 && count >= l)		/* decision limit reached ? */
	return PICOSAT_UNKNOWN;

      if (ps->interrupt.function &&		/* external interrupt */
	  count > 0 && !(count % INTERRUPTLIM) &&
	  ps->interrupt.function (ps->interrupt.state))
	return PICOSAT_UNKNOWN;

      if (ps->propagations >= ps->lpropagations)/* propagation limit reached ? */
	return PICOSAT_UNKNOWN;

#ifndef NADC
      if (!ps->adodisabled && ps->adoconflicts >= ps->adoconflictlimit)
	{
	  assert (bcp_queue_is_empty (ps));
	  return PICOSAT_UNKNOWN;
	}
#endif

      if (ps->fsimplify < ps->fixed && ps->lsimplify <= ps->propagations)
	{
	  simplify (ps, 0);
	  if (!bcp_queue_is_empty (ps))
	    continue;
#ifndef NFL
	  if (ps->mtcls)
	    return PICOSAT_UNSATISFIABLE;

	  if (satisfied (ps))
	    return PICOSAT_SATISFIABLE;

	  assert (!ps->LEVEL);
#endif
	}

      if (need_to_reduce (ps))
	reduce (ps, 50);

      if (ps->conflicts >= ps->lrestart && ps->LEVEL > 2)
	restart (ps);

      decide (ps);
      if (ps->failed_assumption)
	return PICOSAT_UNSATISFIABLE;
      count++;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x250(%rax)
jne 0x766d
movq -0x10(%rbp), %rdi
callq 0x12fd0
movq -0x10(%rbp), %rax
cmpq $0x0, 0x250(%rax)
je 0x7684
movq -0x10(%rbp), %rdi
callq 0x12770
movq -0x10(%rbp), %rax
cmpq $0x0, 0x248(%rax)
je 0x769e
movl $0x14, -0x4(%rbp)
jmp 0x79aa
movq -0x10(%rbp), %rdi
callq 0xf050
cmpl $0x0, %eax
je 0x76b1
jmp 0x77a5
movq -0x10(%rbp), %rax
movq 0x3d0(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x3d8(%rcx), %rax
ja 0x76d4
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x5480
movq -0x10(%rbp), %rax
cmpq $0x0, 0x248(%rax)
je 0x76ee
movl $0x14, -0x4(%rbp)
jmp 0x79aa
movq -0x10(%rbp), %rdi
callq 0xf050
cmpl $0x0, %eax
je 0x7701
jmp 0x77a5
movq -0x10(%rbp), %rdi
callq 0x19130
movq -0x10(%rbp), %rax
cmpl $0x0, 0x3a8(%rax)
jne 0x7720
movq -0x10(%rbp), %rdi
callq 0x19180
movq -0x10(%rbp), %rax
movl 0x3e8(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x3a0(%rax)
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x250(%rax)
jne 0x7752
movq -0x10(%rbp), %rdi
callq 0x12fd0
movq -0x10(%rbp), %rax
cmpq $0x0, 0x250(%rax)
je 0x7795
movq -0x10(%rbp), %rdi
callq 0x19200
movq -0x10(%rbp), %rdi
callq 0x12770
movq -0x10(%rbp), %rax
cmpq $0x0, 0x248(%rax)
je 0x778c
movl $0x14, -0x4(%rbp)
jmp 0x79aa
movl $0x1, -0x1c(%rbp)
jmp 0x773b
movq -0x10(%rbp), %rdi
callq 0xf050
cmpl $0x0, %eax
je 0x77c3
jmp 0x77a5
movq -0x10(%rbp), %rdi
callq 0x19230
movq -0x10(%rbp), %rdi
callq 0x192d0
movl $0xa, -0x4(%rbp)
jmp 0x79aa
cmpl $0x0, -0x1c(%rbp)
je 0x77fb
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x28(%rax)
jne 0x77f9
movq -0x10(%rbp), %rax
movl 0x3a0(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x3e8(%rcx), %eax
jae 0x77f9
movq -0x10(%rbp), %rdi
callq 0x19350
jmp 0x77fb
cmpl $0x0, -0x14(%rbp)
jl 0x7815
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jl 0x7815
movl $0x0, -0x4(%rbp)
jmp 0x79aa
movq -0x10(%rbp), %rax
cmpq $0x0, 0x4c8(%rax)
je 0x7862
cmpl $0x0, -0x18(%rbp)
jle 0x7862
movl -0x18(%rbp), %eax
movl $0x400, %ecx            # imm = 0x400
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x7862
movq -0x10(%rbp), %rax
movq 0x4c8(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x4c0(%rcx), %rdi
callq *%rax
cmpl $0x0, %eax
je 0x7862
movl $0x0, -0x4(%rbp)
jmp 0x79aa
movq -0x10(%rbp), %rax
movq 0x3d8(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x3e0(%rcx), %rax
jb 0x7886
movl $0x0, -0x4(%rbp)
jmp 0x79aa
movq -0x10(%rbp), %rax
movl 0x39c(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x3e8(%rcx), %eax
jae 0x7937
movq -0x10(%rbp), %rax
movq 0x3d0(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x3d8(%rcx), %rax
ja 0x7937
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x5480
movq -0x10(%rbp), %rdi
callq 0x12590
cmpl $0x0, %eax
jne 0x78d6
jmp 0x773b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x248(%rax)
je 0x78f0
movl $0x14, -0x4(%rbp)
jmp 0x79aa
movq -0x10(%rbp), %rdi
callq 0xf050
cmpl $0x0, %eax
je 0x790a
movl $0xa, -0x4(%rbp)
jmp 0x79aa
movq -0x10(%rbp), %rax
cmpl $0x0, 0x28(%rax)
jne 0x7916
jmp 0x7935
leaq 0x16b7c(%rip), %rdi     # 0x1e499
leaq 0x15980(%rip), %rsi     # 0x1d2a4
movl $0x174e, %edx           # imm = 0x174E
leaq 0x17ac3(%rip), %rcx     # 0x1f3f3
callq 0x10b0
jmp 0x7937
movq -0x10(%rbp), %rdi
callq 0x19440
cmpl $0x0, %eax
je 0x7953
movq -0x10(%rbp), %rdi
movl $0x32, %esi
callq 0xbf30
movq -0x10(%rbp), %rax
movl 0x41c(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x3bc(%rcx), %eax
jb 0x797c
movq -0x10(%rbp), %rax
cmpl $0x2, 0x28(%rax)
jbe 0x797c
movq -0x10(%rbp), %rdi
callq 0x19480
movq -0x10(%rbp), %rdi
callq 0x19540
movq -0x10(%rbp), %rax
cmpq $0x0, 0x1b8(%rax)
je 0x799c
movl $0x14, -0x4(%rbp)
jmp 0x79aa
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x773b
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)