// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x98, %rsp
movl $0x0, 0x94(%rsp)
movl %edi, 0x90(%rsp)
movq %rsi, 0x88(%rsp)
cmpl $0x9, 0x90(%rsp)
je 0xbe0e
movq 0x1a91f6(%rip), %rax    # 0x1b4fd8
movq (%rax), %rdi
movq 0x88(%rsp), %rax
movq (%rax), %rdx
leaq 0x153219(%rip), %rsi    # 0x15f010
movb $0x0, %al
callq 0xb890
movl $0x1, 0x94(%rsp)
jmp 0xc164
movq 0x88(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x80(%rsp)
movq 0x88(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x78(%rsp)
movq 0x88(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x70(%rsp)
callq 0x484b0
callq 0x3e7c0
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rdi
callq 0x9cc20
movq %rax, 0x60(%rsp)
cmpq $0x0, %rax
jne 0xbe72
movq 0x8(%rsp), %rdi
callq 0xc180
movq 0x60(%rsp), %rdi
movq 0x80(%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x9d4a0
cmpl $0x0, %eax
je 0xbe98
movq 0x8(%rsp), %rdi
callq 0xc180
callq 0x73a30
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rdi
movq 0x70(%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x715b0
cmpl $0x0, %eax
je 0xbec5
movq 0x8(%rsp), %rdi
callq 0xc180
movq 0x88(%rsp), %rax
movq 0x28(%rax), %rax
movq %rax, 0x68(%rsp)
movq 0x50(%rsp), %rdi
movq 0x68(%rsp), %rdx
movq 0x8(%rsp), %rcx
leaq 0x40(%rsp), %rsi
callq 0x71c70
cmpl $0x0, %eax
je 0xbefe
movq 0x8(%rsp), %rdi
callq 0xc180
movq 0x88(%rsp), %rax
movq 0x30(%rax), %rdi
leaq 0x40(%rsp), %rdx
leaq 0x15d14a(%rip), %rsi    # 0x169060
movb $0x0, %al
callq 0xb660
movq 0x88(%rsp), %rax
movq 0x38(%rax), %rdi
leaq 0x40(%rsp), %rdx
addq $0x8, %rdx
leaq 0x15d127(%rip), %rsi    # 0x169060
movb $0x0, %al
callq 0xb660
movq 0x88(%rsp), %rax
movq 0x40(%rax), %rdi
leaq 0x15d10d(%rip), %rsi    # 0x169060
leaq 0x10(%rsp), %rdx
movb $0x0, %al
callq 0xb660
movq 0x50(%rsp), %rdi
movq 0x68(%rsp), %rsi
movq 0x60(%rsp), %rcx
movq 0x8(%rsp), %r8
leaq 0x40(%rsp), %rdx
callq 0x908b0
movq %rax, 0x38(%rsp)
movq 0x8(%rsp), %rdi
callq 0x3e980
testb $0x1, %al
jne 0xbf92
jmp 0xbf9c
movq 0x8(%rsp), %rdi
callq 0xc180
movq 0x88(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x8(%rsp), %rsi
callq 0xc1d0
movq %rax, 0x58(%rsp)
movq 0x8(%rsp), %rdi
callq 0x3e980
testb $0x1, %al
jne 0xbfc7
jmp 0xbfd1
movq 0x8(%rsp), %rdi
callq 0xc180
movq 0x58(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xc890
movq %rax, (%rsp)
movq 0x58(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xca00
movq (%rsp), %rdi
movq %rax, %rsi
movq 0x10(%rsp), %rdx
movl $0x46, %ecx
movsd 0x152ffe(%rip), %xmm0   # 0x15f008
movl $0x1, %r8d
callq 0x90710
movq %rax, 0x20(%rsp)
movq 0x38(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0x91170
movq 0x38(%rsp), %rdi
movq 0x60(%rsp), %rdx
movq 0x8(%rsp), %rcx
movl $0x258, %esi            # imm = 0x258
callq 0x9aa70
movq %rax, 0x30(%rsp)
movq 0x8(%rsp), %rdi
callq 0x3e980
testb $0x1, %al
jne 0xc057
jmp 0xc061
movq 0x8(%rsp), %rdi
callq 0xc180
movq 0x30(%rsp), %rdi
movq 0x8(%rsp), %rdx
leaq 0x18(%rsp), %rsi
callq 0x9b7b0
cmpl $0x0, %eax
je 0xc084
movq 0x8(%rsp), %rdi
callq 0xc180
movq 0x60(%rsp), %rdi
movq 0x18(%rsp), %rcx
movq 0x8(%rsp), %r9
movl $0x1, %esi
movl $0x258, %edx            # imm = 0x258
xorl %eax, %eax
movl %eax, %r8d
callq 0x8f210
movq %rax, 0x28(%rsp)
cmpq $0x0, 0x28(%rsp)
jne 0xc0be
movq 0x8(%rsp), %rdi
callq 0xc180
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x9b000
cmpl $0x0, %eax
je 0xc0e1
movq 0x8(%rsp), %rdi
callq 0xc180
movq 0x28(%rsp), %rdi
movq 0x78(%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x8efa0
cmpl $0x0, %eax
je 0xc104
movq 0x8(%rsp), %rdi
callq 0xc180
movq 0x20(%rsp), %rdi
callq 0x8f6e0
movq 0x58(%rsp), %rdi
callq 0xc530
movq 0x28(%rsp), %rdi
callq 0x8e720
movq 0x30(%rsp), %rdi
callq 0x9af50
movq 0x38(%rsp), %rdi
callq 0x914c0
movq 0x50(%rsp), %rdi
callq 0x71260
movq 0x60(%rsp), %rdi
callq 0x9fc20
movq 0x8(%rsp), %rdi
callq 0x3eba0
callq 0x48710
movl $0x0, 0x94(%rsp)
movl 0x94(%rsp), %eax
addq $0x98, %rsp
retq
nopw %cs:(%rax,%rax)