// File: /workspace/github_c_makefile_star2_O3/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 $0x38, %rsp
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, 0x18(%rsp)
movq %rdi, %rbx
testq %rcx, %rcx
je 0xbb22f
movq %r14, %rdi
callq 0x34fea
testb %al, %al
jne 0xbb4f9
movq %r14, 0x8(%rsp)
callq 0x3b728
movq %rax, 0x130(%rbx)
movl $0x0, 0x8(%rbx)
xorl %r14d, %r14d
movq %r14, (%rbx)
leaq 0x15(%rbx), %rdi
movl $0x100, %edx            # imm = 0x100
movq %rdi, 0x10(%rsp)
movl $0xfd, %esi
callq 0xb2f0
movq $0x0, 0x28(%rsp)
movq %r14, 0x118(%rbx)
movq %r12, %rdi
callq 0x3cbed
leaq -0x1(%rax), %rdi
leaq 0x45b4a(%rip), %rsi     # 0x100dd2
movl $0xb6, %edx
callq 0x35862
movq %rax, 0x120(%rbx)
movq %r12, %rdi
callq 0x3cbed
testq %rax, %rax
je 0xbb42b
movb $0x1, %r14b
xorl %r15d, %r15d
movq %r12, 0x20(%rsp)
movq %r12, %rdi
movq %r15, %rsi
callq 0x3ca6f
movq %rax, %r13
movq 0x130(%rbx), %rdi
movq %rax, %rsi
callq 0x3b7af
movq 0x130(%rbx), %rdi
movl $0xa, %esi
callq 0x3b9df
testq %r13, %r13
je 0xbb417
movq %r13, 0x30(%rsp)
movb (%r13), %r13b
testb %r13b, %r13b
je 0xbb417
cmpb $0x23, %r13b
sete %al
testb %al, %r14b
je 0xbb312
movb $0x1, %r14b
jmp 0xbb417
callq 0xb6e0
movq %rax, %rbp
movq 0x30(%rsp), %r14
incq %r14
movq 0x10(%rsp), %rdi
movq 0x28(%rsp), %rsi
movsbl %r13b, %edx
movq (%rbp), %rax
movsbq %dl, %rcx
testb $0xc, (%rax,%rcx,2)
je 0xbb3c9
movl %edx, %eax
movzbl (%rdi,%rax), %r8d
cmpl $0xfd, %r8d
jne 0xbb454
movb 0x4(%rbx), %cl
movb %cl, 0x15(%rbx,%rax)
cmpl %esi, (%rbx)
jae 0xbb36a
movq 0x118(%rbx), %rax
jmp 0xbb397
addl $0x8, %esi
movq 0x118(%rbx), %rdi
leaq 0x45a57(%rip), %rdx     # 0x100dd2
movl $0xe2, %ecx
movq %rsi, %r12
callq 0x35a9d
movq %r12, %rsi
movq 0x10(%rsp), %rdi
movq %rax, 0x118(%rbx)
testq %rax, %rax
je 0xbb4f4
movl (%rbx), %ecx
leal 0x1(%rcx), %edx
movl %edx, (%rbx)
movb %r13b, (%rax,%rcx)
movb (%r14), %r13b
incq %r14
testb %r13b, %r13b
jne 0xbb32c
movq 0x30(%rsp), %rax
movb (%rax), %r14b
movq 0x20(%rsp), %r12
jmp 0xbb3e8
cmpb $0x20, %r13b
movq 0x20(%rsp), %r12
jne 0xbb48b
movsbq (%r14), %r14
testb $0x20, 0x1(%rax,%r14,2)
jne 0xbb4a3
movq %rsi, 0x28(%rsp)
movq %r12, %rdi
callq 0x3cbed
decq %rax
cmpq %rax, %r15
jne 0xbb403
movb %r14b, 0x14(%rbx)
jmp 0xbb411
movq 0x120(%rbx), %rax
movl 0x4(%rbx), %ecx
movb %r14b, (%rax,%rcx)
incl 0x4(%rbx)
xorl %r14d, %r14d
incq %r15
movq %r12, %rdi
callq 0x3cbed
cmpq %rax, %r15
jb 0xbb2b5
movb 0x4(%rbx), %al
decb %al
xorl %ecx, %ecx
movq 0x10(%rsp), %rdx
cmpb %al, (%rdx,%rcx)
jne 0xbb444
movb $-0x2, 0x15(%rbx,%rcx)
incl 0x8(%rbx)
incq %rcx
cmpq $0x100, %rcx            # imm = 0x100
jne 0xbb437
xorl %ebp, %ebp
jmp 0xbb46f
movl 0x4(%rbx), %ecx
leaq 0x45f0f(%rip), %rsi     # 0x10136d
movq 0x8(%rsp), %rdi
xorl %eax, %eax
callq 0x34f1f
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl 0x4(%rbx), %edi
callq 0x7a629
movl %eax, 0xc(%rbx)
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%rsp), %r8
testq %r8, %r8
je 0xbb4c8
leaq 0x45f23(%rip), %rsi     # 0x1013bf
movq 0x8(%rsp), %rdi
jmp 0xbb4bc
movq 0x18(%rsp), %r8
testq %r8, %r8
je 0xbb4d6
leaq 0x45f76(%rip), %rsi     # 0x10142a
movq 0x8(%rsp), %rdi
movl %r14d, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0x34f1f
jmp 0xbb46a
leaq 0x45f21(%rip), %rsi     # 0x1013f0
movq 0x8(%rsp), %rdi
jmp 0xbb4e5
leaq 0x45f89(%rip), %rsi     # 0x101466
movq 0x8(%rsp), %rdi
movl %r14d, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0x34f1f
jmp 0xbb46a
callq 0x2848a
callq 0x28451