// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/annotationsketch/graphics_cairo.c
// Function: gt_graphics_cairo_draw_caret
void gt_graphics_cairo_draw_caret(GtGraphics *gg, double x, double y,
                                  double width,double height,
                                  ArrowStatus arrow_status, double arrow_width,
                                  double stroke_width, GtColor stroke_color)
{
  GtGraphicsCairo *g = gt_graphics_cairo_cast(gg);
  gt_assert(g);

  /* save cairo context */
  cairo_save(g->cr);
  cairo_rectangle(g->cr, g->margin_x, g->margin_y,
                  g->width-2*g->margin_x, g->height-2*g->margin_y);
  cairo_clip(g->cr);
  /* create caret path */
  switch (arrow_status)
  {
    case ARROW_RIGHT:
      if (gt_double_smaller_double(0, width - arrow_width))
      {
        width -= arrow_width;
        cairo_move_to(g->cr, x, y + (height/2));
        cairo_line_to(g->cr, x + (width/2), y);
        cairo_line_to(g->cr, x + width, y + (height/2));
        cairo_line_to(g->cr, x + width + arrow_width, y + (height/2));
        /* add arrowhead */
        cairo_move_to(g->cr, x + width, y);
        cairo_line_to(g->cr, x + width + arrow_width, y + height / 2);
        cairo_line_to(g->cr, x + width, y + height);
      }
      break;
    case ARROW_LEFT:
      if (gt_double_smaller_double(0, width - arrow_width))
      {
        width -= arrow_width;
        /* draw arrowhead */
        cairo_move_to(g->cr, x + arrow_width , y);
        cairo_line_to(g->cr, x, y + (height/2));
        cairo_line_to(g->cr, x + arrow_width, y + height);
        cairo_move_to(g->cr, x, y + (height/2));
        cairo_line_to(g->cr, x + arrow_width, y + (height/2));
        cairo_line_to(g->cr, x + arrow_width + (width/2), y);
        cairo_line_to(g->cr, x + arrow_width + width, y + (height/2));
      }
      break;
    case ARROW_BOTH: /* XXX */
    case ARROW_NONE:
     cairo_move_to(g->cr, x, y + (height/2));
     cairo_line_to(g->cr, x + (width/2), y);
     cairo_line_to(g->cr, x + width, y + (height/2));
   }
   /* draw caret */
   cairo_set_line_width(g->cr, stroke_width);
   cairo_set_source_rgba(g->cr, stroke_color.red,
                                stroke_color.green,
                                stroke_color.blue,
                                stroke_color.alpha);
   cairo_stroke(g->cr);
   /* restore cairo context */
   cairo_restore(g->cr);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movsd %xmm5, 0x38(%rsp)
movsd %xmm4, 0x10(%rsp)
movl %esi, %r14d
movsd %xmm3, 0x30(%rsp)
movsd %xmm2, 0x8(%rsp)
movsd %xmm1, 0x18(%rsp)
movsd %xmm0, 0x20(%rsp)
movq %rdi, %rbx
callq 0x2e259
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2c5a1
testq %rax, %rax
je 0x30155
movq %rax, %rbx
leaq 0x60(%rsp), %r15
movq 0x10(%rax), %rdi
callq 0xb3d0
movq 0x10(%rbx), %rdi
movsd 0x50(%rbx), %xmm0
movsd 0x58(%rbx), %xmm1
movsd 0x68(%rbx), %xmm2
movapd %xmm0, %xmm3
addsd %xmm0, %xmm3
subsd %xmm3, %xmm2
movsd 0x60(%rbx), %xmm3
movapd %xmm1, %xmm4
addsd %xmm1, %xmm4
subsd %xmm4, %xmm3
callq 0xb2e0
movq 0x10(%rbx), %rdi
callq 0xbb40
leal -0x2(%r14), %eax
cmpl $0x2, %eax
jb 0x2ffb8
testl %r14d, %r14d
je 0x30069
cmpl $0x1, %r14d
jne 0x3001f
movsd 0x8(%rsp), %xmm1
subsd 0x10(%rsp), %xmm1
xorpd %xmm0, %xmm0
movsd %xmm1, 0x8(%rsp)
callq 0x58dba
testb %al, %al
je 0x3001f
movq 0x10(%rbx), %rdi
movsd 0x30(%rsp), %xmm1
mulsd 0xa3746(%rip), %xmm1    # 0xd3640
addsd 0x18(%rsp), %xmm1
movsd %xmm1, 0x28(%rsp)
movsd 0x20(%rsp), %xmm0
callq 0xb240
movq 0x10(%rbx), %rdi
movsd 0xa3723(%rip), %xmm0    # 0xd3640
mulsd 0x8(%rsp), %xmm0
addsd 0x20(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
callq 0xb770
movq 0x10(%rbx), %rdi
movsd 0x8(%rsp), %xmm0
addsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x28(%rsp), %xmm1
callq 0xb770
movq 0x10(%rbx), %rdi
movsd 0x10(%rsp), %xmm0
addsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x28(%rsp), %xmm1
callq 0xb770
movq 0x10(%rbx), %rdi
movsd 0x8(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
callq 0xb240
movq 0x10(%rbx), %rdi
movsd 0x10(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
callq 0xb770
movq 0x10(%rbx), %rdi
movsd 0x18(%rsp), %xmm1
addsd 0x30(%rsp), %xmm1
movsd 0x8(%rsp), %xmm0
jmp 0x3001a
movq 0x10(%rbx), %rdi
movsd 0x30(%rsp), %xmm1
mulsd 0xa3676(%rip), %xmm1    # 0xd3640
addsd 0x18(%rsp), %xmm1
movsd %xmm1, 0x30(%rsp)
movsd 0x20(%rsp), %xmm0
callq 0xb240
movq 0x10(%rbx), %rdi
movsd 0xa3653(%rip), %xmm0    # 0xd3640
mulsd 0x8(%rsp), %xmm0
addsd 0x20(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
callq 0xb770
movq 0x10(%rbx), %rdi
movsd 0x20(%rsp), %xmm0
addsd 0x8(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
callq 0xb770
movq 0x10(%rbx), %rdi
movsd 0x38(%rsp), %xmm0
callq 0xb0a0
movq 0x10(%rbx), %rdi
movsd (%r15), %xmm0
movsd 0x8(%r15), %xmm1
movsd 0x10(%r15), %xmm2
movsd 0x18(%r15), %xmm3
callq 0xb380
movq 0x10(%rbx), %rdi
callq 0xbbb0
movq 0x10(%rbx), %rdi
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0xba40
movsd 0x8(%rsp), %xmm1
subsd 0x10(%rsp), %xmm1
xorpd %xmm0, %xmm0
movsd %xmm1, 0x8(%rsp)
callq 0x58dba
testb %al, %al
je 0x3001f
movq 0x10(%rbx), %rdi
movsd 0x10(%rsp), %xmm0
addsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x18(%rsp), %xmm1
callq 0xb240
movq 0x10(%rbx), %rdi
movsd 0x30(%rsp), %xmm1
mulsd 0xa3585(%rip), %xmm1    # 0xd3640
addsd 0x18(%rsp), %xmm1
movsd %xmm1, 0x28(%rsp)
movsd 0x20(%rsp), %xmm0
callq 0xb770
movq 0x10(%rbx), %rdi
movsd 0x30(%rsp), %xmm1
addsd 0x18(%rsp), %xmm1
movsd 0x10(%rsp), %xmm0
callq 0xb770
movq 0x10(%rbx), %rdi
movsd 0x20(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
callq 0xb240
movq 0x10(%rbx), %rdi
movsd 0x10(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
callq 0xb770
movq 0x10(%rbx), %rdi
movsd 0xa351d(%rip), %xmm0    # 0xd3640
mulsd 0x8(%rsp), %xmm0
addsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
callq 0xb770
movq 0x10(%rbx), %rdi
movsd 0x10(%rsp), %xmm0
addsd 0x8(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
jmp 0x3001a
movq 0xfde5c(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x99f00(%rip), %rsi     # 0xca066
leaq 0xa3a62(%rip), %rdx     # 0xd3bcf
leaq 0xa43c8(%rip), %rcx     # 0xd453c
leaq 0xa3ff1(%rip), %r8      # 0xd416c
movl $0x209, %r9d            # imm = 0x209
xorl %eax, %eax
callq 0xb8c0
callq 0xb300