// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/annotationsketch/canvas_cairo.c
// Function: gt_canvas_cairo_visit_block
int gt_canvas_cairo_visit_block(GtCanvas *canvas, GtBlock *block,
                                GtError *err)
{
  int had_err = 0, arrow_status = ARROW_NONE;
  GtRange block_range;
  GtDrawingRange draw_range;
  GtColor grey, fillcolor, strokecolor;
  double block_start,
         block_width,
         bar_height = BAR_HEIGHT_DEFAULT,
         min_len_block = MIN_LEN_BLOCK_DEFAULT,
         arrow_width = ARROW_WIDTH_DEFAULT,
         stroke_width = STROKE_WIDTH_DEFAULT;
  const char *caption, *btype;
  GtStrand strand;
  double maxbarheight;
  btype = gt_block_get_type(block);

  gt_assert(canvas && block);

  grey.red = grey.green = grey.blue = DEFAULT_GREY_TONE;
  grey.alpha = 0.5;
  strand = gt_block_get_strand(block);
  block_range = gt_block_get_range(block);
  if (gt_block_get_max_height(block, &maxbarheight, canvas->pvt->sty, err)) {
    return -1;
  }
  if (gt_style_get_num(canvas->pvt->sty, "format", "bar_height", &bar_height,
                       NULL, err) == GT_STYLE_QUERY_ERROR) {
    return -1;
  }
  if (gt_style_get_num(canvas->pvt->sty, "format", "min_len_block",
                       &min_len_block,NULL, err) == GT_STYLE_QUERY_ERROR) {
    return -1;
  }
  if (gt_style_get_num(canvas->pvt->sty, "format", "arrow_width", &arrow_width,
                       NULL, err) == GT_STYLE_QUERY_ERROR) {
    return -1;
  }
  if (gt_style_get_num(canvas->pvt->sty, "format", "stroke_width",
                       &stroke_width, NULL, err) == GT_STYLE_QUERY_ERROR) {
    return -1;
  }
  if (gt_style_get_color_with_track(canvas->pvt->sty,
                                 btype, "stroke", &strokecolor,
                                 gt_block_get_top_level_feature(block),
                                 gt_track_get_title(canvas->pvt->current_track),
                                 err) == GT_STYLE_QUERY_ERROR) {
    return -1;
  }

  if (strand == GT_STRAND_REVERSE || strand == GT_STRAND_BOTH)
    arrow_status = ARROW_LEFT;
  if (strand == GT_STRAND_FORWARD || strand == GT_STRAND_BOTH)
    arrow_status = (arrow_status == ARROW_LEFT ? ARROW_BOTH : ARROW_RIGHT);

  /* calculate scaled drawing coordinates for this canvas */
  draw_range = gt_coords_calc_generic_range(block_range,
                                            canvas->pvt->viewrange);
  draw_range.start *= canvas->pvt->width-2*canvas->pvt->margins;
  draw_range.end *= canvas->pvt->width-2*canvas->pvt->margins;
  block_start = draw_range.start + canvas->pvt->margins;
  block_width = draw_range.end - draw_range.start;

  /* draw block caption */
  if (gt_block_caption_is_visible(block))
  {
    GtStr *fontfam = NULL;
    caption = gt_str_get(gt_block_get_caption(block));
    if (caption)
    {
      double theight = gt_graphics_get_text_height(canvas->pvt->g),
             captionspace = CAPTION_BAR_SPACE_DEFAULT;
      if (gt_style_get_num(canvas->pvt->sty,
                           "format", "block_caption_space",
                           &captionspace, NULL, err) == GT_STYLE_QUERY_ERROR) {
        return -1;
      }
      if (gt_style_get_num(canvas->pvt->sty,
                          "format", "block_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", "block_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);
      gt_str_delete(fontfam);
      gt_graphics_draw_text_clip(canvas->pvt->g,
                                 block_start,
                                 canvas->pvt->y - bar_height/2
                                                - captionspace,
                                 caption);
    }
  }

  /* do not draw further details in very small blocks */
  if (!gt_block_has_only_one_fullsize_element(block)
       && gt_double_smaller_double(block_width, min_len_block))
  {
    /* optimise drawing for very narrow blocks,
       if <= 1px/pt width, draw as simple lines */
    if (canvas->pvt->bt && draw_range.end-draw_range.start <= 1.1)
    {
      if (!gt_bittab_bit_is_set(canvas->pvt->bt,
                                (GtUword) draw_range.start)) {
        gt_graphics_draw_vertical_line(canvas->pvt->g,
                                       block_start,
                                       canvas->pvt->y - bar_height/2,
                                       strokecolor,
                                       bar_height,
                                       stroke_width);
        gt_bittab_set_bit(canvas->pvt->bt, (GtUword) draw_range.start);
      }
    } else {
      if (gt_style_get_color_with_track(canvas->pvt->sty,
                             btype, "fill",
                             &fillcolor,
                             gt_block_get_top_level_feature(block),
                             gt_track_get_title(canvas->pvt->current_track),
                             err) == GT_STYLE_QUERY_ERROR) {
        return -1;
      }

      gt_graphics_draw_box(canvas->pvt->g,
                           block_start,
                           canvas->pvt->y - bar_height/2,
                           block_width,
                           bar_height,
                           fillcolor,
                           arrow_status,
                           arrow_width,
                           stroke_width,
                           strokecolor,
                           true);

      /* draw arrowheads at clipped margins */
      if (draw_range.clip == CLIPPED_LEFT || draw_range.clip == CLIPPED_BOTH)
          gt_graphics_draw_arrowhead(canvas->pvt->g,
                                     canvas->pvt->margins - 10,
                                     canvas->pvt->y - 4,
                                     grey,
                                     ARROW_LEFT);
      if (draw_range.clip == CLIPPED_RIGHT || draw_range.clip == CLIPPED_BOTH)
          gt_graphics_draw_arrowhead(canvas->pvt->g,
                                     canvas->pvt->width-canvas->pvt->margins
                                       + 10,
                                     canvas->pvt->y - 4,
                                     grey,
                                     ARROW_RIGHT);
    }

    /* register coordinates in GtImageInfo object if available */
    if (canvas->pvt->ii)
    {
      GtRecMap *rm = gt_rec_map_new(block_start,
                                    canvas->pvt->y - bar_height/2,
                                    block_start + block_width,
                                    canvas->pvt->y + bar_height/2,
                                    (GtFeatureNode*) /* XXX */
                                      gt_block_get_top_level_feature(block));
      gt_image_info_add_rec_map(canvas->pvt->ii, rm);
      gt_rec_map_set_omitted_children(rm, true);
    }
    /* signal break */
    return 1;
  }

  /* get stroke color */
  if (gt_style_get_color(canvas->pvt->sty,
                         "format", "default_stroke_color",
                         &strokecolor, NULL, err) == GT_STYLE_QUERY_ERROR) {
    return -1;
  }

  /* draw parent block boundaries */
  gt_graphics_draw_dashes(canvas->pvt->g,
                          block_start,
                          canvas->pvt->y - bar_height/2,
                          block_width,
                          bar_height,
                          ARROW_NONE,
                          arrow_width,
                          stroke_width,
                          strokecolor);
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movabsq $0x4030000000000000, %rax # imm = 0x4030000000000000
movq %rax, 0x58(%rsp)
movabsq $0x4034000000000000, %rax # imm = 0x4034000000000000
movq %rax, 0x90(%rsp)
movabsq $0x4018000000000000, %rax # imm = 0x4018000000000000
movq %rax, 0x70(%rsp)
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, 0x68(%rsp)
movq %rsi, %rdi
callq 0x6bb96
movq %rax, 0x60(%rsp)
testq %rbx, %rbx
je 0x6d7a8
testq %r14, %r14
je 0x6d7a8
movaps 0x725b7(%rip), %xmm0    # 0xdf600
movaps %xmm0, 0xe0(%rsp)
movapd 0x725b7(%rip), %xmm0    # 0xdf610
movapd %xmm0, 0xf0(%rsp)
movq %r14, %rdi
callq 0x6bb11
movl %eax, %ebp
movq %r14, %rdi
callq 0x6b254
movq %rax, %r13
movq %rdx, %r12
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdx
leaq 0x110(%rsp), %rsi
movq %r14, %rdi
movq %r15, %rcx
callq 0x6bbd9
pushq $-0x1
popq %rcx
testl %eax, %eax
jne 0x6d1ba
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x5d0e7(%rip), %rsi     # 0xca196
leaq 0x68f3b(%rip), %rdx     # 0xd5ff1
leaq 0x58(%rsp), %rcx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x33ff8
cmpl $0x2, %eax
je 0x6d1b7
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x5d0b8(%rip), %rsi     # 0xca196
leaq 0x726dc(%rip), %rdx     # 0xdf7c1
leaq 0x90(%rsp), %rcx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x33ff8
cmpl $0x2, %eax
je 0x6d1b7
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x5d086(%rip), %rsi     # 0xca196
leaq 0x726b8(%rip), %rdx     # 0xdf7cf
leaq 0x70(%rsp), %rcx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x33ff8
cmpl $0x2, %eax
je 0x6d1b7
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x5d057(%rip), %rsi     # 0xca196
leaq 0x72695(%rip), %rdx     # 0xdf7db
leaq 0x68(%rsp), %rcx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x33ff8
cmpl $0x2, %eax
je 0x6d1b7
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rax
movq %rax, 0x48(%rsp)
movq %r14, %rdi
callq 0x6b84b
movq %rax, 0x80(%rsp)
movq 0x8(%rbx), %rax
movq 0x40(%rax), %rdi
callq 0x3629f
movq %r15, (%rsp)
leaq 0x72658(%rip), %rdx     # 0xdf7e8
leaq 0xa0(%rsp), %rcx
movq 0x48(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq 0x80(%rsp), %r8
movq %rax, %r9
callq 0x330ce
cmpl $0x2, %eax
jne 0x6d1ce
pushq $-0x1
popq %rcx
movl %ecx, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leal -0x1(%rbp), %eax
xorl %edx, %edx
xorl %ecx, %ecx
cmpl $0x2, %eax
setae %cl
adcl $0x1, %edx
leal (%rcx,%rcx,2), %eax
testl $0xfffffffd, %ebp       # imm = 0xFFFFFFFD
cmovnel %eax, %edx
movl %edx, 0x7c(%rsp)
movq 0x8(%rbx), %rax
movq (%rax), %rcx
movq 0x8(%rax), %r8
leaq 0xc0(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x6eef0
movsd 0x8(%rbp), %xmm0
movsd %xmm0, 0x48(%rsp)
movl 0x10(%rbp), %r13d
movq 0x8(%rbx), %rax
movsd 0x28(%rax), %xmm0
unpcklps 0x5d252(%rip), %xmm0    # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x5d25a(%rip), %xmm0    # 0xca490
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
movsd 0x20(%rax), %xmm1
movapd %xmm1, %xmm0
addsd %xmm1, %xmm0
subsd %xmm0, %xmm2
movsd (%rbp), %xmm0
movapd %xmm2, 0x100(%rsp)
mulsd %xmm2, %xmm0
movapd %xmm0, 0x80(%rsp)
addsd %xmm0, %xmm1
movsd %xmm1, 0x50(%rsp)
movq %r14, %rdi
callq 0x6ba40
testb %al, %al
je 0x6d3dc
movq %r14, %rdi
callq 0x6b29b
movq %rax, %rdi
callq 0x143d2
testq %rax, %rax
je 0x6d3dc
movq %rax, %r12
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
callq 0x2c939
movsd %xmm0, 0xc0(%rsp)
movabsq $0x401c000000000000, %rax # imm = 0x401C000000000000
leaq 0x98(%rsp), %rcx
movq %rax, (%rcx)
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x5ceb8(%rip), %rsi     # 0xca196
leaq 0x68ae2(%rip), %rdx     # 0xd5dc7
xorl %r8d, %r8d
movq %r15, %r9
callq 0x33ff8
cmpl $0x2, %eax
je 0x6d1b7
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x5ce8e(%rip), %rsi     # 0xca196
leaq 0x68955(%rip), %rdx     # 0xd5c64
leaq 0xc0(%rsp), %rcx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x33ff8
cmpl $0x2, %eax
je 0x6d1b7
movl %r13d, 0x78(%rsp)
leaq 0x68928(%rip), %rdi     # 0xd5c5f
callq 0x13da9
movq %rax, %r13
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x5ce48(%rip), %rsi     # 0xca196
leaq 0x68927(%rip), %rdx     # 0xd5c7c
movq %r13, %rcx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x33b98
cmpl $0x2, %eax
jne 0x6d375
movq %r13, %rdi
callq 0x152db
jmp 0x6d1b7
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rbp
movq %r13, %rdi
callq 0x143d2
movsd 0xc0(%rsp), %xmm0
movq %rbp, %rdi
movq %rax, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x2cad8
movq %r13, %rdi
callq 0x152db
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
movsd 0x58(%rsp), %xmm1
mulsd 0x66d65(%rip), %xmm1    # 0xd4120
addsd 0x18(%rax), %xmm1
subsd 0x98(%rsp), %xmm1
movsd 0x50(%rsp), %xmm0
movq %r12, %rsi
callq 0x2c6b6
movl 0x78(%rsp), %r13d
movsd 0x48(%rsp), %xmm0
mulsd 0x100(%rsp), %xmm0
subsd 0x80(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
movq %r14, %rdi
callq 0x6b920
testb %al, %al
jne 0x6d4e1
movsd 0x90(%rsp), %xmm1
movsd 0x48(%rsp), %xmm0
callq 0x58dba
testb %al, %al
je 0x6d4e1
movq 0x8(%rbx), %rax
movq 0x50(%rax), %rdi
testq %rdi, %rdi
je 0x6d575
movsd 0x6d4b9(%rip), %xmm0    # 0xda8f8
ucomisd 0x48(%rsp), %xmm0
jb 0x6d575
movapd 0x80(%rsp), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x662e8(%rip), %xmm0    # 0xd3750
cvttsd2si %xmm0, %r15
andq %rcx, %r15
orq %rax, %r15
movq %r15, %rsi
callq 0x4de2d
testb %al, %al
jne 0x6d700
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
movsd 0x58(%rsp), %xmm2
movsd 0x66c87(%rip), %xmm1    # 0xd4120
mulsd %xmm2, %xmm1
addsd 0x18(%rax), %xmm1
movsd 0x68(%rsp), %xmm3
movups 0xa0(%rsp), %xmm0
movups 0xb0(%rsp), %xmm4
movups %xmm4, 0x10(%rsp)
movups %xmm0, (%rsp)
movsd 0x50(%rsp), %xmm0
callq 0x2cf85
movq 0x8(%rbx), %rax
movq 0x50(%rax), %rdi
movq %r15, %rsi
callq 0x4d737
jmp 0x6d700
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x5cca6(%rip), %rsi     # 0xca196
leaq 0x722f8(%rip), %rdx     # 0xdf7ef
leaq 0xa0(%rsp), %rcx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x335b5
cmpl $0x2, %eax
pushq $-0x1
popq %rcx
je 0x6d1ba
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
movsd 0x58(%rsp), %xmm3
movsd 0x66bf4(%rip), %xmm1    # 0xd4120
mulsd %xmm3, %xmm1
addsd 0x18(%rax), %xmm1
movsd 0x70(%rsp), %xmm4
movsd 0x68(%rsp), %xmm5
movups 0xa0(%rsp), %xmm0
movups 0xb0(%rsp), %xmm2
movups %xmm2, 0x10(%rsp)
movups %xmm0, (%rsp)
pushq $0x3
popq %rsi
movsd 0x50(%rsp), %xmm0
movsd 0x48(%rsp), %xmm2
callq 0x2d15c
xorl %ecx, %ecx
jmp 0x6d1ba
movl %r13d, %ebp
movq 0x38(%rax), %r12
movq %r14, %rdi
callq 0x6b84b
movq %rax, %r13
movq 0x8(%rbx), %rax
movq 0x40(%rax), %rdi
callq 0x3629f
movq %r15, (%rsp)
leaq 0x6ced0(%rip), %rdx     # 0xda46f
leaq 0xc0(%rsp), %rcx
movq %r12, %rdi
movq 0x60(%rsp), %rsi
movq %r13, %r8
movq %rax, %r9
callq 0x330ce
cmpl $0x2, %eax
pushq $-0x1
popq %rcx
je 0x6d1ba
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
movsd 0x58(%rsp), %xmm3
movsd 0x66b44(%rip), %xmm1    # 0xd4120
mulsd %xmm3, %xmm1
addsd 0x18(%rax), %xmm1
movsd 0x70(%rsp), %xmm4
movsd 0x68(%rsp), %xmm5
movups 0xa0(%rsp), %xmm0
movups 0xb0(%rsp), %xmm2
movups %xmm2, 0x30(%rsp)
movups %xmm0, 0x20(%rsp)
movups 0xc0(%rsp), %xmm0
movups 0xd0(%rsp), %xmm2
movups %xmm2, 0x10(%rsp)
movups %xmm0, (%rsp)
pushq $0x1
popq %rdx
movsd 0x50(%rsp), %xmm0
movsd 0x48(%rsp), %xmm2
movl 0x7c(%rsp), %esi
callq 0x2d046
testl %ebp, %ebp
je 0x6d699
cmpl $0x3, %ebp
je 0x6d64e
cmpl $0x1, %ebp
jne 0x6d700
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
movsd 0x18(%rax), %xmm1
movsd 0x20(%rax), %xmm0
addsd 0x71f48(%rip), %xmm0    # 0xdf5b0
addsd 0x71f48(%rip), %xmm1    # 0xdf5b8
movapd 0xe0(%rsp), %xmm2
movapd 0xf0(%rsp), %xmm3
movupd %xmm3, 0x10(%rsp)
movupd %xmm2, (%rsp)
xorl %esi, %esi
callq 0x2d426
cmpl $0x3, %ebp
jne 0x6d700
movq 0x8(%rbx), %rax
movsd 0x28(%rax), %xmm1
unpcklps 0x5cdd7(%rip), %xmm1    # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x5cddf(%rip), %xmm1    # 0xca490
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
subsd 0x20(%rax), %xmm0
addsd 0x71ede(%rip), %xmm0    # 0xdf5a8
movq 0x58(%rax), %rdi
movsd 0x18(%rax), %xmm1
addsd 0x71edd(%rip), %xmm1    # 0xdf5b8
movapd 0xe0(%rsp), %xmm2
movapd 0xf0(%rsp), %xmm3
movupd %xmm3, 0x10(%rsp)
movupd %xmm2, (%rsp)
pushq $0x1
popq %rsi
callq 0x2d426
movq 0x8(%rbx), %rax
cmpq $0x0, 0x60(%rax)
je 0x6d7a1
movsd 0x18(%rax), %xmm0
movsd 0x58(%rsp), %xmm1
mulsd 0x65f1e(%rip), %xmm1    # 0xd3640
movapd %xmm0, %xmm2
subsd %xmm1, %xmm2
movsd %xmm2, 0x60(%rsp)
movsd 0x48(%rsp), %xmm2
addsd 0x50(%rsp), %xmm2
movsd %xmm2, 0x48(%rsp)
addsd %xmm0, %xmm1
movsd %xmm1, 0x80(%rsp)
movq %r14, %rdi
callq 0x6b84b
movsd 0x50(%rsp), %xmm0
movsd 0x60(%rsp), %xmm1
movsd 0x48(%rsp), %xmm2
movsd 0x80(%rsp), %xmm3
movq %rax, %rdi
callq 0x32510
movq %rax, %r14
movq 0x8(%rbx), %rax
movq 0x60(%rax), %rdi
movq %r14, %rsi
callq 0x30ec2
pushq $0x1
popq %rbx
movq %r14, %rdi
movl %ebx, %esi
callq 0x3275d
movl %ebx, %ecx
jmp 0x6d1ba
pushq $0x1
jmp 0x6d1b9
movq 0xc0809(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x5c8ad(%rip), %rsi     # 0xca066
leaq 0x65dd8(%rip), %rdx     # 0xd3598
leaq 0x71fde(%rip), %rcx     # 0xdf7a5
leaq 0x71eb2(%rip), %r8      # 0xdf680
movl $0xfb, %r9d
xorl %eax, %eax
callq 0xb8c0
callq 0xb300