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

  if (argc != 9) {
    fprintf(stderr, "Usage: %s style_file PNG_file GFF3_file Seq_file seqid"
                    " start end windowsize\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 */
  seqid = argv[5];
  if (gt_feature_index_get_range_for_seqid(feature_index, &range, seqid, err))
    handle_error(err);
  sscanf(argv[6], "%lu", &range.start);
  sscanf(argv[7], "%lu", &range.end);
  sscanf(argv[8], "%lu", &windowsize);

  diagram = gt_diagram_new(feature_index, seqid, &range, style, err);
  if (gt_error_is_set(err))
    handle_error(err);

  /* load sequence for GC plot */
  bioseq = gt_bioseq_new(argv[4], err);
  if (gt_error_is_set(err))
    handle_error(err);

  /* create custom track with GC plot for first sequence in file,
     window size 1000, 40px height and average line at 16.5% */
  custom = gt_custom_track_gc_content_new(gt_bioseq_get_sequence(bioseq, 0),
                                          gt_bioseq_get_sequence_length(bioseq,
                                                                        0),
                                          windowsize,
                                          70,
                                          0.165,
                                          true);
  gt_diagram_add_custom_track(diagram, custom);

  /* create layout with given width, determine resulting image height */
  layout = gt_layout_new(diagram, 600, style, err);
  if (gt_error_is_set(err))
    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_custom_track_delete(custom);
  gt_bioseq_delete(bioseq);
  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 $0x48, %rsp
movq %rsi, %rbp
cmpl $0x9, %edi
jne 0x35656
movq 0x8(%rbp), %r12
movq 0x10(%rbp), %r13
movq 0x18(%rbp), %r15
callq 0x515cc
callq 0x4cc8c
movq %rax, %rbx
movq %rax, %rdi
callq 0x78d80
testq %rax, %rax
je 0x35665
movq %rax, 0x8(%rsp)
movq %rax, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x79192
testl %eax, %eax
jne 0x35665
callq 0x6442d
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x63068
testl %eax, %eax
jne 0x35665
movq %r13, 0x20(%rsp)
movq 0x28(%rbp), %r15
leaq 0x38(%rsp), %rsi
movq %r14, %rdi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x633e0
testl %eax, %eax
jne 0x35665
movq 0x30(%rbp), %rdi
leaq 0xb54ae(%rip), %r12     # 0xea946
leaq 0x38(%rsp), %r13
movq %r12, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0xb680
movq 0x38(%rbp), %rdi
leaq 0x40(%rsp), %rdx
movq %r12, %rsi
xorl %eax, %eax
callq 0xb680
movq 0x40(%rbp), %rdi
leaq 0x28(%rsp), %rdx
movq %r12, %rsi
xorl %eax, %eax
callq 0xb680
movq %r14, %rdi
movq %r15, %rsi
movq %r13, %rdx
movq 0x8(%rsp), %rcx
movq %rbx, %r8
callq 0x72848
movq %rax, %r13
movq %rbx, %rdi
callq 0x4cd72
testb %al, %al
jne 0x35665
movq %r14, 0x18(%rsp)
movq 0x20(%rbp), %rdi
movq %rbx, %rsi
callq 0x3569c
movq %rax, %rbp
movq %rbx, %rdi
callq 0x4cd72
testb %al, %al
jne 0x35665
movq %rbp, %rdi
xorl %esi, %esi
callq 0x35df4
movq %rax, %r15
movq %rbp, %rdi
xorl %esi, %esi
callq 0x35e8a
movq 0x28(%rsp), %rdx
movsd 0xabac7(%rip), %xmm0    # 0xe1008
movl $0x46, %ecx
movq %r15, %rdi
movq %rax, %rsi
movl $0x1, %r8d
callq 0x72752
movq %rax, %r15
movq %r13, %rdi
movq %rax, %rsi
callq 0x72c8c
movq %r13, %rdi
movl $0x258, %esi            # imm = 0x258
movq 0x8(%rsp), %r14
movq %r14, %rdx
movq %rbx, %rcx
callq 0x77d48
movq %rax, %r12
movq %rbx, %rdi
callq 0x4cd72
testb %al, %al
jne 0x35665
movq %r13, 0x10(%rsp)
leaq 0x30(%rsp), %rsi
movq %r12, %rdi
movq %rbx, %rdx
callq 0x7827c
testl %eax, %eax
jne 0x35665
movq 0x30(%rsp), %rcx
movl $0x258, %edx            # imm = 0x258
movq %r14, %rdi
movl $0x1, %esi
xorl %r8d, %r8d
movq %rbx, %r9
callq 0x71c42
testq %rax, %rax
je 0x35665
movq %rax, %r13
movq %r12, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x78040
testl %eax, %eax
jne 0x35665
movq %r13, %rdi
movq 0x20(%rsp), %rsi
movq %rbx, %rdx
callq 0x71b24
testl %eax, %eax
jne 0x35665
movq %r15, %rdi
callq 0x71e99
movq %rbp, %rdi
callq 0x35c04
movq %r13, %rdi
callq 0x71916
movq %r12, %rdi
callq 0x77fd2
movq 0x10(%rsp), %rdi
callq 0x72e8f
movq 0x18(%rsp), %rdi
callq 0x62eae
movq %r14, %rdi
callq 0x7a4dc
movq %rbx, %rdi
callq 0x4ce0d
callq 0x517fb
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbp, %rdi
callq 0xbd00
movl $0x1, %eax
jmp 0x35647
movq %rbx, %rdi
callq 0x3566d