// File: /workspace/github_c_makefile_star2_O1/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, %r15
movq %rcx, %r14
movl %edx, %ebp
movq %rsi, %rbx
movl %edi, %r12d
testq %r8, %r8
je 0xa39e6
movq %r15, %rdi
callq 0x101a9a
testb %al, %al
jne 0xa3d74
movq %r15, 0x18(%rsp)
testq %r14, %r14
je 0xa3d6f
callq 0x121b54
movq %rax, %r13
cmpl %r12d, %ebp
jge 0xa3a1b
movslq %ebp, %r15
movslq %r12d, %r12
movq (%rbx,%r15,8), %rsi
movq %r13, %rdi
callq 0x121c30
incq %r15
cmpq %r15, %r12
jne 0xa3a07
movq %r13, %rdi
callq 0x104779
movq %rax, %rbx
movq %r13, %rdi
callq 0x121e78
leaq 0x2af5e3(%rip), %rdx    # 0x353018
movl $0x10, %esi
movq %rax, %rdi
movl $0x88, %ecx
callq 0x1093ef
movq %rax, %r12
movq %r13, %rdi
movq 0x18(%rsp), %r15
movq %r15, %rsi
callq 0x11abe6
testq %rax, %rax
je 0xa3d30
movq %rax, %rdi
movq %r12, 0x38(%rsp)
movq %r12, %rsi
movq %rax, %r12
callq 0x11adb5
movq %r12, 0x30(%rsp)
movq %r12, %rdi
callq 0x11a67b
movq %rax, 0x10(%rsp)
cmpb $0x1, 0x5(%r14)
jne 0xa3aa7
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x119a32
movq %rax, %rdi
movq %rbx, %rsi
callq 0x110c6c
movq %r13, 0x40(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movq %rsp, %rdx
leaq 0x20(%rsp), %rcx
movq %r15, %r8
callq 0x119a11
cmpl $0x1, %eax
jne 0xa3b33
cmpb $0x1, 0x2(%r14)
jne 0xa3b3c
movq (%rsp), %rdi
incq %rdi
movl $0x1, %esi
leaq 0x2af52a(%rip), %rdx    # 0x353018
movl $0xa2, %ecx
callq 0x1093ef
movq %rax, %r12
movq 0x28(%rsp), %rsi
movq (%rsp), %rdx
movq %rax, %rdi
callq 0x17660
movq (%rsp), %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0x177290
movl %eax, %ebp
testl %eax, %eax
sete %bl
movl $0x0, %eax
cmovneq %rax, %r12
jne 0xa3ced
jmp 0xa3b46
movl %eax, %ebp
xorl %ebx, %ebx
jmp 0xa3ced
movl $0x1, %ebp
movq 0x28(%rsp), %r12
movl %ebp, 0xc(%rsp)
cmpb $0x0, 0x4(%r14)
jne 0xa3ccc
movq 0x18(%r14), %rdi
movq 0x20(%rsp), %rdx
leaq 0x2af67e(%rip), %rsi    # 0x3531e3
xorl %eax, %eax
callq 0x103d21
movq (%rsp), %rax
testq %rax, %rax
je 0xa3c9d
xorl %r15d, %r15d
xorl %r13d, %r13d
xorl %ebx, %ebx
cmpb $0x1, (%r14)
jne 0xa3bbe
movzbl (%r12,%r15), %ebp
leal -0x41(%rbp), %eax
cmpl $0x34, %eax
ja 0xa3c25
movabsq $0x18004500180045, %rcx # imm = 0x18004500180045
btq %rax, %rcx
jae 0xa3c25
movq 0x18(%r14), %rsi
movl %ebp, %edi
callq 0x103f7f
incq %rbx
xorl %r13d, %r13d
jmp 0xa3c58
movzbl (%r12,%r15), %edi
cmpb $0x1, 0x1(%r14)
jne 0xa3c06
leal -0x42(%rdi), %eax
cmpl $0x38, %eax
ja 0xa3c94
movl $0x1400001, %ecx        # imm = 0x1400001
btq %rax, %rcx
jb 0xa3c14
movabsq $0x140000100000000, %rcx # imm = 0x140000100000000
btq %rax, %rcx
jae 0xa3c94
testb $0x1, %r13b
jne 0xa3c58
movq 0x18(%r14), %rsi
movl $0x6e, %edi
jmp 0xa3c4d
movq 0x18(%r14), %rsi
callq 0x103f7f
incq %rbx
jmp 0xa3c58
testb $0x1, %r13b
jne 0xa3c58
movq 0x18(%r14), %rsi
movl $0x4e, %edi
jmp 0xa3c4d
testb $0x1, %r13b
jne 0xa3c58
callq 0x17870
movq (%rax), %rax
movl %ebp, %ecx
movzwl (%rax,%rcx,2), %eax
xorl %edi, %edi
btl $0x8, %eax
setae %dil
movq 0x18(%r14), %rsi
shll $0x5, %edi
orl $0x4e, %edi
callq 0x103f7f
incq %rbx
movb $0x1, %r13b
movq 0x8(%r14), %rcx
testq %rcx, %rcx
je 0xa3c82
movq %rbx, %rax
xorl %edx, %edx
divq %rcx
testq %rdx, %rdx
jne 0xa3c82
movq 0x18(%r14), %rdi
leaq 0x325aa6(%rip), %rsi    # 0x3c971f
xorl %eax, %eax
callq 0x103d21
xorl %ebx, %ebx
incq %r15
movq (%rsp), %rax
cmpq %r15, %rax
ja 0xa3b81
jmp 0xa3c9d
movq 0x18(%r14), %rsi
jmp 0xa3bae
movq 0x8(%r14), %rcx
testq %rcx, %rcx
movq 0x40(%rsp), %r13
movq 0x18(%rsp), %r15
je 0xa3cba
xorl %edx, %edx
divq %rcx
testq %rdx, %rdx
je 0xa3ccc
movq 0x18(%r14), %rdi
leaq 0x325a5a(%rip), %rsi    # 0x3c971f
xorl %eax, %eax
callq 0x103d21
movb $0x1, %bl
cmpb $0x1, 0x2(%r14)
jne 0xa3ce9
movq %r12, %rdi
leaq 0x2af339(%rip), %rsi    # 0x353018
movl $0xf0, %edx
callq 0x109670
movl 0xc(%rsp), %ebp
testb %bl, %bl
jne 0xa3aac
cmpb $0x1, 0x3(%r14)
movq 0x38(%rsp), %r12
jne 0xa3d0e
movq %r13, %rdi
callq 0x121e78
testq %rax, %rax
jne 0xa3d62
cmpb $0x1, 0x5(%r14)
jne 0xa3d1a
callq 0x111189
movq 0x30(%rsp), %rdi
callq 0x11ab5d
movq 0x10(%rsp), %rdi
callq 0x119a53
jmp 0xa3d35
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %r13, %rdi
callq 0x121e8b
leaq 0x2af2d4(%rip), %rsi    # 0x353018
movq %r12, %rdi
movl $0x104, %edx            # imm = 0x104
callq 0x109670
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %rdi
movq %r12, %rsi
callq 0x19a4b
jmp 0xa3d0e
callq 0x19abd
callq 0x19a14
nopl (%rax)