// File: /workspace/github_c_makefile_star2_O0/thegenemyers[P]DASCRUBBER/align.c
// Function: Flip_Alignment
void Flip_Alignment(Alignment *align, int full)
{ char *aseq  = align->aseq;
  char *bseq  = align->bseq;
  int   alen  = align->alen;
  int   blen  = align->blen;
  Path *path  = align->path;
  int   comp  = COMP(align->flags);

  int  *trace = (int *) path->trace;
  int   tlen  = path->tlen;

  int   i, j, p;

  if (comp)
    { p = path->abpos;
      path->abpos = blen - path->bepos;
      path->bepos = alen - p;
      p = path->aepos;
      path->aepos = blen - path->bbpos;
      path->bbpos = alen - p;

      if (full)
        { alen += 2;
          blen += 2;

          for (i = 0; i < tlen; i++)
            if ((p = trace[i]) < 0)
              trace[i] = alen + p;
            else
              trace[i] = p - blen;

          i = tlen-1;
          j = 0;
          while (j < i)
            { p = trace[i];
              trace[i] = trace[j];
              trace[j] = p;
              i -= 1;
              j += 1;
            }

          alen -= 2;
          blen -= 2;
        }
    }
  else
    { p = path->abpos;
      path->abpos = path->bbpos;
      path->bbpos = p;
      p = path->aepos;
      path->aepos = path->bepos;
      path->bepos = p;

      if (full)
        for (i = 0; i < tlen; i++)
          trace[i] = - (trace[i]);
    }

  align->aseq  = bseq;
  align->bseq  = aseq;
  align->alen  = blen;
  align->blen  = alen;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rax
movl 0x24(%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
andl $0x1, %eax
movl %eax, -0x34(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0xe192
movq -0x30(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x50(%rbp)
movl -0x28(%rbp), %ecx
movq -0x30(%rbp), %rax
subl 0x1c(%rax), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x10(%rax)
movl -0x24(%rbp), %ecx
subl -0x50(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x30(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x50(%rbp)
movl -0x28(%rbp), %ecx
movq -0x30(%rbp), %rax
subl 0x14(%rax), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x18(%rax)
movl -0x24(%rbp), %ecx
subl -0x50(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x14(%rax)
cmpl $0x0, -0xc(%rbp)
je 0xe18d
movl -0x24(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x24(%rbp)
movl -0x28(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x28(%rbp)
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x44(%rbp), %eax
jge 0xe11d
movq -0x40(%rbp), %rax
movslq -0x48(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x50(%rbp)
cmpl $0x0, %eax
jge 0xe0ff
movl -0x24(%rbp), %edx
addl -0x50(%rbp), %edx
movq -0x40(%rbp), %rax
movslq -0x48(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0xe110
movl -0x50(%rbp), %edx
subl -0x28(%rbp), %edx
movq -0x40(%rbp), %rax
movslq -0x48(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0xe112
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0xe0d1
movl -0x44(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x48(%rbp), %eax
jge 0xe17b
movq -0x40(%rbp), %rax
movslq -0x48(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x50(%rbp)
movq -0x40(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x40(%rbp), %rax
movslq -0x48(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x50(%rbp), %edx
movq -0x40(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x48(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x48(%rbp)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0xe12d
movl -0x24(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x24(%rbp)
movl -0x28(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x28(%rbp)
jmp 0xe212
movq -0x30(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x50(%rbp)
movq -0x30(%rbp), %rax
movl 0x14(%rax), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x10(%rax)
movl -0x50(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x30(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x50(%rbp)
movq -0x30(%rbp), %rax
movl 0x1c(%rax), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x18(%rax)
movl -0x50(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x1c(%rax)
cmpl $0x0, -0xc(%rbp)
je 0xe210
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x44(%rbp), %eax
jge 0xe20e
movq -0x40(%rbp), %rax
movslq -0x48(%rbp), %rcx
xorl %edx, %edx
subl (%rax,%rcx,4), %edx
movq -0x40(%rbp), %rax
movslq -0x48(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0xe1e3
jmp 0xe210
jmp 0xe212
movq -0x20(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x18(%rax)
movl -0x28(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x20(%rax)
movl -0x24(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x24(%rax)
popq %rbp
retq