// File: /workspace/github_c_makefile_star2_O3/reactive-systems[P]aiger-ltl-model-checker/aiger.c
// Function: aiger_reencode
void
aiger_reencode (aiger * public)
{
  unsigned *code, i, j, size_code, old, new, lhs, rhs0, rhs1, tmp;
  unsigned *stack, size_stack;
  IMPORT_private_FROM (public);

  assert (!aiger_error (public));

  aiger_symbol *symbol;
  aiger_type *type;
  aiger_and *and;

  if (aiger_is_reencoded (public))
    return;

  size_code = 2 * (public->maxvar + 1);
  if (size_code < 2)
    size_code = 2;

  NEWN (code, size_code);

  code[1] = 1;			/* not used actually */

  new = 2;

  for (i = 0; i < public->num_inputs; i++)
    {
      old = public->inputs[i].lit;

      code[old] = new;
      code[old + 1] = new + 1;

      new += 2;
    }

  for (i = 0; i < public->num_latches; i++)
    {
      old = public->latches[i].lit;

      code[old] = new;
      code[old + 1] = new + 1;

      new += 2;
    }

  stack = 0;
  size_stack = 0;

  for (i = 0; i < public->num_latches; i++)
    {
      old = public->latches[i].next;
      public->latches[i].next =
	aiger_reencode_lit (public, old, &new, code, &stack, &size_stack);

      old = public->latches[i].reset;
      public->latches[i].reset =
	aiger_reencode_lit (public, old, &new, code, &stack, &size_stack);
    }

  for (i = 0; i < public->num_outputs; i++)
    {
      old = public->outputs[i].lit;
      public->outputs[i].lit =
	aiger_reencode_lit (public, old, &new, code, &stack, &size_stack);
    }

  for (i = 0; i < public->num_bad; i++)
    {
      old = public->bad[i].lit;
      public->bad[i].lit =
	aiger_reencode_lit (public, old, &new, code, &stack, &size_stack);
    }

  for (i = 0; i < public->num_constraints; i++)
    {
      old = public->constraints[i].lit;
      public->constraints[i].lit =
	aiger_reencode_lit (public, old, &new, code, &stack, &size_stack);
    }

  for (i = 0; i < public->num_justice; i++)
    {
      for (j = 0; j < public->justice[i].size; j++)
	{
	  old = public->justice[i].lits[j];
	  public->justice[i].lits[j] =
	    aiger_reencode_lit (public, old, &new, code, &stack, &size_stack);
	}
    }

  for (i = 0; i < public->num_fairness; i++)
    {
      old = public->fairness[i].lit;
      public->fairness[i].lit =
	aiger_reencode_lit (public, old, &new, code, &stack, &size_stack);
    }

  DELETEN (stack, size_stack);

  j = 0;
  for (i = 0; i < public->num_ands; i++)
    {
      and = public->ands + i;
      lhs = code[and->lhs];
      if (!lhs)
	continue;

      rhs0 = code[and->rhs0];
      rhs1 = code[and->rhs1];

      and = public->ands + j++;

      if (rhs0 < rhs1)
	{
	  tmp = rhs1;
	  rhs1 = rhs0;
	  rhs0 = tmp;
	}

      assert (lhs > rhs0);
      assert (rhs0 >= rhs1);

      and->lhs = lhs;
      and->rhs0 = rhs0;
      and->rhs1 = rhs1;
    }
  public->num_ands = j;

  qsort (public->ands, j, sizeof (*and), cmp_lhs);

  assert (new);
  assert (public->maxvar >= aiger_lit2var (new - 1));
  public->maxvar = aiger_lit2var (new - 1);

  /* Reset types.
   */
  for (i = 1; i <= public->maxvar; i++)
    {
      type = private->types + i;
      type->input = 0;
      type->latch = 0;
      type->and = 0;
      type->idx = 0;
    }

  /* Fix types for ANDs.
   */
  for (i = 0; i < public->num_ands; i++)
    {
      and = public->ands + i;
      type = private->types + aiger_lit2var (and->lhs);
      type->and = 1;
      type->idx = i;
    }

  /* Fix types for inputs.
   */
  for (i = 0; i < public->num_inputs; i++)
    {
      symbol = public->inputs + i;
      assert (symbol->lit < size_code);
      symbol->lit = code[symbol->lit];
      type = private->types + aiger_lit2var (symbol->lit);
      type->input = 1;
      type->idx = i;
    }

  /* Fix types for latches.
   */
  for (i = 0; i < public->num_latches; i++)
    {
      symbol = public->latches + i;
      symbol->lit = code[symbol->lit];
      type = private->types + aiger_lit2var (symbol->lit);
      type->latch = 1;
      type->idx = i;
    }

  DELETEN (code, size_code);

#ifndef NDEBUG
  for (i = 0; i <= public->maxvar; i++)
    {
      type = private->types + i;
      assert (!(type->input && type->latch));
      assert (!(type->input && type->and));
      assert (!(type->latch && type->and));
    }
#endif
  assert (aiger_is_reencoded (public));
  assert (!aiger_check (public));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
cmpq $0x0, 0xd0(%rdi)
jne 0x4110
movq %rdi, %rbx
callq 0x39f6
testl %eax, %eax
jne 0x4066
movl (%rbx), %eax
leal 0x2(,%rax,2), %eax
testl %eax, %eax
movl $0x2, %r14d
cmovel %r14d, %eax
movq %rax, -0x58(%rbp)
leaq (,%rax,4), %r15
movq 0xb8(%rbx), %rdi
movq %r15, %rsi
callq *0xc0(%rbx)
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
movq %r15, -0x50(%rbp)
movq %r15, %rdx
callq 0x1100
movl $0x1, 0x4(%r12)
cmpl $0x0, 0x4(%rbx)
je 0x3c09
movq 0x28(%rbx), %rax
movl $0x2, %r14d
xorl %ecx, %ecx
movl (%rax), %edx
movl %r14d, (%r12,%rdx,4)
incl %edx
leal 0x1(%r14), %esi
movl %esi, (%r12,%rdx,4)
addl $0x2, %r14d
incq %rcx
movl 0x4(%rbx), %edx
addq $0x20, %rax
cmpq %rdx, %rcx
jb 0x3be6
cmpl $0x0, 0x8(%rbx)
je 0x3cc4
movq 0x30(%rbx), %rax
xorl %ecx, %ecx
movl (%rax), %edx
movl %r14d, (%r12,%rdx,4)
leal 0x1(%r14), %esi
incl %edx
movl %esi, (%r12,%rdx,4)
addl $0x2, %r14d
incq %rcx
movl 0x8(%rbx), %edx
addq $0x20, %rax
cmpq %rdx, %rcx
jb 0x3c19
movl %r14d, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movl $0x0, -0x2c(%rbp)
testl %edx, %edx
je 0x3cd7
movq 0x30(%rbx), %rcx
xorl %r15d, %r15d
xorl %r14d, %r14d
movl 0x4(%rcx,%r15), %esi
movq %rbx, %rdi
leaq -0x30(%rbp), %rdx
movq %r12, %rcx
movq %r12, %r13
leaq -0x38(%rbp), %r12
movq %r12, %r8
leaq -0x2c(%rbp), %r9
callq 0x41ab
movq 0x30(%rbx), %rcx
movl %eax, 0x4(%rcx,%r15)
movl 0x8(%rcx,%r15), %esi
movq %rbx, %rdi
leaq -0x30(%rbp), %rdx
movq %r13, %rcx
movq %r12, %r8
movq %r13, %r12
leaq -0x2c(%rbp), %r9
callq 0x41ab
movq 0x30(%rbx), %rcx
movl %eax, 0x8(%rcx,%r15)
incq %r14
movl 0x8(%rbx), %eax
addq $0x20, %r15
cmpq %rax, %r14
jb 0x3c61
jmp 0x3cd7
movl %r14d, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movl $0x0, -0x2c(%rbp)
cmpl $0x0, 0xc(%rbx)
je 0x3d1c
movq 0x38(%rbx), %rcx
xorl %r15d, %r15d
leaq -0x2c(%rbp), %r13
xorl %r14d, %r14d
movl (%rcx,%r15), %esi
movq %rbx, %rdi
leaq -0x30(%rbp), %rdx
movq %r12, %rcx
leaq -0x38(%rbp), %r8
movq %r13, %r9
callq 0x41ab
movq 0x38(%rbx), %rcx
movl %eax, (%rcx,%r15)
incq %r14
movl 0xc(%rbx), %eax
addq $0x20, %r15
cmpq %rax, %r14
jb 0x3ceb
cmpl $0x0, 0x14(%rbx)
je 0x3d61
movq 0x40(%rbx), %rcx
xorl %r15d, %r15d
leaq -0x2c(%rbp), %r13
xorl %r14d, %r14d
movl (%rcx,%r15), %esi
movq %rbx, %rdi
leaq -0x30(%rbp), %rdx
movq %r12, %rcx
leaq -0x38(%rbp), %r8
movq %r13, %r9
callq 0x41ab
movq 0x40(%rbx), %rcx
movl %eax, (%rcx,%r15)
incq %r14
movl 0x14(%rbx), %eax
addq $0x20, %r15
cmpq %rax, %r14
jb 0x3d30
cmpl $0x0, 0x18(%rbx)
je 0x3da6
movq 0x48(%rbx), %rcx
xorl %r15d, %r15d
leaq -0x2c(%rbp), %r13
xorl %r14d, %r14d
movl (%rcx,%r15), %esi
movq %rbx, %rdi
leaq -0x30(%rbp), %rdx
movq %r12, %rcx
leaq -0x38(%rbp), %r8
movq %r13, %r9
callq 0x41ab
movq 0x48(%rbx), %rcx
movl %eax, (%rcx,%r15)
incq %r14
movl 0x18(%rbx), %eax
addq $0x20, %r15
cmpq %rax, %r14
jb 0x3d75
movq %r12, -0x40(%rbp)
movl 0x1c(%rbx), %eax
testl %eax, %eax
je 0x3e36
movq 0x50(%rbx), %rcx
xorl %esi, %esi
leaq -0x30(%rbp), %r14
leaq -0x38(%rbp), %r13
leaq -0x2c(%rbp), %r15
movq %rsi, %rdi
shlq $0x5, %rdi
movq %rdi, -0x48(%rbp)
cmpl $0x0, 0xc(%rcx,%rdi)
je 0x3e2c
movq %rsi, -0x60(%rbp)
movq -0x48(%rbp), %rax
movq 0x10(%rcx,%rax), %rsi
movq %rbx, %r12
xorl %ebx, %ebx
movl (%rsi,%rbx,4), %esi
movq %r12, %rdi
movq %r14, %rdx
movq -0x40(%rbp), %rcx
movq %r13, %r8
movq %r15, %r9
callq 0x41ab
movq 0x50(%r12), %rcx
movq -0x48(%rbp), %rdi
movq 0x10(%rcx,%rdi), %rsi
movl %eax, (%rsi,%rbx,4)
incq %rbx
movl 0xc(%rcx,%rdi), %eax
cmpq %rax, %rbx
jb 0x3deb
movl 0x1c(%r12), %eax
movq %r12, %rbx
movq -0x60(%rbp), %rsi
incq %rsi
movl %eax, %edi
cmpq %rdi, %rsi
jb 0x3dc7
cmpl $0x0, 0x20(%rbx)
movq -0x40(%rbp), %r12
je 0x3e7f
movq 0x58(%rbx), %rcx
xorl %r15d, %r15d
leaq -0x2c(%rbp), %r13
xorl %r14d, %r14d
movl (%rcx,%r15), %esi
movq %rbx, %rdi
leaq -0x30(%rbp), %rdx
movq %r12, %rcx
leaq -0x38(%rbp), %r8
movq %r13, %r9
callq 0x41ab
movq 0x58(%rbx), %rcx
movl %eax, (%rcx,%r15)
incq %r14
movl 0x20(%rbx), %eax
addq $0x20, %r15
cmpq %rax, %r14
jb 0x3e4e
movl -0x2c(%rbp), %edx
shlq $0x2, %rdx
movq 0xb8(%rbx), %rdi
movq -0x38(%rbp), %rsi
callq *0xc8(%rbx)
movl 0x10(%rbx), %eax
movq 0x60(%rbx), %rdi
testq %rax, %rax
je 0x3f0c
shlq $0x2, %rax
leaq (%rax,%rax,2), %rcx
xorl %edx, %edx
xorl %eax, %eax
movq -0x40(%rbp), %r14
movl (%rdi,%rdx), %esi
movl (%r14,%rsi,4), %esi
testl %esi, %esi
je 0x3f01
movl 0x4(%rdi,%rdx), %r8d
movl 0x8(%rdi,%rdx), %r9d
movl (%r14,%r8,4), %r10d
movl (%r14,%r9,4), %r8d
cmpl %r8d, %r10d
movl %r8d, %r9d
cmoval %r10d, %r9d
cmpl %r9d, %esi
jbe 0x40f1
cmpl %r8d, %r10d
cmovbl %r10d, %r8d
movl %eax, %r10d
leaq (%r10,%r10,2), %r10
incl %eax
movl %esi, (%rdi,%r10,4)
movl %r9d, 0x4(%rdi,%r10,4)
movl %r8d, 0x8(%rdi,%r10,4)
addq $0xc, %rdx
cmpq %rdx, %rcx
jne 0x3eb3
jmp 0x3f12
xorl %eax, %eax
movq -0x40(%rbp), %r14
movl %eax, 0x10(%rbx)
movl %eax, %esi
leaq 0x954(%rip), %rcx       # 0x4872
movl $0xc, %edx
callq 0x1090
movl -0x30(%rbp), %eax
testl %eax, %eax
je 0x412f
leal -0x1(%rax), %ecx
shrl %ecx
cmpl %ecx, (%rbx)
movq -0x58(%rbp), %rdi
jb 0x414e
movl %ecx, (%rbx)
cmpl $0x3, %eax
jb 0x3f68
movl $0x1, %eax
movq 0x70(%rbx), %rcx
movl %eax, %edx
andb $-0x8, (%rcx,%rdx,8)
movl $0x0, 0x4(%rcx,%rdx,8)
incl %eax
cmpl (%rbx), %eax
jbe 0x3f50
cmpl $0x0, 0x10(%rbx)
je 0x3f96
xorl %eax, %eax
xorl %ecx, %ecx
movq 0x60(%rbx), %rdx
movq 0x70(%rbx), %rsi
movl (%rdx,%rax), %edx
shrl %edx
orb $0x4, (%rsi,%rdx,8)
movl %ecx, 0x4(%rsi,%rdx,8)
incq %rcx
movl 0x10(%rbx), %edx
addq $0xc, %rax
cmpq %rdx, %rcx
jb 0x3f72
cmpl $0x0, 0x4(%rbx)
je 0x3fd3
xorl %eax, %eax
xorl %ecx, %ecx
movq 0x28(%rbx), %rdx
movl (%rdx,%rax), %esi
cmpl %edi, %esi
jae 0x40d2
movl (%r14,%rsi,4), %esi
movl %esi, (%rdx,%rax)
movq 0x70(%rbx), %rdx
shrl %esi
orb $0x1, (%rdx,%rsi,8)
movl %ecx, 0x4(%rdx,%rsi,8)
incq %rcx
movl 0x4(%rbx), %edx
addq $0x20, %rax
cmpq %rdx, %rcx
jb 0x3fa0
cmpl $0x0, 0x8(%rbx)
je 0x4008
xorl %eax, %eax
xorl %ecx, %ecx
movq 0x30(%rbx), %rdx
movl (%rdx,%rax), %esi
movl (%r14,%rsi,4), %esi
movl %esi, (%rdx,%rax)
movq 0x70(%rbx), %rdx
shrl %esi
orb $0x2, (%rdx,%rsi,8)
movl %ecx, 0x4(%rdx,%rsi,8)
incq %rcx
movl 0x8(%rbx), %edx
addq $0x20, %rax
cmpq %rdx, %rcx
jb 0x3fdd
movq 0xb8(%rbx), %rdi
movq %r14, %rsi
movq -0x50(%rbp), %rdx
callq *0xc8(%rbx)
movl (%rbx), %eax
movq 0x70(%rbx), %rcx
xorl %edx, %edx
movl %edx, %esi
movb (%rcx,%rsi,8), %sil
notb %sil
testb $0x3, %sil
je 0x4094
testb $0x5, %sil
je 0x40b3
testb $0x6, %sil
je 0x4075
incl %edx
cmpl %eax, %edx
jbe 0x4024
movq %rbx, %rdi
callq 0x39f6
testl %eax, %eax
je 0x416d
movq %rbx, %rdi
callq 0x2fe8
testq %rax, %rax
jne 0x418c
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x45f1(%rip), %rdi      # 0x866d
leaq 0x4270(%rip), %rsi      # 0x82f3
leaq 0x453f(%rip), %rcx      # 0x85c9
movl $0x681, %edx            # imm = 0x681
callq 0x10f0
leaq 0x4598(%rip), %rdi      # 0x8633
leaq 0x4251(%rip), %rsi      # 0x82f3
leaq 0x4520(%rip), %rcx      # 0x85c9
movl $0x67f, %edx            # imm = 0x67F
callq 0x10f0
leaq 0x4597(%rip), %rdi      # 0x8651
leaq 0x4232(%rip), %rsi      # 0x82f3
leaq 0x4501(%rip), %rcx      # 0x85c9
movl $0x680, %edx            # imm = 0x680
callq 0x10f0
leaq 0x4542(%rip), %rdi      # 0x861b
leaq 0x4213(%rip), %rsi      # 0x82f3
leaq 0x44e2(%rip), %rcx      # 0x85c9
movl $0x667, %edx            # imm = 0x667
callq 0x10f0
leaq 0x44ee(%rip), %rdi      # 0x85e6
leaq 0x41f4(%rip), %rsi      # 0x82f3
leaq 0x44c3(%rip), %rcx      # 0x85c9
movl $0x63e, %edx            # imm = 0x63E
callq 0x10f0
leaq 0x422a(%rip), %rdi      # 0x8341
leaq 0x41d5(%rip), %rsi      # 0x82f3
leaq 0x44a4(%rip), %rcx      # 0x85c9
movl $0x5cd, %edx            # imm = 0x5CD
callq 0x10f0
leaq 0x4d1d(%rip), %rdi      # 0x8e53
leaq 0x41b6(%rip), %rsi      # 0x82f3
leaq 0x4485(%rip), %rcx      # 0x85c9
movl $0x649, %edx            # imm = 0x649
callq 0x10f0
leaq 0x449c(%rip), %rdi      # 0x85f1
leaq 0x4197(%rip), %rsi      # 0x82f3
leaq 0x4466(%rip), %rcx      # 0x85c9
movl $0x64a, %edx            # imm = 0x64A
callq 0x10f0
leaq 0x4515(%rip), %rdi      # 0x8689
leaq 0x4178(%rip), %rsi      # 0x82f3
leaq 0x4447(%rip), %rcx      # 0x85c9
movl $0x684, %edx            # imm = 0x684
callq 0x10f0
leaq 0x4512(%rip), %rdi      # 0x86a5
leaq 0x4159(%rip), %rsi      # 0x82f3
leaq 0x4428(%rip), %rcx      # 0x85c9
movl $0x685, %edx            # imm = 0x685
callq 0x10f0