// File: /workspace/github_c_makefile_star2_O1/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 0x8b101
movq %rax, 0x60(%rsp)
testq %rbx, %rbx
je 0x8cbf3
testq %r14, %r14
je 0x8cbf3
movaps 0x69e8a(%rip), %xmm0    # 0xf6310
movaps %xmm0, 0xe0(%rsp)
movapd 0x69e8a(%rip), %xmm0    # 0xf6320
movapd %xmm0, 0xf0(%rsp)
movq %r14, %rdi
callq 0x8b0e2
movl %eax, %ebp
movq %r14, %rdi
callq 0x8ac4f
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 0x8b111
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x8c5fb
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x54ca8(%rip), %rsi     # 0xe1196
leaq 0x60b54(%rip), %rdx     # 0xed049
leaq 0x58(%rsp), %rcx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x545d2
cmpl $0x2, %eax
je 0x8c5f6
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x54c79(%rip), %rsi     # 0xe1196
leaq 0x69fad(%rip), %rdx     # 0xf64d1
leaq 0x90(%rsp), %rcx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x545d2
cmpl $0x2, %eax
je 0x8c5f6
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x54c47(%rip), %rsi     # 0xe1196
leaq 0x69f89(%rip), %rdx     # 0xf64df
leaq 0x70(%rsp), %rcx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x545d2
cmpl $0x2, %eax
je 0x8c5f6
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x54c18(%rip), %rsi     # 0xe1196
leaq 0x69f66(%rip), %rdx     # 0xf64eb
leaq 0x68(%rsp), %rcx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x545d2
cmpl $0x2, %eax
je 0x8c5f6
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rax
movq %rax, 0x48(%rsp)
movq %r14, %rdi
callq 0x8afdd
movq %rax, 0x80(%rsp)
movq 0x8(%rbx), %rax
movq 0x40(%rax), %rdi
callq 0x56394
movq %r15, (%rsp)
leaq 0x69f29(%rip), %rdx     # 0xf64f8
leaq 0xa0(%rsp), %rcx
movq 0x48(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq 0x80(%rsp), %r8
movq %rax, %r9
callq 0x53a23
cmpl $0x2, %eax
jne 0x8c60f
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
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 0x8e1f4
movsd 0x8(%rbp), %xmm0
movsd %xmm0, 0x48(%rsp)
movl 0x10(%rbp), %r13d
movq 0x8(%rbx), %rax
movsd 0x28(%rax), %xmm0
unpcklps 0x54e11(%rip), %xmm0    # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x54e19(%rip), %xmm0    # 0xe1490
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 0x8b0aa
testb %al, %al
je 0x8c81d
movq %r14, %rdi
callq 0x8ac63
movq %rax, %rdi
callq 0x3c40b
testq %rax, %rax
je 0x8c81d
movq %rax, %r12
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
callq 0x4eae0
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 0x54a77(%rip), %rsi     # 0xe1196
leaq 0x606f9(%rip), %rdx     # 0xece1f
xorl %r8d, %r8d
movq %r15, %r9
callq 0x545d2
cmpl $0x2, %eax
je 0x8c5f6
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x54a4d(%rip), %rsi     # 0xe1196
leaq 0x60574(%rip), %rdx     # 0xeccc4
leaq 0xc0(%rsp), %rcx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x545d2
cmpl $0x2, %eax
je 0x8c5f6
movl %r13d, 0x78(%rsp)
leaq 0x60547(%rip), %rdi     # 0xeccbf
callq 0x3c03d
movq %rax, %r13
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x54a07(%rip), %rsi     # 0xe1196
leaq 0x60546(%rip), %rdx     # 0xeccdc
movq %r13, %rcx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x542cf
cmpl $0x2, %eax
jne 0x8c7b6
movq %r13, %rdi
callq 0x3d1eb
jmp 0x8c5f6
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rbp
movq %r13, %rdi
callq 0x3c40b
movsd 0xc0(%rsp), %xmm0
movq %rbp, %rdi
movq %rax, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x4ebe6
movq %r13, %rdi
callq 0x3d1eb
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
movsd 0x58(%rsp), %xmm1
mulsd 0x5e984(%rip), %xmm1    # 0xeb180
addsd 0x18(%rax), %xmm1
subsd 0x98(%rsp), %xmm1
movsd 0x50(%rsp), %xmm0
movq %r12, %rsi
callq 0x4e929
movl 0x78(%rsp), %r13d
movsd 0x48(%rsp), %xmm0
mulsd 0x100(%rsp), %xmm0
subsd 0x80(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
movq %r14, %rdi
callq 0x8b019
testb %al, %al
jne 0x8c922
movsd 0x90(%rsp), %xmm1
movsd 0x48(%rsp), %xmm0
callq 0x7a0a0
testb %al, %al
je 0x8c922
movq 0x8(%rbx), %rax
movq 0x50(%rax), %rdi
testq %rdi, %rdi
je 0x8c9ba
movsd 0x69a30(%rip), %xmm0    # 0xf62b0
ucomisd 0x48(%rsp), %xmm0
jb 0x8c9ba
movapd 0x80(%rsp), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x5df07(%rip), %xmm0    # 0xea7b0
cvttsd2si %xmm0, %r15
andq %rcx, %r15
orq %rax, %r15
movq %r15, %rsi
callq 0x70b1b
testb %al, %al
jne 0x8cb4f
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
movsd 0x58(%rsp), %xmm2
movsd 0x5e8a6(%rip), %xmm1    # 0xeb180
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 0x4eefb
movq 0x8(%rbx), %rax
movq 0x50(%rax), %rdi
movq %r15, %rsi
callq 0x70790
jmp 0x8cb4f
movq 0x8(%rbx), %rax
movq 0x38(%rax), %rdi
leaq 0x54865(%rip), %rsi     # 0xe1196
leaq 0x69bc7(%rip), %rdx     # 0xf64ff
leaq 0xa0(%rsp), %rcx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x53e39
cmpl $0x2, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
je 0x8c5fb
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
movsd 0x58(%rsp), %xmm3
movsd 0x5e811(%rip), %xmm1    # 0xeb180
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)
movsd 0x50(%rsp), %xmm0
movsd 0x48(%rsp), %xmm2
movl $0x3, %esi
callq 0x4f06c
xorl %ecx, %ecx
jmp 0x8c5fb
movl %r13d, %ebp
movq 0x38(%rax), %r12
movq %r14, %rdi
callq 0x8afdd
movq %rax, %r13
movq 0x8(%rbx), %rax
movq 0x40(%rax), %rdi
callq 0x56394
movq %r15, (%rsp)
leaq 0x64b2b(%rip), %rdx     # 0xf150f
leaq 0xc0(%rsp), %rcx
movq %r12, %rdi
movq 0x60(%rsp), %rsi
movq %r13, %r8
movq %rax, %r9
callq 0x53a23
cmpl $0x2, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
je 0x8c5fb
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
movsd 0x58(%rsp), %xmm3
movsd 0x5e75d(%rip), %xmm1    # 0xeb180
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)
movsd 0x50(%rsp), %xmm0
movsd 0x48(%rsp), %xmm2
movl 0x7c(%rsp), %esi
movl $0x1, %edx
callq 0x4ef89
testl %ebp, %ebp
je 0x8cae6
cmpl $0x3, %ebp
je 0x8ca97
cmpl $0x1, %ebp
jne 0x8cb4f
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
movsd 0x18(%rax), %xmm1
movsd 0x20(%rax), %xmm0
addsd 0x69807(%rip), %xmm0    # 0xf62b8
addsd 0x69807(%rip), %xmm1    # 0xf62c0
movapd 0xe0(%rsp), %xmm2
movapd 0xf0(%rsp), %xmm3
movupd %xmm3, 0x10(%rsp)
movupd %xmm2, (%rsp)
xorl %esi, %esi
callq 0x4f29d
cmpl $0x3, %ebp
je 0x8cae6
testl %ebp, %ebp
jne 0x8cb4f
movq 0x8(%rbx), %rax
movsd 0x28(%rax), %xmm1
unpcklps 0x5498a(%rip), %xmm1    # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x54992(%rip), %xmm1    # 0xe1490
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
subsd 0x20(%rax), %xmm0
addsd 0x69791(%rip), %xmm0    # 0xf62a8
movq 0x58(%rax), %rdi
movsd 0x18(%rax), %xmm1
addsd 0x69798(%rip), %xmm1    # 0xf62c0
movapd 0xe0(%rsp), %xmm2
movapd 0xf0(%rsp), %xmm3
movupd %xmm3, 0x10(%rsp)
movupd %xmm2, (%rsp)
movl $0x1, %esi
callq 0x4f29d
movq 0x8(%rbx), %rax
cmpq $0x0, 0x60(%rax)
je 0x8cbe9
movsd 0x18(%rax), %xmm0
movsd 0x58(%rsp), %xmm1
mulsd 0x5db2f(%rip), %xmm1    # 0xea6a0
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 0x8afdd
movsd 0x50(%rsp), %xmm0
movsd 0x60(%rsp), %xmm1
movsd 0x48(%rsp), %xmm2
movsd 0x80(%rsp), %xmm3
movq %rax, %rdi
callq 0x53308
movq %rax, %r14
movq 0x8(%rbx), %rax
movq 0x60(%rax), %rdi
movq %r14, %rsi
callq 0x52237
movq %r14, %rdi
movl $0x1, %esi
callq 0x53404
movl $0x1, %ecx
jmp 0x8c5fb
callq 0x21597