// File: /workspace/github_c_makefile_star2_O1/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 0x41e7
movq %rdi, %rbx
callq 0x3b05
testl %eax, %eax
jne 0x413d
movl (%rbx), %eax
leal 0x2(,%rax,2), %eax
testl %eax, %eax
movl $0x2, %r14d
cmovel %r14d, %eax
movq %rax, -0x50(%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, -0x48(%rbp)
movq %r15, %rdx
callq 0x1100
movl $0x1, 0x4(%r12)
movl $0x2, -0x2c(%rbp)
cmpl $0x0, 0x4(%rbx)
je 0x3cf5
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 0x3cd2
movl %r14d, -0x2c(%rbp)
cmpl $0x0, 0x8(%rbx)
movq %r12, -0x40(%rbp)
je 0x3d2c
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 0x3d09
movl %r14d, -0x2c(%rbp)
movq $0x0, -0x38(%rbp)
movl $0x0, -0x30(%rbp)
cmpl $0x0, 0x8(%rbx)
movq -0x40(%rbp), %r12
je 0x3db4
xorl %r15d, %r15d
xorl %r14d, %r14d
movq 0x30(%rbx), %rax
movl 0x4(%rax,%r15), %esi
movq %rbx, %rdi
leaq -0x2c(%rbp), %rdx
movq %r12, %rcx
movq %r12, %r13
leaq -0x38(%rbp), %r12
movq %r12, %r8
leaq -0x30(%rbp), %r9
callq 0x4282
movq 0x30(%rbx), %rcx
movl %eax, 0x4(%rcx,%r15)
movl 0x8(%rcx,%r15), %esi
movq %rbx, %rdi
leaq -0x2c(%rbp), %rdx
movq %r13, %rcx
movq %r12, %r8
movq %r13, %r12
leaq -0x30(%rbp), %r9
callq 0x4282
movq 0x30(%rbx), %rcx
movl %eax, 0x8(%rcx,%r15)
incq %r14
movl 0x8(%rbx), %eax
addq $0x20, %r15
cmpq %rax, %r14
jb 0x3d4f
cmpl $0x0, 0xc(%rbx)
je 0x3df9
xorl %r15d, %r15d
leaq -0x30(%rbp), %r13
xorl %r14d, %r14d
movq 0x38(%rbx), %rax
movl (%rax,%r15), %esi
movq %rbx, %rdi
leaq -0x2c(%rbp), %rdx
movq %r12, %rcx
leaq -0x38(%rbp), %r8
movq %r13, %r9
callq 0x4282
movq 0x38(%rbx), %rcx
movl %eax, (%rcx,%r15)
incq %r14
movl 0xc(%rbx), %eax
addq $0x20, %r15
cmpq %rax, %r14
jb 0x3dc4
cmpl $0x0, 0x14(%rbx)
je 0x3e3e
xorl %r15d, %r15d
leaq -0x30(%rbp), %r13
xorl %r14d, %r14d
movq 0x40(%rbx), %rax
movl (%rax,%r15), %esi
movq %rbx, %rdi
leaq -0x2c(%rbp), %rdx
movq %r12, %rcx
leaq -0x38(%rbp), %r8
movq %r13, %r9
callq 0x4282
movq 0x40(%rbx), %rcx
movl %eax, (%rcx,%r15)
incq %r14
movl 0x14(%rbx), %eax
addq $0x20, %r15
cmpq %rax, %r14
jb 0x3e09
cmpl $0x0, 0x18(%rbx)
je 0x3e83
xorl %r15d, %r15d
leaq -0x30(%rbp), %r13
xorl %r14d, %r14d
movq 0x48(%rbx), %rax
movl (%rax,%r15), %esi
movq %rbx, %rdi
leaq -0x2c(%rbp), %rdx
movq %r12, %rcx
leaq -0x38(%rbp), %r8
movq %r13, %r9
callq 0x4282
movq 0x48(%rbx), %rcx
movl %eax, (%rcx,%r15)
incq %r14
movl 0x18(%rbx), %eax
addq $0x20, %r15
cmpq %rax, %r14
jb 0x3e4e
cmpl $0x0, 0x1c(%rbx)
je 0x3efd
xorl %r14d, %r14d
leaq -0x38(%rbp), %r13
leaq -0x30(%rbp), %r12
movq 0x50(%rbx), %rsi
movq %r14, -0x58(%rbp)
shlq $0x5, %r14
cmpl $0x0, 0xc(%rsi,%r14)
movq %rbx, %rdi
movq -0x40(%rbp), %rcx
je 0x3eeb
xorl %ebx, %ebx
movq 0x10(%rsi,%r14), %rax
movl (%rax,%rbx,4), %esi
movq %rdi, %r15
leaq -0x2c(%rbp), %rdx
movq %r13, %r8
movq %r12, %r9
callq 0x4282
movq -0x40(%rbp), %rcx
movq %r15, %rdi
movq 0x50(%r15), %rsi
movq 0x10(%rsi,%r14), %rdx
movl %eax, (%rdx,%rbx,4)
incq %rbx
movl 0xc(%rsi,%r14), %eax
cmpq %rax, %rbx
jb 0x3eb1
movq -0x58(%rbp), %r14
incq %r14
movl 0x1c(%rdi), %eax
cmpq %rax, %r14
movq %rdi, %rbx
jb 0x3e94
cmpl $0x0, 0x20(%rbx)
movq %rbx, %r14
movq -0x40(%rbp), %r12
je 0x3f49
xorl %r15d, %r15d
leaq -0x30(%rbp), %r13
xorl %ebx, %ebx
movq 0x58(%r14), %rax
movl (%rax,%r15), %esi
movq %r14, %rdi
leaq -0x2c(%rbp), %rdx
movq %r12, %rcx
leaq -0x38(%rbp), %r8
movq %r13, %r9
callq 0x4282
movq 0x58(%r14), %rcx
movl %eax, (%rcx,%r15)
incq %rbx
movl 0x20(%r14), %eax
addq $0x20, %r15
cmpq %rax, %rbx
jb 0x3f13
movl -0x30(%rbp), %edx
shlq $0x2, %rdx
movq 0xb8(%r14), %rdi
movq -0x38(%rbp), %rsi
callq *0xc8(%r14)
movq $0x0, -0x38(%rbp)
movl 0x10(%r14), %ecx
testq %rcx, %rcx
movq %r14, %rbx
je 0x3fe3
movq 0x60(%rbx), %rax
shlq $0x2, %rcx
leaq (%rcx,%rcx,2), %rdx
xorl %esi, %esi
xorl %ecx, %ecx
movq -0x40(%rbp), %r14
movl (%rax,%rsi), %edi
movl (%r14,%rdi,4), %edi
testl %edi, %edi
je 0x3fd8
movl 0x4(%rax,%rsi), %r8d
movl 0x8(%rax,%rsi), %r9d
movl (%r14,%r8,4), %r10d
movl (%r14,%r9,4), %r8d
cmpl %r8d, %r10d
movl %r8d, %r9d
cmoval %r10d, %r9d
cmpl %r9d, %edi
jbe 0x41c8
cmpl %r8d, %r10d
cmovbl %r10d, %r8d
movl %ecx, %r10d
leaq (%r10,%r10,2), %r10
incl %ecx
movl %edi, (%rax,%r10,4)
movl %r9d, 0x4(%rax,%r10,4)
movl %r8d, 0x8(%rax,%r10,4)
addq $0xc, %rsi
cmpq %rsi, %rdx
jne 0x3f8a
jmp 0x3fe9
xorl %ecx, %ecx
movq -0x40(%rbp), %r14
movl %ecx, 0x10(%rbx)
movq 0x60(%rbx), %rdi
movl %ecx, %esi
leaq 0x95e(%rip), %rcx       # 0x4957
movl $0xc, %edx
callq 0x1090
movl -0x2c(%rbp), %eax
testl %eax, %eax
je 0x4206
leal -0x1(%rax), %ecx
shrl %ecx
cmpl %ecx, (%rbx)
movq -0x50(%rbp), %rdi
jb 0x4225
movl %ecx, (%rbx)
cmpl $0x3, %eax
jb 0x4043
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 0x402b
cmpl $0x0, 0x10(%rbx)
je 0x4071
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 0x404d
cmpl $0x0, 0x4(%rbx)
je 0x40aa
xorl %eax, %eax
xorl %ecx, %ecx
movq 0x28(%rbx), %rdx
movl (%rdx,%rax), %esi
cmpl %edi, %esi
jae 0x41a9
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)
incl %ecx
addq $0x20, %rax
cmpl 0x4(%rbx), %ecx
jb 0x407b
cmpl $0x0, 0x8(%rbx)
je 0x40df
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 0x40b4
movq 0xb8(%rbx), %rdi
movq %r14, %rsi
movq -0x48(%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 0x416b
testb $0x5, %sil
je 0x418a
testb $0x6, %sil
je 0x414c
incl %edx
cmpl %eax, %edx
jbe 0x40fb
movq %rbx, %rdi
callq 0x3b05
testl %eax, %eax
je 0x4244
movq %rbx, %rdi
callq 0x30c6
testq %rax, %rax
jne 0x4263
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x451a(%rip), %rdi      # 0x866d
leaq 0x4199(%rip), %rsi      # 0x82f3
leaq 0x4468(%rip), %rcx      # 0x85c9
movl $0x681, %edx            # imm = 0x681
callq 0x10f0
leaq 0x44c1(%rip), %rdi      # 0x8633
leaq 0x417a(%rip), %rsi      # 0x82f3
leaq 0x4449(%rip), %rcx      # 0x85c9
movl $0x67f, %edx            # imm = 0x67F
callq 0x10f0
leaq 0x44c0(%rip), %rdi      # 0x8651
leaq 0x415b(%rip), %rsi      # 0x82f3
leaq 0x442a(%rip), %rcx      # 0x85c9
movl $0x680, %edx            # imm = 0x680
callq 0x10f0
leaq 0x446b(%rip), %rdi      # 0x861b
leaq 0x413c(%rip), %rsi      # 0x82f3
leaq 0x440b(%rip), %rcx      # 0x85c9
movl $0x667, %edx            # imm = 0x667
callq 0x10f0
leaq 0x4417(%rip), %rdi      # 0x85e6
leaq 0x411d(%rip), %rsi      # 0x82f3
leaq 0x43ec(%rip), %rcx      # 0x85c9
movl $0x63e, %edx            # imm = 0x63E
callq 0x10f0
leaq 0x4153(%rip), %rdi      # 0x8341
leaq 0x40fe(%rip), %rsi      # 0x82f3
leaq 0x43cd(%rip), %rcx      # 0x85c9
movl $0x5cd, %edx            # imm = 0x5CD
callq 0x10f0
leaq 0x4c46(%rip), %rdi      # 0x8e53
leaq 0x40df(%rip), %rsi      # 0x82f3
leaq 0x43ae(%rip), %rcx      # 0x85c9
movl $0x649, %edx            # imm = 0x649
callq 0x10f0
leaq 0x43c5(%rip), %rdi      # 0x85f1
leaq 0x40c0(%rip), %rsi      # 0x82f3
leaq 0x438f(%rip), %rcx      # 0x85c9
movl $0x64a, %edx            # imm = 0x64A
callq 0x10f0
leaq 0x443e(%rip), %rdi      # 0x8689
leaq 0x40a1(%rip), %rsi      # 0x82f3
leaq 0x4370(%rip), %rcx      # 0x85c9
movl $0x684, %edx            # imm = 0x684
callq 0x10f0
leaq 0x443b(%rip), %rdi      # 0x86a5
leaq 0x4082(%rip), %rsi      # 0x82f3
leaq 0x4351(%rip), %rcx      # 0x85c9
movl $0x685, %edx            # imm = 0x685
callq 0x10f0