// File: /workspace/github_c_makefile_star2_O1/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, %r15
movq %rsi, 0x20(%rsp)
movq %rdi, %rbx
testq %rcx, %rcx
je 0xba125
movq %r14, %rdi
callq 0x3566a
testb %al, %al
jne 0xba466
callq 0x3bfe0
movq %rax, 0x130(%rbx)
movl $0x0, 0x8(%rbx)
xorl %r12d, %r12d
movq %r12, (%rbx)
leaq 0x15(%rbx), %rdi
movl $0x100, %edx            # imm = 0x100
movl $0xfd, %esi
callq 0xb2f0
movq $0x0, 0x18(%rsp)
movq %r12, 0x118(%rbx)
movq %r15, %rdi
callq 0x3d560
leaq -0x1(%rax), %rdi
leaq 0x46cbe(%rip), %rsi     # 0x100e32
movl $0xb6, %edx
callq 0x35ee2
movq %rax, 0x120(%rbx)
movq %r15, %rdi
callq 0x3d560
testq %rax, %rax
je 0xba3d0
movq %r14, (%rsp)
movb $0x1, %r12b
xorl %r13d, %r13d
xorl %ebp, %ebp
movq %r15, 0x28(%rsp)
movq %r15, %rdi
movq %rbp, %rsi
callq 0x3d3e2
movq %rax, %r14
movq 0x130(%rbx), %rdi
movq %rax, %rsi
callq 0x3c067
movq 0x130(%rbx), %rdi
movl $0xa, %esi
callq 0x3c28d
testq %r14, %r14
je 0xba3ba
movb (%r14), %al
testb %al, %al
je 0xba3ba
movzbl %r12b, %ecx
movl %r12d, %edx
andb $0x1, %dl
cmpb $0x23, %al
sete %al
movl $0x0, %r12d
cmovel %ecx, %r12d
testb %dl, %dl
cmovel %ecx, %r12d
testb %al, %dl
jne 0xba3ba
movl %r12d, 0xc(%rsp)
movq %r13, 0x10(%rsp)
movb (%r14), %r13b
testb %r13b, %r13b
je 0xba2da
callq 0xb6e0
movq %rax, %rdi
xorl %r12d, %r12d
movq 0x18(%rsp), %rsi
movq %rbp, 0x30(%rsp)
movsbl %r13b, %edx
movq (%rdi), %rax
movsbq %dl, %rcx
testb $0xc, (%rax,%rcx,2)
je 0xba2e7
movl %edx, %eax
movzbl 0x15(%rbx,%rax), %r8d
cmpl $0xfd, %r8d
jne 0xba2f7
movb 0x4(%rbx), %cl
movb %cl, 0x15(%rbx,%rax)
cmpl %esi, (%rbx)
jb 0xba2a9
addl $0x8, %esi
movq %r14, %rbp
movq %rdi, %r14
movq 0x118(%rbx), %rdi
movq %rsi, %r15
leaq 0x46ba8(%rip), %rdx     # 0x100e32
movl $0xe2, %ecx
callq 0x36116
movq %r14, %rdi
movq %rbp, %r14
movq 0x30(%rsp), %rbp
movq %r15, %rsi
movq %rax, 0x118(%rbx)
movq 0x118(%rbx), %rax
testq %rax, %rax
je 0xba461
movl (%rbx), %ecx
leal 0x1(%rcx), %edx
movl %edx, (%rbx)
movb %r13b, (%rax,%rcx)
movb 0x1(%r14,%r12), %r13b
incq %r12
testb %r13b, %r13b
jne 0xba23b
xorl %r15d, %r15d
jmp 0xba2f0
xorl %r12d, %r12d
xorl %r15d, %r15d
movq 0x18(%rsp), %rsi
jmp 0xba2f0
movb $0x1, %r15b
cmpb $0x20, %r13b
jne 0xba314
movq 0x10(%rsp), %r13
jmp 0xba356
movl 0x4(%rbx), %ecx
xorl %r15d, %r15d
movq (%rsp), %rdi
movq %rsi, %r13
leaq 0x470ee(%rip), %rsi     # 0x1013f9
xorl %eax, %eax
callq 0x3559f
jmp 0xba350
movq %rsi, %r13
movq 0x20(%rsp), %r8
xorl %r15d, %r15d
testq %r8, %r8
je 0xba33b
movq (%rsp), %rdi
leaq 0x4711c(%rip), %rsi     # 0x10144b
movq %rbp, %rcx
xorl %eax, %eax
callq 0x3559f
jmp 0xba350
movq (%rsp), %rdi
leaq 0x47136(%rip), %rsi     # 0x10147c
movq %rbp, %rcx
xorl %eax, %eax
callq 0x3559f
movq %r13, %rsi
movb $0x1, %r13b
testb $0x1, %r13b
jne 0xba3d3
testb %r15b, %r15b
movq %rsi, 0x18(%rsp)
je 0xba386
callq 0xb6e0
movq (%rax), %rax
movsbq 0x1(%r14,%r12), %r14
testb $0x20, 0x1(%rax,%r14,2)
movl 0xc(%rsp), %r12d
je 0xba38e
jmp 0xba41d
movb (%r14), %r14b
movl 0xc(%rsp), %r12d
movq 0x28(%rsp), %r15
movq %r15, %rdi
callq 0x3d560
decq %rax
cmpq %rax, %rbp
jne 0xba3a9
movb %r14b, 0x14(%rbx)
jmp 0xba3b7
movq 0x120(%rbx), %rax
movl 0x4(%rbx), %ecx
movb %r14b, (%rax,%rcx)
incl 0x4(%rbx)
incq %rbp
movq %r15, %rdi
callq 0x3d560
cmpq %rax, %rbp
jb 0xba1a7
jmp 0xba3d3
xorl %r13d, %r13d
testb $0x1, %r13b
jne 0xba3fa
movb 0x4(%rbx), %al
decb %al
xorl %ecx, %ecx
cmpb %al, 0x15(%rbx,%rcx)
jne 0xba3ee
movb $-0x2, 0x15(%rbx,%rcx)
incl 0x8(%rbx)
incq %rcx
cmpq $0x100, %rcx            # imm = 0x100
jne 0xba3e0
movl 0x4(%rbx), %edi
callq 0x7a294
movl %eax, 0xc(%rbx)
movzbl %r13b, %eax
andl $0x1, %eax
negl %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x20(%rsp), %r8
testq %r8, %r8
je 0xba441
leaq 0x47088(%rip), %rsi     # 0x1014b6
movq (%rsp), %rdi
movl %r14d, %edx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x3559f
jmp 0xba459
leaq 0x470aa(%rip), %rsi     # 0x1014f2
movq (%rsp), %rdi
movl %r14d, %edx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x3559f
movb $0x1, %r13b
jmp 0xba3d3
callq 0x2864c
callq 0x28613