// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/annotationsketch/canvas_cairo.c
// Function: gt_canvas_cairo_visit_custom_track
int gt_canvas_cairo_visit_custom_track(GtCanvas *canvas,
                                       GtCustomTrack *ct,
                                       GtError *err)
{
  bool show_track_captions = true;
  double space;
  int had_err = 0;
  GtColor color;
  gt_assert(canvas && ct);

  if (gt_style_get_bool(canvas->pvt->sty,
                        "format", "show_track_captions",
                        &show_track_captions,
                        NULL, err) == GT_STYLE_QUERY_ERROR) {
    return -1;
  }
  if (gt_style_get_color(canvas->pvt->sty, "format", "track_title_color",
                         &color, NULL, err) == GT_STYLE_QUERY_ERROR) {
    return -1;
  }

  if (show_track_captions)
  {
    GtStr *fontfam = NULL;
    double theight = gt_graphics_get_text_height(canvas->pvt->g),
           captionspace = CAPTION_BAR_SPACE_DEFAULT;
    if (gt_style_get_num(canvas->pvt->sty,
                         "format", "track_caption_font_size",
                         &theight, NULL, err) == GT_STYLE_QUERY_ERROR) {
      return -1;
    }
    fontfam = gt_str_new_cstr("Sans");
    if (gt_style_get_str(canvas->pvt->sty,
                         "format", "track_caption_font_family",
                         fontfam, NULL, err ) == GT_STYLE_QUERY_ERROR) {
      gt_str_delete(fontfam);
      return -1;
    }
    /* draw track title */
    gt_graphics_set_font(canvas->pvt->g,
                           gt_str_get(fontfam),
                           SLANT_NORMAL,
                           WEIGHT_NORMAL,
                           theight);
    gt_graphics_draw_colored_text(canvas->pvt->g,
                                  canvas->pvt->margins,
                                  canvas->pvt->y,
                                  color,
                                  gt_custom_track_get_title(ct));
    if (gt_style_get_num(canvas->pvt->sty,
                         "format", "track_caption_space",
                         &captionspace, NULL, err) == GT_STYLE_QUERY_ERROR) {
      return -1;
    }
    canvas->pvt->y += theight + captionspace;
    gt_str_delete(fontfam);
  }

  /* call rendering function */
  had_err = gt_custom_track_render(ct,
                                   canvas->pvt->g,
                                   canvas->pvt->y,
                                   canvas->pvt->viewrange,
                                   canvas->pvt->sty,
                                   err);
  canvas->pvt->y += gt_custom_track_get_height(ct);

  /* put spacers after track */
  space = TRACK_VSPACE_DEFAULT;
  if (gt_style_get_num(canvas->pvt->sty, "format", "track_vspace", &space,
                       NULL, err) == GT_STYLE_QUERY_ERROR) {
    return -1;
  }
  canvas->pvt->y += space;

  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movb $0x1, 0x27(%rsp)
testq %rdi, %rdi
je 0x8d91a
movq %rsi, %r15
testq %rsi, %rsi
je 0x8d91a
movq %rdx, %r14
movq %rdi, %rbx
movq 0x8(%rdi), %rax
movq 0x38(%rax), %rdi
leaq 0x53af0(%rip), %rsi     # 0xe1196
leaq 0x5e427(%rip), %rdx     # 0xebad4
leaq 0x27(%rsp), %rcx
xorl %r8d, %r8d
movq %r14, %r9
callq 0x5488a
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x2, %eax
je 0x8d909
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x53abc(%rip), %rsi     # 0xe1196
leaq 0x68cd3(%rip), %rdx     # 0xf63b4
leaq 0x48(%rsp), %rcx
xorl %r8d, %r8d
movq %r14, %r9
callq 0x53e39
cmpl $0x2, %eax
je 0x8d909
cmpb $0x1, 0x27(%rsp)
jne 0x8d85f
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
callq 0x4eae0
leaq 0x28(%rsp), %rcx
movsd %xmm0, (%rcx)
movabsq $0x401c000000000000, %rax # imm = 0x401C000000000000
movq %rax, 0x30(%rsp)
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x53a5d(%rip), %rsi     # 0xe1196
leaq 0x5e3a8(%rip), %rdx     # 0xebae8
xorl %r8d, %r8d
movq %r14, %r9
callq 0x545d2
cmpl $0x2, %eax
je 0x8d909
leaq 0x5f564(%rip), %rdi     # 0xeccbf
callq 0x3c03d
movq %rax, %r12
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x53a24(%rip), %rsi     # 0xe1196
leaq 0x68c61(%rip), %rdx     # 0xf63da
movq %r12, %rcx
xorl %r8d, %r8d
movq %r14, %r9
callq 0x542cf
cmpl $0x2, %eax
jne 0x8d799
movq %r12, %rdi
callq 0x3d1eb
jmp 0x8d909
movq 0x8(%rbx), %rax
movq 0x58(%rax), %r13
movq %r12, %rdi
callq 0x3c40b
movsd 0x28(%rsp), %xmm0
movq %r13, %rdi
movq %rax, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x4ebe6
movq 0x8(%rbx), %rax
movq 0x58(%rax), %r13
movsd 0x18(%rax), %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x20(%rax), %xmm0
movsd %xmm0, 0x38(%rsp)
movq %r15, %rdi
callq 0x8e460
movups 0x48(%rsp), %xmm0
movups 0x58(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r13, %rdi
movsd 0x38(%rsp), %xmm0
movsd 0x40(%rsp), %xmm1
movq %rax, %rsi
callq 0x4ea5e
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x53979(%rip), %rsi     # 0xe1196
leaq 0x5e2dc(%rip), %rdx     # 0xebb00
leaq 0x30(%rsp), %rcx
xorl %r8d, %r8d
movq %r14, %r9
callq 0x545d2
cmpl $0x2, %eax
je 0x8d909
movsd 0x28(%rsp), %xmm0
addsd 0x30(%rsp), %xmm0
movq 0x8(%rbx), %rax
addsd 0x18(%rax), %xmm0
movsd %xmm0, 0x18(%rax)
movq %r12, %rdi
callq 0x3d1eb
movq 0x8(%rbx), %rax
cvttsd2si 0x18(%rax), %rdx
movq 0x58(%rax), %rsi
movq 0x38(%rax), %r9
movq (%rax), %rcx
movq 0x8(%rax), %r8
movq %r14, (%rsp)
movq %r15, %rdi
callq 0x8e409
movl %eax, %r12d
movq %r15, %rdi
callq 0x8e44a
movq %rax, %xmm0
punpckldq 0x53be4(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x53bec(%rip), %xmm0    # 0xe1490
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movq 0x8(%rbx), %rax
addsd 0x18(%rax), %xmm1
movsd %xmm1, 0x18(%rax)
movabsq $0x402e000000000000, %rdx # imm = 0x402E000000000000
leaq 0x28(%rsp), %rcx
movq %rdx, (%rcx)
movq 0x38(%rax), %rdi
leaq 0x538bb(%rip), %rsi     # 0xe1196
leaq 0x5e232(%rip), %rdx     # 0xebb14
xorl %r8d, %r8d
movq %r14, %r9
callq 0x545d2
cmpl $0x2, %eax
je 0x8d909
movsd 0x28(%rsp), %xmm0
movq 0x8(%rbx), %rax
addsd 0x18(%rax), %xmm0
movsd %xmm0, 0x18(%rax)
movl %r12d, %ebp
movl %ebp, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2167b