// File: /workspace/github_c_makefile_star2_O3/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 $0x78, %rsp
movq %r8, %r13
movq %rcx, %rbx
movl %edx, %r14d
movq %rsi, %r12
movl %edi, %ebp
movl $0x8, %edi
callq 0xd214c
movq %rax, 0x60(%rsp)
testq %r13, %r13
je 0xcc6d4
movq %r13, %rdi
callq 0xfcc32
testb %al, %al
jne 0xccc2f
callq 0x175dd0
testq %rax, %rax
je 0xccc25
movq %rax, %r15
movl %r14d, 0x18(%rsp)
movq 0x8(%rbx), %rdi
callq 0x11b0a1
movq %rax, %rdi
callq 0xff28c
testb %al, %al
je 0xcc712
movq 0x8(%rbx), %rdi
callq 0x11b1f3
movq %rax, 0x58(%rsp)
jmp 0xcc7b1
movl %ebp, 0x20(%rsp)
movq %r12, %rbp
movq %r15, %r12
callq 0x11ac6c
movq %rax, %r14
movq %r13, %rdi
callq 0xfccba
movq %rax, %r15
movq %r13, %rdi
callq 0xfccba
movq %rax, %rdi
movl $0x20, %esi
callq 0xe438c
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x11ae1b
movq %r14, %rdi
callq 0x11b0a1
movq %rax, %rdi
xorl %esi, %esi
callq 0x100758
movq %rax, %r15
movq %r14, %rdi
callq 0x11bdbf
leaq 0x28f3ef(%rip), %rsi    # 0x35bb65
movq %r15, %rdi
callq 0x11acf3
movq 0x8(%rbx), %rsi
movq %r15, %rdi
callq 0x11adc1
movq %r15, %rdi
callq 0x11b0a1
movq %rax, %rdi
callq 0xff28c
testb %al, %al
movq %r15, 0x58(%rsp)
je 0xcc859
movq %r12, %r15
movq %rbp, %r12
movl 0x20(%rsp), %ebp
movq (%rbx), %rdi
callq 0x11b0a1
movq %rax, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x17746d
testq %rax, %rax
je 0xcc847
movq %rax, %r14
callq 0x11c954
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0xccc2a
movq 0x18(%rbx), %rdi
callq 0x172f92
testb %al, %al
je 0xcc80f
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0x172fdd
testq %rax, %rax
je 0xcc8d6
movq %r14, %rdi
movq %rax, %rsi
callq 0x177421
movq 0x28(%rbx), %rdi
callq 0x1833be
testb %al, %al
je 0xcc8bd
movq 0x28(%rbx), %rdi
movq %r13, %rsi
callq 0x1833e7
testq %rax, %rax
je 0xcc8d6
movq %r14, %rdi
movq %rax, 0x20(%rsp)
movq %rax, %rsi
callq 0x177458
jmp 0xcc8c6
movq %r15, %rdi
callq 0x176b71
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0xccc16
movq %r15, %rdi
callq 0x11b0a1
leaq 0x28f313(%rip), %rsi    # 0x35bb7b
movq %r13, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xfcb67
callq 0x11c954
testq %rax, %rax
je 0xccc2a
movq %rax, %r14
movq %r12, %r15
movl $0xffffffff, 0x8(%rsp)  # imm = 0xFFFFFFFF
xorl %r12d, %r12d
xorl %ebx, %ebx
movq $0x0, 0x18(%rsp)
movq $0x0, 0x38(%rsp)
xorl %ebp, %ebp
xorl %r13d, %r13d
xorl %edi, %edi
movq $0x0, 0x20(%rsp)
jmp 0xccbab
movq $0x0, 0x20(%rsp)
cmpb $0x1, 0x12(%rbx)
jne 0xcc90f
movq %r14, %rdi
callq 0x1773da
jmp 0xcc917
movl $0xffffffff, 0x8(%rsp)  # imm = 0xFFFFFFFF
movq $0x0, 0x20(%rsp)
xorl %r12d, %r12d
xorl %ebx, %ebx
movq $0x0, 0x18(%rsp)
movq $0x0, 0x38(%rsp)
xorl %ebp, %ebp
xorl %r13d, %r13d
xorl %edi, %edi
movq 0x10(%rsp), %r14
jmp 0xccbab
movq %r14, %rdi
callq 0x1773ca
leaq 0x32a(%rip), %rdi       # 0xccc48
movq %r15, %rsi
callq 0x11f740
movl 0x18(%rsp), %eax
subl %eax, %ebp
cltq
leaq (%r12,%rax,8), %rsi
movl %ebp, %edi
callq 0x145cdf
testq %rax, %rax
je 0xccc34
movq %r15, 0x68(%rsp)
movq %rax, %r15
movq %rax, %rdi
callq 0x145c94
cmpb $0x1, 0x14(%rbx)
movq %r15, 0x50(%rsp)
jne 0xcc96f
movq %r15, %rdi
callq 0x175d64
movq %rax, %r15
movq %rax, 0x18(%rsp)
jmp 0xcc978
movq $0x0, 0x18(%rsp)
cmpb $0x1, 0x13(%rbx)
jne 0xcc9f3
callq 0x141cb1
testq %rax, %rax
je 0xccc3e
movq %rax, %rbp
movq %r15, %rdi
movq %rax, %rsi
callq 0x14422c
testq %rax, %rax
je 0xccc43
movq %rax, %r15
movq %rax, %rdi
movq 0x60(%rsp), %rsi
movq %r13, %rdx
callq 0x125aa1
movq %rax, %r12
movq 0x10(%rsp), %rdi
callq 0x11c9e3
testq %r12, %r12
movq %rbp, 0x38(%rsp)
movq %r15, 0x30(%rsp)
je 0xcca4a
movq %r12, 0x28(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x162f5d
testl %eax, %eax
je 0xccb45
xorl %r12d, %r12d
xorl %ecx, %ecx
movl %eax, %ebp
jmp 0xcca5d
movq 0x10(%rsp), %rdi
callq 0x11c9e3
movq $0x0, 0x28(%rsp)
movq $0x0, 0x30(%rsp)
movq $0x0, 0x38(%rsp)
xorl %eax, %eax
movq %rax, 0x8(%rsp)
movq %r15, %rdi
movq %r14, %rsi
callq 0x1841d5
testq %rax, %rax
je 0xccc39
movq %rax, %r12
movq %rax, %rdi
movq %r13, %rsi
callq 0x162f5d
movl %eax, %ebp
movq 0x8(%rsp), %rcx
jmp 0xcca5d
xorl %r12d, %r12d
movq $0x0, 0x28(%rsp)
xorl %ecx, %ecx
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %rcx, 0x40(%rsp)
movq %r12, 0x48(%rsp)
movq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x11ca28
leaq -0x93b76(%rip), %rdi    # 0x38f05
xorl %esi, %esi
callq 0x11f740
testl %ebp, %ebp
je 0xcca94
movl %ebp, 0x8(%rsp)
movq 0x68(%rsp), %r15
jmp 0xccb92
callq 0x11ac6c
movq %r14, %rdi
movq %rax, %r14
leaq 0x28f0fc(%rip), %rsi    # 0x35bba2
movq %rax, %rdx
callq 0x11cbd9
movq 0x58(%rsp), %rdi
callq 0x11b0a1
movq %rax, 0x8(%rsp)
movq (%rbx), %rdi
movq 0x30(%rbx), %rax
movq %rax, 0x70(%rsp)
callq 0x11b0a1
movq %rax, %r15
movzbl 0x10(%rbx), %r12d
movzbl 0x11(%rbx), %ebx
movq %r14, %rdi
callq 0x11b0a1
movq 0x68(%rsp), %rbp
movq %rbp, %rdi
movq 0x8(%rsp), %rsi
movq 0x70(%rsp), %rdx
movq %r15, %rcx
movl %r12d, %r8d
movl %ebx, %r9d
pushq %r13
pushq %rax
callq 0x1762b4
addq $0x10, %rsp
movl %eax, %ebx
movq %r14, %rdi
callq 0x11bdbf
testl %ebx, %ebx
je 0xccb20
movl %ebx, 0x8(%rsp)
movq %rbp, %r15
jmp 0xccb8d
movq %rbp, %rdi
callq 0x176296
testb %al, %al
movq %rbp, %r15
jne 0xccb3b
movq %r15, %rdi
callq 0x1762a5
testb %al, %al
je 0xccb85
movl $0xfffffffe, 0x8(%rsp)  # imm = 0xFFFFFFFE
jmp 0xccb8d
movq %rbp, %rdi
callq 0x1406df
movq %r14, %rdi
movq %rax, %rsi
callq 0x1773ea
xorl %r12d, %r12d
movq 0x60(%rsp), %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x1258fa
movq %rax, %r15
movl $0x0, %ecx
testq %rax, %rax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jne 0xcca1a
jmp 0xcca5d
movl $0x0, 0x8(%rsp)
movq 0x10(%rsp), %r14
movq 0x50(%rsp), %rdi
movq 0x30(%rsp), %rbx
movq 0x28(%rsp), %r12
movq 0x48(%rsp), %r13
movq 0x40(%rsp), %rbp
callq 0x162dee
movq %rbp, %rdi
callq 0x162dee
movq %r12, %rdi
callq 0x162dee
movq %r13, %rdi
callq 0x162dee
movq %rbx, %rdi
callq 0x162dee
movq 0x18(%rsp), %rdi
callq 0x162dee
movq %r15, %rdi
callq 0x176b71
movq 0x38(%rsp), %rdi
callq 0x14070e
movq 0x20(%rsp), %rdi
callq 0x183173
movq %r14, %rdi
callq 0x11d054
movq 0x60(%rsp), %rdi
callq 0xd2938
movq 0x58(%rsp), %rdi
callq 0x11bdbf
movl 0x8(%rsp), %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2102d
callq 0x20ff4
callq 0x20ed7
callq 0x20fbb
callq 0x20f10
callq 0x20f82
callq 0x20f49