// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/giextract.c
// Function: gt_extractkeysfromfastafile
int gt_extractkeysfromfastafile(bool verbose,
                                GtFile *outfp,
                                GtUword width,
                                const GtStr *fileofkeystoextract,
                                GtStrArray *referencefiletab,
                                GtError *err)
{
  GtSeqIterator *seqit;
  const GtUchar *sequence;
  char *desc, *headerbufferspace = NULL, *keyspace = NULL;
  const char *keyptr;
  GtUword allockeyspace = 0, len, keylen, numofqueries, keyposition,
                countmarkhit = 0;
  int had_err = 0;
  off_t totalsize;
  Fastakeyquery *fastakeyqueries;
  size_t headerbuffersize = 0, headerlength;

  gt_error_check(err);
  fastakeyqueries = readfileofkeystoextract(verbose,&numofqueries,
                                            fileofkeystoextract,err);
  if (fastakeyqueries == NULL)
  {
    return -1;
  }
  totalsize = gt_files_estimate_total_size(referencefiletab);
  if (verbose)
  {
    printf("# estimated total size is " Formatuint64_t "\n",
            PRINTuint64_tcast(totalsize));
  }
  seqit = gt_seq_iterator_sequence_buffer_new(referencefiletab, err);
  if (!seqit)
  {
    had_err = -1;
  }
  if (!had_err && verbose)
  {
    gt_progressbar_start(gt_seq_iterator_getcurrentcounter(seqit,
                                                          (GtUint64)
                                                          totalsize),
                                                          (GtUint64)
                                                          totalsize);
  }
  while (had_err != -1 && countmarkhit < numofqueries)
  {
    had_err = gt_seq_iterator_next(seqit, &sequence, &len, &desc, err);
    if (had_err != 1)
    {
      break;
    }
    keyptr = desc2key(&keylen,desc,err);
    if (keyptr == NULL)
    {
      had_err = -1;
    } else
    {
      if (allockeyspace < keylen)
      {
        keyspace = gt_realloc(keyspace,sizeof (*keyspace) * (keylen+1));
        allockeyspace = keylen;
      }
      gt_assert(keyspace != NULL);
      strncpy(keyspace,keyptr,(size_t) keylen);
      keyspace[keylen] = '\0';
      keyposition = searchdesinfastakeyqueries(keyspace,fastakeyqueries,
                                               numofqueries);
      if (keyposition < numofqueries)
      {
        while (keyposition < numofqueries &&
               strcmp(fastakeyqueries[keyposition].fastakey,keyspace) == 0)
        {
#ifndef NDEBUG
          if (fastakeyqueries[keyposition].markhit)
          {
            fprintf(stderr,"key %s was already found before\n",
                     fastakeyqueries[keyposition].fastakey);
            exit(GT_EXIT_PROGRAMMING_ERROR);
          }
#endif
          headerlength = strlen(desc);
          if (headerbuffersize < headerlength + EXTRABUF + 1)
          {
            headerbuffersize = headerlength + EXTRABUF + 1;
            headerbufferspace = gt_realloc(headerbufferspace,
                                           sizeof (*headerbufferspace)
                                           * headerbuffersize);
          }
          if (COMPLETE(fastakeyqueries + keyposition))
          {
            /*
            (void) snprintf(headerbufferspace,headerbuffersize,
                            "%*.*s complete %s",
                            (int) keylen,(int) keylen,keyspace,
                            desc);
            */
            gt_fasta_show_entry(desc, (const char *) sequence, len, width,
                                outfp);
          } else
          {
            (void) snprintf(headerbufferspace,headerbuffersize,
                            "%*.*s "GT_WU" "GT_WU" %s",
                            (int) keylen,(int) keylen,keyspace,
                            fastakeyqueries[keyposition].frompos,
                            fastakeyqueries[keyposition].topos,
                            desc);
            gt_fasta_show_entry(headerbufferspace,
                                (const char *)
                                (sequence+fastakeyqueries[keyposition].
                                                          frompos - 1),
                                fastakeyqueries[keyposition].topos -
                                fastakeyqueries[keyposition].frompos+1,
                                width, outfp);
          }
          fastakeyqueries[keyposition].markhit = true;
          countmarkhit++;
          keyposition++;
        }
      }
#ifdef SKDEBUG
      printf("%s 1 "GT_WU"\n",keyspace, len);
#endif
    }
  }
  gt_free(headerbufferspace);
  gt_free(keyspace);
  if (verbose)
  {
    gt_progressbar_stop();
  }
  if (verbose)
  {
    outputnonmarked(fastakeyqueries,numofqueries);
  }
  fastakeyqueries_delete(fastakeyqueries,numofqueries);
  gt_seq_iterator_delete(seqit);
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %r9, %rbx
movq %r8, %r12
movq %rcx, %r13
movq %rdx, %r14
movq %rsi, %r15
movl %edi, %ebp
testq %r9, %r9
je 0x15eaa2
movq %rbx, %rdi
callq 0x89eb7
testb %al, %al
jne 0x15f129
movq %rbx, %rdi
callq 0x89eb7
testb %al, %al
jne 0x15f157
movl %ebp, 0xc(%rsp)
movq %r14, %rbp
movq %r12, %r14
movq %r13, %rdi
callq 0xad1fa
movq %rax, %rdi
callq 0x8dc01
movq %rax, %r12
movq %r13, %rdi
callq 0xad1fa
movq %r12, 0x18(%rsp)
testq %r12, %r12
je 0x15eba4
leaq 0x19c351(%rip), %rsi    # 0x2fae2d
leaq 0x1e89df(%rip), %rdx    # 0x3474c2
movq %rax, %rdi
movl $0xfd, %ecx
movq %rbx, 0x28(%rsp)
movq %rbx, %r8
callq 0x8a156
testq %rax, %rax
je 0x15f03d
movq %rax, %rbx
movq %r14, 0x20(%rsp)
movq %r15, 0x60(%rsp)
movq %rbp, 0x68(%rsp)
cmpb $0x0, 0xc(%rsp)
je 0x15eb33
movq %r13, %rdi
callq 0xad1fa
leaq 0x1e8dff(%rip), %rdi    # 0x347928
movq %rax, %rsi
xorl %eax, %eax
callq 0x17070
movq 0x18(%rsp), %rbp
shlq $0x5, %rbp
leaq 0x1e897f(%rip), %rsi    # 0x3474c2
movq %rbp, %rdi
movl $0x106, %edx            # imm = 0x106
callq 0x93160
movq %rax, %r15
xorl %r14d, %r14d
callq 0xacb84
movq %rax, %r12
movq %r15, 0x10(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0xad4de
cmpl $-0x1, %eax
je 0x15ebbd
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %r14, %rcx
movq %r13, %r8
movq 0x28(%rsp), %r9
callq 0x15f23a
testl %eax, %eax
jne 0x15f01e
movq %r12, %rdi
callq 0xad357
incq %r14
addq $0x20, %r15
jmp 0x15eb63
leaq 0x1e8d61(%rip), %rsi    # 0x34790c
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x89dbb
jmp 0x15f03d
movq %r12, %rdi
callq 0xae103
movq %rbx, %rdi
callq 0x8a4fd
leaq 0x83f(%rip), %rcx       # 0x15f413
pushq $0x20
popq %rdx
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x17ed0
cmpb $0x0, 0xc(%rsp)
je 0x15ec00
leaq 0x1e8d4b(%rip), %rdi    # 0x34793f
movq 0x18(%rsp), %rsi
xorl %eax, %eax
callq 0x17070
movq 0x10(%rsp), %r13
addq %r13, %rbp
pushq $0x7d
popq %rbx
movq %r13, %r15
movq %r13, %r12
addq $0x20, %r15
movq %r15, %rax
pushq $-0x1
popq %r13
cmpq %rbp, %rax
jae 0x15ec9e
movq %rax, %r15
movq (%r12), %rdi
movq (%rax), %r14
movq %r14, %rsi
callq 0x179e0
testl %eax, %eax
jne 0x15ec51
movq 0x8(%r12), %rax
cmpq 0x8(%r15), %rax
jne 0x15ec51
movq 0x10(%r12), %rcx
leaq 0x20(%r15), %rax
cmpq 0x10(%r15), %rcx
je 0x15ec1c
leaq 0x20(%r12), %r13
leaq -0x20(%r15), %rax
cmpq %r12, %rax
je 0x15ec0e
movups 0x8(%r15), %xmm0
movups %xmm0, 0x28(%r12)
movq %r14, %rdi
callq 0x172d0
movq 0x20(%r12), %rdi
leaq 0x1(%rax), %rsi
leaq 0x1e8840(%rip), %rdx    # 0x3474c2
movl %ebx, %ecx
callq 0x93472
movq %rax, 0x20(%r12)
movq (%r15), %rsi
movq %rax, %rdi
callq 0x17730
jmp 0x15ec0e
subq 0x10(%rsp), %r12
sarq $0x5, %r12
incq %r12
subq %r12, 0x18(%rsp)
jbe 0x15ecfd
cmpb $0x0, 0xc(%rsp)
je 0x15eccb
leaq 0x1e8cb7(%rip), %rdi    # 0x347976
movq 0x18(%rsp), %rsi
xorl %eax, %eax
callq 0x17070
movq %r12, %r14
shlq $0x5, %r14
addq 0x10(%rsp), %r14
leaq 0x1e87e4(%rip), %rbx    # 0x3474c2
cmpq %rbp, %r14
jae 0x15ecfd
movq (%r14), %rdi
movq %rbx, %rsi
movl $0x8e, %edx
callq 0x936f9
andq $0x0, (%r14)
addq $0x20, %r14
jmp 0x15ecde
cmpq $0x0, 0x10(%rsp)
je 0x15f041
movq 0x20(%rsp), %rdi
callq 0x8e240
movq %rax, %rbx
movl 0xc(%rsp), %r14d
testb %r14b, %r14b
je 0x15ed31
leaq 0x19a227(%rip), %rdi    # 0x2f8f4e
movq %rbx, %rsi
xorl %eax, %eax
callq 0x17070
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0xa70d0
xorl %r13d, %r13d
movq %rax, 0x18(%rsp)
testq %rax, %rax
sete %r13b
movl %r14d, %eax
xorb $0x1, %al
orb %r13b, %al
jne 0x15ed71
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
callq 0xa6337
movq %rax, %rdi
movq %rbx, %rsi
callq 0x9c79c
negl %r13d
movq %r12, %rax
shlq $0x5, %rax
movq 0x10(%rsp), %rcx
addq %rcx, %rax
addq $-0x20, %rax
movq %rax, 0x78(%rsp)
leaq 0x18(%rcx), %r15
movq $0x0, 0x58(%rsp)
movq $0x0, 0x20(%rsp)
xorl %ebp, %ebp
movq $0x0, 0x30(%rsp)
movq $0x0, 0x50(%rsp)
cmpl $-0x1, %r13d
je 0x15f059
cmpq %r12, 0x20(%rsp)
jae 0x15f059
movq 0x18(%rsp), %rdi
leaq 0x70(%rsp), %rsi
leaq 0x80(%rsp), %rdx
leaq 0x40(%rsp), %rcx
movq 0x28(%rsp), %rbx
movq %rbx, %r8
callq 0xa62e5
cmpl $0x1, %eax
jne 0x15f056
movq 0x40(%rsp), %rsi
leaq 0x38(%rsp), %rdi
movq %rbx, %rdx
callq 0x15e3c7
pushq $-0x1
popq %r13
testq %rax, %rax
je 0x15edb6
movq %rax, %rbx
movq 0x38(%rsp), %rdx
cmpq %rdx, 0x58(%rsp)
jae 0x15ee49
incq %rdx
movq %rbp, %rdi
movq %rdx, %rsi
leaq 0x1e8690(%rip), %rdx    # 0x3474c2
movl $0x37b, %ecx            # imm = 0x37B
callq 0x93472
movq %rax, %rbp
movq 0x38(%rsp), %rdx
movq %rdx, 0x58(%rsp)
testq %rbp, %rbp
je 0x15f18f
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x17350
movq 0x38(%rsp), %rax
movb $0x0, (%rbp,%rax)
movq 0x78(%rsp), %rbx
movq 0x10(%rsp), %r14
cmpq %rbx, %r14
ja 0x15f010
movq %rbx, %rax
subq %r14, %rax
sarq %rax
andq $-0x20, %rax
leaq (%r14,%rax), %r13
movq (%r14,%rax), %rsi
movq %rbp, %rdi
callq 0x179e0
testl %eax, %eax
je 0x15eea6
js 0x15eece
addq $0x20, %r13
movq %r13, %r14
jmp 0x15ee71
movq %r13, %rax
subq 0x10(%rsp), %rax
movq %rax, 0x48(%rsp)
jbe 0x15eed7
movq -0x20(%r13), %rsi
addq $-0x20, %r13
movq %rbp, %rdi
callq 0x179e0
movq %r13, %rbx
testl %eax, %eax
je 0x15ee71
jmp 0x15eed7
addq $-0x20, %r13
movq %r13, %rbx
jmp 0x15ee71
movq 0x48(%rsp), %rbx
sarq $0x5, %rbx
pushq $0x1
popq %r13
cmpq %r12, %rbx
movl 0xc(%rsp), %r14d
jae 0x15edb6
movq %rbx, %r14
shlq $0x5, %r14
addq %r15, %r14
cmpq %r12, %rbx
jae 0x15f010
movq -0x18(%r14), %rdi
movq %rdi, %r13
movq %rbp, %rsi
callq 0x179e0
testl %eax, %eax
jne 0x15f010
cmpb $0x1, (%r14)
je 0x15f1bd
movq 0x40(%rsp), %rdi
callq 0x172d0
movq %rax, %r13
addq $0x81, %r13
cmpq %r13, 0x50(%rsp)
movq %rbx, 0x48(%rsp)
jae 0x15ef69
movq 0x30(%rsp), %rdi
movq %r13, %rsi
leaq 0x1e856d(%rip), %rdx    # 0x3474c2
movl $0x396, %ecx            # imm = 0x396
callq 0x93472
movq %rax, 0x30(%rsp)
movq %r13, 0x50(%rsp)
movq -0x10(%r14), %r11
movq -0x8(%r14), %rbx
cmpq $0x1, %r11
jne 0x15ef93
movq 0x40(%rsp), %r10
testq %rbx, %rbx
jne 0x15ef98
movq 0x70(%rsp), %rsi
movq 0x80(%rsp), %rdx
movq %r10, %rdi
jmp 0x15efe7
movq 0x40(%rsp), %r10
movl 0x38(%rsp), %ecx
subq $0x8, %rsp
movq 0x38(%rsp), %r13
movq %r13, %rdi
movq 0x58(%rsp), %rsi
leaq 0x1e8730(%rip), %rdx    # 0x3476e4
movl %ecx, %r8d
movq %rbp, %r9
xorl %eax, %eax
pushq %r10
pushq %rbx
pushq %r11
callq 0x17bf0
addq $0x20, %rsp
movq 0x70(%rsp), %rax
movq -0x10(%r14), %rcx
movq -0x8(%r14), %rdx
leaq (%rax,%rcx), %rsi
decq %rsi
subq %rcx, %rdx
incq %rdx
movq %r13, %rdi
movq 0x68(%rsp), %rcx
movq 0x60(%rsp), %r8
callq 0x8c0bc
movb $0x1, (%r14)
incq 0x20(%rsp)
movq 0x48(%rsp), %rbx
incq %rbx
addq $0x20, %r14
jmp 0x15eefc
pushq $0x1
popq %r13
movl 0xc(%rsp), %r14d
jmp 0x15edb6
movq %r12, %rdi
callq 0xae103
movq %rbx, %rdi
callq 0x8a4fd
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x15f1e0
pushq $-0x1
popq %r13
movl %r13d, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %r13d
leaq 0x1e8462(%rip), %rbx    # 0x3474c2
movq 0x30(%rsp), %rdi
movq %rbx, %rsi
movl $0x3bc, %edx            # imm = 0x3BC
callq 0x936f9
movq %rbp, %rdi
movq %rbx, %rsi
movl $0x3bd, %edx            # imm = 0x3BD
callq 0x936f9
testb %r14b, %r14b
je 0x15f10d
movl %r13d, 0x28(%rsp)
callq 0x9cce9
leaq 0x1e88fb(%rip), %r14    # 0x347997
leaq 0x1c3159(%rip), %rbp    # 0x3221fc
movq %r12, %r13
xorl %ebx, %ebx
subq $0x1, %r13
jb 0x15f0f7
cmpb $0x0, (%r15)
jne 0x15f0f1
movq -0x18(%r15), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x17070
movq -0x10(%r15), %rsi
movq -0x8(%r15), %rdx
movq %rsi, %rax
xorq $0x1, %rax
orq %rdx, %rax
jne 0x15f0e4
leaq 0x1e88c9(%rip), %rdi    # 0x3479a6
callq 0x17b60
jmp 0x15f0ee
movq %rbp, %rdi
xorl %eax, %eax
callq 0x17070
incq %rbx
addq $0x20, %r15
jmp 0x15f0a8
leaq 0x1e86cb(%rip), %rdi    # 0x3477c9
movq %rbx, %rsi
xorl %eax, %eax
callq 0x17070
movl 0x28(%rsp), %r13d
movq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x15f1e0
movq 0x18(%rsp), %rdi
callq 0xa6389
jmp 0x15f041
movq 0x2d8e38(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x185ed9(%rip), %rsi    # 0x2e5013
leaq 0x18607e(%rip), %rdx    # 0x2e51bf
leaq 0x1e854e(%rip), %rcx    # 0x347696
leaq 0x1e8373(%rip), %r8     # 0x3474c2
movl $0x352, %r9d            # imm = 0x352
jmp 0x15f183
movq 0x2d8e0a(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x185eab(%rip), %rsi    # 0x2e5013
leaq 0x186050(%rip), %rdx    # 0x2e51bf
leaq 0x1e877e(%rip), %rcx    # 0x3478f4
leaq 0x1e8345(%rip), %r8     # 0x3474c2
movl $0xf5, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x2d8dd2(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x185e73(%rip), %rsi    # 0x2e5013
leaq 0x1e850b(%rip), %rdx    # 0x3476b2
leaq 0x1e84e8(%rip), %rcx    # 0x347696
leaq 0x1e830d(%rip), %r8     # 0x3474c2
movl $0x37e, %r9d            # imm = 0x37E
jmp 0x15f183
movq 0x2d8da4(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1e84f5(%rip), %rsi    # 0x3476c3
movq %r13, %rdx
xorl %eax, %eax
callq 0x17a50
pushq $0x2
popq %rdi
callq 0x178f0