// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/annotationsketch/layout.c
// Function: gt_layout_get_height
int gt_layout_get_height(GtLayout *layout, GtUword *result,
                         GtError *err)
{
  int had_err = 0;
  GtTracklineInfo lines;
  double tmp, head_track_space = HEAD_TRACK_SPACE_DEFAULT;
  bool show_track_captions = true;
  GtUword height, i;
  gt_assert(layout);

  had_err = layout_all_tracks(layout, err);
  if (!had_err) {
    /* get dynamic heights from tracks */
    lines.style = layout->style;
    lines.height = 0;
    if (gt_hashmap_foreach(layout->tracks, add_tracklines, &lines, err) < 0) {
      return -1;
    }
    height = lines.height;

    if (gt_style_get_bool(layout->style,
                          "format","show_track_captions",
                          &show_track_captions,
                          NULL, err) == GT_STYLE_QUERY_ERROR) {
      return -1;
    }

    /* add custom track space allotment */
    if (show_track_captions)
    {
      double theight = TEXT_SIZE_DEFAULT,
             captionspace = CAPTION_BAR_SPACE_DEFAULT;
      if (gt_style_get_num(layout->style,
                           "format", "track_caption_font_size",
                           &theight, NULL, err) == GT_STYLE_QUERY_ERROR) {
        return -1;
      }
      if (gt_style_get_num(layout->style,
                           "format", "track_caption_space",
                           &captionspace, NULL, err) == GT_STYLE_QUERY_ERROR) {
        return -1;
      }
      height += gt_array_size(layout->custom_tracks)
                    * (theight + captionspace);
    }

    for (i=0;i<gt_array_size(layout->custom_tracks);i++)
    {
      GtCustomTrack *ct = *(GtCustomTrack**) gt_array_get(layout->custom_tracks,
                                                          i);
      height += gt_custom_track_get_height(ct);
      if (gt_style_get_num(layout->style, "format", "track_vspace", &tmp,
                           NULL, err) == GT_STYLE_QUERY_ERROR) {
        return -1;
      }
      height += tmp;
    }

    /* add header space and footer */
    if (gt_style_get_num(layout->style, "format", "ruler_space",
                         &head_track_space, NULL,
                         err) == GT_STYLE_QUERY_ERROR) {
      return -1;
    }
    height += HEADER_SPACE + head_track_space + FOOTER_SPACE;

    *result = height;
    return 0;
  }
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movabsq $0x402e000000000000, %rax # imm = 0x402E000000000000
movq %rax, 0x20(%rsp)
movb $0x1, 0x7(%rsp)
testq %rdi, %rdi
je 0x31d30
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
movq %rdx, %rsi
callq 0x31724
movl %eax, %ebp
testl %eax, %eax
je 0x31a9c
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r15), %rax
leaq 0x28(%rsp), %rdx
movq %rax, 0x8(%rdx)
andq $0x0, (%rdx)
movq 0x20(%r15), %rdi
leaq 0x2b1(%rip), %rsi       # 0x31d68
movq %r14, %rcx
callq 0x55fe2
pushq $-0x1
popq %rbp
testl %eax, %eax
js 0x31a8b
movq 0x28(%rsp), %r13
movq (%r15), %rdi
leaq 0x986c1(%rip), %rsi     # 0xca196
leaq 0xa2f98(%rip), %rdx     # 0xd4a74
leaq 0x7(%rsp), %rcx
xorl %r8d, %r8d
movq %r14, %r9
callq 0x3440a
cmpl $0x2, %eax
je 0x31a8b
cmpb $0x1, 0x7(%rsp)
jne 0x31bf1
movabsq $0x4020000000000000, %rax # imm = 0x4020000000000000
leaq 0x8(%rsp), %rcx
movq %rax, (%rcx)
movabsq $0x401c000000000000, %rax # imm = 0x401C000000000000
movq %rax, 0x18(%rsp)
movq (%r15), %rdi
leaq 0x9866f(%rip), %rsi     # 0xca196
leaq 0xa2f5a(%rip), %rdx     # 0xd4a88
xorl %r8d, %r8d
movq %r14, %r9
callq 0x33ff8
cmpl $0x2, %eax
je 0x31a8b
movq (%r15), %rdi
leaq 0x9864a(%rip), %rsi     # 0xca196
leaq 0xa2f4d(%rip), %rdx     # 0xd4aa0
leaq 0x18(%rsp), %rcx
xorl %r8d, %r8d
movq %r14, %r9
callq 0x33ff8
cmpl $0x2, %eax
je 0x31a8b
movq %rbx, 0x10(%rsp)
movq 0x18(%r15), %rdi
callq 0x4b988
movq %rax, %xmm0
movq 0x988f9(%rip), %xmm1    # 0xca480
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x988fd(%rip), %xmm2    # 0xca490
subpd %xmm2, %xmm0
movapd %xmm0, %xmm3
unpckhpd %xmm0, %xmm3            # xmm3 = xmm3[1],xmm0[1]
addsd %xmm0, %xmm3
movsd 0x8(%rsp), %xmm0
addsd 0x18(%rsp), %xmm0
mulsd %xmm3, %xmm0
movq %r13, %xmm3
punpckldq %xmm1, %xmm3    # xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1]
subpd %xmm2, %xmm3
movapd %xmm3, %xmm1
unpckhpd %xmm3, %xmm1            # xmm1 = xmm1[1],xmm3[1]
addsd %xmm3, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0xa1b6c(%rip), %xmm1    # 0xd3750
cvttsd2si %xmm1, %r13
andq %rcx, %r13
orq %rax, %r13
jmp 0x31bf6
movq %rbx, 0x10(%rsp)
xorl %r12d, %r12d
movq 0x18(%r15), %rdi
callq 0x4b988
cmpq %rax, %r12
jae 0x31c9d
movq 0x18(%r15), %rdi
movq %r12, %rsi
callq 0x4b48e
movq (%rax), %rdi
callq 0x6f1b1
movq %rax, %rbx
movq (%r15), %rdi
leaq 0x9856a(%rip), %rsi     # 0xca196
leaq 0xa2e81(%rip), %rdx     # 0xd4ab4
leaq 0x8(%rsp), %rcx
xorl %r8d, %r8d
movq %r14, %r9
callq 0x33ff8
cmpl $0x2, %eax
je 0x31a8b
addq %r13, %rbx
movq %rbx, %xmm0
punpckldq 0x98824(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x9882c(%rip), %xmm0    # 0xca490
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
addsd 0x8(%rsp), %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rcx
subsd 0xa1aca(%rip), %xmm1    # 0xd3750
cvttsd2si %xmm1, %r13
sarq $0x3f, %rcx
andq %rcx, %r13
orq %rax, %r13
incq %r12
jmp 0x31bf9
movq (%r15), %rdi
leaq 0x984ef(%rip), %rsi     # 0xca196
leaq 0xa2e13(%rip), %rdx     # 0xd4ac1
leaq 0x20(%rsp), %rcx
xorl %r8d, %r8d
movq %r14, %r9
callq 0x33ff8
cmpl $0x2, %eax
movq 0x10(%rsp), %rsi
je 0x31a8b
movsd 0x20(%rsp), %xmm0
addsd 0xa2bf6(%rip), %xmm0    # 0xd48d0
addsd 0xa2bf6(%rip), %xmm0    # 0xd48d8
movq %r13, %xmm1
punpckldq 0x98791(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x98799(%rip), %xmm1    # 0xca490
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
addsd %xmm0, %xmm2
cvttsd2si %xmm2, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0xa1a35(%rip), %xmm2    # 0xd3750
cvttsd2si %xmm2, %rdx
andq %rcx, %rdx
orq %rax, %rdx
movq %rdx, (%rsi)
xorl %ebp, %ebp
jmp 0x31a8b
movq 0xfc281(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x98325(%rip), %rsi     # 0xca066
leaq 0xa178b(%rip), %rdx     # 0xd34d3
leaq 0xa2d10(%rip), %rcx     # 0xd4a5f
leaq 0xa2bbd(%rip), %r8      # 0xd4913
movl $0x19b, %r9d            # imm = 0x19B
xorl %eax, %eax
callq 0xb8c0
callq 0xb300