// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/core/encseq.c
// Function: determine_original_subdist
static void determine_original_subdist(const GtAlphabet *alpha,
                                       char *maxchars,
                                       char **allchars,
                                       unsigned char *subsymbolmap,
                                       unsigned char *maxsubalphasize,
                                       GtUword *numofallchars,
                                       GtUword *classstartpositions,
                                       GtUword *originaldistribution)
{
  GtUword i, *maxima, offset = 0, j;
  unsigned char encodedchar = GT_UNDEFCHAR;
  GtStr **origchars;
  const char *classchars;

  maxima = gt_calloc((size_t) UCHAR_MAX, sizeof (*maxima));
  origchars = gt_calloc((size_t) UCHAR_MAX, sizeof (*origchars));
  *maxsubalphasize = 0UL;

  for (i = 0; i < (GtUword) gt_alphabet_num_of_chars(alpha); i++) {
    maxchars[i] = gt_alphabet_decode(alpha, (GtUchar) i);
    origchars[i] = gt_str_new();
  }
  maxchars[GT_WILDCARD] = gt_alphabet_decode(alpha, (GtUchar) GT_WILDCARD);
  origchars[GT_WILDCARD] = gt_str_new();

  for (i = 1UL; i < 128UL /* printable characters */; i++) {
    if (originaldistribution[i] > 0UL) {
      gt_assert(gt_alphabet_valid_input(alpha, (char) i));
      encodedchar = (unsigned char) gt_alphabet_encode(alpha, (char) i);
      gt_assert(encodedchar != GT_UNDEFCHAR);
      if (encodedchar != GT_SEPARATOR) {
        if (originaldistribution[i] > maxima[encodedchar]) {
          maxima[encodedchar] = originaldistribution[i];
          maxchars[encodedchar] = (char) i;
        }
        gt_str_append_char(origchars[encodedchar], (char) i);
        (*numofallchars)++;
      }
    }
  }
  *allchars = gt_malloc((size_t) (*numofallchars * sizeof (char)));
  for (i = 0UL; i < (GtUword) gt_alphabet_num_of_chars(alpha); i++) {
    classchars = gt_str_get(origchars[i]);
    gt_log_log("encoding class "GT_WU": chars: %s, "
               "most frequent character %d(%c) ("GT_WU" occs)",
               i, classchars, maxchars[i], maxchars[i], maxima[i]);
    strncpy(*allchars + offset,
            classchars,
            (size_t) gt_str_length(origchars[i]));
    classstartpositions[i] = offset;
    offset += gt_str_length(origchars[i]);
    for (j = 0; j < gt_str_length(origchars[i]); j++) {
      gt_assert(j < (GtUword) UCHAR_MAX);
      subsymbolmap[(int) classchars[j]] = (unsigned char) j;
    }
    if (gt_str_length(origchars[i]) > *maxsubalphasize) {
      gt_assert(gt_str_length(origchars[i]) < (GtUword) UCHAR_MAX);
      *maxsubalphasize = (unsigned char) gt_str_length(origchars[i]);
    }
    gt_str_delete(origchars[i]);
  }
  i = GT_WILDCARD;
  classchars = gt_str_get(origchars[i]);
  gt_log_log("encoding class "GT_WU": chars: %s, "
             "most frequent character %d(%c) ("GT_WU" occs)",
               i, classchars, maxchars[i], maxchars[i], maxima[i]);
  strncpy(*allchars + offset,
          classchars,
          (size_t) gt_str_length(origchars[i]));
  classstartpositions[i] = offset;
  offset += gt_str_length(origchars[i]);
  for (j = 0; j < gt_str_length(origchars[i]); j++) {
    gt_assert(j < (GtUword) UCHAR_MAX);
    subsymbolmap[(int) classchars[j]] = (unsigned char) j;
  }
  if (gt_str_length(origchars[i]) > *maxsubalphasize) {
      gt_assert(gt_str_length(origchars[i]) < (GtUword) UCHAR_MAX);
      *maxsubalphasize = (unsigned char) gt_str_length(origchars[i]);
    }
  gt_str_delete(origchars[i]);

  gt_assert(*numofallchars == offset);
  gt_free(maxima);
  gt_free(origchars);
}

