// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/ltr/ltr_cluster_stream.c
// Function: cluster_annotate_nodes
static int cluster_annotate_nodes(GtClusteredSet *cs, GtEncseq *encseq,
                                  const char *feature, GtArray *nodes,
                                  GtError *err)
{
  GtFeatureNodeIterator *fni;
  GtFeatureNode *curnode = NULL, *tmp;
  GtClusteredSetIterator *csi = NULL;
  GtGenomeNode *gn;
  GtHashmap *desc2node;
  GtStr *seqid = NULL;
  int had_err = 0;
  GtUword num_of_clusters, i, elm;
  const char *fnt = NULL;
  char buffer[BUFSIZ], *real_feature;
  gt_error_check(err);

  if ((strcmp(feature, "lLTR") == 0) || (strcmp(feature, "rLTR") == 0))
    real_feature = gt_cstr_dup(gt_ft_long_terminal_repeat);
  else
    real_feature = gt_cstr_dup(feature);

  desc2node = gt_hashmap_new(GT_HASH_STRING, free_hash, NULL);
  for (i = 0; i < gt_array_size(nodes); i++) {
    gn = *(GtGenomeNode**) gt_array_get(nodes, i);
    if (gt_feature_node_try_cast(gn) == NULL)
      continue;
    fni = gt_feature_node_iterator_new((GtFeatureNode*) gn);
    while ((curnode = gt_feature_node_iterator_next(fni)) != NULL) {
      char header[2*BUFSIZ];
      fnt = gt_feature_node_get_type(curnode);
      if (strcmp(fnt, gt_ft_repeat_region) == 0) {
        const char *rid;
        GtUword id;
        seqid = gt_genome_node_get_seqid((GtGenomeNode*) curnode);
        rid = gt_feature_node_get_attribute(curnode, "ID");
        (void) sscanf(rid, "repeat_region"GT_WU"", &id);
        (void) snprintf(buffer, BUFSIZ, "%s_"GT_WU"", gt_str_get(seqid), id);
      } else if (strcmp(fnt, gt_ft_protein_match) == 0) {
        GtRange range;
        const char *attr;
        attr = gt_feature_node_get_attribute(curnode, "name");
        if (!attr)
          continue;
        if (strcmp(feature, attr) != 0)
          continue;
        range = gt_genome_node_get_range((GtGenomeNode*) curnode);
        if ((range.end - range.start + 1) < 10UL)
          continue;
        (void) snprintf(header, 2*BUFSIZ, "%s_"GT_WU"_"GT_WU"", buffer,
                        range.start, range.end);
        gt_hashmap_add(desc2node, (void*) gt_cstr_dup(header), (void*) curnode);
      } else if (strcmp(fnt, real_feature) == 0) {
        GtRange range;
        range = gt_genome_node_get_range((GtGenomeNode*) curnode);
        if ((range.end - range.start + 1) < 10UL)
          continue;
        (void) snprintf(header, 2*BUFSIZ, "%s_"GT_WU"_"GT_WU"", buffer,
                        range.start, range.end);
        gt_hashmap_add(desc2node, (void*) gt_cstr_dup(header), (void*) curnode);
      }
    }
    gt_feature_node_iterator_delete(fni);
  }
  gt_free(real_feature);

  num_of_clusters = gt_clustered_set_num_of_clusters(cs, err);
  for (i = 0; i < num_of_clusters; i++) {
    csi = gt_clustered_set_get_iterator(cs, i ,err);
    if (csi != NULL) {
      while (!had_err && (gt_clustered_set_iterator_next(csi, &elm, err)
             != GT_CLUSTERED_SET_ITERATOR_STATUS_END)) {
        char clid[BUFSIZ];
        const char *encseqdesc;
        char *encseqid;
        GtUword desclen;
        encseqdesc = gt_encseq_description(encseq, &desclen, elm);
        encseqid = gt_calloc((size_t) (desclen + 1), sizeof (char));
        (void) strncpy(encseqid, encseqdesc, (size_t) desclen);
        encseqid[desclen] = '\0';
        tmp = (GtFeatureNode*) gt_hashmap_get(desc2node, (void*) encseqid);
        (void) snprintf(clid, BUFSIZ, ""GT_WU"", i);
        gt_feature_node_set_attribute(tmp, "clid", clid);
        gt_free(encseqid);
      }
    }
    gt_clustered_set_iterator_delete(csi, err);
    csi = NULL;
  }
  gt_hashmap_delete(desc2node);
  return had_err;
}

