// File: biotomas[P]ipasir/sat/picosat961/picosat-961/picosat.c
// Function: picosat_humus
const int *
picosat_humus (PS * ps, 
               void (*callback)(void*state,int nmcs,int nhumus),
	       void * state)
{
  int lit, nmcs, j, nhumus;
  const int * mcs, * p;
  unsigned i;
  Var * v;
  enter (ps);
#ifndef NDEBUG
  for (i = 1; i <= ps->max_var; i++)
    {
      v = ps->vars + i;
      assert (!v->humuspos);
      assert (!v->humusneg);
    }
#endif
  nhumus = nmcs = 0;
  while ((mcs = picosat_next_minimal_correcting_subset_of_assumptions (ps)))
    {
      for (p = mcs; (lit = *p); p++)
	{
	  v = ps->vars + abs (lit);
	  if (lit < 0)
	    {
	      if (!v->humusneg)
		{
		  v->humusneg = 1;
		  nhumus++;
		}
	    }
	  else
	    {
	      if (!v->humuspos)
		{
		  v->humuspos = 1;
		  nhumus++;
		}
	    }
	}
      nmcs++;
      LOG ( fprintf (ps->out, 
             "%smcs %d of size %d humus %d\n",
	     ps->prefix, nmcs, (int)(p - mcs), nhumus));
      if (callback)
	callback (state, nmcs, nhumus);
    }
  assert (!ps->szhumus);
  ps->szhumus = 1;
  for (i = 1; i <= ps->max_var; i++)
    {
      v = ps->vars + i;
      if (v->humuspos)
	ps->szhumus++;
      if (v->humusneg)
	ps->szhumus++;
    }
  assert (nhumus + 1 == ps->szhumus);
  NEWN (ps->humus, ps->szhumus);
  j = 0;
  for (i = 1; i <= ps->max_var; i++)
    {
      v = ps->vars + i;
      if (v->humuspos)
	{
	  assert (j < nhumus);
	  ps->humus[j++] = (int) i;
	}
      if (v->humusneg)
	{
	  assert (j < nhumus);
	  assert (i < INT_MAX);
	  ps->humus[j++] = - (int) i;
	}
    }
  assert (j == nhumus);
  assert (j < ps->szhumus);
  ps->humus[j] = 0;
  leave (ps);
  return ps->humus;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0x43a0
movl $0x1, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x2c(%rcx), %eax
ja 0xa4ba
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x3c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movw (%rax), %ax
shrw $0xb, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0xa453
jmp 0xa472
leaq 0x135a7(%rip), %rdi     # 0x1da01
leaq 0x12e43(%rip), %rsi     # 0x1d2a4
movl $0x1e80, %edx           # imm = 0x1E80
leaq 0x135a1(%rip), %rcx     # 0x1da0e
callq 0x10b0
movq -0x48(%rbp), %rax
movw (%rax), %ax
shrw $0xc, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0xa48b
jmp 0xa4aa
leaq 0x135bf(%rip), %rdi     # 0x1da51
leaq 0x12e0b(%rip), %rsi     # 0x1d2a4
movl $0x1e81, %edx           # imm = 0x1E81
leaq 0x13569(%rip), %rcx     # 0x1da0e
callq 0x10b0
jmp 0xa4ac
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xa414
movl $0x0, -0x20(%rbp)
movl $0x0, -0x28(%rbp)
movq -0x8(%rbp), %rdi
callq 0xa380
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0xa5c5
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
je 0xa59e
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
negl %edx
cmovnsl %edx, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0xa555
movq -0x48(%rbp), %rax
movw (%rax), %ax
shrw $0xc, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0xa553
movq -0x48(%rbp), %rax
movw (%rax), %cx
andw $0xefff, %cx            # imm = 0xEFFF
orw $0x1000, %cx            # imm = 0x1000
movw %cx, (%rax)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xa58b
movq -0x48(%rbp), %rax
movw (%rax), %ax
shrw $0xb, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0xa589
movq -0x48(%rbp), %rax
movw (%rax), %cx
andw $0xf7ff, %cx            # imm = 0xF7FF
orw $0x800, %cx             # imm = 0x800
movw %cx, (%rax)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xa58b
jmp 0xa58d
movq -0x38(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x38(%rbp)
jmp 0xa4e7
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xa5a9
cmpq $0x0, -0x10(%rbp)
je 0xa5c0
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rdi
movl -0x20(%rbp), %esi
movl -0x28(%rbp), %edx
callq *%rax
jmp 0xa4c8
movq -0x8(%rbp), %rax
cmpl $0x0, 0x1b0(%rax)
jne 0xa5d4
jmp 0xa5f3
leaq 0x13483(%rip), %rdi     # 0x1da5e
leaq 0x12cc2(%rip), %rsi     # 0x1d2a4
movl $0x1ea2, %edx           # imm = 0x1EA2
leaq 0x13420(%rip), %rcx     # 0x1da0e
callq 0x10b0
movq -0x8(%rbp), %rax
movl $0x1, 0x1b0(%rax)
movl $0x1, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x2c(%rcx), %eax
ja 0xa68e
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x3c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movw (%rax), %ax
shrw $0xb, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
je 0xa654
movq -0x8(%rbp), %rax
movl 0x1b0(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x1b0(%rax)
movq -0x48(%rbp), %rax
movw (%rax), %ax
shrw $0xc, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
je 0xa67e
movq -0x8(%rbp), %rax
movl 0x1b0(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x1b0(%rax)
jmp 0xa680
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xa608
movl -0x28(%rbp), %eax
addl $0x1, %eax
movq -0x8(%rbp), %rcx
cmpl 0x1b0(%rcx), %eax
jne 0xa6a2
jmp 0xa6c1
leaq 0x133c2(%rip), %rdi     # 0x1da6b
leaq 0x12bf4(%rip), %rsi     # 0x1d2a4
movl $0x1eac, %edx           # imm = 0x1EAC
leaq 0x13352(%rip), %rcx     # 0x1da0e
callq 0x10b0
jmp 0xa6c3
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movslq 0x1b0(%rax), %rsi
shlq $0x2, %rsi
callq 0x9900
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x1a8(%rax)
movl $0x0, -0x24(%rbp)
movl $0x1, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x2c(%rcx), %eax
ja 0xa817
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x3c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movw (%rax), %ax
shrw $0xb, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
je 0xa77c
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0xa73e
jmp 0xa75d
leaq 0x13340(%rip), %rdi     # 0x1da85
leaq 0x12b58(%rip), %rsi     # 0x1d2a4
movl $0x1eb4, %edx           # imm = 0x1EB4
leaq 0x132b6(%rip), %rcx     # 0x1da0e
callq 0x10b0
movl -0x3c(%rbp), %edx
movq -0x8(%rbp), %rax
movq 0x1a8(%rax), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x24(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq -0x48(%rbp), %rax
movw (%rax), %ax
shrw $0xc, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
je 0xa807
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0xa79d
jmp 0xa7bc
leaq 0x132e1(%rip), %rdi     # 0x1da85
leaq 0x12af9(%rip), %rsi     # 0x1d2a4
movl $0x1eb9, %edx           # imm = 0x1EB9
leaq 0x13257(%rip), %rcx     # 0x1da0e
callq 0x10b0
cmpl $0x7fffffff, -0x3c(%rbp) # imm = 0x7FFFFFFF
jae 0xa7c7
jmp 0xa7e6
leaq 0x132c2(%rip), %rdi     # 0x1da90
leaq 0x12acf(%rip), %rsi     # 0x1d2a4
movl $0x1eba, %edx           # imm = 0x1EBA
leaq 0x1322d(%rip), %rcx     # 0x1da0e
callq 0x10b0
xorl %edx, %edx
subl -0x3c(%rbp), %edx
movq -0x8(%rbp), %rax
movq 0x1a8(%rax), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x24(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0xa809
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xa6f7
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jne 0xa821
jmp 0xa840
leaq 0x13274(%rip), %rdi     # 0x1da9c
leaq 0x12a75(%rip), %rsi     # 0x1d2a4
movl $0x1ebe, %edx           # imm = 0x1EBE
leaq 0x131d3(%rip), %rcx     # 0x1da0e
callq 0x10b0
movl -0x24(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x1b0(%rcx), %eax
jge 0xa851
jmp 0xa870
leaq 0x13250(%rip), %rdi     # 0x1daa8
leaq 0x12a45(%rip), %rsi     # 0x1d2a4
movl $0x1ebf, %edx           # imm = 0x1EBF
leaq 0x131a3(%rip), %rcx     # 0x1da0e
callq 0x10b0
movq -0x8(%rbp), %rax
movq 0x1a8(%rax), %rax
movslq -0x24(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movq -0x8(%rbp), %rdi
callq 0x4910
movq -0x8(%rbp), %rax
movq 0x1a8(%rax), %rax
addq $0x50, %rsp
popq %rbp
retq