// File: /workspace/github_c_makefile_star2_O1/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
testq %rdx, %rdx
je 0x127801
movq %rcx, %r12
testq %r9, %r9
sete %al
movl %esi, %ecx
xorb $0x1, %cl
movb %cl, 0xf(%rsp)
orb %cl, %al
je 0x127801
movq %rdi, %rbp
movl %esi, 0x4c(%rsp)
movq %r9, 0x40(%rsp)
movb 0xa0(%rsp), %al
movb %al, 0xe(%rsp)
movl %r8d, 0x24(%rsp)
movl %r8d, %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, 0x10(%rsp)
movq 0x30(%rdx), %rdi
callq 0x169f71
testq %rax, %rax
je 0x127806
movq %rax, %rsi
leaq (%rbx,%rbp), %rax
incq %rax
movq %rax, 0x28(%rsp)
leaq (%rbx,%r14), %rax
addq $0x2, %rax
movq %rax, 0x30(%rsp)
xorl %r8d, %r8d
xorl %r14d, %r14d
xorl %r15d, %r15d
movl 0x24(%rsp), %ebx
movq 0x10(%rsp), %rcx
movq %r12, 0x60(%rsp)
movq %rbp, 0x38(%rsp)
movq %r8, 0x18(%rsp)
decq %rsi
movq 0x30(%rcx), %rdi
movq %rsi, 0x58(%rsp)
callq 0x169f76
movq %rdx, %r13
cmpl $0x3, %eax
jae 0x127661
testq %r13, %r13
je 0x1276ed
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %r8
cmpq 0x38(%rcx), %r15
jae 0x12776c
cmpq 0x40(%rcx), %r14
jae 0x12776c
movq 0x20(%rcx), %rax
movq 0x28(%rcx), %rcx
movb (%rax,%r15), %bpl
movzbl %bpl, %edi
movb (%rcx,%r14), %bl
movzbl %bl, %r9d
movl %r8d, %r12d
movq 0x40(%rsp), %rsi
testq %rsi, %rsi
je 0x1275bc
movb 0xe(%rsp), %al
cmpb $-0x3, %bpl
ja 0x127599
movb (%rsi,%rdi), %al
cmpb $-0x2, %bpl
setb %dl
movq 0x38(%rsp), %rcx
movb %al, (%rcx,%r12)
cmpb %bl, %bpl
sete %cl
andb %dl, %cl
cmpb $-0x3, %bl
jbe 0x127602
movb 0xe(%rsp), %bl
jmp 0x127606
movq 0x38(%rsp), %rax
movb %bpl, (%rax,%r12)
cmpb $0x0, 0x4c(%rsp)
je 0x1275f6
movq %r8, 0x18(%rsp)
movq %r9, 0x50(%rsp)
callq 0x17ae0
movl %eax, 0x48(%rsp)
movq 0x50(%rsp), %rdi
callq 0x17ae0
movq 0x18(%rsp), %r8
movb $0x1, %cl
cmpl %eax, 0x48(%rsp)
je 0x127606
cmpb %bl, %bpl
sete %cl
andb 0xf(%rsp), %cl
jmp 0x127606
movb (%rsi,%r9), %bl
movq 0x30(%rsp), %rax
movb %bl, (%rax,%r12)
testb %cl, %cl
movl $0x20, %eax
movl $0x7c, %ecx
cmovnel %ecx, %eax
movq 0x28(%rsp), %rcx
movb %al, (%rcx,%r12)
movl %r8d, %edi
movl 0x24(%rsp), %ebx
movl %ebx, %esi
movq 0x38(%rsp), %rbp
movq %rbp, %rdx
movq 0x60(%rsp), %r12
movq %r12, %rcx
callq 0x12780b
movl %eax, %r8d
incq %r15
incq %r14
decq %r13
movq 0x10(%rsp), %rcx
jne 0x127553
jmp 0x12776c
je 0x1276f9
cmpl $0x4, %eax
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %r8
jne 0x12776c
testq %r13, %r13
je 0x12776c
cmpq 0x40(%rcx), %r14
jae 0x12776c
movq 0x28(%rcx), %rax
movb (%rax,%r14), %cl
movl %r8d, %eax
movb $0x2d, (%rbp,%rax)
movq 0x28(%rsp), %rdx
movb $0x20, (%rdx,%rax)
movq 0x40(%rsp), %rsi
testq %rsi, %rsi
je 0x1276c1
movb 0xe(%rsp), %dl
cmpb $-0x3, %cl
ja 0x1276c3
movzbl %cl, %ecx
movb (%rsi,%rcx), %dl
jmp 0x1276c3
movl %ecx, %edx
movq 0x30(%rsp), %rcx
movb %dl, (%rcx,%rax)
movl %r8d, %edi
movl %ebx, %esi
movq %rbp, %rdx
movq %r12, %rcx
callq 0x12780b
movl %eax, %r8d
incq %r14
decq %r13
movq 0x10(%rsp), %rcx
jne 0x127683
jmp 0x12776c
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %r8
jmp 0x12776c
testq %r13, %r13
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %r8
je 0x12776c
cmpq 0x38(%rcx), %r15
jae 0x12776c
movq 0x20(%rcx), %rax
movb (%rax,%r15), %cl
movq 0x40(%rsp), %rdx
testq %rdx, %rdx
je 0x127731
movb 0xe(%rsp), %al
cmpb $-0x3, %cl
ja 0x127733
movzbl %cl, %eax
movb (%rdx,%rax), %al
jmp 0x127733
movl %ecx, %eax
movl %r8d, %ecx
movb %al, (%rbp,%rcx)
movq 0x28(%rsp), %rax
movb $0x20, (%rax,%rcx)
movq 0x30(%rsp), %rax
movb $0x2d, (%rax,%rcx)
movl %r8d, %edi
movl %ebx, %esi
movq %rbp, %rdx
movq %r12, %rcx
callq 0x12780b
movl %eax, %r8d
incq %r15
decq %r13
movq 0x10(%rsp), %rcx
jne 0x127708
movq 0x58(%rsp), %rsi
testq %rsi, %rsi
je 0x12778a
cmpq 0x38(%rcx), %r15
jb 0x12751e
cmpq 0x40(%rcx), %r14
jb 0x12751e
testl %r8d, %r8d
je 0x1277f2
movl %r8d, %ebx
movq %rbp, %rdi
movb $0xa, %bpl
movb %bpl, (%rdi,%rbx)
incl %r8d
movl $0x1, %esi
movq %r8, %rdx
movq %r12, %rcx
movq %r8, %r14
callq 0x17fa0
movq 0x28(%rsp), %rdi
movb %bpl, (%rdi,%rbx)
movl $0x1, %esi
movq %r14, %rdx
movq %r12, %rcx
callq 0x17fa0
movq 0x30(%rsp), %rdi
movb %bpl, (%rdi,%rbx)
movl $0x1, %esi
movq %r14, %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 0x3abc1
callq 0x3ab88