// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/tools/gt_convertseq.c
// Function: gt_convertseq_runner
static int gt_convertseq_runner(int argc, const char **argv, int parsed_args,
                              void *tool_arguments, GtError *err)
{
  GtConvertseqArguments *arguments = tool_arguments;
  int had_err = 0, i;
  GtFilelengthvalues *flv;
  GtSeqIterator *seqit;
  GtSequenceBuffer *sb = NULL;
  GtStrArray *files;
  const GtUchar *sequence;
  char *desc;
  GtUword len, j;
  off_t totalsize;
  gt_error_check(err);
  gt_assert(arguments != NULL);

  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);

  flv = gt_calloc((size_t) gt_str_array_size(files),
                  sizeof (GtFilelengthvalues));

  sb = gt_sequence_buffer_new_guess_type(files, err);
  if (!sb) {
    had_err = -1;
  }
  if (!had_err) {
    gt_sequence_buffer_set_filelengthtab(sb, flv);
    /* read input using seqiterator */
    seqit = gt_seq_iterator_sequence_buffer_new_with_buffer(sb);
    if (arguments->verbose)
    {
      gt_progressbar_start(gt_seq_iterator_getcurrentcounter(seqit,
                                                           (GtUint64)
                                                           totalsize),
                           (GtUint64) totalsize);
    }
    while (true)
    {
      GtUchar *seq = NULL;
      desc = NULL;
      j = 0UL;
      had_err = gt_seq_iterator_next(seqit, &sequence, &len, &desc, err);
      if (had_err != 1)
        break;
      if (arguments->revcomp) {
        GtUchar *newseq = gt_calloc((size_t) len+1, sizeof (GtUchar));
        memcpy(newseq, sequence, (size_t) len*sizeof (GtUchar));
        had_err = gt_reverse_complement((char*) newseq, len, err);
        if (had_err)
          break;
        seq = newseq;
      } else seq = (GtUchar*) sequence;

      if (!arguments->showseq) {
        bool in_wildcard = false;
        gt_file_xprintf(arguments->outfp, ">%s\n", desc);
        for (i = 0; (GtUword) i < len; i++) {
          if (arguments->reduce_wc_dna) {
            switch (seq[i]) {
              case 'a':
              case 'A':
              case 'c':
              case 'C':
              case 'g':
              case 'G':
              case 't':
              case 'u':
              case 'T':
              case 'U':
                in_wildcard = false;
                gt_file_xfputc((int) seq[i], arguments->outfp);
                j++;
                break;
              default:
                if (!in_wildcard) {
                  in_wildcard = true;
                  if (isupper((int) seq[i]))
                    gt_file_xfputc((int) 'N', arguments->outfp);
                  else
                    gt_file_xfputc((int) 'n', arguments->outfp);
                  j++;
                }
            }
          }
          else if (arguments->reduce_wc_prot) {
            switch (seq[i]) {
              case 'X':
              case 'B':
              case 'Z':
                if (!in_wildcard) {
                  in_wildcard = true;
                  gt_file_xfputc((int) 'N', arguments->outfp);
                  j++;
                }
                break;
              case 'x':
              case 'b':
              case 'z':
                if (!in_wildcard) {
                  in_wildcard = true;
                  gt_file_xfputc((int) 'n', arguments->outfp);
                  j++;
                }
                break;
              default:
                in_wildcard = false;
                gt_file_xfputc((int) seq[i], arguments->outfp);
                j++;
            }
          }
          else {
            gt_file_xfputc((int) seq[i], arguments->outfp);
            j++;
          }
          if (arguments->fastawidth > 0 && j % arguments->fastawidth == 0) {
            j = 0;
            gt_file_xprintf(arguments->outfp, "\n");
          }
        }
        if (arguments->fastawidth == 0 || len % arguments->fastawidth != 0)
            gt_file_xprintf(arguments->outfp, "\n");
      }
      if (arguments->revcomp) {
        gt_free(seq);
      }
    }
    if (arguments->showflv) {
      for (j=0;j<gt_str_array_size(files);j++) {
        fprintf(stderr, "file "GT_WU" (%s): "GT_WU"/"GT_WU"\n",
               j,
               gt_str_array_get(files, j),
               (GtUword) flv[j].length,
               (GtUword) flv[j].effectivelength);
      }
    }
    if (arguments->verbose)
    {
      gt_progressbar_stop();
    }
    gt_sequence_buffer_delete(sb);
    gt_seq_iterator_delete(seqit);
  }
  gt_str_array_delete(files);
  gt_free(flv);

  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %rbx
