// File: biotomas[P]ipasir/sat/picosat961/picosat-961/picosat.c
// Function: mss
static const int *
mss (PS * ps, int * a, int size)
{
  int i, j, k, res;

  assert (!ps->mtcls);

  if (ps->szmssass)
    DELETEN (ps->mssass, ps->szmssass);

  ps->szmssass = 0;
  ps->mssass = 0;

  ps->szmssass = size + 1;
  NEWN (ps->mssass, ps->szmssass);

  LOG ( fprintf (ps->out, "%ssearch MSS over %d assumptions\n", ps->prefix, size));

  k = 0;
  for (i = k; i < size; i++)
    {
      for (j = 0; j < k; j++)
	picosat_assume (ps, ps->mssass[j]);

      LOG ( fprintf (ps->out, 
             "%strying to add assumption %d to MSS : %d\n", 
	     ps->prefix, i, a[i])); 

      picosat_assume (ps, a[i]);

      res = picosat_sat (ps, -1);
      if (res == 10)
	{
	  LOG ( fprintf (ps->out, 
		 "%sadding assumption %d to MSS : %d\n", ps->prefix, i, a[i])); 

	  ps->mssass[k++] = a[i];

	  for (j = i + 1; j < size; j++)
	    {
	      if (picosat_deref (ps, a[j]) <= 0)
		continue;

	      LOG ( fprintf (ps->out, 
		     "%salso adding assumption %d to MSS : %d\n", 
		     ps->prefix, j, a[j])); 

	      ps->mssass[k++] = a[j];

	      if (++i != j)
		{
		  int tmp = a[i];
		  a[i] = a[j];
		  a[j] = tmp;
		}
	    }
	}
      else
	{
	  assert (res == 20);

	  LOG ( fprintf (ps->out, 
		 "%signoring assumption %d in MSS : %d\n", ps->prefix, i, a[i])); 
	}
    }
  ps->mssass[k] = 0;
  LOG ( fprintf (ps->out, "%sfound MSS of size %d\n", ps->prefix, k));

  return ps->mssass;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x248(%rax)
jne 0x9bd3
jmp 0x9bf2
leaq 0x14719(%rip), %rdi     # 0x1e2f3
leaq 0x136c3(%rip), %rsi     # 0x1d2a4
movl $0x1d72, %edx           # imm = 0x1D72
leaq 0x15d32(%rip), %rcx     # 0x1f91f
callq 0x10b0
movq -0x8(%rbp), %rax
cmpl $0x0, 0x190(%rax)
je 0x9c35
jmp 0x9c01
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x188(%rax), %rsi
movq -0x8(%rbp), %rax
movslq 0x190(%rax), %rdx
shlq $0x2, %rdx
callq 0x97a0
movq -0x8(%rbp), %rax
movq $0x0, 0x188(%rax)
jmp 0x9c35
movq -0x8(%rbp), %rax
movl $0x0, 0x190(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x188(%rax)
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x190(%rax)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movslq 0x190(%rax), %rsi
shlq $0x2, %rsi
callq 0x9900
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x188(%rax)
jmp 0x9c8a
jmp 0x9c8c
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x9e22
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x9cda
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x188(%rax), %rax
movslq -0x1c(%rbp), %rcx
movl (%rax,%rcx,4), %esi
callq 0x7230
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x9cac
jmp 0x9cdc
jmp 0x9cde
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
movl (%rax,%rcx,4), %esi
callq 0x7230
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x7500
movl %eax, -0x24(%rbp)
cmpl $0xa, -0x24(%rbp)
jne 0x9de5
jmp 0x9d0f
jmp 0x9d11
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x8(%rbp), %rax
movq 0x188(%rax), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x20(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x9de3
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl (%rax,%rcx,4), %esi
callq 0x7dd0
cmpl $0x0, %eax
jg 0x9d68
jmp 0x9dd5
jmp 0x9d6a
jmp 0x9d6c
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x8(%rbp), %rax
movq 0x188(%rax), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x20(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
cmpl -0x1c(%rbp), %eax
je 0x9dd3
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x28(%rbp), %edx
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x9dd5
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x9d41
jmp 0x9e12
cmpl $0x14, -0x24(%rbp)
jne 0x9ded
jmp 0x9e0c
leaq 0x13a99(%rip), %rdi     # 0x1d88d
leaq 0x134a9(%rip), %rsi     # 0x1d2a4
movl $0x1da8, %edx           # imm = 0x1DA8
leaq 0x15b18(%rip), %rcx     # 0x1f91f
callq 0x10b0
jmp 0x9e0e
jmp 0x9e10
jmp 0x9e12
jmp 0x9e14
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x9c99
movq -0x8(%rbp), %rax
movq 0x188(%rax), %rax
movslq -0x20(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
jmp 0x9e3a
movq -0x8(%rbp), %rax
movq 0x188(%rax), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)