// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/examples/sketch_parsed.c
// Function: main
int main(int argc, char *argv[])
{
  const char *style_file, *png_file, *gff3_file;
  char *seqid;
  GtStyle *style;
  GtFeatureIndex *feature_index;
  GtRange range;
  GtDiagram *diagram;
  GtLayout *layout;
  GtCanvas *canvas;
  GtUword height;
  GtError *err;

  if (argc != 4) {
    fprintf(stderr, "Usage: %s style_file PNG_file GFF3_file\n", argv[0]);
    return EXIT_FAILURE;
  }

  style_file = argv[1];
  png_file = argv[2];
  gff3_file = argv[3];

  /* initialize */
  gt_lib_init();

  /* create error object */
  err = gt_error_new();

  /* create style */
  if (!(style = gt_style_new(err)))
    handle_error(err);

  /* load style file */
  if (gt_style_load_file(style, style_file, err))
    handle_error(err);

  /* create feature index */
  feature_index = gt_feature_index_memory_new();

  /* add GFF3 file to index */
  if (gt_feature_index_add_gff3file(feature_index, gff3_file, err))
    handle_error(err);

  /* create diagram for first sequence ID in feature index */
  if (!(seqid = gt_feature_index_get_first_seqid(feature_index, err))) {
    if (gt_error_is_set(err))
      handle_error(err);
  }
  if (gt_feature_index_get_range_for_seqid(feature_index, &range, seqid, err))
    handle_error(err);
  diagram = gt_diagram_new(feature_index, seqid, &range, style, err);
  gt_free(seqid);
  if (gt_error_is_set(err))
    handle_error(err);

  /* create layout with given width, determine resulting image height */
  layout = gt_layout_new(diagram, 600, style, err);
  if (!layout)
    handle_error(err);
  if (gt_layout_get_height(layout, &height, err))
    handle_error(err);

  /* create PNG canvas */
  canvas = gt_canvas_cairo_file_new(style, GT_GRAPHICS_PNG, 600, height,
                                    NULL, err);
  if (!canvas)
    handle_error(err);

  /* sketch layout on canvas */
  if (gt_layout_sketch(layout, canvas, err))
    handle_error(err);

  /* write canvas to file */
  if (gt_canvas_cairo_file_to_file((GtCanvasCairoFile*) canvas, png_file, err))
    handle_error(err);

  /* free */
  gt_canvas_delete(canvas);
  gt_layout_delete(layout);
  gt_diagram_delete(diagram);
  gt_feature_index_delete(feature_index);
  gt_style_delete(style);
  gt_error_delete(err);
  /* perform static data cleanup */
  gt_lib_clean();
  return EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
cmpl $0x4, %edi
jne 0xbf9c
movq 0x8(%rsi), %r15
movq 0x10(%rsi), %r12
movq 0x18(%rsi), %r13
callq 0xc2cc
callq 0xbff0
movq %rax, %rbx
movq %rax, %rdi
callq 0x32840
testq %rax, %rax
je 0xbfbc
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x32e69
testl %eax, %eax
jne 0xbfbc
movq %r12, 0x8(%rsp)
callq 0x18544
movq %rax, %r12
movq %rax, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x16bed
testl %eax, %eax
jne 0xbfbc
movq %r12, %rdi
movq %rbx, %rsi
callq 0x16f57
movq %rax, %rbp
testq %rax, %rax
jne 0xbe7c
movq %rbx, %rdi
callq 0xc103
testb %al, %al
jne 0xbfbc
leaq 0x18(%rsp), %rsi
movq %r12, %rdi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x1710c
testl %eax, %eax
jne 0xbfbc
leaq 0x18(%rsp), %rdx
movq %r12, %rdi
movq %rbp, %rsi
movq %r14, %rcx
movq %rbx, %r8
callq 0x2a748
movq %rax, %r13
leaq 0xbe176(%rip), %rsi     # 0xca02d
pushq $0x3c
popq %rdx
movq %rbp, %rdi
callq 0xd249
movq %rbx, %rdi
callq 0xc103
testb %al, %al
jne 0xbfbc
movq %r13, %rdi
movl $0x258, %esi            # imm = 0x258
movq %r14, %rdx
movq %rbx, %rcx
callq 0x311f4
testq %rax, %rax
je 0xbfbc
movq %rax, %rbp
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0x31a49
testl %eax, %eax
jne 0xbfbc
movq 0x10(%rsp), %rcx
pushq $0x1
popq %rsi
movl $0x258, %edx            # imm = 0x258
movq %r14, %rdi
xorl %r8d, %r8d
movq %rbx, %r9
callq 0x2a575
testq %rax, %rax
je 0xbfbc
movq %rax, %r15
movq %rbp, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x315c9
testl %eax, %eax
jne 0xbfbc
movq %r15, %rdi
movq 0x8(%rsp), %rsi
movq %rbx, %rdx
callq 0x2a3d4
testl %eax, %eax
jne 0xbfbc
movq %r15, %rdi
callq 0x29ef3
movq %rbp, %rdi
callq 0x3155b
movq %r13, %rdi
callq 0x2af85
movq %r12, %rdi
callq 0x16967
movq %r14, %rdi
callq 0x34915
movq %rbx, %rdi
callq 0xc291
callq 0xc513
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x122015(%rip), %rax    # 0x12dfb8
movq (%rax), %rdi
movq (%rsi), %rdx
leaq 0xbe054(%rip), %rsi     # 0xca004
xorl %eax, %eax
callq 0xb8c0
pushq $0x1
popq %rax
jmp 0xbf8d
movq %rbx, %rdi
callq 0xbfc4