// File: biotomas[P]ipasir/sat/picosat961/picosat-961/picosat.c
// Function: resolve_top_level_unit
static Cls *
resolve_top_level_unit (PS * ps, Lit * lit, Cls * reason)
{
  unsigned count_resolved;
  Lit **p, **eol, *other;
  Var *u, *v;

  assert (ps->rhead == ps->resolved);
  assert (ps->ahead == ps->added);

  add_lit (ps, lit);
  add_antecedent (ps, reason);
  count_resolved = 1;
  v = LIT2VAR (lit);

  eol = end_of_lits (reason);
  for (p = reason->lits; p < eol; p++)
    {
      other = *p;
      u = LIT2VAR (other);
      if (u == v)
	continue;

      add_antecedent (ps, u->reason);
      count_resolved++;
    }

  /* Some of the literals could be assumptions.  If at least one
   * variable is not an assumption, we should resolve.
   */
  if (count_resolved >= 2)
    {
#ifdef NO_BINARY_CLAUSES
      if (reason == &ps->impl)
	resetimpl (ps);
#endif
      reason = add_simplified_clause (ps, 1);
#ifdef NO_BINARY_CLAUSES
      if (reason->size == 2)
	{
	  assert (reason == &ps->impl);
	  reason = impl2reason (ps, lit);
	}
#endif
      assign_reason (ps, v, reason);
    }
  else
    {
      ps->ahead = ps->added;
      ps->rhead = ps->resolved;
    }

  return reason;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x2a8(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x2a0(%rcx), %rax
jne 0x13cce
jmp 0x13ced
leaq 0xaae5(%rip), %rdi      # 0x1e7ba
leaq 0x95c8(%rip), %rsi      # 0x1d2a4
movl $0x74b, %edx            # imm = 0x74B
leaq 0xaaec(%rip), %rcx      # 0x1e7d4
callq 0x10b0
movq -0x8(%rbp), %rax
movq 0x260(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x258(%rcx), %rax
jne 0x13d07
jmp 0x13d26
leaq 0xaaf6(%rip), %rdi      # 0x1e804
leaq 0x958f(%rip), %rsi      # 0x1d2a4
movl $0x74c, %edx            # imm = 0x74C
leaq 0xaab3(%rip), %rcx      # 0x1e7d4
callq 0x10b0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x6c80
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x14060
movl $0x1, -0x1c(%rbp)
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, -0x48(%rbp)
movq -0x18(%rbp), %rdi
callq 0xb980
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x13df5
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x38(%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, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x48(%rbp), %rax
jne 0x13dcd
jmp 0x13de7
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x14060
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x28(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x28(%rbp)
jmp 0x13d86
cmpl $0x2, -0x1c(%rbp)
jb 0x13e8a
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
addq $0x70, %rcx
cmpq %rcx, %rax
jne 0x13e19
movq -0x8(%rbp), %rdi
callq 0x13ec0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x14260
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x13e77
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
addq $0x70, %rcx
cmpq %rcx, %rax
jne 0x13e47
jmp 0x13e66
leaq 0xa9cd(%rip), %rdi      # 0x1e81b
leaq 0x944f(%rip), %rsi      # 0x1d2a4
movl $0x76c, %edx            # imm = 0x76C
leaq 0xa973(%rip), %rcx      # 0x1e7d4
callq 0x10b0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x15710
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x12d20
jmp 0x13eb6
movq -0x8(%rbp), %rax
movq 0x258(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x260(%rax)
movq -0x8(%rbp), %rax
movq 0x2a0(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x2a8(%rax)
movq -0x18(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq