// File: biotomas[P]ipasir/sat/picosat961/picosat-961/picosat.c
// Function: unassign
static void
unassign (PS * ps, Lit * lit)
{
  Cls *reason;
  Var *v;
  Rnk *r;

  assert (lit->val == TRUE);

  LOG ( fprintf (ps->out, "%sunassign %d\n", ps->prefix, LIT2INT (lit)));

  v = LIT2VAR (lit);
  reason = v->reason;

#ifdef NO_BINARY_CLAUSES
  assert (reason != &ps->impl);
  if (ISLITREASON (reason))
    {
      /* DO NOTHING */
    }
  else
#endif
  if (reason)
    {
      assert (reason->locked);
      reason->locked = 0;
      if (reason->learned && reason->size > 2)
	{
	  assert (ps->llocked > 0);
	  ps->llocked--;
	}
    }

  lit->val = UNDEF;
  NOTLIT (lit)->val = UNDEF;

  r = VAR2RNK (v);
  if (!r->pos)
    hpush (ps, r);

#ifndef NDSC
  {
    Cls * p, * next, ** q;

    q = LIT2DHTPS (lit);
    p = *q;
    *q = 0;

    while (p)
      {
	Lit * other = p->lits[0];

	if (other == lit)
	  {
	    other = p->lits[1];
	    q = p->next + 1;
	  }
	else
	  {
	    assert (p->lits[1] == lit);
	    q = p->next;
	  }

	next = *q;
	*q = *LIT2HTPS (other);
	*LIT2HTPS (other) = p;
	p = next;
      }
  }
#endif

#ifndef NADC
  if (v->adotabpos)
    {
      assert (ps->nadotab);
      assert (*v->adotabpos == v->ado);

      *v->adotabpos = 0;
      v->adotabpos = 0;

      ps->nadotab--;
    }
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x1, %eax
jne 0xed4e
jmp 0xed6d
leaq 0xf486(%rip), %rdi      # 0x1e1db
leaq 0xe548(%rip), %rsi      # 0x1d2a4
movl $0xb71, %edx            # imm = 0xB71
leaq 0xf484(%rip), %rcx      # 0x1e1ec
callq 0x10b0
jmp 0xed6f
jmp 0xed71
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rdx
movq 0x38(%rdx), %rdx
subq %rdx, %rcx
shrl %ecx
movl %ecx, %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
addq $0x70, %rcx
cmpq %rcx, %rax
je 0xedb6
jmp 0xedd5
leaq 0xf44a(%rip), %rdi      # 0x1e207
leaq 0xe4e0(%rip), %rsi      # 0x1d2a4
movl $0xb79, %edx            # imm = 0xB79
leaq 0xf41c(%rip), %rcx      # 0x1e1ec
callq 0x10b0
movq -0x18(%rbp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0xede8
jmp 0xee95
cmpq $0x0, -0x18(%rbp)
je 0xee93
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
shrl $0x2, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xee07
jmp 0xee26
leaq 0xf93a(%rip), %rdi      # 0x1e748
leaq 0xe48f(%rip), %rsi      # 0x1d2a4
movl $0xb82, %edx            # imm = 0xB82
leaq 0xf3cb(%rip), %rcx      # 0x1e1ec
callq 0x10b0
movq -0x18(%rbp), %rax
movl 0x4(%rax), %ecx
andl $-0x5, %ecx
orl $0x0, %ecx
movl %ecx, 0x4(%rax)
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
shrl %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xee91
movq -0x18(%rbp), %rax
cmpl $0x2, (%rax)
jbe 0xee91
movq -0x8(%rbp), %rax
cmpl $0x0, 0x3b8(%rax)
jbe 0xee5f
jmp 0xee7e
leaq 0xf3b5(%rip), %rdi      # 0x1e21b
leaq 0xe437(%rip), %rsi      # 0x1d2a4
movl $0xb86, %edx            # imm = 0xB86
leaq 0xf373(%rip), %rcx      # 0x1e1ec
callq 0x10b0
movq -0x8(%rbp), %rax
movl 0x3b8(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x3b8(%rax)
jmp 0xee93
jmp 0xee95
movq -0x10(%rbp), %rax
movb $0x0, (%rax)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rdx
movq 0x38(%rdx), %rdx
subq %rdx, %rcx
xorq $0x1, %rcx
movb $0x0, (%rax,%rcx)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x20(%rbp), %rcx
movq -0x8(%rbp), %rdx
movq 0x40(%rdx), %rdx
subq %rdx, %rcx
sarq $0x4, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
cmpl $0x0, %eax
jne 0xeeff
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0xbcf0
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rdx
movq 0x38(%rdx), %rdx
subq %rdx, %rcx
movl %ecx, %ecx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x40(%rbp), %rax
movq $0x0, (%rax)
cmpq $0x0, -0x30(%rbp)
je 0xf010
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x10(%rbp), %rax
jne 0xef78
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
addq $0x8, %rax
addq $0x8, %rax
movq %rax, -0x40(%rbp)
jmp 0xefb3
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
cmpq -0x10(%rbp), %rax
jne 0xef88
jmp 0xefa7
leaq 0xf29c(%rip), %rdi      # 0x1e22b
leaq 0xe30e(%rip), %rsi      # 0x1d2a4
movl $0xba5, %edx            # imm = 0xBA5
leaq 0xf24a(%rip), %rcx      # 0x1e1ec
callq 0x10b0
movq -0x30(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x48(%rbp), %rcx
movq -0x8(%rbp), %rdx
movq 0x38(%rdx), %rdx
subq %rdx, %rcx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x48(%rbp), %rcx
movq -0x8(%rbp), %rsi
movq 0x38(%rsi), %rsi
subq %rsi, %rcx
movl %ecx, %ecx
movq %rdx, (%rax,%rcx,8)
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0xef39
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)