// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/annotationsketch/diagram.c
// Function: collect_blocks
static int collect_blocks(GT_UNUSED void *key, void *value, void *data,
                          GT_UNUSED GtError *err)
{
  NodeInfoElement *ni = (NodeInfoElement*) value;
  GtDiagram *diagram = (GtDiagram*) data;
  GtBlock *block = NULL;
  GtStr *trackid_str;
  GtUword i = 0;
  trackid_str = gt_str_new();
  for (i = 0; i < gt_str_array_size(ni->types); i++) {
    const char *type;
    GtUword j;
    GtArray *list;
    PerTypeInfo *type_struc = NULL;
    GtBlock* mainblock = NULL;
    type = gt_str_array_get(ni->types, i);
    type_struc = gt_hashmap_get(ni->type_index, type);
    gt_assert(type_struc);
    for (j=0; j<gt_array_size(type_struc->blocktuples); j++)
    {
      GtBlockTuple *bt;
      bt  = *(GtBlockTuple**) gt_array_get(type_struc->blocktuples, j);
      if (bt->rep == GT_UNDEF_REPR && type_struc->must_merge)
      {
        block = mainblock = gt_block_ref(bt->block);
        gt_block_delete(mainblock);
        gt_free(bt);
        continue;
      }
      else
      {
        if (mainblock)
        {
          block = gt_block_clone(mainblock);
          gt_block_merge(block, bt->block);
          gt_block_delete(bt->block);
        } else block = bt->block;
      }
      gt_assert(block);
      gt_str_reset(trackid_str);
      /* execute hook for track selector function */
      diagram->select_func(block, trackid_str, diagram->ptr);

      if (!(list = (GtArray*) gt_hashmap_get(diagram->blocks,
                                             gt_str_get(trackid_str))))
      {
        list = gt_array_new(sizeof (GtBlock*));
        gt_hashmap_add(diagram->blocks, gt_cstr_dup(gt_str_get(trackid_str)),
                       list);
      };
      gt_assert(list);
      gt_array_add(list, block);
      gt_free(bt);
    }
    gt_array_delete(type_struc->blocktuples);
    gt_hashmap_delete(type_struc->rep_index);
    gt_block_delete(mainblock);
  }
  gt_hashmap_delete(ni->type_index);
  gt_str_array_delete(ni->types);
  gt_free(ni);
  gt_str_delete(trackid_str);
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movq %rsp, %rax
andq $0x0, (%rax)
xorl %r15d, %r15d
callq 0x13d5c
movq %rax, 0x8(%rsp)
movq %rbx, 0x18(%rsp)
movq 0x10(%rbx), %rdi
callq 0x157f4
cmpq %rax, %r15
jae 0x2b21b
movq 0x10(%rbx), %rdi
movq %r15, 0x20(%rsp)
movq %r15, %rsi
callq 0x1555e
movq 0x8(%rbx), %rdi
movq %rax, %rsi
callq 0x55ef6
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x2b2c2
xorl %ebp, %ebp
xorl %r13d, %r13d
movq 0x10(%rsp), %rbx
movq 0x8(%rbx), %rdi
callq 0x4b988
movq 0x8(%rbx), %rdi
cmpq %rax, %rbp
jae 0x2b1ef
movq %rbp, %rsi
callq 0x4b48e
movq (%rax), %rbx
cmpq $-0x1, 0x8(%rbx)
jne 0x2b10f
movq 0x10(%rsp), %rax
cmpb $0x1, 0x10(%rax)
jne 0x2b10f
movq 0x10(%rbx), %rdi
callq 0x6b2de
movq %rax, %r13
movq %rax, (%rsp)
movq %rax, %rdi
callq 0x6c7e1
movl $0x2bb, %edx            # imm = 0x2BB
jmp 0x2b1d8
testq %r13, %r13
je 0x2b13b
movq %r13, %rdi
callq 0x6b6e7
movq %rax, (%rsp)
movq 0x10(%rbx), %rsi
movq %rax, %rdi
callq 0x6b569
movq 0x10(%rbx), %rdi
callq 0x6c7e1
movq (%rsp), %rax
jmp 0x2b143
movq 0x10(%rbx), %rax
movq %rax, (%rsp)
testq %rax, %rax
je 0x2b25c
movq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x1452f
movq (%rsp), %rdi
movq 0x50(%r14), %rdx
movq %r15, %rsi
callq *0x58(%r14)
movq (%r14), %r12
movq %r15, %rdi
callq 0x143d2
movq %r12, %rdi
movq %rax, %rsi
callq 0x55ef6
testq %rax, %rax
je 0x2b188
movq %rax, %r12
jmp 0x2b1c5
pushq $0x8
popq %rdi
callq 0x4b380
movq %rax, %r12
movq 0x8(%rsp), %rdi
movq %r14, %r15
movq (%r14), %r14
callq 0x143d2
movq %rax, %rdi
callq 0x4f8ae
movq %r14, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x55f31
testq %r12, %r12
je 0x2b28a
movq %r15, %r14
movq %r12, %rdi
movq %rsp, %rsi
pushq $0x8
popq %rdx
callq 0x4b801
movl $0x2d5, %edx            # imm = 0x2D5
movq %rbx, %rdi
leaq 0xa859d(%rip), %rsi     # 0xd377f
callq 0xd249
incq %rbp
jmp 0x2b0b5
callq 0x4c19d
movq 0x10(%rsp), %rax
movq (%rax), %rdi
callq 0x563a7
movq %r13, %rdi
callq 0x6c7e1
movq 0x20(%rsp), %r15
incq %r15
movq 0x18(%rsp), %rbx
jmp 0x2b073
movq 0x8(%rbx), %rdi
callq 0x563a7
movq 0x10(%rbx), %rdi
callq 0x1583a
leaq 0xa854b(%rip), %rsi     # 0xd377f
movq %rbx, %rdi
movl $0x2dd, %edx            # imm = 0x2DD
callq 0xd249
movq 0x8(%rsp), %rdi
callq 0x152db
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x102d55(%rip), %rax    # 0x12dfb8
movq (%rax), %rdi
leaq 0x9edf9(%rip), %rsi     # 0xca066
leaq 0xb4dc8(%rip), %rdx     # 0xe003c
leaq 0xa88bd(%rip), %rcx     # 0xd3b38
leaq 0xa84fd(%rip), %r8      # 0xd377f
movl $0x2c7, %r9d            # imm = 0x2C7
jmp 0x2b2b6
movq 0x102d27(%rip), %rax    # 0x12dfb8
movq (%rax), %rdi
leaq 0x9edcb(%rip), %rsi     # 0xca066
leaq 0xa7a7b(%rip), %rdx     # 0xd2d1d
leaq 0xa888f(%rip), %rcx     # 0xd3b38
leaq 0xa84cf(%rip), %r8      # 0xd377f
movl $0x2d3, %r9d            # imm = 0x2D3
xorl %eax, %eax
callq 0xb8c0
callq 0xb300
movq 0x102cef(%rip), %rax    # 0x12dfb8
movq (%rax), %rdi
leaq 0x9ed93(%rip), %rsi     # 0xca066
leaq 0xa8853(%rip), %rdx     # 0xd3b2d
leaq 0xa8857(%rip), %rcx     # 0xd3b38
leaq 0xa8497(%rip), %r8      # 0xd377f
movl $0x2b2, %r9d            # imm = 0x2B2
jmp 0x2b2b6