// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2098, %rsp           # imm = 0x2098
movb $0x1, 0x2f(%rsp)
testq %rdi, %rdi
je 0x6cc13
movq %rsi, %r14
testq %rsi, %rsi
je 0x6cc13
movq %rdx, %r13
movq %rdi, %rbx
movq 0x8(%rdi), %rax
movq 0x38(%rax), %rdi
leaq 0x5d849(%rip), %rsi     # 0xca196
leaq 0x68120(%rip), %rdx     # 0xd4a74
leaq 0x2f(%rsp), %rcx
xorl %r8d, %r8d
movq %r13, %r9
callq 0x3440a
pushq $-0x1
popq %rbp
cmpl $0x2, %eax
je 0x6c99a
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x5d81b(%rip), %rsi     # 0xca196
leaq 0x72d22(%rip), %rdx     # 0xdf6a4
xorl %r15d, %r15d
leaq 0x70(%rsp), %rcx
xorl %r8d, %r8d
movq %r13, %r9
callq 0x335b5
cmpl $0x2, %eax
jne 0x6c9b2
movl %ebp, %r15d
movl %r15d, %eax
addq $0x2098, %rsp           # imm = 0x2098
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x3629f
movq %rax, %rdi
callq 0x143d2
leaq 0x72ced(%rip), %rdi     # 0xdf6b6
movq %rax, %rsi
xorl %eax, %eax
callq 0xc5d2
cmpb $0x1, 0x2f(%rsp)
jne 0x6c99d
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
callq 0x2c939
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 0x5d788(%rip), %rsi     # 0xca196
leaq 0x68073(%rip), %rdx     # 0xd4a88
xorl %r8d, %r8d
movq %r13, %r9
callq 0x33ff8
cmpl $0x2, %eax
je 0x6c99a
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x5d75e(%rip), %rsi     # 0xca196
leaq 0x68061(%rip), %rdx     # 0xd4aa0
leaq 0x30(%rsp), %rcx
xorl %r8d, %r8d
movq %r13, %r9
callq 0x33ff8
cmpl $0x2, %eax
je 0x6c99a
leaq 0x69200(%rip), %rdi     # 0xd5c5f
callq 0x13da9
movq %rax, %r12
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x5d720(%rip), %rsi     # 0xca196
leaq 0x72c4d(%rip), %rdx     # 0xdf6ca
movq %r12, %rcx
xorl %r8d, %r8d
movq %r13, %r9
callq 0x33b98
cmpl $0x2, %eax
jne 0x6ca9d
movq %r12, %rdi
callq 0x152db
jmp 0x6c99a
movq 0x8(%rbx), %rax
movq 0x58(%rax), %r13
movq %r12, %rdi
callq 0x143d2
movsd 0x38(%rsp), %xmm0
xorl %r15d, %r15d
movq %r13, %rdi
movq %rax, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x2cad8
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 0x3629f
movq %rax, %rdi
callq 0x143d2
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 0x2c884
movq %r14, %rdi
callq 0x3607a
testq %rax, %rax
je 0x6cbf2
movaps 0x72a9d(%rip), %xmm0    # 0xdf5e0
movaps %xmm0, 0x50(%rsp)
movapd 0x72aa0(%rip), %xmm0    # 0xdf5f0
movapd %xmm0, 0x60(%rsp)
cmpq $0x1, %rax
jne 0x6cb77
leaq 0x72b81(%rip), %rsi     # 0xdf6e4
leaq 0x90(%rsp), %rdi
movl $0x2000, %edx           # imm = 0x2000
callq 0xb2d0
jmp 0x6cb95
leaq 0x72b95(%rip), %rdx     # 0xdf713
leaq 0x90(%rsp), %rdi
movl $0x2000, %esi           # imm = 0x2000
movq %rax, %rcx
xorl %eax, %eax
callq 0xba00
movq 0x8(%rbx), %rax
movq 0x58(%rax), %r13
movq %r14, %rdi
callq 0x3629f
movq %rax, %rdi
callq 0x143d2
movq %r13, %rdi
movq %rax, %rsi
callq 0x2c9b9
movq 0x8(%rbx), %rax
addsd 0x20(%rax), %xmm0
movq 0x58(%rax), %rdi
addsd 0x729db(%rip), %xmm0    # 0xdf5a8
movsd 0x18(%rax), %xmm1
movaps 0x50(%rsp), %xmm2
movaps 0x60(%rsp), %xmm3
movups %xmm3, 0x10(%rsp)
movups %xmm2, (%rsp)
leaq 0x90(%rsp), %rsi
callq 0x2c884
movsd 0x30(%rsp), %xmm0
movq 0x8(%rbx), %rax
addsd 0x18(%rax), %xmm0
movsd %xmm0, 0x18(%rax)
movq %r12, %rdi
callq 0x152db
jmp 0x6c99d
movq 0xc139e(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x5d442(%rip), %rsi     # 0xca066
leaq 0x668e6(%rip), %rdx     # 0xd3511
leaq 0x72a2e(%rip), %rcx     # 0xdf660
leaq 0x72a47(%rip), %r8      # 0xdf680
pushq $0x48
popq %r9
xorl %eax, %eax
callq 0xb8c0
callq 0xb300