// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/extended/alignment.c
// Function: gt_alignment_show_generic
void gt_alignment_show_generic(GtUchar *buffer,
                               bool downcase,
                               const GtAlignment *alignment,
                               FILE *fp,
                               unsigned int width,
                               const GtUchar *characters,
                               GtUchar wildcardshow)
{
  GtMultieop meop;
  GtUword idx_eop, idx_u = 0, idx_v = 0, meoplen;
  unsigned int pos = 0;
  GtUchar *topbuf = buffer, *midbuf = NULL, *lowbuf = NULL;

  gt_assert(alignment != NULL && (characters == NULL || !downcase));
  topbuf[width] = '\n';
  midbuf = topbuf + width + 1;
  midbuf[width] = '\n';
  lowbuf = midbuf + width + 1;
  lowbuf[width] = '\n';
  meoplen = gt_multieoplist_get_num_entries(alignment->eops);
  gt_assert(meoplen > 0);
  idx_eop = meoplen - 1;
  while (true)
  {
    meop = gt_multieoplist_get_entry(alignment->eops, idx_eop);
    switch (meop.type)
    {
      GtUword j;

      case Mismatch:
      case Match:
      case Replacement:
        for (j = 0; j < meop.steps && idx_u < alignment->ulen &&
                                      idx_v < alignment->vlen; j++)
        {
          GtUchar a = alignment->u[idx_u];
          GtUchar b = alignment->v[idx_v];
          bool is_match;

          if (characters != NULL)
          {
            topbuf[pos] = GT_ISSPECIAL(a) ? wildcardshow : characters[a];
            is_match = (a == b && !GT_ISSPECIAL(a)) ? true : false;
            lowbuf[pos] = GT_ISSPECIAL(b) ? wildcardshow : characters[b];
          } else
          {
            topbuf[pos] = a;
            is_match = ((downcase && tolower((int) a) == tolower((int) b)) ||
                        (!downcase && a == b)) ? true : false;
            lowbuf[pos] = b;
          }
          if (is_match)
          {
            midbuf[pos] = (GtUchar) MATCHSYMBOL;
          } else
          {
            midbuf[pos] = (GtUchar) MISMATCHSYMBOL;
          }
          pos = gt_alignment_show_advance(pos,width,topbuf,fp);
          idx_u++;
          idx_v++;
        }
        break;
      case Deletion:
        for (j = 0; j < meop.steps && idx_u < alignment->ulen; j++)
        {
          GtUchar a = alignment->u[idx_u++];

          if (characters != NULL)
          {
            topbuf[pos] = GT_ISSPECIAL(a) ? wildcardshow : characters[a];
          } else
          {
            topbuf[pos] = a;
          }
          midbuf[pos] = (GtUchar) MISMATCHSYMBOL;
          lowbuf[pos] = (GtUchar) GAPSYMBOL;
          pos = gt_alignment_show_advance(pos,width,topbuf,fp);
        }
        break;
      case Insertion:
        for (j = 0; j < meop.steps && idx_v < alignment->vlen; j++)
        {
          GtUchar b = alignment->v[idx_v++];

          topbuf[pos] = (GtUchar) GAPSYMBOL;
          midbuf[pos] = (GtUchar) MISMATCHSYMBOL;
          if (characters != NULL)
          {
            lowbuf[pos] = GT_ISSPECIAL(b) ? wildcardshow : characters[b];
          } else
          {
            lowbuf[pos] = b;
          }
          pos = gt_alignment_show_advance(pos,width,topbuf,fp);
        }
        break;
    }
    if (idx_eop > 0 && (idx_u < alignment->ulen || idx_v < alignment->vlen))
    {
      idx_eop--;
    } else
    {
      break;
    }
  }
  if (pos > 0)
  {
    topbuf[pos] = '\n';
    fwrite(topbuf,sizeof *topbuf,pos+1,fp);
    midbuf[pos] = '\n';
    fwrite(midbuf,sizeof *midbuf,pos+1,fp);
    lowbuf[pos] = '\n';
    fwrite(lowbuf,sizeof *lowbuf,pos+1,fp);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %r8d, 0x1c(%rsp)
testq %rdx, %rdx
je 0x121a20
movq %rcx, %r12
testq %r9, %r9
sete %al
movl %esi, %ecx
xorb $0x1, %cl
orb %al, %cl
je 0x121a20
movq %rdi, %r13
movl %esi, 0x44(%rsp)
movq %r9, 0x30(%rsp)
movb 0xa0(%rsp), %al
movb %al, 0xf(%rsp)
movl 0x1c(%rsp), %ebx
leaq (%rdi,%rbx), %r14
movb $0xa, %al
movb %al, (%rdi,%rbx)
leaq 0x1(%rbx,%r14), %rcx
movb %al, 0x1(%rbx,%r14)
movb %al, 0x1(%rbx,%rcx)
movq %rdx, 0x20(%rsp)
movq 0x30(%rdx), %rdi
callq 0x162109
testq %rax, %rax
je 0x121a25
movq %rax, %rsi
leaq (%rbx,%r13), %rax
incq %rax
movq %rax, 0x38(%rsp)
leaq (%rbx,%r14), %rax
addq $0x2, %rax
movq %rax, 0x28(%rsp)
xorl %ebp, %ebp
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x20(%rsp), %rcx
movq %r12, 0x60(%rsp)
movq %r13, 0x10(%rsp)
decq %rsi
movq 0x30(%rcx), %rdi
movq %rsi, 0x58(%rsp)
callq 0x16210e
movq %rdx, %r13
cmpl $0x3, %eax
jae 0x12185a
testq %r13, %r13
movq 0x30(%rsp), %r8
je 0x1218fa
movq %r13, %rax
addq %r15, %rax
movq %rax, 0x48(%rsp)
movq 0x20(%rsp), %rcx
cmpq 0x38(%rcx), %r15
jae 0x12198c
cmpq 0x40(%rcx), %r14
movq 0x10(%rsp), %rdx
jae 0x121991
movq 0x20(%rcx), %rax
movq 0x28(%rcx), %rcx
movb (%rax,%r15), %al
movzbl %al, %edi
movb (%rcx,%r14), %bl
movzbl %bl, %r9d
movl %ebp, %r12d
testq %r8, %r8
je 0x121807
movb 0xf(%rsp), %cl
cmpb $-0x3, %al
ja 0x12179d
movb (%r8,%rdi), %cl
cmpb $-0x2, %al
setb %sil
movb %cl, (%rdx,%r12)
cmpb %bl, %al
sete %al
movb 0xf(%rsp), %cl
cmpb $-0x3, %bl
ja 0x1217b9
movb (%r8,%r9), %cl
movq 0x28(%rsp), %rdi
movb %cl, (%rdi,%r12)
movb $0x7c, %cl
andb %al, %sil
jne 0x1217cb
movb $0x20, %cl
movq 0x38(%rsp), %rax
movb %cl, (%rax,%r12)
movl %ebp, %edi
movl 0x1c(%rsp), %esi
movq 0x60(%rsp), %r12
movq %r12, %rcx
callq 0x121a2a
movl %eax, %ebp
incq %r15
incq %r14
decq %r13
movq 0x30(%rsp), %r8
movq 0x20(%rsp), %rcx
jne 0x121759
jmp 0x121987
movb %al, (%rdx,%r12)
cmpb $0x0, 0x44(%rsp)
je 0x121842
movq %r9, 0x50(%rsp)
callq 0x17ae0
movl %eax, 0x40(%rsp)
movq 0x50(%rsp), %rdi
callq 0x17ae0
movq 0x10(%rsp), %rdx
movq 0x28(%rsp), %rcx
movb %bl, (%rcx,%r12)
movb $0x7c, %cl
cmpl %eax, 0x40(%rsp)
jne 0x1217c9
jmp 0x1217cb
movq 0x28(%rsp), %rcx
movb %bl, (%rcx,%r12)
movb $0x7c, %cl
cmpb %bl, %al
jne 0x1217c9
jmp 0x1217cb
je 0x121909
cmpl $0x4, %eax
movq 0x10(%rsp), %rdx
movq 0x30(%rsp), %rdi
movq 0x20(%rsp), %rcx
jne 0x121991
testq %r13, %r13
je 0x121991
movq %r13, %rbx
addq %r14, %rbx
cmpq 0x40(%rcx), %r14
jae 0x121991
movq 0x28(%rcx), %rax
movb (%rax,%r14), %cl
movl %ebp, %eax
movb $0x2d, (%rdx,%rax)
movq 0x38(%rsp), %rsi
movb $0x20, (%rsi,%rax)
testq %rdi, %rdi
je 0x1218c0
movb 0xf(%rsp), %sil
cmpb $-0x3, %cl
ja 0x1218c2
movzbl %cl, %ecx
movb (%rdi,%rcx), %sil
jmp 0x1218c2
movl %ecx, %esi
movq 0x28(%rsp), %rcx
movb %sil, (%rcx,%rax)
movl %ebp, %edi
movl 0x1c(%rsp), %esi
movq %r12, %rcx
callq 0x121a2a
movq 0x30(%rsp), %rdi
movq 0x10(%rsp), %rdx
movl %eax, %ebp
incq %r14
decq %r13
movq 0x20(%rsp), %rcx
jne 0x121887
movq %rbx, %r14
jmp 0x121991
movq 0x10(%rsp), %rdx
movq 0x20(%rsp), %rcx
jmp 0x121991
testq %r13, %r13
movq 0x30(%rsp), %rsi
movq 0x20(%rsp), %rcx
je 0x12198c
movq %r13, %rbx
addq %r15, %rbx
cmpq 0x38(%rcx), %r15
jae 0x12198c
movq 0x20(%rcx), %rax
movb (%rax,%r15), %cl
testq %rsi, %rsi
movq 0x10(%rsp), %rdx
je 0x121947
movb 0xf(%rsp), %al
cmpb $-0x3, %cl
ja 0x121949
movzbl %cl, %eax
movb (%rsi,%rax), %al
jmp 0x121949
movl %ecx, %eax
movl %ebp, %ecx
movb %al, (%rdx,%rcx)
movq 0x38(%rsp), %rax
movb $0x20, (%rax,%rcx)
movq 0x28(%rsp), %rax
movb $0x2d, (%rax,%rcx)
movl %ebp, %edi
movl 0x1c(%rsp), %esi
movq %r12, %rcx
callq 0x121a2a
movq 0x30(%rsp), %rsi
movl %eax, %ebp
incq %r15
decq %r13
movq 0x20(%rsp), %rcx
jne 0x12191e
movq %rbx, %r15
jmp 0x12198c
movq 0x48(%rsp), %r15
movq 0x10(%rsp), %rdx
movq 0x58(%rsp), %rsi
testq %rsi, %rsi
je 0x1219af
cmpq 0x38(%rcx), %r15
jb 0x12171e
cmpq 0x40(%rcx), %r14
jb 0x12171e
testl %ebp, %ebp
je 0x121a11
movl %ebp, %ebx
movb $0xa, %r14b
movb %r14b, (%rdx,%rbx)
incl %ebp
movl $0x1, %esi
movq %rdx, %rdi
movq %rbp, %rdx
movq %r12, %rcx
callq 0x17fa0
movq 0x38(%rsp), %rdi
movb %r14b, (%rdi,%rbx)
movl $0x1, %esi
movq %rbp, %rdx
movq %r12, %rcx
callq 0x17fa0
movq 0x28(%rsp), %rdi
movb %r14b, (%rdi,%rbx)
movl $0x1, %esi
movq %rbp, %rdx
movq %r12, %rcx
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x17fa0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3a1ec
callq 0x3a1b3