// File: /workspace/github_c_makefile_star2_O3/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 0x8bbff
movq %rsi, %r14
testq %rsi, %rsi
je 0x8bbff
movq %rdx, %r13
movq %rdi, %rbx
movq 0x8(%rdi), %rax
movq 0x38(%rax), %rdi
leaq 0x5585c(%rip), %rsi     # 0xe1196
leaq 0x60143(%rip), %rdx     # 0xeba84
leaq 0x2f(%rsp), %rcx
xorl %r8d, %r8d
movq %r13, %r9
callq 0x53bf6
cmpl $0x2, %eax
je 0x8b984
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x55831(%rip), %rsi     # 0xe1196
leaq 0x6a9e8(%rip), %rdx     # 0xf6354
xorl %r15d, %r15d
leaq 0x70(%rsp), %rcx
xorl %r8d, %r8d
movq %r13, %r9
callq 0x531a5
cmpl $0x2, %eax
jne 0x8b99e
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 0x555b5
movq %rax, %rdi
callq 0x3bb5d
leaq 0x6a9b1(%rip), %rdi     # 0xf6366
movq %rax, %rsi
xorl %eax, %eax
callq 0x353ae
cmpb $0x1, 0x2f(%rsp)
jne 0x8b98a
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
callq 0x4de34
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 0x5579c(%rip), %rsi     # 0xe1196
leaq 0x60097(%rip), %rdx     # 0xeba98
xorl %r8d, %r8d
movq %r13, %r9
callq 0x5393e
cmpl $0x2, %eax
je 0x8b984
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x55772(%rip), %rsi     # 0xe1196
leaq 0x60085(%rip), %rdx     # 0xebab0
leaq 0x30(%rsp), %rcx
xorl %r8d, %r8d
movq %r13, %r9
callq 0x5393e
cmpl $0x2, %eax
je 0x8b984
leaq 0x61224(%rip), %rdi     # 0xecc6f
callq 0x3b785
movq %rax, %r12
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x55734(%rip), %rsi     # 0xe1196
leaq 0x6a911(%rip), %rdx     # 0xf637a
movq %r12, %rcx
xorl %r8d, %r8d
movq %r13, %r9
callq 0x5363b
cmpl $0x2, %eax
jne 0x8ba89
movq %r12, %rdi
callq 0x3c87b
jmp 0x8b984
movq 0x8(%rbx), %rax
movq 0x58(%rax), %r13
movq %r12, %rdi
callq 0x3bb5d
movsd 0x38(%rsp), %xmm0
xorl %r15d, %r15d
movq %r13, %rdi
movq %rax, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x4df3a
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 0x555b5
movq %rax, %rdi
callq 0x3bb5d
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 0x4ddb2
movq %r14, %rdi
callq 0x55439
testq %rax, %rax
je 0x8bbde
movaps 0x6a761(%rip), %xmm0    # 0xf6290
movaps %xmm0, 0x50(%rsp)
movapd 0x6a764(%rip), %xmm0    # 0xf62a0
movapd %xmm0, 0x60(%rsp)
cmpq $0x1, %rax
jne 0x8bb63
leaq 0x6a845(%rip), %rsi     # 0xf6394
leaq 0x90(%rsp), %rdi
movl $0x2000, %edx           # imm = 0x2000
callq 0xb2d0
jmp 0x8bb81
leaq 0x6a859(%rip), %rdx     # 0xf63c3
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 0x555b5
movq %rax, %rdi
callq 0x3bb5d
movq %r13, %rdi
movq %rax, %rsi
callq 0x4de81
movq 0x8(%rbx), %rax
addsd 0x20(%rax), %xmm0
movq 0x58(%rax), %rdi
addsd 0x6a68f(%rip), %xmm0    # 0xf6248
movsd 0x18(%rax), %xmm1
movaps 0x50(%rsp), %xmm2
movaps 0x60(%rsp), %xmm3
movups %xmm3, 0x10(%rsp)
movups %xmm2, (%rsp)
leaq 0x90(%rsp), %rsi
callq 0x4ddb2
movsd 0x30(%rsp), %xmm0
movq 0x8(%rbx), %rax
addsd 0x18(%rax), %xmm0
movsd %xmm0, 0x18(%rax)
movq %r12, %rdi
callq 0x3c87b
jmp 0x8b98a
callq 0x21416