// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/annotationsketch/canvas_cairo.c
// Function: gt_canvas_cairo_visit_track_pre
int gt_canvas_cairo_visit_track_pre(GtCanvas *canvas, GtTrack *track,
                                    GtError *err)
{
  int had_err = 0;
  GtUword exceeded;
  bool show_track_captions = true;
  GtColor color;

  gt_assert(canvas && track);

  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;
  }

  /* debug */
  gt_log_log("processing track %s", gt_str_get(gt_track_get_title(track)));

  if (show_track_captions)
  {
    double theight      = gt_graphics_get_text_height(canvas->pvt->g),
           captionspace = CAPTION_BAR_SPACE_DEFAULT;
    GtStr *fontfam = NULL;
    if (gt_style_get_num(canvas->pvt->sty,
                          "format", "track_caption_font_size",
                          &theight, NULL, err) == GT_STYLE_QUERY_ERROR) {
      return -1;
    }
    if (gt_style_get_num(canvas->pvt->sty,
                         "format", "track_caption_space",
                         &captionspace, 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;
    }
    gt_graphics_set_font(canvas->pvt->g,
                         gt_str_get(fontfam),
                         SLANT_NORMAL,
                         WEIGHT_NORMAL,
                         theight);
    canvas->pvt->y += theight;
    /* draw track title */
    gt_graphics_draw_colored_text(canvas->pvt->g,
                                  canvas->pvt->margins,
                                  canvas->pvt->y,
                                  color,
                                  gt_str_get(gt_track_get_title(track)));
    /* draw 'line maximum exceeded' message */
    if ((exceeded = gt_track_get_number_of_discarded_blocks(track)) > 0)
    {
      char buf[BUFSIZ];
      const char *msg;
      double width;
      GtColor red;
      red.red   = LINE_EXCEEDED_MSG_R;
      red.green = LINE_EXCEEDED_MSG_G;
      red.blue  = LINE_EXCEEDED_MSG_B;
      red.alpha = 1.0;
      if (exceeded == 1) {
        msg = "(1 block not shown due to exceeded line limit)";
        strncpy(buf, msg, BUFSIZ);
      } else {
        msg = "("GT_WU" blocks not shown due to exceeded line limit)";
        /*@ignore@*/
        snprintf(buf, BUFSIZ, msg, exceeded);
        /*@end@*/
      }
      width = gt_graphics_get_text_width(canvas->pvt->g,
                                         gt_str_get(gt_track_get_title(track)));
      gt_graphics_draw_colored_text(canvas->pvt->g,
                                    canvas->pvt->margins+width+10.0,
                                    canvas->pvt->y,
                                    red,
                                    buf);
    }
    canvas->pvt->y += captionspace;
    gt_str_delete(fontfam);
  }
  return had_err;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2090, %rsp           # imm = 0x2090
movb $0x1, 0x2f(%rsp)
testq %rdi, %rdi
je 0x8c10f
movq %rsi, %r14
testq %rsi, %rsi
je 0x8c10f
movq %rdx, %r13
movq %rdi, %rbx
movq 0x8(%rdi), %rax
movq 0x38(%rax), %rdi
leaq 0x5534c(%rip), %rsi     # 0xe1196
leaq 0x5fc83(%rip), %rdx     # 0xebad4
leaq 0x2f(%rsp), %rcx
xorl %r8d, %r8d
movq %r13, %r9
callq 0x5488a
cmpl $0x2, %eax
je 0x8be94
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x55321(%rip), %rsi     # 0xe1196
leaq 0x6a538(%rip), %rdx     # 0xf63b4
xorl %r15d, %r15d
leaq 0x70(%rsp), %rcx
xorl %r8d, %r8d
movq %r13, %r9
callq 0x53e39
cmpl $0x2, %eax
jne 0x8beae
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl %r15d, %eax
addq $0x2090, %rsp           # imm = 0x2090
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %r14, %rdi
callq 0x56394
movq %rax, %rdi
callq 0x3c40b
leaq 0x6a501(%rip), %rdi     # 0xf63c6
movq %rax, %rsi
xorl %eax, %eax
callq 0x35a32
cmpb $0x1, 0x2f(%rsp)
jne 0x8be9a
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
callq 0x4eae0
leaq 0x38(%rsp), %rcx
movsd %xmm0, (%rcx)
movabsq $0x401c000000000000, %rax # imm = 0x401C000000000000
movq %rax, 0x30(%rsp)
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x5528c(%rip), %rsi     # 0xe1196
leaq 0x5fbd7(%rip), %rdx     # 0xebae8
xorl %r8d, %r8d
movq %r13, %r9
callq 0x545d2
cmpl $0x2, %eax
je 0x8be94
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x55262(%rip), %rsi     # 0xe1196
leaq 0x5fbc5(%rip), %rdx     # 0xebb00
leaq 0x30(%rsp), %rcx
xorl %r8d, %r8d
movq %r13, %r9
callq 0x545d2
cmpl $0x2, %eax
je 0x8be94
leaq 0x60d64(%rip), %rdi     # 0xeccbf
callq 0x3c03d
movq %rax, %r12
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x55224(%rip), %rsi     # 0xe1196
leaq 0x6a461(%rip), %rdx     # 0xf63da
movq %r12, %rcx
xorl %r8d, %r8d
movq %r13, %r9
callq 0x542cf
cmpl $0x2, %eax
jne 0x8bf99
movq %r12, %rdi
callq 0x3d1eb
jmp 0x8be94
movq 0x8(%rbx), %rax
movq 0x58(%rax), %r13
movq %r12, %rdi
callq 0x3c40b
movsd 0x38(%rsp), %xmm0
xorl %r15d, %r15d
movq %r13, %rdi
movq %rax, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x4ebe6
movsd 0x38(%rsp), %xmm0
movq 0x8(%rbx), %rax
addsd 0x18(%rax), %xmm0
movsd %xmm0, 0x48(%rsp)
movsd %xmm0, 0x18(%rax)
movq 0x58(%rax), %r13
movsd 0x20(%rax), %xmm0
movsd %xmm0, 0x40(%rsp)
movq %r14, %rdi
callq 0x56394
movq %rax, %rdi
callq 0x3c40b
movups 0x70(%rsp), %xmm0
movups 0x80(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r13, %rdi
movsd 0x40(%rsp), %xmm0
movsd 0x48(%rsp), %xmm1
movq %rax, %rsi
callq 0x4ea5e
movq %r14, %rdi
callq 0x561fd
testq %rax, %rax
je 0x8c0ee
movaps 0x6a2b1(%rip), %xmm0    # 0xf62f0
movaps %xmm0, 0x50(%rsp)
movapd 0x6a2b4(%rip), %xmm0    # 0xf6300
movapd %xmm0, 0x60(%rsp)
cmpq $0x1, %rax
jne 0x8c073
leaq 0x6a395(%rip), %rsi     # 0xf63f4
leaq 0x90(%rsp), %rdi
movl $0x2000, %edx           # imm = 0x2000
callq 0xb2d0
jmp 0x8c091
leaq 0x6a3a9(%rip), %rdx     # 0xf6423
leaq 0x90(%rsp), %rdi
movl $0x2000, %esi           # imm = 0x2000
movq %rax, %rcx
xorl %eax, %eax
callq 0xba10
movq 0x8(%rbx), %rax
movq 0x58(%rax), %r13
movq %r14, %rdi
callq 0x56394
movq %rax, %rdi
callq 0x3c40b
movq %r13, %rdi
movq %rax, %rsi
callq 0x4eb2d
movq 0x8(%rbx), %rax
addsd 0x20(%rax), %xmm0
movq 0x58(%rax), %rdi
addsd 0x6a1df(%rip), %xmm0    # 0xf62a8
movsd 0x18(%rax), %xmm1
movaps 0x50(%rsp), %xmm2
movaps 0x60(%rsp), %xmm3
movups %xmm3, 0x10(%rsp)
movups %xmm2, (%rsp)
leaq 0x90(%rsp), %rsi
callq 0x4ea5e
movsd 0x30(%rsp), %xmm0
movq 0x8(%rbx), %rax
addsd 0x18(%rax), %xmm0
movsd %xmm0, 0x18(%rax)
movq %r12, %rdi
callq 0x3d1eb
jmp 0x8be9a
callq 0x214b5