// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/tools/gt_speck.c
// Function: gt_speck_runner
static int gt_speck_runner(int argc, const char **argv, int parsed_args,
                               void *tool_arguments, GtError *err)
{
  GtNodeStream *gff3_in_stream = NULL, *checker_stream = NULL,
               *a_in_stream = NULL, *a_out_stream = NULL,
               *feature_stream = NULL, *sort_stream = NULL,
               *last_stream = NULL;
  GtNodeVisitor *spec_visitor = NULL;
  GtSpecResults *res = NULL;
  GtFeatureIndex *fi = NULL;
  GtTypeChecker *type_checker = NULL;
  GtTimer *t = NULL;
  GtRegionMapping *rm = NULL;
  GtArray *arr = gt_array_new(sizeof (GtFeatureNode*));
  GtStr *prog, *speclib;
  SpeccheckArguments *arguments = tool_arguments;

  int had_err = 0;
  gt_error_check(err);

  res = gt_spec_results_new();
  gt_assert(res);

  if (gt_file_exists(gt_str_get(arguments->format))) {
    speclib = gt_str_ref(arguments->format);
  } else {
    prog = gt_str_new();
    gt_str_append_cstr_nt(prog, gt_error_get_progname(err),
                    gt_cstr_length_up_to_char(gt_error_get_progname(err), ' '));
    speclib = gt_get_gtdata_path(gt_str_get(prog), NULL);
    gt_str_delete(prog);
    gt_str_append_cstr(speclib, "/spec/output_drivers/");
    gt_str_append_str(speclib, arguments->format);

    if (!gt_file_exists(gt_str_get(speclib))) {
      gt_error_set(err, "output driver file \"%s\" does not exist",
                   gt_str_get(speclib));
      had_err = -1;
    }
  }

  if (!had_err) {
    spec_visitor = gt_spec_visitor_new(gt_str_get(arguments->specfile), res,
                                       err);
    if (!spec_visitor) {
      gt_spec_results_delete(res);
      return -1;
    }
  }

  t = gt_timer_new();
  gt_assert(t);

  /* add region mapping if given */
  if (!had_err && gt_seqid2file_option_used(arguments->s2fi)) {
    rm = gt_seqid2file_region_mapping_new(arguments->s2fi, err);
    if (!rm)
      had_err = -1;
    if (!had_err)
      gt_spec_visitor_add_region_mapping((GtSpecVisitor*) spec_visitor, rm);
  }

  /* set type checker if necessary */
  if (!had_err && gt_typecheck_info_option_used(arguments->tci)) {
    type_checker = gt_typecheck_info_create_type_checker(arguments->tci, err);
    if (!type_checker)
      had_err = -1;
    if (!had_err)
      gt_spec_visitor_add_type_checker((GtSpecVisitor*) spec_visitor,
                                       type_checker);
  }

  if (!had_err) {
    /* set runtime error behaviour */
    if (arguments->fail_hard)
      gt_spec_visitor_fail_on_runtime_error((GtSpecVisitor*) spec_visitor);
    else
      gt_spec_visitor_report_runtime_errors((GtSpecVisitor*) spec_visitor);

    /* redirect warnings */
    gt_warning_set_handler(gt_speck_record_warning, res);

    last_stream = gff3_in_stream = gt_gff3_in_stream_new_unsorted(
                                                            argc - parsed_args,
                                                            argv + parsed_args);
    gt_assert(gff3_in_stream);
    gt_gff3_in_stream_enable_tidy_mode((GtGFF3InStream*) gff3_in_stream);

    /* insert sort stream if requested */
    if (arguments->sort) {
      last_stream = sort_stream = gt_sort_stream_new(last_stream);
    }

    /* if -provideindex is given, collect input features and index them first */
    if (arguments->provideindex) {
      fi = gt_feature_index_memory_new();
      gt_assert(fi);

      last_stream = feature_stream = gt_feature_stream_new(last_stream, fi);
      gt_assert(feature_stream);

      last_stream = a_out_stream = gt_array_out_stream_all_new(last_stream, arr,
                                                               err);
      if (!a_out_stream)
        had_err = -1;

      gt_timer_start(t);

      if (!had_err)
        had_err = gt_node_stream_pull(last_stream, err);

      if (!had_err) {
        gt_spec_visitor_add_feature_index((GtSpecVisitor*) spec_visitor,
                                          gt_feature_index_ref(fi));
        last_stream = a_in_stream = gt_array_in_stream_new(arr, NULL, err);
        if (!a_in_stream)
          had_err = -1;
      }
    } else {
      gt_timer_start(t);
    }

    if (!had_err) {
      checker_stream = gt_visitor_stream_new(last_stream, spec_visitor);
      gt_assert(checker_stream);
    }

    /* perform checking  */
    if (!had_err)
      had_err = gt_node_stream_pull(checker_stream, err);

    gt_timer_stop(t);

    /* reset warnings output */
    gt_warning_set_handler(gt_warning_default_handler, NULL);

    /* output results */
    if (!had_err) {
      GtStr *runtime = gt_str_new();
      gt_timer_get_formatted(t, GT_WD ".%06ld", runtime);
      had_err = gt_spec_results_render_template(res, gt_str_get(speclib),
                                                arguments->outfp,
                                                gt_str_get(arguments->specfile),
                                                arguments->verbose,
                                                arguments->colored,
                                                gt_str_get(runtime), err);
      gt_str_delete(runtime);
    }

    if (!had_err && (gt_spec_results_has_runtime_errors(res)
          || gt_spec_results_has_failures(res))) {
      had_err = -2;
    }
  }

  /* free */
  gt_node_stream_delete(gff3_in_stream);
  gt_node_stream_delete(a_in_stream);
  gt_node_stream_delete(a_out_stream);
  gt_node_stream_delete(checker_stream);
  gt_node_stream_delete(feature_stream);
  gt_node_stream_delete(sort_stream);
  gt_spec_results_delete(res);
  gt_feature_index_delete(fi);
  gt_type_checker_delete(type_checker);
  gt_timer_delete(t);
  gt_array_delete(arr);
  gt_str_delete(speclib);

  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r8, %r12
movq %rcx, %r13
movl %edx, (%rsp)
movq %rsi, %r15
movl %edi, %ebx
pushq $0x8
popq %rdi
callq 0x5809c
movq %rax, %rbp
testq %r12, %r12
je 0x5179d
movq %r12, %rdi
callq 0x89eb7
testb %al, %al
jne 0x51cfe
callq 0x11a670
testq %rax, %rax
je 0x51c9c
movq %rax, %r14
movq %r15, 0x8(%rsp)
movq 0x8(%r13), %rdi
callq 0xad1fa
movq %rax, %rdi
callq 0x8da98
testb %al, %al
movq %r14, 0x18(%rsp)
je 0x517e0
movq 0x8(%r13), %rdi
callq 0xad4d2
movq %rax, 0x60(%rsp)
jmp 0x5186a
callq 0xacb84
movq %rax, %r14
movq %r12, %rdi
callq 0x8a001
movq %rax, %r15
movq %r12, %rdi
callq 0x8a001
pushq $0x20
popq %rsi
movq %rax, %rdi
callq 0x6c46d
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0xacd9e
movq %r14, %rdi
callq 0xad1fa
movq %rax, %rdi
xorl %esi, %esi
callq 0x8f124
movq %rax, %r15
movq %r14, %rdi
callq 0xae103
leaq 0x2aa283(%rip), %rsi    # 0x2fbabb
movq %r15, %rdi
callq 0xacbfb
movq 0x8(%r13), %rsi
movq %r15, %rdi
callq 0xacd13
movq %r15, %rdi
callq 0xad1fa
movq %rax, %rdi
callq 0x8da98
testb %al, %al
movq %r15, 0x60(%rsp)
je 0x5189e
movq 0x18(%rsp), %r14
movq (%r13), %rdi
callq 0xad1fa
movq %rax, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x11c124
testq %rax, %rax
je 0x5188e
movq %rax, %r15
movb $0x1, %r14b
jmp 0x518c0
movq %r14, %rdi
callq 0x11b67e
pushq $-0x1
popq %rax
jmp 0x51c8d
movq %r15, %rdi
callq 0xad1fa
leaq 0x2aa224(%rip), %rsi    # 0x2fbad1
xorl %r14d, %r14d
movq %r12, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x89dbb
xorl %r15d, %r15d
movq %rbp, 0x58(%rsp)
callq 0xaf478
movq %rax, 0x50(%rsp)
testq %rax, %rax
je 0x51ccd
pushq $-0x1
popq %rbp
testb %r14b, %r14b
je 0x5193e
movq 0x18(%r13), %rdi
callq 0x116b18
testb %al, %al
movq 0x18(%rsp), %r14
je 0x5190e
movq 0x18(%r13), %rdi
movq %r12, %rsi
callq 0x116b63
testq %rax, %rax
je 0x5193e
movq %r15, %rdi
movq %rax, %rsi
callq 0x11c072
movq 0x28(%r13), %rdi
callq 0x12ac14
testb %al, %al
je 0x51961
movq 0x28(%r13), %rdi
movq %r12, %rsi
callq 0x12ac6e
testq %rax, %rax
je 0x5193e
movq %r15, %rdi
movq %rax, 0x28(%rsp)
movq %rax, %rsi
callq 0x11c0dc
jmp 0x5196a
movl %ebp, (%rsp)
movq $0x0, 0x28(%rsp)
xorl %r14d, %r14d
xorl %ebp, %ebp
xorl %r15d, %r15d
xorl %r12d, %r12d
xorl %ebx, %ebx
xorl %r13d, %r13d
xorl %edi, %edi
jmp 0x51c23
movq $0x0, 0x28(%rsp)
cmpb $0x1, 0x12(%r13)
jne 0x5197b
movq %r15, %rdi
callq 0x11bfc5
jmp 0x51983
movq %r15, %rdi
callq 0x11bf82
leaq 0x46a(%rip), %rdi       # 0x51df4
movq %r14, %rsi
callq 0xb2d84
movl (%rsp), %eax
subl %eax, %ebx
cltq
movq 0x8(%rsp), %rcx
leaq (%rcx,%rax,8), %rsi
movl %ebx, %edi
callq 0xdeebd
testq %rax, %rax
je 0x51d2f
movq %rax, %rbx
movq %rax, %rdi
callq 0xdee0c
cmpb $0x1, 0x14(%r13)
movq %rbx, 0x40(%rsp)
jne 0x519db
movq %rbx, %rdi
callq 0x11a5d8
movq %rax, %rbx
movq %rax, 0x48(%rsp)
jmp 0x519e4
movq $0x0, 0x48(%rsp)
cmpb $0x1, 0x13(%r13)
jne 0x51a69
callq 0xd9354
testq %rax, %rax
movq 0x58(%rsp), %r14
je 0x51d8e
movq %rbx, %rdi
movq %rax, 0x8(%rsp)
movq %rax, %rsi
callq 0xdcac8
testq %rax, %rax
je 0x51dbc
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xba9e7
movq %rax, %r14
movq 0x50(%rsp), %rdi
callq 0xaf4d6
pushq $-0x1
popq %rbp
testq %r14, %r14
movq %rbx, 0x20(%rsp)
je 0x51abc
movq %r14, 0x38(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x102b93
testl %eax, %eax
je 0x51bbd
movq $0x0, 0x10(%rsp)
xorl %ecx, %ecx
movl %eax, %ebp
jmp 0x51ad0
movq 0x50(%rsp), %rdi
callq 0xaf4d6
movq $0x0, 0x38(%rsp)
movq $0x0, 0x20(%rsp)
movq $0x0, 0x8(%rsp)
xorl %r14d, %r14d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x12bf59
testq %rax, %rax
je 0x51d60
movq %rax, 0x10(%rsp)
movq %rax, %rdi
movq %r12, %rsi
callq 0x102b93
movl %eax, %ebp
movq %r14, %rcx
jmp 0x51ad0
movq $0x0, 0x10(%rsp)
movq $0x0, 0x38(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x30(%rsp)
movq 0x50(%rsp), %r15
movq %r15, %rdi
callq 0xaf549
leaq 0x612aa(%rip), %rdi     # 0xb2d93
xorl %esi, %esi
callq 0xb2d84
testl %ebp, %ebp
je 0x51b0b
movl %ebp, (%rsp)
movq 0x48(%rsp), %r15
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %r14
jmp 0x51c0f
callq 0xacb84
movq %rax, %rbx
leaq 0x2a9fde(%rip), %rsi    # 0x2fbaf8
movq %r15, %rdi
movq %rax, %rdx
callq 0xaf785
movq 0x60(%rsp), %rdi
callq 0xad1fa
movq %rax, %r14
movq (%r13), %rdi
movq 0x30(%r13), %rax
movq %rax, (%rsp)
callq 0xad1fa
movq %rax, %r15
movzbl 0x10(%r13), %ebp
movzbl 0x11(%r13), %r13d
movq %rbx, %rdi
callq 0xad1fa
movq 0x18(%rsp), %rdi
movq %r14, %rsi
movq (%rsp), %rdx
movq %r15, %rcx
movl %ebp, %r8d
movl %r13d, %r9d
pushq %r12
pushq %rax
callq 0x11ace7
popq %rcx
popq %rdx
movl %eax, %ebp
movq %rbx, %rdi
callq 0xae103
testl %ebp, %ebp
movq 0x38(%rsp), %r14
je 0x51b94
movl %ebp, (%rsp)
movq 0x48(%rsp), %r15
jmp 0x51c0a
movq 0x18(%rsp), %rdi
callq 0x11ac63
testb %al, %al
movq 0x48(%rsp), %r15
jne 0x51bb5
movq 0x18(%rsp), %rdi
callq 0x11aca5
testb %al, %al
je 0x51c03
pushq $-0x2
popq %rax
movl %eax, (%rsp)
jmp 0x51c0a
movq 0x8(%rsp), %rdi
callq 0xd7717
movq %r15, %rdi
movq %rax, %rsi
callq 0x11c008
movq $0x0, 0x10(%rsp)
movq 0x58(%rsp), %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0xba7b6
movq %rax, %rbx
movq %rax, %r14
movl $0x0, %ecx
testq %rax, %rax
jne 0x51a91
jmp 0x51ad0
movl $0x0, (%rsp)
movq 0x40(%rsp), %rdi
movq 0x8(%rsp), %r12
movq 0x20(%rsp), %rbp
movq 0x10(%rsp), %r13
movq 0x30(%rsp), %rbx
callq 0x10297b
movq %rbx, %rdi
callq 0x10297b
movq %r14, %rdi
callq 0x10297b
movq %r13, %rdi
callq 0x10297b
movq %rbp, %rdi
callq 0x10297b
movq %r15, %rdi
callq 0x10297b
movq 0x18(%rsp), %rdi
callq 0x11b67e
movq %r12, %rdi
callq 0xd7777
movq 0x28(%rsp), %rdi
callq 0x12a832
movq 0x50(%rsp), %rdi
callq 0xafc5b
movq 0x58(%rsp), %rdi
callq 0x58eb9
movq 0x60(%rsp), %rdi
callq 0xae103
movl (%rsp), %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x3e62c5(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x293366(%rip), %rsi    # 0x2e5013
leaq 0x30edc6(%rip), %rdx    # 0x360a7a
leaq 0x2a9df0(%rip), %rcx    # 0x2fbaab
leaq 0x2a9ba7(%rip), %r8     # 0x2fb869
movl $0xb2, %r9d
jmp 0x51de8
movq 0x3e6294(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x293335(%rip), %rsi    # 0x2e5013
leaq 0x3131a6(%rip), %rdx    # 0x364e8b
leaq 0x2a9dbf(%rip), %rcx    # 0x2fbaab
leaq 0x2a9b76(%rip), %r8     # 0x2fb869
movl $0xd0, %r9d
jmp 0x51de8
movq 0x3e6263(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x293304(%rip), %rsi    # 0x2e5013
leaq 0x2934a9(%rip), %rdx    # 0x2e51bf
leaq 0x2a9d8e(%rip), %rcx    # 0x2fbaab
leaq 0x2a9b45(%rip), %r8     # 0x2fb869
movl $0xaf, %r9d
jmp 0x51de8
movq 0x3e6232(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2932d3(%rip), %rsi    # 0x2e5013
leaq 0x29d647(%rip), %rdx    # 0x2ef38e
leaq 0x2a9d5d(%rip), %rcx    # 0x2fbaab
leaq 0x2a9b14(%rip), %r8     # 0x2fb869
movl $0xf2, %r9d
jmp 0x51de8
movq 0x3e6201(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2932a2(%rip), %rsi    # 0x2e5013
leaq 0x29e6b9(%rip), %rdx    # 0x2f0431
leaq 0x2a9d2c(%rip), %rcx    # 0x2fbaab
leaq 0x2a9ae3(%rip), %r8     # 0x2fb869
movl $0x119, %r9d            # imm = 0x119
jmp 0x51de8
movq 0x3e61d3(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x293274(%rip), %rsi    # 0x2e5013
leaq 0x2e1e91(%rip), %rdx    # 0x333c37
leaq 0x2a9cfe(%rip), %rcx    # 0x2fbaab
leaq 0x2a9ab5(%rip), %r8     # 0x2fb869
movl $0xfd, %r9d
jmp 0x51de8
movq 0x3e61a5(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x293246(%rip), %rsi    # 0x2e5013
leaq 0x32e741(%rip), %rdx    # 0x380515
leaq 0x2a9cd0(%rip), %rcx    # 0x2fbaab
leaq 0x2a9a87(%rip), %r8     # 0x2fb869
movl $0x100, %r9d            # imm = 0x100
xorl %eax, %eax
callq 0x17a50
callq 0x17390