// Assembly:
subq $0x8138, %rsp           # imm = 0x8138
movq %rdi, 0x8130(%rsp)
movq %rsi, 0x8128(%rsp)
movq %rdx, 0x8120(%rsp)
movq %rcx, 0x8118(%rsp)
movq %r8, 0x8110(%rsp)
movq $0x0, 0x8100(%rsp)
movq $0x0, 0x80f0(%rsp)
movq $0x0, 0x80d8(%rsp)
movl $0x0, 0x80d4(%rsp)
movq $0x0, 0x80b0(%rsp)
cmpq $0x0, 0x8110(%rsp)
je 0x3002e0
movq 0x8110(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x3002a8
jmp 0x3002e0
movq 0x33bcf1(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x215d5a(%rip), %rsi    # 0x516013
leaq 0x215eff(%rip), %rdx    # 0x5161bf
leaq 0x2924cd(%rip), %rcx    # 0x592794
leaq 0x2923a7(%rip), %r8     # 0x592675
movl $0x136, %r9d            # imm = 0x136
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x3002e2
movq 0x8120(%rsp), %rdi
leaq 0x292283(%rip), %rsi    # 0x592574
callq 0x19980
cmpl $0x0, %eax
je 0x300314
movq 0x8120(%rsp), %rdi
leaq 0x29226f(%rip), %rsi    # 0x592579
callq 0x19980
cmpl $0x0, %eax
jne 0x30032a
leaq 0x269b9b(%rip), %rdi    # 0x569eb6
callq 0xa2db0
movq %rax, 0x60a8(%rsp)
jmp 0x30033f
movq 0x8120(%rsp), %rdi
callq 0xa2db0
movq %rax, 0x60a8(%rsp)
movl $0x1, %edi
leaq -0x60b(%rip), %rsi      # 0x2ffd40
xorl %eax, %eax
movl %eax, %edx
callq 0xe0c40
movq %rax, 0x80e0(%rsp)
movq $0x0, 0x80c0(%rsp)
movq 0x80c0(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x8118(%rsp), %rdi
callq 0x81370
movq %rax, %rcx
movq 0x20(%rsp), %rax
cmpq %rcx, %rax
jae 0x3006f8
movq 0x8118(%rsp), %rdi
movq 0x80c0(%rsp), %rsi
callq 0x80b60
movq (%rax), %rax
movq %rax, 0x80e8(%rsp)
movq 0x80e8(%rsp), %rdi
callq 0x170450
cmpq $0x0, %rax
jne 0x3003cb
jmp 0x3006df
movq 0x80e8(%rsp), %rdi
callq 0x170b00
movq %rax, 0x8108(%rsp)
movq 0x8108(%rsp), %rdi
callq 0x170e30
movq %rax, 0x8100(%rsp)
cmpq $0x0, %rax
je 0x3006d2
movq 0x8100(%rsp), %rdi
callq 0x16d430
movq %rax, 0x80b0(%rsp)
movq 0x80b0(%rsp), %rdi
leaq 0x268ee7(%rip), %rsi    # 0x56930a
callq 0x19980
cmpl $0x0, %eax
jne 0x3004c2
movq 0x8100(%rsp), %rdi
callq 0x171b70
movq %rax, 0x80d8(%rsp)
movq 0x8100(%rsp), %rdi
leaq 0x2af658(%rip), %rsi    # 0x5afaad
callq 0x16c040
movq %rax, 0x2098(%rsp)
movq 0x2098(%rsp), %rdi
leaq 0x29233a(%rip), %rsi    # 0x5927ab
leaq 0x2090(%rsp), %rdx
movb $0x0, %al
callq 0x19770
leaq 0x60b0(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x80d8(%rsp), %rdi
callq 0x11dee0
movq 0x18(%rsp), %rdi
movq %rax, %rcx
movq 0x2090(%rsp), %r8
movl $0x2000, %esi           # imm = 0x2000
leaq 0x292306(%rip), %rdx    # 0x5927bc
movb $0x0, %al
callq 0x19b90
jmp 0x3006cd
movq 0x80b0(%rsp), %rdi
leaq 0x252d61(%rip), %rsi    # 0x553232
callq 0x19980
cmpl $0x0, %eax
jne 0x3005ed
movq 0x8100(%rsp), %rdi
leaq 0x254910(%rip), %rsi    # 0x554dfe
callq 0x16c040
movq %rax, 0x2078(%rsp)
cmpq $0x0, 0x2078(%rsp)
jne 0x30050b
jmp 0x3003e0
movq 0x8120(%rsp), %rdi
movq 0x2078(%rsp), %rsi
callq 0x19980
cmpl $0x0, %eax
je 0x30052a
jmp 0x3003e0
movq 0x8100(%rsp), %rdi
callq 0x171cc0
movq %rax, 0x2068(%rsp)
movq %rdx, 0x2070(%rsp)
movq 0x2068(%rsp), %rax
movq %rax, 0x2080(%rsp)
movq 0x2070(%rsp), %rax
movq %rax, 0x2088(%rsp)
movq 0x2088(%rsp), %rax
subq 0x2080(%rsp), %rax
addq $0x1, %rax
cmpq $0xa, %rax
jae 0x300586
jmp 0x3003e0
leaq 0x20a0(%rsp), %rdi
leaq 0x60b0(%rsp), %rcx
movq 0x2080(%rsp), %r8
movq 0x2088(%rsp), %r9
movl $0x4000, %esi           # imm = 0x4000
leaq 0x292402(%rip), %rdx    # 0x5929b4
movb $0x0, %al
callq 0x19b90
movq 0x80e0(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0x20a0(%rsp), %rdi
callq 0xa2db0
movq 0x10(%rsp), %rdi
movq %rax, %rsi
movq 0x8100(%rsp), %rdx
callq 0xe0fc0
jmp 0x3006cb
movq 0x80b0(%rsp), %rdi
movq 0x60a8(%rsp), %rsi
callq 0x19980
cmpl $0x0, %eax
jne 0x3006c9
movq 0x8100(%rsp), %rdi
callq 0x171cc0
movq %rax, 0x2048(%rsp)
movq %rdx, 0x2050(%rsp)
movq 0x2048(%rsp), %rax
movq %rax, 0x2058(%rsp)
movq 0x2050(%rsp), %rax
movq %rax, 0x2060(%rsp)
movq 0x2060(%rsp), %rax
subq 0x2058(%rsp), %rax
addq $0x1, %rax
cmpq $0xa, %rax
jae 0x300667
jmp 0x3003e0
leaq 0x20a0(%rsp), %rdi
leaq 0x60b0(%rsp), %rcx
movq 0x2058(%rsp), %r8
movq 0x2060(%rsp), %r9
movl $0x4000, %esi           # imm = 0x4000
leaq 0x292321(%rip), %rdx    # 0x5929b4
movb $0x0, %al
callq 0x19b90
movq 0x80e0(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x20a0(%rsp), %rdi
callq 0xa2db0
movq 0x8(%rsp), %rdi
movq %rax, %rsi
movq 0x8100(%rsp), %rdx
callq 0xe0fc0
jmp 0x3006cb
jmp 0x3006cd
jmp 0x3003e0
movq 0x8108(%rsp), %rdi
callq 0x170f50
movq 0x80c0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x80c0(%rsp)
jmp 0x300368
movq 0x60a8(%rsp), %rdi
leaq 0x291f6e(%rip), %rsi    # 0x592675
movl $0x167, %edx            # imm = 0x167
callq 0xe88c0
movq 0x8130(%rsp), %rdi
movq 0x8110(%rsp), %rsi
callq 0x48bce0
movq %rax, 0x80c8(%rsp)
movq $0x0, 0x80c0(%rsp)
movq 0x80c0(%rsp), %rax
cmpq 0x80c8(%rsp), %rax
jae 0x3008d9
movq 0x8130(%rsp), %rdi
movq 0x80c0(%rsp), %rsi
movq 0x8110(%rsp), %rdx
callq 0x48bd80
movq %rax, 0x80f0(%rsp)
cmpq $0x0, 0x80f0(%rsp)
je 0x30089f
jmp 0x300786
xorl %eax, %eax
cmpl $0x0, 0x80d4(%rsp)
movb %al, 0x7(%rsp)
jne 0x3007bd
movq 0x80f0(%rsp), %rdi
movq 0x8110(%rsp), %rdx
leaq 0x80b8(%rsp), %rsi
callq 0x48bdc0
cmpl $-0x1, %eax
setne %al
movb %al, 0x7(%rsp)
movb 0x7(%rsp), %al
testb $0x1, %al
jne 0x3007ca
jmp 0x30089d
movq 0x8128(%rsp), %rdi
movq 0x80b8(%rsp), %rdx
leaq 0x28(%rsp), %rsi
callq 0xb1b40
movq %rax, 0x38(%rsp)
movq 0x28(%rsp), %rdi
addq $0x1, %rdi
movl $0x1, %esi
leaq 0x291e77(%rip), %rdx    # 0x592675
movl $0x174, %ecx            # imm = 0x174
callq 0xe83c0
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x28(%rsp), %rdx
callq 0x19330
movq 0x30(%rsp), %rax
movq 0x28(%rsp), %rcx
movb $0x0, (%rax,%rcx)
movq 0x80e0(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0xe0f20
movq %rax, 0x80f8(%rsp)
leaq 0x40(%rsp), %rdi
movq 0x80c0(%rsp), %rcx
movl $0x2000, %esi           # imm = 0x2000
leaq 0x28e7a7(%rip), %rdx    # 0x58f009
movb $0x0, %al
callq 0x19b90
movq 0x80f8(%rsp), %rdi
leaq 0x40(%rsp), %rdx
leaq 0x291d71(%rip), %rsi    # 0x5925ee
callq 0x16d660
movq 0x30(%rsp), %rdi
leaq 0x291de7(%rip), %rsi    # 0x592675
movl $0x17a, %edx            # imm = 0x17A
callq 0xe88c0
jmp 0x300786
jmp 0x30089f
movq 0x80f0(%rsp), %rdi
movq 0x8110(%rsp), %rsi
callq 0x48be30
movq $0x0, 0x80f0(%rsp)
movq 0x80c0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x80c0(%rsp)
jmp 0x30073a
movq 0x80e0(%rsp), %rdi
callq 0xe1770
movl 0x80d4(%rsp), %eax
addq $0x8138, %rsp           # imm = 0x8138
retq
nopw %cs:(%rax,%rax)