// Assembly:
subq $0xa8, %rsp
movq 0xb8(%rsp), %rax
movq 0xb0(%rsp), %rax
movq %rdi, 0xa0(%rsp)
movq %rsi, 0x98(%rsp)
movq %rdx, 0x90(%rsp)
movq %rcx, 0x88(%rsp)
movq %r8, 0x80(%rsp)
movq %r9, 0x78(%rsp)
movq $0x0, 0x60(%rsp)
movb $-0x3, 0x57(%rsp)
movl $0xff, %edi
movl $0x8, %esi
leaq 0x4f32b(%rip), %rdx     # 0x18565e
movl $0x14b2, %ecx           # imm = 0x14B2
callq 0xd5b0
movq %rax, 0x68(%rsp)
movl $0xff, %edi
movl $0x8, %esi
leaq 0x4f30b(%rip), %rdx     # 0x18565e
movl $0x14b3, %ecx           # imm = 0x14B3
callq 0xd5b0
movq %rax, 0x48(%rsp)
movq 0x80(%rsp), %rax
movb $0x0, (%rax)
movq $0x0, 0x70(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0xa0(%rsp), %rdi
callq 0x109da0
movl %eax, %ecx
movq 0x38(%rsp), %rax
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x1363e8
movq 0xa0(%rsp), %rdi
movq 0x70(%rsp), %rax
movzbl %al, %esi
callq 0x10ac90
movb %al, %dl
movq 0x98(%rsp), %rax
movq 0x70(%rsp), %rcx
movb %dl, (%rax,%rcx)
callq 0x18f00
movq %rax, %rdx
movq 0x48(%rsp), %rax
movq 0x70(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x70(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x70(%rsp)
jmp 0x136376
movq 0xa0(%rsp), %rdi
movl $0xfe, %esi
callq 0x10ac90
movb %al, %cl
movq 0x98(%rsp), %rax
movb %cl, 0xfe(%rax)
callq 0x18f00
movq %rax, %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x7f0(%rax)
movq $0x1, 0x70(%rsp)
cmpq $0x80, 0x70(%rsp)
jae 0x1365aa
movq 0xb8(%rsp), %rax
movq 0x70(%rsp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jbe 0x136595
jmp 0x136450
movq 0xa0(%rsp), %rdi
movq 0x70(%rsp), %rax
movsbl %al, %esi
callq 0x10ab90
testb $0x1, %al
jne 0x1364a1
movq 0x7db68(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x27bec(%rip), %rsi     # 0x15e066
leaq 0x53a7a(%rip), %rdx     # 0x189efb
leaq 0x53a9c(%rip), %rcx     # 0x189f24
leaq 0x4f1cf(%rip), %r8      # 0x18565e
movl $0x14bf, %r9d           # imm = 0x14BF
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x1364a3
movq 0xa0(%rsp), %rdi
movq 0x70(%rsp), %rax
movsbl %al, %esi
callq 0x10abd0
movb %al, 0x57(%rsp)
movzbl 0x57(%rsp), %eax
cmpl $0xfd, %eax
jne 0x136500
movq 0x7db09(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x27b8d(%rip), %rsi     # 0x15e066
leaq 0x53a5f(%rip), %rdx     # 0x189f3f
leaq 0x53a3d(%rip), %rcx     # 0x189f24
leaq 0x4f170(%rip), %r8      # 0x18565e
movl $0x14c1, %r9d           # imm = 0x14C1
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x136502
movzbl 0x57(%rsp), %eax
cmpl $0xff, %eax
je 0x136593
movq 0xb8(%rsp), %rax
movq 0x70(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x68(%rsp), %rcx
movzbl 0x57(%rsp), %edx
cmpq (%rcx,%rdx,8), %rax
jbe 0x136569
movq 0xb8(%rsp), %rax
movq 0x70(%rsp), %rcx
movq (%rax,%rcx,8), %rdx
movq 0x68(%rsp), %rax
movzbl 0x57(%rsp), %ecx
movq %rdx, (%rax,%rcx,8)
movq 0x70(%rsp), %rax
movb %al, %dl
movq 0x98(%rsp), %rax
movzbl 0x57(%rsp), %ecx
movb %dl, (%rax,%rcx)
movq 0x48(%rsp), %rax
movzbl 0x57(%rsp), %ecx
movq (%rax,%rcx,8), %rdi
movq 0x70(%rsp), %rax
movsbl %al, %esi
callq 0x194d0
movq 0x78(%rsp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
jmp 0x136595
jmp 0x136597
movq 0x70(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x70(%rsp)
jmp 0x136427
movq 0x78(%rsp), %rax
movq (%rax), %rdi
shlq $0x0, %rdi
leaq 0x4f0a1(%rip), %rsi     # 0x18565e
movl $0x14cc, %edx           # imm = 0x14CC
callq 0xd2e0
movq %rax, %rcx
movq 0x90(%rsp), %rax
movq %rcx, (%rax)
movq $0x0, 0x70(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0xa0(%rsp), %rdi
callq 0x109da0
movl %eax, %ecx
movq 0x30(%rsp), %rax
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x13684e
movq 0x48(%rsp), %rax
movq 0x70(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x19940
movq %rax, 0x40(%rsp)
movq 0x70(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq 0x98(%rsp), %rax
movq 0x70(%rsp), %rcx
movsbl (%rax,%rcx), %ecx
movq 0x98(%rsp), %rax
movq 0x70(%rsp), %rdi
movsbl (%rax,%rdi), %r8d
movq 0x68(%rsp), %rax
movq 0x70(%rsp), %rdi
movq (%rax,%rdi,8), %r9
leaq 0x538fa(%rip), %rdi     # 0x189f5b
movb $0x0, %al
callq 0xc930
movq 0x90(%rsp), %rax
movq (%rax), %rax
addq 0x60(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x48(%rsp), %rax
movq 0x70(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x19a00
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq %rax, %rdx
callq 0xb2b0
movq 0x60(%rsp), %rdx
movq 0xb0(%rsp), %rax
movq 0x70(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x48(%rsp), %rax
movq 0x70(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x19a00
addq 0x60(%rsp), %rax
movq %rax, 0x60(%rsp)
movq $0x0, 0x58(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x48(%rsp), %rax
movq 0x70(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x19a00
movq %rax, %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
jae 0x13678f
jmp 0x136714
cmpq $0xff, 0x58(%rsp)
jb 0x136757
movq 0x7d8b2(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x27936(%rip), %rsi     # 0x15e066
leaq 0x5386d(%rip), %rdx     # 0x189fa4
leaq 0x537e6(%rip), %rcx     # 0x189f24
leaq 0x4ef19(%rip), %r8      # 0x18565e
movl $0x14d8, %r9d           # imm = 0x14D8
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x136759
movq 0x58(%rsp), %rax
movb %al, %dl
movq 0x88(%rsp), %rax
movq 0x40(%rsp), %rcx
movq 0x58(%rsp), %rsi
movsbl (%rcx,%rsi), %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq 0x58(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x58(%rsp)
jmp 0x1366e8
movq 0x48(%rsp), %rax
movq 0x70(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x19a00
movq 0x80(%rsp), %rcx
movzbl (%rcx), %ecx
cmpq %rcx, %rax
jbe 0x136828
jmp 0x1367b4
movq 0x48(%rsp), %rax
movq 0x70(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x19a00
cmpq $0xff, %rax
jb 0x136807
movq 0x7d802(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x27886(%rip), %rsi     # 0x15e066
leaq 0x537d5(%rip), %rdx     # 0x189fbc
leaq 0x53736(%rip), %rcx     # 0x189f24
leaq 0x4ee69(%rip), %r8      # 0x18565e
movl $0x14dc, %r9d           # imm = 0x14DC
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x136809
movq 0x48(%rsp), %rax
movq 0x70(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x19a00
movb %al, %cl
movq 0x80(%rsp), %rax
movb %cl, (%rax)
movq 0x48(%rsp), %rax
movq 0x70(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x1afc0
movq 0x70(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x70(%rsp)
jmp 0x1365de
movq $0xfe, 0x70(%rsp)
movq 0x48(%rsp), %rax
movq 0x70(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x19940
movq %rax, 0x40(%rsp)
movq 0x70(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq 0x98(%rsp), %rax
movq 0x70(%rsp), %rcx
movsbl (%rax,%rcx), %ecx
movq 0x98(%rsp), %rax
movq 0x70(%rsp), %rdi
movsbl (%rax,%rdi), %r8d
movq 0x68(%rsp), %rax
movq 0x70(%rsp), %rdi
movq (%rax,%rdi,8), %r9
leaq 0x536aa(%rip), %rdi     # 0x189f5b
movb $0x0, %al
callq 0xc930
movq 0x90(%rsp), %rax
movq (%rax), %rax
addq 0x60(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %rax
movq 0x70(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x19a00
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %rax, %rdx
callq 0xb2b0
movq 0x60(%rsp), %rdx
movq 0xb0(%rsp), %rax
movq 0x70(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x48(%rsp), %rax
movq 0x70(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x19a00
addq 0x60(%rsp), %rax
movq %rax, 0x60(%rsp)
movq $0x0, 0x58(%rsp)
movq 0x58(%rsp), %rax
movq %rax, (%rsp)
movq 0x48(%rsp), %rax
movq 0x70(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x19a00
movq %rax, %rcx
movq (%rsp), %rax
cmpq %rcx, %rax
jae 0x1369dd
jmp 0x136962
cmpq $0xff, 0x58(%rsp)
jb 0x1369a5
movq 0x7d664(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x276e8(%rip), %rsi     # 0x15e066
leaq 0x5361f(%rip), %rdx     # 0x189fa4
leaq 0x53598(%rip), %rcx     # 0x189f24
leaq 0x4eccb(%rip), %r8      # 0x18565e
movl $0x14ec, %r9d           # imm = 0x14EC
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x1369a7
movq 0x58(%rsp), %rax
movb %al, %dl
movq 0x88(%rsp), %rax
movq 0x40(%rsp), %rcx
movq 0x58(%rsp), %rsi
movsbl (%rcx,%rsi), %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq 0x58(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x58(%rsp)
jmp 0x136938
movq 0x48(%rsp), %rax
movq 0x70(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x19a00
movq 0x80(%rsp), %rcx
movzbl (%rcx), %ecx
cmpq %rcx, %rax
jbe 0x136a76
jmp 0x136a02
movq 0x48(%rsp), %rax
movq 0x70(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x19a00
cmpq $0xff, %rax
jb 0x136a55
movq 0x7d5b4(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x27638(%rip), %rsi     # 0x15e066
leaq 0x53587(%rip), %rdx     # 0x189fbc
leaq 0x534e8(%rip), %rcx     # 0x189f24
leaq 0x4ec1b(%rip), %r8      # 0x18565e
movl $0x14f0, %r9d           # imm = 0x14F0
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x136a57
movq 0x48(%rsp), %rax
movq 0x70(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x19a00
movb %al, %cl
movq 0x80(%rsp), %rax
movb %cl, (%rax)
movq 0x48(%rsp), %rax
movq 0x70(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x1afc0
movq 0x78(%rsp), %rax
movq (%rax), %rax
cmpq 0x60(%rsp), %rax
je 0x136ad0
movq 0x7d539(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x275bd(%rip), %rsi     # 0x15e066
leaq 0x5353e(%rip), %rdx     # 0x189fee
leaq 0x5346d(%rip), %rcx     # 0x189f24
leaq 0x4eba0(%rip), %r8      # 0x18565e
movl $0x14f5, %r9d           # imm = 0x14F5
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x136ad2
movq 0x68(%rsp), %rdi
leaq 0x4eb80(%rip), %rsi     # 0x18565e
movl $0x14f6, %edx           # imm = 0x14F6
callq 0xdab0
movq 0x48(%rsp), %rdi
leaq 0x4eb6a(%rip), %rsi     # 0x18565e
movl $0x14f7, %edx           # imm = 0x14F7
callq 0xdab0
addq $0xa8, %rsp
retq
nopw %cs:(%rax,%rax)