// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/annotationsketch/graphics_cairo.c
// Function: gt_graphics_cairo_save_to_stream
void gt_graphics_cairo_save_to_stream(const GtGraphics *gg, GtStr *stream)
{
  const GtGraphicsCairo *g = (const GtGraphicsCairo*) gg;
  GT_UNUSED cairo_status_t rval;
  cairo_surface_t *bgsurf = NULL;
  cairo_t *bgc = NULL;
  gt_assert(g && stream);

  /* do nothing if no surface was created */
  if (g->from_context)
    return;
  switch (g->type)
  {
    case GT_GRAPHICS_PNG:
      /* blend rendered image with background color */
      bgsurf = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, g->width,
                                          g->height);
      bgc = cairo_create(bgsurf);
      cairo_set_source_rgba(bgc, g->bg_color.red, g->bg_color.green,
                                 g->bg_color.blue, g->bg_color.alpha);
      cairo_paint(bgc);
      cairo_set_source_surface(bgc, g->surf, 0, 0);
      cairo_paint(bgc);
      rval = cairo_surface_write_to_png_stream(bgsurf, str_write_func, stream);
      gt_assert(rval == CAIRO_STATUS_SUCCESS); /* str_write_func() is sane */
      cairo_destroy(bgc);
      cairo_surface_destroy(bgsurf);
      break;
    default:
      cairo_show_page(g->cr);
      cairo_surface_flush(g->surf);
      cairo_surface_finish(g->surf);
      gt_str_reset(stream);
      gt_str_append_str(stream, g->outbuf);
      gt_assert(gt_str_length(stream) > 0);
  }
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq $0x0, 0x10(%rsp)
movq $0x0, 0x8(%rsp)
cmpq $0x0, 0x20(%rsp)
je 0x4462a
cmpq $0x0, 0x28(%rsp)
jne 0x44662
movq 0x16f9a7(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0x119a2b(%rip), %rsi    # 0x15e066
leaq 0x12424a(%rip), %rdx    # 0x16888c
leaq 0x12424f(%rip), %rcx    # 0x168898
leaq 0x123d5c(%rip), %r8     # 0x1683ac
movl $0x2c3, %r9d            # imm = 0x2C3
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x44664
movq 0x20(%rsp), %rax
testb $0x1, 0x70(%rax)
je 0x44674
jmp 0x4481c
movq 0x20(%rsp), %rax
movl 0x48(%rax), %eax
subl $0x1, %eax
jne 0x44789
jmp 0x44687
movq 0x20(%rsp), %rax
cvttsd2si 0x68(%rax), %esi
movq 0x20(%rsp), %rax
cvttsd2si 0x60(%rax), %edx
xorl %edi, %edi
callq 0xb810
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rdi
callq 0xb1c0
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rdi
movq 0x20(%rsp), %rax
movsd 0x20(%rax), %xmm0
movq 0x20(%rsp), %rax
movsd 0x28(%rax), %xmm1
movq 0x20(%rsp), %rax
movsd 0x30(%rax), %xmm2
movq 0x20(%rsp), %rax
movsd 0x38(%rax), %xmm3
callq 0xb360
movq 0x8(%rsp), %rdi
callq 0xba40
movq 0x8(%rsp), %rdi
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rsi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0xbba0
movq 0x8(%rsp), %rdi
callq 0xba40
movq 0x10(%rsp), %rdi
movq 0x28(%rsp), %rdx
leaq -0x33a6(%rip), %rsi     # 0x41380
callq 0xbb60
movl %eax, 0x1c(%rsp)
cmpl $0x0, 0x1c(%rsp)
je 0x4476e
movq 0x16f89b(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0x11991f(%rip), %rsi    # 0x15e066
leaq 0x12416b(%rip), %rdx    # 0x1688b9
leaq 0x124143(%rip), %rcx    # 0x168898
leaq 0x123c50(%rip), %r8     # 0x1683ac
movl $0x2d5, %r9d            # imm = 0x2D5
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x44770
movq 0x8(%rsp), %rdi
callq 0xb880
movq 0x10(%rsp), %rdi
callq 0xb770
jmp 0x4481c
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0xb480
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0xbab0
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0xb210
movq 0x28(%rsp), %rdi
callq 0x19b70
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rax
movq 0x40(%rax), %rsi
callq 0x191b0
movq 0x28(%rsp), %rdi
callq 0x19a00
cmpq $0x0, %rax
ja 0x44818
movq 0x16f7f1(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0x119875(%rip), %rsi    # 0x15e066
leaq 0x1240de(%rip), %rdx    # 0x1688d6
leaq 0x124099(%rip), %rcx    # 0x168898
leaq 0x123ba6(%rip), %r8     # 0x1683ac
movl $0x2df, %r9d            # imm = 0x2DF
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x4481a
jmp 0x4481c
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)