// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/annotationsketch/layout.c
// Function: layout_tracks
static int layout_tracks(void *key, void *value, void *data,
                         GtError *err)
{
  GtUword i,
                max = 50;
  GtTrack *track = NULL;
  GtLayoutTraverseInfo *lti = (GtLayoutTraverseInfo*) data;
  GtArray *list = (GtArray*) value;
  GtStr *gt_track_key;
  GtBlock *block;
  int had_err = 0;
  bool split = true;
  double tmp = 50;
  gt_assert(list);

  /* to get a deterministic layout, we sort the GtBlocks for each type */
  if (lti->layout->block_ordering_func) {
    gt_array_sort_stable_with_data(list, blocklist_block_compare,
                                   lti->layout);
  }

  /* XXX: get first block for track property lookups, this should be reworked
     to allow arbitrary track keys! */
  block = *(GtBlock**) gt_array_get(list, 0);
  gt_track_key = gt_str_new_cstr((char*) key);

  /* obtain default settings*/
  if (gt_style_get_bool(lti->layout->style, "format", "split_lines", &split,
                         NULL, err) == GT_STYLE_QUERY_ERROR) {
    had_err = 1;
  }
  if (!had_err) {
    if (gt_style_get_num(lti->layout->style,
                         "format", "max_num_lines",
                         &tmp, NULL, err) == GT_STYLE_QUERY_ERROR) {
      had_err = 1;
    }
  }
  /* obtain track-specific settings, should be changed to query arbitrary
     track keys! */
  if (!had_err) {
    if (gt_style_get_bool(lti->layout->style, gt_block_get_type(block),
                          "split_lines",  &split, NULL,
                          err) == GT_STYLE_QUERY_ERROR) {
      had_err = 1;
    }
  }
  if (!had_err) {
    if (gt_style_get_num(lti->layout->style, gt_block_get_type(block),
                         "max_num_lines", &tmp, NULL,
                         err) == GT_STYLE_QUERY_ERROR) {
      had_err = 1;
    }
  }

  if (!had_err) {
    max = (GtUword) tmp;
    track = gt_track_new(gt_track_key, max, split,
                         gt_line_breaker_captions_new(lti->layout,
                                                      lti->layout->width,
                                                      lti->layout->style));
    lti->layout->nof_tracks++;
    for (i = 0; !had_err && i < gt_array_size(list); i++) {
      block = *(GtBlock**) gt_array_get(list, i);
      had_err = gt_track_insert_block(track, block, err);
    }
  }
  if (!had_err) {
    gt_hashmap_add(lti->layout->tracks, gt_cstr_dup(gt_str_get(gt_track_key)),
                   track);
  }
  else
  {
    gt_track_delete(track);
  }

  gt_str_delete(gt_track_key);
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movb $0x1, 0xf(%rsp)
movabsq $0x4049000000000000, %rax # imm = 0x4049000000000000
movq %rax, 0x18(%rsp)
testq %rsi, %rsi
je 0x31fff
movq %rcx, %r15
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbp
movq 0x8(%rdx), %rdx
cmpq $0x0, 0x60(%rdx)
je 0x31e2a
leaq 0x213(%rip), %rsi       # 0x32035
movq %r12, %rdi
callq 0x4bba2
xorl %r13d, %r13d
movq %r12, %rdi
xorl %esi, %esi
callq 0x4b48e
movq (%rax), %rbx
movq %rbp, %rdi
callq 0x13da9
movq %rax, 0x10(%rsp)
movq 0x8(%r14), %rax
movq (%rax), %rdi
leaq 0x98341(%rip), %rsi     # 0xca196
leaq 0xa2cf9(%rip), %rdx     # 0xd4b55
leaq 0xf(%rsp), %rcx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x3440a
pushq $0x1
popq %rbp
cmpl $0x2, %eax
je 0x31fb0
movq 0x8(%r14), %rax
movq (%rax), %rdi
leaq 0x98310(%rip), %rsi     # 0xca196
leaq 0xa2cd4(%rip), %rdx     # 0xd4b61
xorl %r13d, %r13d
leaq 0x18(%rsp), %rcx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x33ff8
cmpl $0x2, %eax
je 0x31fb0
movq 0x8(%r14), %rax
movq (%rax), %rax
movq %rax, 0x20(%rsp)
movq %rbx, %rdi
callq 0x6bb96
leaq 0xa2c91(%rip), %rdx     # 0xd4b55
xorl %r13d, %r13d
leaq 0xf(%rsp), %rcx
movq 0x20(%rsp), %rdi
movq %rax, %rsi
xorl %r8d, %r8d
movq %r15, %r9
callq 0x3440a
cmpl $0x2, %eax
je 0x31fb0
movq 0x8(%r14), %rax
movq (%rax), %r13
movq %rbx, %rdi
callq 0x6bb96
leaq 0xa2c63(%rip), %rdx     # 0xd4b61
xorl %ebx, %ebx
leaq 0x18(%rsp), %rcx
movq %r13, %rdi
movq %rax, %rsi
xorl %r8d, %r8d
movq %r15, %r9
callq 0x33ff8
movl $0x0, %r13d
cmpl $0x2, %eax
je 0x31fb0
movsd 0x18(%rsp), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0xa1811(%rip), %xmm0    # 0xd3750
cvttsd2si %xmm0, %r13
andq %rcx, %r13
orq %rax, %r13
movzbl 0xf(%rsp), %ebp
movq 0x8(%r14), %rdi
movl 0x48(%rdi), %esi
movq (%rdi), %rdx
callq 0x32436
movq 0x10(%rsp), %rdi
movq %r13, %rsi
movl %ebp, %edx
movq %rax, %rcx
callq 0x35f24
movq %rax, %r13
movq 0x8(%r14), %rax
incq 0x40(%rax)
xorl %ebp, %ebp
testl %ebx, %ebx
jne 0x31fae
movq %r12, %rdi
callq 0x4b988
cmpq %rax, %rbp
jae 0x31fd3
movq %r12, %rdi
movq %rbp, %rsi
callq 0x4b48e
movq (%rax), %rsi
movq %r13, %rdi
movq %r15, %rdx
callq 0x360bb
movl %eax, %ebx
incq %rbp
jmp 0x31f7d
movl %ebx, %ebp
movq %r13, %rdi
callq 0x37543
movq 0x10(%rsp), %rdi
callq 0x152db
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%r14), %rax
movq 0x20(%rax), %rbx
movq 0x10(%rsp), %rdi
callq 0x143d2
movq %rax, %rdi
callq 0x4f8ae
movq %rbx, %rdi
movq %rax, %rsi
movq %r13, %rdx
callq 0x55f31
xorl %ebp, %ebp
jmp 0x31fb8
movq 0xfbfb2(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x98056(%rip), %rsi     # 0xca066
leaq 0xa0d06(%rip), %rdx     # 0xd2d1d
leaq 0xa2b29(%rip), %rcx     # 0xd4b47
leaq 0xa28ee(%rip), %r8      # 0xd4913
pushq $0x6f
popq %r9
xorl %eax, %eax
callq 0xb8c0
callq 0xb300