// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/condenseq.c
// Function: condenseq_process_descriptions
static void condenseq_process_descriptions(GtCondenseq *condenseq,
                                           const GtEncseq *orig_es,
                                           GtLogger *logger)
{
  GtUword    *dist;
  const char *desc;
  char       *cur_id_startptr;
  GtUword     desclen,
              dist_idx,
              distsize = (GtUword) 128,
              idlen,
              idx,
              maxendidx = 0,
              maxlen = 0,
              minlen = GT_UWORD_MAX,
              wastedmem = 0,
              sdssize,
              cur_total_id_len = 0;
  bool        use_const_len;

  condenseq->ids_total_len = 0;
  dist = gt_calloc((size_t) distsize, sizeof (*dist));

  for (idx = 0; idx < condenseq->orig_num_seq; ++idx) {
    desc = gt_encseq_description(orig_es, &desclen, idx);
    idlen = condenseq_idlen(desc, desclen);
    if (distsize <= idlen) {
      dist = gt_realloc(dist, (size_t) (idlen + 1) * sizeof (*dist));
      for (dist_idx = distsize; dist_idx <= idlen; dist_idx++)
        dist[dist_idx] = 0;
      distsize = idlen + 1;
    }
    dist[idlen]++;
    if (idlen > maxlen)
      maxlen = idlen;
    if (idlen < minlen)
      minlen = idlen;
    maxendidx += idlen;
  }

  /* calculate memory we would waste if we assume equal length, and size if we
     store actual descriptions */
  for (dist_idx = minlen; dist_idx < maxlen; dist_idx++) {
    wastedmem += dist[dist_idx] * (maxlen - dist_idx);
    condenseq->ids_total_len += dist[dist_idx] * dist_idx;
  }
  condenseq->ids_total_len += dist_idx * dist[dist_idx];

  sdssize = (GtUword) gt_intset_best_memory_size(maxendidx,
                                                 condenseq->orig_num_seq);
  use_const_len = wastedmem < sdssize;

  if (use_const_len) {
    gt_logger_log(logger, "Condenseq descriptions will use const len, " GT_WU
                  ", \"wasting\" " GT_WU " bytes. SDS would use "
                  GT_WU " bytes",
                  maxlen, wastedmem, sdssize);
    condenseq->id_len = maxlen;
    condenseq->ids_total_len = maxlen * condenseq->orig_num_seq;
  }
  else {
    gt_logger_log(logger, "Condenseq descriptions will use sdstab with size "
                  GT_WU ". Const length would have wasted " GT_WU " bytes.",
                  sdssize, wastedmem);
    condenseq->sdstab = gt_intset_best_new(maxendidx, condenseq->orig_num_seq);
  }
  condenseq->orig_ids = gt_calloc((size_t) condenseq->ids_total_len,
                                  sizeof (*condenseq->orig_ids));

  cur_id_startptr = condenseq->orig_ids;
  for (idx = 0; idx < condenseq->orig_num_seq; ++idx) {
    desc = gt_encseq_description(orig_es, &desclen, idx);
    idlen = condenseq_idlen(desc, desclen);
    gt_assert(idlen <= maxlen);
    (void) memcpy(cur_id_startptr, desc, (size_t) idlen);
    if (use_const_len) {
      cur_id_startptr += maxlen;
      cur_total_id_len += maxlen;
    }
    else {
      cur_id_startptr += idlen;
      cur_total_id_len += idlen;
      gt_intset_add(condenseq->sdstab, cur_total_id_len);
    }
  }
  gt_assert(cur_total_id_len == condenseq->ids_total_len);
  gt_free(dist);
}

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x90(%rsp)
movq %rsi, 0x88(%rsp)
movq %rdx, 0x80(%rsp)
movq $0x80, 0x50(%rsp)
movq $0x0, 0x38(%rsp)
movq $0x0, 0x30(%rsp)
movq $-0x1, 0x28(%rsp)
movq $0x0, 0x20(%rsp)
movq $0x0, 0x10(%rsp)
movq 0x90(%rsp), %rax
movq $0x0, 0x60(%rax)
movq 0x50(%rsp), %rdi
movl $0x8, %esi
leaq 0x40c46e(%rip), %rdx    # 0x54af44
movl $0x7f, %ecx
callq 0xe83c0
movq %rax, 0x78(%rsp)
movq $0x0, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq 0x90(%rsp), %rcx
cmpq 0x80(%rcx), %rax
jae 0x13ec16
movq 0x88(%rsp), %rdi
movq 0x40(%rsp), %rdx
leaq 0x60(%rsp), %rsi
callq 0xb1b40
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x142d30
movq %rax, 0x48(%rsp)
movq 0x50(%rsp), %rax
cmpq 0x48(%rsp), %rax
ja 0x13ebb2
movq 0x78(%rsp), %rdi
movq 0x48(%rsp), %rsi
addq $0x1, %rsi
shlq $0x3, %rsi
leaq 0x40c3e7(%rip), %rdx    # 0x54af44
movl $0x85, %ecx
callq 0xe8540
movq %rax, 0x78(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x58(%rsp), %rax
cmpq 0x48(%rsp), %rax
ja 0x13eba4
movq 0x78(%rsp), %rax
movq 0x58(%rsp), %rcx
movq $0x0, (%rax,%rcx,8)
movq 0x58(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x58(%rsp)
jmp 0x13eb76
movq 0x48(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x50(%rsp)
movq 0x78(%rsp), %rax
movq 0x48(%rsp), %rcx
movq (%rax,%rcx,8), %rdx
addq $0x1, %rdx
movq %rdx, (%rax,%rcx,8)
movq 0x48(%rsp), %rax
cmpq 0x30(%rsp), %rax
jbe 0x13ebde
movq 0x48(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x48(%rsp), %rax
cmpq 0x28(%rsp), %rax
jae 0x13ebf4
movq 0x48(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x48(%rsp), %rax
addq 0x38(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x40(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x40(%rsp)
jmp 0x13eaee
movq 0x28(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x58(%rsp), %rax
cmpq 0x30(%rsp), %rax
jae 0x13ec86
movq 0x78(%rsp), %rax
movq 0x58(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x30(%rsp), %rcx
subq 0x58(%rsp), %rcx
imulq %rcx, %rax
addq 0x20(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x78(%rsp), %rax
movq 0x58(%rsp), %rcx
movq (%rax,%rcx,8), %rcx
imulq 0x58(%rsp), %rcx
movq 0x90(%rsp), %rax
addq 0x60(%rax), %rcx
movq %rcx, 0x60(%rax)
movq 0x58(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x58(%rsp)
jmp 0x13ec20
movq 0x58(%rsp), %rcx
movq 0x78(%rsp), %rax
movq 0x58(%rsp), %rdx
imulq (%rax,%rdx,8), %rcx
movq 0x90(%rsp), %rax
addq 0x60(%rax), %rcx
movq %rcx, 0x60(%rax)
movq 0x38(%rsp), %rdi
movq 0x90(%rsp), %rax
movq 0x80(%rax), %rsi
callq 0x197450
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rax
cmpq 0x18(%rsp), %rax
setb %al
andb $0x1, %al
movb %al, 0xf(%rsp)
testb $0x1, 0xf(%rsp)
je 0x13ed3b
movq 0x80(%rsp), %rdi
movq 0x30(%rsp), %rdx
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %r8
leaq 0x40c985(%rip), %rsi    # 0x54b685
movb $0x0, %al
callq 0xe7cd0
movq 0x30(%rsp), %rcx
movq 0x90(%rsp), %rax
movq %rcx, 0x58(%rax)
movq 0x30(%rsp), %rcx
movq 0x90(%rsp), %rax
imulq 0x80(%rax), %rcx
movq 0x90(%rsp), %rax
movq %rcx, 0x60(%rax)
jmp 0x13ed83
movq 0x80(%rsp), %rdi
movq 0x18(%rsp), %rdx
movq 0x20(%rsp), %rcx
leaq 0x40c98e(%rip), %rsi    # 0x54b6e2
movb $0x0, %al
callq 0xe7cd0
movq 0x38(%rsp), %rdi
movq 0x90(%rsp), %rax
movq 0x80(%rax), %rsi
callq 0x197390
movq %rax, %rcx
movq 0x90(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x90(%rsp), %rax
movq 0x60(%rax), %rdi
movl $0x1, %esi
leaq 0x40c1a9(%rip), %rdx    # 0x54af44
movl $0xad, %ecx
callq 0xe83c0
movq %rax, %rcx
movq 0x90(%rsp), %rax
movq %rcx, 0x48(%rax)
movq 0x90(%rsp), %rax
movq 0x48(%rax), %rax
movq %rax, 0x68(%rsp)
movq $0x0, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq 0x90(%rsp), %rcx
cmpq 0x80(%rcx), %rax
jae 0x13eee2
movq 0x88(%rsp), %rdi
movq 0x40(%rsp), %rdx
leaq 0x60(%rsp), %rsi
callq 0xb1b40
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x142d30
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rax
cmpq 0x30(%rsp), %rax
jbe 0x13ee5c
movq 0x4fd175(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3d71de(%rip), %rsi    # 0x516013
leaq 0x40c906(%rip), %rdx    # 0x54b742
leaq 0x40c90f(%rip), %rcx    # 0x54b752
leaq 0x40c0fa(%rip), %r8     # 0x54af44
movl $0xb3, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x13ee5e
movq 0x68(%rsp), %rdi
movq 0x70(%rsp), %rsi
movq 0x48(%rsp), %rdx
callq 0x19610
testb $0x1, 0xf(%rsp)
je 0x13ee99
movq 0x30(%rsp), %rax
addq 0x68(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x30(%rsp), %rax
addq 0x10(%rsp), %rax
movq %rax, 0x10(%rsp)
jmp 0x13eecd
movq 0x48(%rsp), %rax
addq 0x68(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x48(%rsp), %rax
addq 0x10(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x90(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x10(%rsp), %rsi
callq 0x196950
jmp 0x13eecf
movq 0x40(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x40(%rsp)
jmp 0x13edce
jmp 0x13eee4
movq 0x10(%rsp), %rax
movq 0x90(%rsp), %rcx
cmpq 0x60(%rcx), %rax
je 0x13ef2f
movq 0x4fd0a2(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3d710b(%rip), %rsi    # 0x516013
leaq 0x40c862(%rip), %rdx    # 0x54b771
leaq 0x40c83c(%rip), %rcx    # 0x54b752
leaq 0x40c027(%rip), %r8     # 0x54af44
movl $0xbf, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x13ef31
movq 0x78(%rsp), %rdi
leaq 0x40c007(%rip), %rsi    # 0x54af44
movl $0xc0, %edx
callq 0xe88c0
addq $0x98, %rsp
retq
nop