// File: /workspace/github_c_makefile_star2_O1/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, 0x18(%rsp)
movb $0x1, 0x7(%rsp)
testq %rdi, %rdi
je 0x52c84
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r15
movq %rdx, %rsi
callq 0x52853
movl %eax, %ebp
testl %eax, %eax
je 0x529d7
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)
movq $0x0, (%rdx)
movq 0x20(%r15), %rdi
leaq 0x294(%rip), %rsi       # 0x52c89
movq %r14, %rcx
callq 0x771f5
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x529c6
movq 0x28(%rsp), %r13
movq (%r15), %rdi
leaq 0x8e781(%rip), %rsi     # 0xe1196
leaq 0x990b8(%rip), %rdx     # 0xebad4
leaq 0x7(%rsp), %rcx
xorl %r8d, %r8d
movq %r14, %r9
callq 0x5488a
cmpl $0x2, %eax
je 0x529c6
cmpb $0x1, 0x7(%rsp)
jne 0x52b38
movabsq $0x4020000000000000, %rax # imm = 0x4020000000000000
leaq 0x8(%rsp), %rcx
movq %rax, (%rcx)
movabsq $0x401c000000000000, %rax # imm = 0x401C000000000000
movq %rax, 0x10(%rsp)
movq (%r15), %rdi
leaq 0x8e72f(%rip), %rsi     # 0xe1196
leaq 0x9907a(%rip), %rdx     # 0xebae8
xorl %ebx, %ebx
xorl %r8d, %r8d
movq %r14, %r9
callq 0x545d2
cmpl $0x2, %eax
je 0x52b30
movq (%r15), %rdi
leaq 0x8e708(%rip), %rsi     # 0xe1196
leaq 0x9906b(%rip), %rdx     # 0xebb00
xorl %ebx, %ebx
leaq 0x10(%rsp), %rcx
xorl %r8d, %r8d
movq %r14, %r9
callq 0x545d2
cmpl $0x2, %eax
je 0x52b30
movq 0x18(%r15), %rdi
callq 0x6ecda
movq %rax, %xmm0
movq 0x8e9ba(%rip), %xmm1    # 0xe1480
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x8e9be(%rip), %xmm2    # 0xe1490
subpd %xmm2, %xmm0
movapd %xmm0, %xmm3
unpckhpd %xmm0, %xmm3            # xmm3 = xmm3[1],xmm0[1]
movsd 0x8(%rsp), %xmm4
addsd 0x10(%rsp), %xmm4
addsd %xmm0, %xmm3
mulsd %xmm3, %xmm4
movq %r13, %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
subpd %xmm2, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
addsd %xmm4, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rcx
subsd 0x97c91(%rip), %xmm1    # 0xea7b0
cvttsd2si %xmm1, %r13
sarq $0x3f, %rcx
andq %rcx, %r13
orq %rax, %r13
movb $0x1, %bl
testb %bl, %bl
je 0x529c6
movq %r12, 0x20(%rsp)
movq 0x18(%r15), %rdi
callq 0x6ecda
testq %rax, %rax
je 0x52bf1
xorl %r12d, %r12d
movq 0x18(%r15), %rdi
movq %r12, %rsi
callq 0x6e9fa
movq (%rax), %rdi
callq 0x8e44a
movq %rax, %rbx
movq (%r15), %rdi
leaq 0x8e623(%rip), %rsi     # 0xe1196
leaq 0x98f9a(%rip), %rdx     # 0xebb14
leaq 0x8(%rsp), %rcx
xorl %r8d, %r8d
movq %r14, %r9
callq 0x545d2
cmpl $0x2, %eax
je 0x529c6
addq %r13, %rbx
movq %rbx, %xmm0
punpckldq 0x8e8dd(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x8e8e5(%rip), %xmm0    # 0xe1490
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
addsd 0x8(%rsp), %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x97bdf(%rip), %xmm1    # 0xea7b0
cvttsd2si %xmm1, %r13
andq %rcx, %r13
orq %rax, %r13
incq %r12
movq 0x18(%r15), %rdi
callq 0x6ecda
cmpq %rax, %r12
jb 0x52b52
movq (%r15), %rdi
leaq 0x8e59b(%rip), %rsi     # 0xe1196
leaq 0x98f1f(%rip), %rdx     # 0xebb21
leaq 0x18(%rsp), %rcx
xorl %r8d, %r8d
movq %r14, %r9
callq 0x545d2
cmpl $0x2, %eax
movq 0x20(%rsp), %rsi
je 0x529c6
movsd 0x18(%rsp), %xmm0
addsd 0x98d02(%rip), %xmm0    # 0xeb930
addsd 0x98d02(%rip), %xmm0    # 0xeb938
movq %r13, %xmm1
punpckldq 0x8e83d(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x8e845(%rip), %xmm1    # 0xe1490
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 0x97b41(%rip), %xmm2    # 0xea7b0
cvttsd2si %xmm2, %rdx
andq %rcx, %rdx
orq %rax, %rdx
movq %rdx, (%rsi)
xorl %ebp, %ebp
jmp 0x529c6
callq 0x177b9