// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/core/alphabet.c
// Function: read_symbolmap_from_lines
static int read_symbolmap_from_lines(GtAlphabet *alpha,
                                     const char *mapfile,
                                     const GtStrArray *lines,
                                     GtError *err)
{
  char cc;
  unsigned int cnum, allocateddomainsize = 0;
  GtUword linecount, column;
  bool blankfound, ignore, preamble = true, haserr = false;
  const char *currentline;
  GtUchar chartoshow;

  gt_error_check(err);
  alpha->alphadef = gt_str_new();
  alpha->domainsize = alpha->mapsize = alpha->mappedwildcards = 0;
  for (cnum=0; cnum<=(unsigned int) GT_MAXALPHABETCHARACTER; cnum++)
  {
    alpha->symbolmap[cnum] = (GtUchar) GT_UNDEFCHAR;
  }
  alpha->mapdomain = NULL;
  alpha->characters = gt_malloc(sizeof (GtUchar) *
                                (gt_str_array_size(lines)-1));
  for (linecount = 0; linecount < gt_str_array_size(lines); linecount++)
  {
    currentline = gt_str_array_get(lines,linecount);
    gt_str_append_cstr(alpha->alphadef, currentline);
    gt_str_append_char(alpha->alphadef, '\n');
    ignore = false;
    if (currentline != NULL && currentline[0] != '\0')
    {
      if (preamble)
      {
        if (LINE(0) == (GtUchar) '#')
        {
          ignore = true;
        } else
        {
          preamble = false;
        }
      }
      if (!ignore)
      {
        blankfound = false;
        for (column=0; LINE(column) != '\0'; column++)
        { /* for all chars in line */
          cc = LINE(column);
          if (ispunct((int) cc) || isalnum((int) cc))
          {
            if (alpha->symbolmap[(unsigned int) cc] != (GtUchar) GT_UNDEFCHAR)
            {
              gt_error_set(err,"cannot map symbol '%c' to %u: "
                            "it is already mapped to %u",
                             cc,
                             alpha->mapsize,
                             (unsigned int) alpha->
                                            symbolmap[(unsigned int) cc]);
              haserr = true;
              break;
            }
            /* get same value */
            alpha->symbolmap[(unsigned int) cc] = (GtUchar) alpha->mapsize;
            if (alpha->domainsize >= allocateddomainsize)
            {
              allocateddomainsize += 8;
              alpha->mapdomain = gt_realloc(alpha->mapdomain,
                                        sizeof (GtUchar) * allocateddomainsize);
            }
            gt_assert(alpha->mapdomain != NULL);
            alpha->mapdomain[alpha->domainsize++] = (GtUchar) cc;
          } else
          {
            if (cc == (GtUchar) ' ')    /* first blank in line found */
            {
              blankfound = true;
              /*@innerbreak@*/ break;
            }
            if (mapfile != NULL) {
              gt_error_set(err,
                           "illegal character '%c' in line " GT_WU
                           " of mapfile %s",
                           cc, linecount,mapfile);
            } else {
              gt_error_set(err,
                           "illegal character '%c' in line " GT_WU
                           " of alphabet definition",
                           cc, linecount);
            }
            haserr = true;
            break;
          }
        }
        if (haserr)
        {
          break;
        }
        if (blankfound)
        {
          if (isspace((int) LINE(column+1)))
          {
            if (mapfile != NULL) {
              gt_error_set(err,"illegal character '%c' at the end of "
                           "line "GT_WU" in mapfile %s",
                           LINE(column+1),linecount,mapfile);
            } else {
              gt_error_set(err,"illegal character '%c' at the end of "
                           "line "GT_WU" of alphabet definition",
                           LINE(column+1),linecount);
            }
            haserr  = true;
            break;
          }
          /* use next character to display character */
          chartoshow = (GtUchar) LINE(column+1);
        } else
        {
          /* use first character of line to display character */
          chartoshow = (GtUchar) LINE(0);
        }
        if (linecount == gt_str_array_size(lines)-1)
        {
          alpha->wildcardshow = chartoshow;
        } else
        {
          alpha->characters[alpha->mapsize] = chartoshow;
        }
        alpha->mapsize++;
      }
    }
  }
  if (!haserr)
  {
    for (cnum=0;cnum<=(unsigned int) GT_MAXALPHABETCHARACTER; cnum++)
    {
      if (alpha->symbolmap[cnum] == (GtUchar) (alpha->mapsize - 1))
      {
        alpha->symbolmap[cnum] = (GtUchar) GT_WILDCARD;
        alpha->mappedwildcards++;
      }
    }
  }
  /* there are mapsize-1 characters plus wildcard plus separator.
     hence there are mapsize+1 symbols in the range 0..mapsize.
     that is, mapsize is the largest symbol and we obtain */
  alpha->bitspersymbol
    = gt_determinebitspervalue((GtUword) alpha->mapsize);
  return haserr ? -1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r14
movq %rdx, 0x8(%rsp)
movq %rsi, %r15
movq %rdi, %rbx
testq %rcx, %rcx
je 0x9c401
movq %r14, %rdi
callq 0xc103
testb %al, %al
jne 0x9c6e4
callq 0x13d5c
movq %rax, 0x130(%rbx)
andl $0x0, 0x8(%rbx)
andq $0x0, (%rbx)
pushq $0x15
popq %rax
cmpq $0x115, %rax            # imm = 0x115
je 0x9c429
movb $-0x3, (%rbx,%rax)
incq %rax
jmp 0x9c418
movq %r15, 0x20(%rsp)
movq %r14, (%rsp)
andq $0x0, 0x118(%rbx)
movq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x157f4
leaq -0x1(%rax), %rdi
leaq 0x4dbd0(%rip), %rsi     # 0xea022
movl $0xb6, %edx
callq 0xccb0
movq %rax, 0x120(%rbx)
movb $0x1, %r12b
xorl %r15d, %r15d
xorl %r13d, %r13d
movq %r14, %rdi
callq 0x157f4
movq %rax, %rbp
cmpq %rax, %r13
jae 0x9c61c
movq %rbp, 0x18(%rsp)
movq %r14, %rdi
movq %r13, %rsi
callq 0x1555e
movq %rax, %rbp
movq 0x130(%rbx), %rdi
movq %rax, %rsi
callq 0x13dd3
movq 0x130(%rbx), %rdi
pushq $0xa
popq %rsi
callq 0x140b1
testq %rbp, %rbp
je 0x9c5d2
movb (%rbp), %r14b
testb %r14b, %r14b
je 0x9c4d2
cmpb $0x23, %r14b
sete %al
testb %al, %r12b
je 0x9c4dc
movb $0x1, %r12b
movq 0x8(%rsp), %r14
jmp 0x9c5d2
movq %r13, 0x10(%rsp)
callq 0xb6e0
movq %rax, %r13
movq %rbp, %r12
incq %r12
testb %r14b, %r14b
je 0x9c573
movsbl %r14b, %edx
movq (%r13), %rax
movsbq %r14b, %rcx
testb $0xc, (%rax,%rcx,2)
je 0x9c57e
movl %edx, %eax
movzbl 0x15(%rbx,%rax), %r8d
cmpl $0xfd, %r8d
jne 0x9c5da
movb 0x4(%rbx), %cl
movb %cl, 0x15(%rbx,%rax)
cmpl %r15d, (%rbx)
jae 0x9c530
movq 0x118(%rbx), %rax
jmp 0x9c556
addl $0x8, %r15d
movq 0x118(%rbx), %rdi
movq %r15, %rsi
leaq 0x4dadd(%rip), %rdx     # 0xea022
movl $0xe2, %ecx
callq 0xcfc2
movq %rax, 0x118(%rbx)
testq %rax, %rax
je 0x9c6ac
movl (%rbx), %ecx
leal 0x1(%rcx), %edx
movl %edx, (%rbx)
movb %r14b, (%rax,%rcx)
movb (%r12), %r14b
jmp 0x9c4ec
movb (%rbp), %r12b
movq 0x10(%rsp), %r13
jmp 0x9c5a3
cmpb $0x20, %r14b
movq 0x10(%rsp), %r13
jne 0x9c63f
movsbq (%r12), %r12
testb $0x20, 0x1(%rax,%r12,2)
movq 0x18(%rsp), %rbp
jne 0x9c65b
movq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x157f4
decq %rax
cmpq %rax, %r13
jne 0x9c5be
movb %r12b, 0x14(%rbx)
jmp 0x9c5cc
movq 0x120(%rbx), %rax
movl 0x4(%rbx), %ecx
movb %r12b, (%rax,%rcx)
incl 0x4(%rbx)
xorl %r12d, %r12d
incq %r13
jmp 0x9c46c
movl 0x4(%rbx), %ecx
leaq 0x4e005(%rip), %rsi     # 0xea5e9
movq (%rsp), %rdi
xorl %eax, %eax
callq 0xc007
movq 0x10(%rsp), %r13
movq 0x18(%rsp), %rbp
movl 0x4(%rbx), %edi
callq 0x58fe7
xorl %ecx, %ecx
cmpq %rbp, %r13
movl %eax, 0xc(%rbx)
sbbl %ecx, %ecx
movl %ecx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb 0x4(%rbx), %al
decb %al
xorl %ecx, %ecx
cmpq $0x100, %rcx            # imm = 0x100
je 0x9c5f9
cmpb %al, 0x15(%rbx,%rcx)
jne 0x9c63a
movb $-0x2, 0x15(%rbx,%rcx)
incl 0x8(%rbx)
incq %rcx
jmp 0x9c623
movq 0x20(%rsp), %r8
testq %r8, %r8
movq 0x18(%rsp), %rbp
je 0x9c682
leaq 0x4dfe6(%rip), %rsi     # 0xea63b
movq (%rsp), %rdi
jmp 0x9c673
movq 0x20(%rsp), %r8
testq %r8, %r8
je 0x9c68f
leaq 0x4e03a(%rip), %rsi     # 0xea6a6
movq (%rsp), %rdi
movl %r12d, %edx
movq %r13, %rcx
xorl %eax, %eax
callq 0xc007
jmp 0x9c5f9
leaq 0x4dfe3(%rip), %rsi     # 0xea66c
movq (%rsp), %rdi
jmp 0x9c69d
leaq 0x4e04c(%rip), %rsi     # 0xea6e2
movq (%rsp), %rdi
movl %r12d, %edx
movq %r13, %rcx
xorl %eax, %eax
callq 0xc007
jmp 0x9c5f9
movq 0x91905(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x2d9a9(%rip), %rsi     # 0xca066
leaq 0x4df5e(%rip), %rdx     # 0xea622
leaq 0x4df04(%rip), %rcx     # 0xea5cf
leaq 0x4d950(%rip), %r8      # 0xea022
movl $0xe4, %r9d
xorl %eax, %eax
callq 0xb8c0
callq 0xb300
movq 0x918cd(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x2d971(%rip), %rsi     # 0xca066
leaq 0x2df5d(%rip), %rdx     # 0xca659
leaq 0x4decc(%rip), %rcx     # 0xea5cf
leaq 0x4d918(%rip), %r8      # 0xea022
movl $0xad, %r9d
jmp 0x9c6d8