// File: biotomas[P]ipasir/sat/picosat961/picosat-961/picosat.c
// Function: minautarky
static void
minautarky (PS * ps)
{
  unsigned * occs, maxoccs, tmpoccs, npartial;
  int * p, * c, lit, best, val;
#ifdef LOGGING
  int tl;
#endif

  assert (!ps->partial);

  npartial = 0;

  NEWN (occs, 2*ps->max_var + 1);
  CLRN (occs, 2*ps->max_var + 1);
  occs += ps->max_var;
  for (p = ps->soclauses; p < ps->sohead; p++)
    occs[*p]++;
  assert (occs[0] == ps->oadded);

  for (c = ps->soclauses; c < ps->sohead; c = p + 1) 
    {
#ifdef LOGGING
      tl = 0;
#endif
      best = 0; 
      maxoccs = 0;
      for (p = c; (lit = *p); p++)
	{
	  val = tderef (ps, lit);
	  if (val < 0)
	    continue;
	  if (val > 0)
	    {
#ifdef LOGGING
	      tl = 1;
#endif
	      best = lit;
	      maxoccs = occs[lit];
	    }

	  val = pderef (ps, lit);
	  if (val > 0)
	    break;
	  if (val < 0)
	    continue;
	  val = int2lit (ps, lit)->val;
	  assert (val);
	  if (val < 0)
	    continue;
	  tmpoccs = occs[lit];
	  if (best && tmpoccs <= maxoccs)
	    continue;
	  best = lit;
	  maxoccs = tmpoccs;
	}
      if (!lit)
	{
	  assert (best);
	  LOG ( fprintf (ps->out, "%sautark %d with %d occs%s\n", 
	       ps->prefix, best, maxoccs, tl ? " (top)" : ""));
	  ps->vars[abs (best)].partial = 1;
	  npartial++;
	}
      for (p = c; (lit = *p); p++)
	{
	  assert (occs[lit] > 0);
	  occs[lit]--;
	}
    }
  occs -= ps->max_var;
  DELETEN (occs, 2*ps->max_var + 1);
  ps->partial = 1;

  if (ps->verbosity)
     fprintf (ps->out,
      "%sautarky of size %u out of %u satisfying all clauses (%.1f%%)\n",
      ps->prefix, npartial, ps->max_var, PERCENT (npartial, ps->max_var));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x22c(%rax)
jne 0xd7fb
jmp 0xd81a
leaq 0x123ac(%rip), %rdi     # 0x1fbae
leaq 0xfa9b(%rip), %rsi      # 0x1d2a4
movl $0x1b5a, %edx           # imm = 0x1B5A
leaq 0x123a6(%rip), %rcx     # 0x1fbbb
callq 0x10b0
movl $0x0, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x2c(%rax), %eax
shll %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
shlq $0x2, %rsi
callq 0x9900
movq %rax, -0x10(%rbp)
jmp 0xd844
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x2c(%rax), %eax
shll %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %edx
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x10d0
movq -0x8(%rbp), %rax
movl 0x2c(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, %ecx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x210(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x218(%rcx), %rax
jae 0xd8bd
movq -0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
movslq (%rcx), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq -0x28(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x28(%rbp)
jmp 0xd88a
movq -0x10(%rbp), %rax
movl (%rax), %eax
movq -0x8(%rbp), %rcx
cmpl 0x438(%rcx), %eax
jne 0xd8d1
jmp 0xd8f0
leaq 0x122f9(%rip), %rdi     # 0x1fbd1
leaq 0xf9c5(%rip), %rsi      # 0x1d2a4
movl $0x1b63, %edx           # imm = 0x1B63
leaq 0x122d0(%rip), %rcx     # 0x1fbbb
callq 0x10b0
movq -0x8(%rbp), %rax
movq 0x210(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x218(%rcx), %rax
jae 0xdaeb
movl $0x0, -0x38(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x34(%rbp)
cmpl $0x0, %eax
je 0xda0e
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0x7f70
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jge 0xd956
jmp 0xd9fd
cmpl $0x0, -0x3c(%rbp)
jle 0xd970
movl -0x34(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0xdbe0
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jle 0xd98a
jmp 0xda0e
cmpl $0x0, -0x3c(%rbp)
jge 0xd992
jmp 0xd9fd
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0x4ef0
movsbl (%rax), %eax
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0xd9ac
jmp 0xd9cb
leaq 0x10be1(%rip), %rdi     # 0x1e594
leaq 0xf8ea(%rip), %rsi      # 0x1d2a4
movl $0x1b80, %edx           # imm = 0x1B80
leaq 0x121f5(%rip), %rcx     # 0x1fbbb
callq 0x10b0
cmpl $0x0, -0x3c(%rbp)
jge 0xd9d3
jmp 0xd9fd
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x38(%rbp)
je 0xd9f1
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
ja 0xd9f1
jmp 0xd9fd
movl -0x34(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x14(%rbp)
movq -0x28(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x28(%rbp)
jmp 0xd92a
cmpl $0x0, -0x34(%rbp)
jne 0xda74
cmpl $0x0, -0x38(%rbp)
je 0xda1c
jmp 0xda3b
leaq 0x121c4(%rip), %rdi     # 0x1fbe7
leaq 0xf87a(%rip), %rsi      # 0x1d2a4
movl $0x1b8b, %edx           # imm = 0x1B8B
leaq 0x12185(%rip), %rcx     # 0x1fbbb
callq 0x10b0
jmp 0xda3d
jmp 0xda3f
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x38(%rbp), %ecx
movl %ecx, %edx
negl %edx
cmovnsl %edx, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movw (%rax), %cx
andw $0xdfff, %cx            # imm = 0xDFFF
orw $0x2000, %cx            # imm = 0x2000
movw %cx, (%rax)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x34(%rbp)
cmpl $0x0, %eax
je 0xdad8
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jbe 0xda9a
jmp 0xdab9
leaq 0x1214b(%rip), %rdi     # 0x1fbec
leaq 0xf7fc(%rip), %rsi      # 0x1d2a4
movl $0x1b93, %edx           # imm = 0x1B93
leaq 0x12107(%rip), %rcx     # 0x1fbbb
callq 0x10b0
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $-0x1, %edx
movl %edx, (%rax,%rcx,4)
movq -0x28(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x28(%rbp)
jmp 0xda7c
jmp 0xdada
movq -0x28(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
jmp 0xd8ff
movq -0x8(%rbp), %rax
movl 0x2c(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, %ecx
movl %ecx, %edx
xorl %ecx, %ecx
subq %rdx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x8(%rbp), %rax
movl 0x2c(%rax), %eax
shll %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %edx
shlq $0x2, %rdx
callq 0x97a0
movq $0x0, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl $0x1, 0x22c(%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x20(%rax)
je 0xdbd8
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x50(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x44(%rbp)
movq -0x8(%rbp), %rax
movl 0x2c(%rax), %eax
movl %eax, -0x40(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x2c(%rax)
je 0xdba0
movl -0x1c(%rbp), %eax
cvtsi2sd %rax, %xmm0
movq -0x8(%rbp), %rax
movl 0x2c(%rax), %eax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x60(%rbp)
jmp 0xdbaa
xorps %xmm0, %xmm0
movsd %xmm0, -0x60(%rbp)
jmp 0xdbaa
movl -0x40(%rbp), %r8d
movl -0x44(%rbp), %ecx
movq -0x50(%rbp), %rdx
movq -0x58(%rbp), %rdi
movsd -0x60(%rbp), %xmm1
movsd 0xf52a(%rip), %xmm0     # 0x1d0f0
mulsd %xmm1, %xmm0
leaq 0x12029(%rip), %rsi     # 0x1fbfa
movb $0x1, %al
callq 0x1130
addq $0x60, %rsp
popq %rbp
retq
nop