movq %rcx, %r14
movl %edx, %ebp
movq %rsi, %r15
movl %edi, %r13d
testq %r8, %r8
je 0x22ef0
movq %rbx, %rdi
callq 0x89eb7
testb %al, %al
jne 0x232b3
movq %rbx, 0x28(%rsp)
testq %r14, %r14
je 0x23289
callq 0xae154
movslq %ebp, %rbx
movq %rax, %rbp
movslq %r13d, %r12
movq 0x28(%rsp), %r13
cmpq %r12, %rbx
jge 0x22f27
movq (%r15,%rbx,8), %rsi
movq %rbp, %rdi
callq 0xae22f
incq %rbx
jmp 0x22f11
movq %rbp, %rdi
callq 0x8e240
movq %rax, %r15
movq %rbp, %rdi
callq 0xae61c
leaq 0x2c70c7(%rip), %rdx    # 0x2ea008
pushq $0x10
popq %rsi
movq %rax, %rdi
movl $0x88, %ecx
callq 0x9334a
movq %rax, %rbx
movq %rbp, %rdi
movq %r13, %rsi
callq 0xa77c3
testq %rax, %rax
movq %rbp, 0x10(%rsp)
je 0x23257
movq %rax, %r12
movq %rax, %rdi
movq %rbx, 0x18(%rsp)
movq %rbx, %rsi
callq 0xa7aac
movq %r12, 0x40(%rsp)
movq %r12, %rdi
callq 0xa7103
movq %rax, %rbx
cmpb $0x1, 0x5(%r14)
jne 0x22fad
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa6337
movq %rax, %rdi
movq %r15, %rsi
callq 0x9c79c
movq %rbx, 0x20(%rsp)
andq $0x0, 0x30(%rsp)
movq %rbx, %rdi
leaq 0x38(%rsp), %rsi
leaq 0x8(%rsp), %rdx
leaq 0x30(%rsp), %rcx
movq %r13, %r8
callq 0xa62e5
cmpl $0x1, %eax
jne 0x231c8
cmpb $0x1, 0x2(%r14)
jne 0x2302c
movq 0x8(%rsp), %rdi
incq %rdi
pushq $0x1
popq %rsi
leaq 0x2c7014(%rip), %rdx    # 0x2ea008
movl $0xa2, %ecx
callq 0x9334a
movq %rax, %r15
movq 0x38(%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rax, %rdi
callq 0x17630
movq 0x8(%rsp), %rsi
movq %r15, %rdi
movq %r13, %rdx
callq 0x111ab8
testl %eax, %eax
je 0x23031
jmp 0x231c8
movq 0x38(%rsp), %r15
cmpb $0x0, 0x4(%r14)
jne 0x231a4
movq 0x18(%r14), %rdi
movq 0x30(%rsp), %rdx
xorl %r13d, %r13d
leaq 0x2c7184(%rip), %rsi    # 0x2ea1d3
xorl %eax, %eax
callq 0x8d432
xorl %ebp, %ebp
xorl %ebx, %ebx
movq 0x8(%rsp), %rax
cmpq %r13, %rax
jbe 0x23175
cmpb $0x1, (%r14)
jne 0x230a8
movzbl (%r15,%r13), %r12d
leal -0x41(%r12), %eax
cmpl $0x34, %eax
ja 0x23142
movabsq $0x18004500180045, %rcx # imm = 0x18004500180045
btq %rax, %rcx
jae 0x23142
movq 0x18(%r14), %rsi
movl %r12d, %edi
callq 0x8d771
incq %rbp
xorl %ebx, %ebx
jmp 0x23110
movzbl (%r15,%r13), %edi
cmpb $0x1, 0x1(%r14)
jne 0x230ec
leal -0x42(%rdi), %eax
cmpl $0x38, %eax
ja 0x2316c
movl $0x1400001, %ecx        # imm = 0x1400001
btq %rax, %rcx
jb 0x230fa
movabsq $0x140000100000000, %rcx # imm = 0x140000100000000
btq %rax, %rcx
jae 0x2316c
testb $0x1, %bl
jne 0x23110
movq 0x18(%r14), %rsi
pushq $0x6e
jmp 0x23105
movq 0x18(%r14), %rsi
callq 0x8d771
incq %rbp
jmp 0x23110
testb $0x1, %bl
jne 0x23110
movq 0x18(%r14), %rsi
pushq $0x4e
popq %rdi
callq 0x8d771
incq %rbp
movb $0x1, %bl
movq 0x8(%r14), %rcx
testq %rcx, %rcx
je 0x2313a
movq %rbp, %rax
xorl %edx, %edx
divq %rcx
testq %rdx, %rdx
jne 0x2313a
movq 0x18(%r14), %rdi
leaq 0x33d3be(%rip), %rsi    # 0x3604ef
xorl %eax, %eax
callq 0x8d432
xorl %ebp, %ebp
incq %r13
jmp 0x2305a
testb $0x1, %bl
jne 0x23110
callq 0x17820
movq (%rax), %rax
movl %r12d, %ecx
movzwl (%rax,%rcx,2), %eax
xorl %edi, %edi
btl $0x8, %eax
setae %dil
movq 0x18(%r14), %rsi
shll $0x5, %edi
orl $0x4e, %edi
jmp 0x23106
movq 0x18(%r14), %rsi
jmp 0x2309c
movq 0x8(%r14), %rcx
testq %rcx, %rcx
movq 0x28(%rsp), %r13
movq 0x20(%rsp), %rbx
je 0x23192
xorl %edx, %edx
divq %rcx
testq %rdx, %rdx
je 0x231a4
movq 0x18(%r14), %rdi
leaq 0x33d352(%rip), %rsi    # 0x3604ef
xorl %eax, %eax
callq 0x8d432
cmpb $0x1, 0x2(%r14)
jne 0x22fb2
movq %r15, %rdi
leaq 0x2c6e4f(%rip), %rsi    # 0x2ea008
movl $0xf0, %edx
callq 0x936f9
jmp 0x22fb2
movl %eax, %ebp
cmpb $0x1, 0x3(%r14)
jne 0x23230
movq 0x18(%rsp), %rbx
addq $0x8, %rbx
xorl %r12d, %r12d
movq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0xae61c
cmpq %rax, %r12
jae 0x23230
movq 0x414d72(%rip), %rax    # 0x437f68
movq (%rax), %r13
movq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0xae386
movq -0x8(%rbx), %r8
movq (%rbx), %r9
movq %r13, %rdi
leaq 0x2c6fbe(%rip), %rsi    # 0x2ea1d8
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x17a50
incq %r12
addq $0x10, %rbx
jmp 0x231e2
cmpb $0x1, 0x5(%r14)
jne 0x2323c
callq 0x9cce9
movq 0x40(%rsp), %rdi
callq 0xa76dc
movq 0x20(%rsp), %rdi
callq 0xa6389
movq 0x18(%rsp), %rbx
jmp 0x2325a
pushq $-0x1
popq %rbp
movq 0x10(%rsp), %rdi
callq 0xae662
leaq 0x2c6d9d(%rip), %rsi    # 0x2ea008
movq %rbx, %rdi
movl $0x104, %edx            # imm = 0x104
callq 0x936f9
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x414cd8(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2c1d79(%rip), %rsi    # 0x2e5013
leaq 0x2c2fcb(%rip), %rdx    # 0x2e626c
leaq 0x2c6f16(%rip), %rcx    # 0x2ea1be
leaq 0x2c6d59(%rip), %r8     # 0x2ea008
pushq $0x7e
jmp 0x232db
movq 0x414cae(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2c1d4f(%rip), %rsi    # 0x2e5013
leaq 0x2c1ef4(%rip), %rdx    # 0x2e51bf
leaq 0x2c6eec(%rip), %rcx    # 0x2ea1be
leaq 0x2c6d2f(%rip), %r8     # 0x2ea008
pushq $0x7d
popq %r9
xorl %eax, %eax
callq 0x17a50
callq 0x17390
nopl (%rax)