// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/tools/gt_seqstat.c
// Function: gt_seqstat_runner
static int gt_seqstat_runner(int argc, const char **argv, int parsed_args,
                             void *tool_arguments, GtError *err)
{
  SeqstatArguments *arguments = tool_arguments;
  GtStrArray *files;
  GtSeqIterator *seqit;
  const GtUchar *sequence;
  char *desc;
  GtUword len;
  int i, had_err = 0;
  off_t totalsize;
  GtDiscDistri *distseqlen = NULL;
  GtAssemblyStatsCalculator *asc = NULL;
  GtLogger *asc_logger = NULL;
  GtDiscDistri *distastretch = NULL;
  uint64_t numofseq = 0, sumlength = 0;
  GtUword minlength = 0, maxlength = 0;
  GtUint64 countA = 0;
  bool minlengthdefined = false;

  gt_error_check(err);
  gt_assert(arguments);

  files = gt_str_array_new();
  for (i = parsed_args; i < argc; i++)
  {
    gt_str_array_add_cstr(files, argv[i]);
  }
  totalsize = gt_files_estimate_total_size(files);
  if (arguments->showestimsize)
  {
    printf("# estimated total size is " Formatuint64_t "\n",
              PRINTuint64_tcast(totalsize));
  }
  if (!had_err) {
    /* read input using seqiterator */
    seqit = gt_seq_iterator_sequence_buffer_new(files, err);
    if (!seqit)
      had_err = -1;
    if (!had_err)
    {
      if (arguments->dodistlen)
      {
        distseqlen = gt_disc_distri_new();
        if (arguments->binarydistlen)
          arguments->bucketsize = 1U;
      }
      if (arguments->docstats)
      {
        asc = gt_assembly_stats_calculator_new();
        gt_assembly_stats_calculator_set_genome_length(asc,
            arguments->genome_length);
      }
      if (arguments->doastretch)
      {
        distastretch = gt_disc_distri_new();
      }
      if (arguments->verbose)
      {
        gt_progressbar_start(gt_seq_iterator_getcurrentcounter(seqit,
                                                            (GtUint64)
                                                            totalsize),
                             (GtUint64) totalsize);
      }
      while (true)
      {
        desc = NULL;
        had_err = gt_seq_iterator_next(seqit, &sequence, &len, &desc, err);
        if (had_err != 1) break; /* 0: finished; 1: error */
        if (arguments->dodistlen || arguments->docstats)
        {
          if (!minlengthdefined || minlength > len)
          {
            minlength = len;
            minlengthdefined = true;
          }
          if (maxlength < len)
          {
            maxlength = len;
          }
          sumlength += (uint64_t) len;
          numofseq++;
          if (arguments->dodistlen)
          {
            gt_disc_distri_add(distseqlen,len/arguments->bucketsize);
          }
          if (arguments->docstats)
          {
            gt_assembly_stats_calculator_add(asc, len);
          }
        }
        if (arguments->doastretch)
        {
          countA += accumulateastretch(distastretch,sequence,len);
        }
      }
      if (arguments->verbose)
      {
        gt_progressbar_stop();
      }
      gt_seq_iterator_delete(seqit);
    }
  }
  gt_str_array_delete(files);
  if (!had_err && arguments->dodistlen)
  {
    printf("# " Formatuint64_t " sequences of average length %.2f\n",
             PRINTuint64_tcast(numofseq),(double) sumlength/numofseq);
    printf("# total length " Formatuint64_t "\n",
             PRINTuint64_tcast(sumlength));
    printf("# minimum length "GT_WU"\n",minlength);
    printf("# maximum length "GT_WU"\n",maxlength);
    if (arguments->binarydistlen)
    {
      FILE *distlenoutfile;
      GtStr *distlenoutfilename = gt_str_new_cstr(argv[parsed_args]);
      gt_str_append_cstr(distlenoutfilename, GT_SEQSTAT_BINARY_DISTLEN_SUFFIX);
      distlenoutfile = gt_fa_fopen(gt_str_get(distlenoutfilename), "wb", err);
      if (distlenoutfile == NULL)
        had_err = -1;
      else
      {
        /*@ignore@*/
        gt_disc_distri_foreach(distseqlen, showdistseqlenbinary,
            distlenoutfile);
        /*@end@*/
        printf("# distribution of sequence length written to file: %s\n",
          gt_str_get(distlenoutfilename));
        gt_fa_fclose(distlenoutfile);
      }
      gt_str_delete(distlenoutfilename);
    }
    else
    {
      printf("# distribution of sequence length in buckets of size %u\n",
          arguments->bucketsize);
      gt_disc_distri_foreach(distseqlen, showdistseqlen,
          &(arguments->bucketsize));
    }
    gt_disc_distri_delete(distseqlen);
  }
  if (!had_err && arguments->docstats)
  {
    GtUword i;
    asc_logger = gt_logger_new(true, GT_LOGGER_DEFLT_PREFIX, stdout);
    if (gt_str_array_size(arguments->nstats) == 0) {
      had_err = gt_assembly_stats_calculator_register_nstat(asc, 50, err);
      gt_assert(!had_err); /* 50 and 80 are sane */
      had_err = gt_assembly_stats_calculator_register_nstat(asc, 80, err);
      gt_assert(!had_err); /* 50 and 80 are sane */
    }
    for (i = 0; !had_err && i < gt_str_array_size(arguments->nstats); i++) {
      GtUword val = GT_UNDEF_UWORD;
      if (gt_parse_uword(&val, gt_str_array_get(arguments->nstats, i)) != 0) {
        gt_error_set(err, "could not parse nstat value '%s'",
                     gt_str_array_get(arguments->nstats, i));
        had_err = -1;
        break;
      }
      gt_assert(val != GT_UNDEF_UWORD);
      had_err = gt_assembly_stats_calculator_register_nstat(asc, val, err);
      if (had_err) break;
    }
    if (!had_err)
      gt_assembly_stats_calculator_show(asc, asc_logger);
    gt_logger_delete(asc_logger);
  }
  if (asc != NULL)
    gt_assembly_stats_calculator_delete(asc);
  if (!had_err && arguments->doastretch)
  {
    processastretches(distastretch,countA);
    gt_disc_distri_delete(distastretch);
  }
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %r8, %r13
movq %rcx, %rbx
movl %edx, %r12d
movq %rsi, %r15
movl %edi, %ebp
testq %r8, %r8
je 0xc67ac
movq %r13, %rdi
callq 0x101a9a
testb %al, %al
jne 0xc6ee9
movq %rbx, 0x40(%rsp)
testq %rbx, %rbx
je 0xc6ee4
callq 0x121b54
cmpl %ebp, %r12d
movq %rax, 0x8(%rsp)
jge 0xc67ea
movslq %r12d, %rbx
movslq %ebp, %r14
movq (%r15,%rbx,8), %rsi
movq 0x8(%rsp), %rdi
callq 0x121c30
movq 0x8(%rsp), %rax
incq %rbx
cmpq %rbx, %r14
jne 0xc67cf
movq %rax, %rdi
callq 0x104779
movq %rax, %r14
movq 0x40(%rsp), %rbx
cmpb $0x1, 0x5(%rbx)
jne 0xc6811
leaq 0x29b7bf(%rip), %rdi    # 0x361fc6
movq %r14, %rsi
xorl %eax, %eax
callq 0x17070
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x11a648
testq %rax, %rax
movq %r13, 0x50(%rsp)
movq %r15, 0x78(%rsp)
movl %r12d, 0x5c(%rsp)
je 0xc684f
movq %rax, %rbp
cmpb $0x1, 0x1(%rbx)
jne 0xc6896
callq 0xe99dc
cmpb $0x1, 0x2(%rbx)
jne 0xc6898
movl $0x1, 0x8(%rbx)
jmp 0xc6898
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movq $0x0, 0x20(%rsp)
xorl %r12d, %r12d
movq $0x0, 0x18(%rsp)
movq $0x0, 0x30(%rsp)
movq $0x0, 0x38(%rsp)
movq $0x0, 0x28(%rsp)
movq $0x0, 0x10(%rsp)
xorl %r14d, %r14d
jmp 0xc6ac3
xorl %eax, %eax
cmpb $0x1, 0x4(%rbx)
movq %rax, 0x20(%rsp)
jne 0xc68b9
callq 0x12b8c8
movq %rax, %r12
movq 0x10(%rbx), %rsi
movq %rax, %rdi
callq 0x12b9ac
jmp 0xc68bc
xorl %r12d, %r12d
cmpb $0x1, 0x3(%rbx)
jne 0xc68ce
callq 0xe99dc
movq %rax, 0x18(%rsp)
jmp 0xc68d7
movq $0x0, 0x18(%rsp)
cmpb $0x1, (%rbx)
jne 0xc68f2
movq %rbp, %rdi
movq %r14, %rsi
callq 0x119a32
movq %rax, %rdi
movq %r14, %rsi
callq 0x110c6c
leaq 0x68(%rsp), %rcx
movq $0x0, (%rcx)
leaq 0x70(%rsp), %rsi
leaq 0x48(%rsp), %rdx
movq %rbp, %rdi
movq %r13, %r8
callq 0x119a11
cmpl $0x1, %eax
jne 0xc6a87
movq %r12, 0x60(%rsp)
xorl %r12d, %r12d
xorl %r14d, %r14d
movq $0x0, 0x10(%rsp)
movq $0x0, 0x28(%rsp)
movq $0x0, 0x38(%rsp)
movq $0x0, 0x30(%rsp)
movq %rbp, 0x80(%rsp)
movb 0x1(%rbx), %al
testb %al, %al
jne 0xc6960
cmpb $0x1, 0x4(%rbx)
jne 0xc69d5
movq 0x48(%rsp), %r15
movq 0x28(%rsp), %rdx
cmpq %r15, %rdx
setbe %cl
testb %cl, %r12b
cmoveq %r15, %rdx
movq %rdx, 0x28(%rsp)
movzbl %r12b, %r12d
movl $0x1, %ecx
cmovel %ecx, %r12d
movq 0x10(%rsp), %rcx
cmpq %r15, %rcx
cmovbeq %r15, %rcx
movq %rcx, 0x10(%rsp)
testb %al, %al
je 0xc69b6
movl 0x8(%rbx), %ecx
movq %r15, %rax
xorl %edx, %edx
divq %rcx
movq 0x20(%rsp), %rdi
movq %rax, %rsi
callq 0xe99f7
addq %r15, 0x38(%rsp)
incq 0x30(%rsp)
cmpb $0x1, 0x4(%rbx)
jne 0xc69d5
movq 0x48(%rsp), %rsi
movq 0x60(%rsp), %rdi
callq 0x12b941
cmpb $0x1, 0x3(%rbx)
jne 0xc6a51
movq %r14, %rbp
movq 0x48(%rsp), %r13
testq %r13, %r13
je 0xc6a25
movq 0x70(%rsp), %rbx
xorl %r15d, %r15d
xorl %esi, %esi
xorl %r14d, %r14d
movzbl (%rbx,%r14), %eax
orl $0x20, %eax
cmpl $0x61, %eax
jne 0xc6a0a
incq %r15
incq %rsi
jmp 0xc6a1b
testq %rsi, %rsi
je 0xc6a19
movq 0x18(%rsp), %rdi
callq 0xe99f7
xorl %esi, %esi
incq %r14
cmpq %r14, %r13
jne 0xc69f5
jmp 0xc6a2a
xorl %esi, %esi
xorl %r15d, %r15d
testq %rsi, %rsi
je 0xc6a39
movq 0x18(%rsp), %rdi
callq 0xe99f7
movq %rbp, %r14
addq %r15, %r14
movq 0x40(%rsp), %rbx
movq 0x50(%rsp), %r13
movq 0x80(%rsp), %rbp
movq $0x0, 0x68(%rsp)
movq %rbp, %rdi
leaq 0x70(%rsp), %rsi
leaq 0x48(%rsp), %rdx
leaq 0x68(%rsp), %rcx
movq %r13, %r8
callq 0x119a11
cmpl $0x1, %eax
je 0xc6953
movl %eax, %r15d
movq 0x60(%rsp), %r12
jmp 0xc6ab1
movl %eax, %r15d
movq $0x0, 0x30(%rsp)
movq $0x0, 0x38(%rsp)
movq $0x0, 0x28(%rsp)
movq $0x0, 0x10(%rsp)
xorl %r14d, %r14d
cmpb $0x1, (%rbx)
jne 0xc6abb
callq 0x111189
movq %rbp, %rdi
callq 0x119a53
movq 0x8(%rsp), %rdi
callq 0x121e8b
testl %r15d, %r15d
jne 0xc6c6b
xorl %r15d, %r15d
cmpb $0x1, 0x1(%rbx)
jne 0xc6c6b
movq %r14, 0x8(%rsp)
movq 0x38(%rsp), %r14
movq %r14, %xmm1
movq 0x289de6(%rip), %xmm2   # 0x3508e0
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x289dea(%rip), %xmm3   # 0x3508f0
subpd %xmm3, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq 0x30(%rsp), %rsi
movq %rsi, %xmm1
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
subpd %xmm3, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
leaq 0x29b4a6(%rip), %rdi    # 0x361fe5
movb $0x1, %al
callq 0x17070
leaq 0x29b4c0(%rip), %rdi    # 0x36200d
xorl %r15d, %r15d
movq %r14, %rsi
xorl %eax, %eax
callq 0x17070
leaq 0x29b4c0(%rip), %rdi    # 0x362021
movq 0x28(%rsp), %rsi
xorl %eax, %eax
callq 0x17070
leaq 0x29b4c3(%rip), %rdi    # 0x362037
movq 0x10(%rsp), %rsi
xorl %eax, %eax
callq 0x17070
cmpb $0x1, 0x2(%rbx)
jne 0xc6c1a
movq %r12, %rbp
movslq 0x5c(%rsp), %rax
movq 0x78(%rsp), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x120955
movq %rax, %r14
leaq 0x29b4a3(%rip), %rsi    # 0x36204d
movq %rax, %rdi
callq 0x12097f
movq %r14, %rdi
callq 0x120d23
leaq 0x297f4c(%rip), %rsi    # 0x35eb0d
leaq 0x29b1cb(%rip), %rdx    # 0x361d93
movq %rax, %rdi
movl $0x183, %ecx            # imm = 0x183
movq %r13, %r8
callq 0x101c23
testq %rax, %rax
je 0xc6c48
movq %rax, %r12
leaq 0x316(%rip), %rsi       # 0xc6efd
movq 0x20(%rsp), %rdi
movq %rax, %rdx
callq 0xe9bdf
movq %r14, %rdi
callq 0x120d23
leaq 0x29b453(%rip), %rdi    # 0x362056
xorl %r15d, %r15d
movq %rax, %rsi
xorl %eax, %eax
callq 0x17070
movq %r12, %rdi
callq 0x101e80
jmp 0xc6c4e
leaq 0x8(%rbx), %r14
movl 0x8(%rbx), %esi
leaq 0x29b465(%rip), %rdi    # 0x36208d
xorl %eax, %eax
callq 0x17070
leaq 0x313(%rip), %rsi       # 0xc6f49
movq 0x20(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rdx
callq 0xe9bdf
jmp 0xc6c5e
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movq %r14, %rdi
callq 0x121b03
movq %rbp, %r12
movq 0x20(%rsp), %rbp
movq %rbp, %rdi
callq 0xe9ff6
movq 0x8(%rsp), %r14
testl %r15d, %r15d
jne 0xc6dca
xorl %r15d, %r15d
cmpb $0x1, 0x4(%rbx)
jne 0xc6dca
movq 0x3fd260(%rip), %rax    # 0x4c3ee8
movq (%rax), %rdx
leaq 0x288c42(%rip), %rsi    # 0x34f8d4
movl $0x1, %edi
callq 0x108ed0
movq %rax, %r15
movq 0x18(%rbx), %rdi
callq 0x121e78
testq %rax, %rax
jne 0xc6cdd
movl $0x32, %esi
movq %r12, %rdi
movq %r13, %rdx
callq 0x12bb77
testl %eax, %eax
jne 0xc6ef3
movl $0x50, %esi
movq %r12, %rdi
movq %r13, %rdx
callq 0x12bb77
testl %eax, %eax
jne 0xc6ef8
movq %r15, 0x10(%rsp)
movq %r14, 0x8(%rsp)
movq %r12, %r14
xorl %r12d, %r12d
leaq 0x88(%rsp), %r13
leaq 0x29b3ca(%rip), %rbp    # 0x3620c6
movq 0x18(%rbx), %rdi
callq 0x121e78
cmpq %rax, %r12
jae 0xc6d9b
movq $-0x1, 0x88(%rsp)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0x121cfa
movq %r13, %rdi
movq %rax, %rsi
callq 0x11043f
testl %eax, %eax
je 0xc6d5d
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0x121cfa
xorl %ebx, %ebx
movq 0x50(%rsp), %rdi
movq %rbp, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
jmp 0xc6d84
movq 0x88(%rsp), %rsi
cmpq $-0x1, %rsi
je 0xc6edf
movq %r14, %rdi
movq 0x50(%rsp), %rdx
callq 0x12bb77
movl %eax, %r15d
testl %eax, %eax
sete %bl
testb %bl, %bl
je 0xc6da0
incq %r12
testl %r15d, %r15d
movq 0x40(%rsp), %rbx
je 0xc6cfc
jmp 0xc6da5
xorl %r15d, %r15d
jmp 0xc6da5
movq 0x40(%rsp), %rbx
testl %r15d, %r15d
movq %r14, %r12
movq 0x10(%rsp), %r14
jne 0xc6dbd
movq %r12, %rdi
movq %r14, %rsi
callq 0x12bc49
movq %r14, %rdi
callq 0x10916a
movq 0x8(%rsp), %r14
testq %r12, %r12
je 0xc6dd7
movq %r12, %rdi
callq 0x12b910
testl %r15d, %r15d
jne 0xc6eca
cmpb $0x1, 0x3(%rbx)
jne 0xc6eca
movq %r14, %r12
xorl %eax, %eax
leaq 0x88(%rsp), %rbx
movq %rax, (%rbx)
movq %rax, 0x10(%rbx)
movq $0xa, 0x18(%rbx)
leaq 0x15e(%rip), %rsi       # 0xc6f6b
movq 0x18(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rdx
callq 0xe9bdf
movq 0x10(%rbx), %rax
leaq 0x8(,%rax,8), %rdi
leaq 0x29af63(%rip), %rsi    # 0x361d93
movl $0xff, %edx
callq 0x1092b2
movq %rax, 0x8(%rbx)
movq 0x10(%rbx), %rcx
leaq 0x8(,%rcx,8), %rdx
movq %rax, %rdi
xorl %esi, %esi
callq 0x173a0
leaq 0x13b(%rip), %rsi       # 0xc6f96
movq %r14, %rdi
movq %rbx, %rdx
callq 0xe9bdf
movq 0x18(%rbx), %r14
cmpq 0x10(%rbx), %r14
ja 0xc6e9d
leaq 0x29b294(%rip), %rbx    # 0x36210b
movq 0x90(%rsp), %rax
movq (%rax,%r14,8), %rdx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x17070
incq %r14
cmpq 0x98(%rsp), %r14
jbe 0xc6e77
cmpq %r12, 0x88(%rsp)
jne 0xc6eee
movq 0x90(%rsp), %rdi
leaq 0x29aedd(%rip), %rsi    # 0x361d93
movl $0x10b, %edx            # imm = 0x10B
callq 0x109670
movq 0x18(%rsp), %rdi
callq 0xe9ff6
movl %r15d, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1f6d4
callq 0x1f70d
callq 0x1f5f0
callq 0x1f69b
callq 0x1f629
callq 0x1f662