// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x98, %rsp
movq %rdi, 0x90(%rsp)
movq %rsi, 0x88(%rsp)
movq %rdx, 0x80(%rsp)
movq %rcx, 0x78(%rsp)
movq 0x88(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x68(%rsp)
movq $0x0, 0x60(%rsp)
movq $0x0, 0x50(%rsp)
callq 0x18f00
movq %rax, 0x58(%rsp)
movq $0x0, 0x50(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x70(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x1b720
movq %rax, %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
jae 0x3c6a3
movq $0x0, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
movq 0x70(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x50(%rsp), %rsi
callq 0x1b320
movq %rax, 0x48(%rsp)
movq 0x70(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x48(%rsp), %rsi
callq 0x86470
movq %rax, 0x30(%rsp)
cmpq $0x0, 0x30(%rsp)
jne 0x3c41e
movq 0x177beb(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0x121c6f(%rip), %rsi    # 0x15e066
leaq 0x12b95c(%rip), %rdx    # 0x167d5a
leaq 0x12b960(%rip), %rcx    # 0x167d65
leaq 0x12b54b(%rip), %r8     # 0x167957
movl $0x2b2, %r9d            # imm = 0x2B2
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x3c420
movq $0x0, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x76490
movq %rax, %rcx
movq 0x10(%rsp), %rax
cmpq %rcx, %rax
jae 0x3c66b
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x40(%rsp), %rsi
callq 0x75c80
movq (%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq $-0x1, %rcx
cmpq %rcx, 0x8(%rax)
jne 0x3c4c7
movq 0x30(%rsp), %rax
testb $0x1, 0x10(%rax)
je 0x3c4c7
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0xb0440
movq %rax, 0x28(%rsp)
movq %rax, 0x60(%rsp)
movq 0x28(%rsp), %rdi
callq 0xb21b0
movq 0x20(%rsp), %rdi
leaq 0x12b49f(%rip), %rsi    # 0x167957
movl $0x2bb, %edx            # imm = 0x2BB
callq 0xdab0
jmp 0x3c658
cmpq $0x0, 0x28(%rsp)
je 0x3c501
movq 0x28(%rsp), %rdi
callq 0xb09d0
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rdi
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0xb07e0
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0xb21b0
jmp 0x3c50f
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x60(%rsp)
jmp 0x3c511
jmp 0x3c513
cmpq $0x0, 0x60(%rsp)
jne 0x3c553
movq 0x177ab6(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0x121b3a(%rip), %rsi    # 0x15e066
leaq 0x13895c(%rip), %rdx    # 0x174e8f
leaq 0x12b82b(%rip), %rcx    # 0x167d65
leaq 0x12b416(%rip), %r8     # 0x167957
movl $0x2c7, %r9d            # imm = 0x2C7
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x3c555
movq 0x58(%rsp), %rdi
callq 0x19b70
movq 0x68(%rsp), %rax
movq 0x58(%rax), %rax
movq 0x60(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq 0x68(%rsp), %rcx
movq 0x50(%rcx), %rdx
callq *%rax
movq 0x68(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x58(%rsp), %rdi
callq 0x19940
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x86470
movq %rax, 0x38(%rsp)
cmpq $0x0, %rax
jne 0x3c5ea
movl $0x8, %edi
callq 0x75ab0
movq %rax, 0x38(%rsp)
movq 0x68(%rsp), %rax
movq (%rax), %rax
movq %rax, (%rsp)
movq 0x58(%rsp), %rdi
callq 0x19940
movq %rax, %rdi
callq 0x7c400
movq (%rsp), %rdi
movq %rax, %rsi
movq 0x38(%rsp), %rdx
callq 0x86510
jmp 0x3c5ec
cmpq $0x0, 0x38(%rsp)
jne 0x3c62c
movq 0x1779dd(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0x121a61(%rip), %rsi    # 0x15e066
leaq 0x12a8c7(%rip), %rdx    # 0x166ed3
leaq 0x12b752(%rip), %rcx    # 0x167d65
leaq 0x12b33d(%rip), %r8     # 0x167957
movl $0x2d3, %r9d            # imm = 0x2D3
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x3c62e
movq 0x38(%rsp), %rdi
leaq 0x60(%rsp), %rsi
movl $0x8, %edx
callq 0x76220
movq 0x20(%rsp), %rdi
leaq 0x12b309(%rip), %rsi    # 0x167957
movl $0x2d5, %edx            # imm = 0x2D5
callq 0xdab0
movq 0x40(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x40(%rsp)
jmp 0x3c429
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x770a0
movq 0x30(%rsp), %rax
movq (%rax), %rdi
callq 0x86cc0
movq 0x28(%rsp), %rdi
callq 0xb21b0
movq 0x50(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x50(%rsp)
jmp 0x3c373
movq 0x70(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x86cc0
movq 0x70(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x1b780
movq 0x70(%rsp), %rdi
leaq 0x12b28c(%rip), %rsi    # 0x167957
movl $0x2dd, %edx            # imm = 0x2DD
callq 0xdab0
movq 0x58(%rsp), %rdi
callq 0x1afc0
xorl %eax, %eax
addq $0x98, %rsp
retq
nopl (%rax)