// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/giextract.c
// Function: gt_extractkeysfromfastaindex
int gt_extractkeysfromfastaindex(const char *indexname,
                                 const GtStr *fileofkeystoextract,
                                 GtUword linewidth,GtError *err)
{
  GtEncseq *encseq = NULL;
  GtEncseqLoader *el = NULL;
  bool haserr = false;
  GtUword numofdbsequences = 0, keysize = 0;

  el = gt_encseq_loader_new();
  encseq = gt_encseq_loader_load(el, indexname, err);
  gt_encseq_loader_delete(el);
  if (encseq == NULL)
  {
    haserr = true;
  }
  if (!haserr)
  {
    int retval;

    numofdbsequences = gt_encseq_num_of_sequences(encseq);
    retval = readkeysize(indexname,err);
    if (retval < 0)
    {
      haserr = true;
    }
    keysize = (GtUword) retval;
  }
  if (!haserr)
  {
    char *keytab;
    GtUword keytablength;

    keytablength = 1UL + numofdbsequences * (keysize+1);
    keytab = gt_fa_mmap_check_size_with_suffix(indexname,
                                               GT_KEYSTABFILESUFFIX,
                                               keytablength,
                                               sizeof (GtUchar),
                                               err);
    if (keytab == NULL)
    {
      haserr = true;
    } else
    {
      if (itersearchoverallkeys(encseq,keytab,numofdbsequences,
                                keysize,fileofkeystoextract,
                                linewidth,err) != 0)
      {
        haserr = true;
      }
    }
    gt_fa_xmunmap(keytab);
  }
  if (encseq != NULL)
  {
    gt_encseq_delete(encseq);
    encseq = NULL;
  }
  return haserr ? -1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rcx, %r13
movq %rdx, %r14
movq %rsi, 0x50(%rsp)
movq %rdi, %r12
callq 0x791cd
movq %rax, %rbx
movq %rax, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x7921d
movq %rax, %rbp
movq %rbx, %rdi
callq 0x79f01
testq %rbp, %rbp
je 0x15e70e
movq %r14, 0x40(%rsp)
movq %rbp, %rdi
callq 0x705a1
movq %rax, 0x18(%rsp)
movb $0x0, 0x68(%rsp)
testq %r13, %r13
je 0x15e68d
movq %r13, %rdi
callq 0x89eb7
testb %al, %al
jne 0x15ea23
leaq 0x1e8e44(%rip), %rsi    # 0x3474d8
leaq 0x1e7402(%rip), %rdx    # 0x345a9d
leaq 0x1e8e20(%rip), %rcx    # 0x3474c2
movq %r12, %rdi
movl $0x2ed, %r8d            # imm = 0x2ED
movq %r13, %r9
callq 0x8a449
movq %rax, %r15
movb $0x1, %r14b
testq %rax, %rax
movq %rbp, 0x10(%rsp)
je 0x15e718
leaq 0x68(%rsp), %rdi
pushq $0x1
popq %rdx
movq %rdx, %rsi
movq %r15, %rcx
callq 0x17ad0
movq %r15, %rdi
callq 0x17e70
testl %eax, %eax
je 0x15e715
callq 0x17060
movl (%rax), %edi
callq 0x17220
leaq 0x1e9060(%rip), %rsi    # 0x347755
leaq 0x1e8ddc(%rip), %rcx    # 0x3474d8
movq %r13, %rdi
movq %r12, %rdx
movq %rax, %r8
xorl %eax, %eax
callq 0x89dbb
jmp 0x15e718
movb $0x1, %bl
jmp 0x15e97f
xorl %r14d, %r14d
movsbq 0x68(%rsp), %rbp
testq %rbp, %rbp
js 0x15e996
cmpq $0x0, 0x10(%rsp)
sete %bl
movq %r15, %rdi
callq 0x8a5e5
orb %r14b, %bl
testb %r14b, %r14b
pushq $-0x1
popq %rax
cmovneq %rax, %rbp
testb %bl, %bl
je 0x15e753
movq 0x10(%rsp), %r14
jmp 0x15e977
movb %bl, 0xf(%rsp)
leaq 0x1(%rbp), %r15
movq 0x18(%rsp), %rdx
imulq %r15, %rdx
incq %rdx
leaq 0x1e8d6a(%rip), %rsi    # 0x3474d8
pushq $0x1
popq %rcx
movq %r12, %rdi
movq %r13, %r8
callq 0x8bbed
movq %rax, %r12
movb $0x1, %bl
testq %rax, %rax
je 0x15e905
movq 0x40(%rsp), %rax
testq %rax, %rax
je 0x15e8f4
movq 0x50(%rsp), %rdi
callq 0xad1fa
leaq 0x19c684(%rip), %rsi    # 0x2fae2d
leaq 0x1e8d12(%rip), %rdx    # 0x3474c2
movq %rax, %rdi
movl $0x2b5, %ecx            # imm = 0x2B5
movq %r13, %r8
callq 0x8a156
movq %rax, 0x48(%rsp)
testq %rax, %rax
je 0x15e905
movq %rbp, 0x60(%rsp)
callq 0xacb84
movq %rax, %rbx
leaq 0x1e8ce0(%rip), %rsi    # 0x3474c2
movq %r15, %rdi
movl $0x2bb, %edx            # imm = 0x2BB
callq 0x93160
leaq 0x68(%rsp), %rcx
movq %rax, (%rcx)
movq %r12, 0x20(%rsp)
leaq 0x1(%r12), %rbp
xorl %r14d, %r14d
movq $0x0, 0x28(%rsp)
movq %r13, 0x30(%rsp)
movq %rbx, 0x38(%rsp)
movq %rbx, %rdi
movq 0x48(%rsp), %rsi
callq 0xad4de
cmpl $-0x1, %eax
je 0x15e90c
leaq 0x68(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq %rbx, %rdx
movq %r14, %rcx
movq 0x50(%rsp), %r8
movq %r13, %r9
callq 0x15f23a
testl %eax, %eax
jne 0x15e934
movq %r14, 0x58(%rsp)
movq 0x68(%rsp), %r14
movq 0x18(%rsp), %rbx
xorl %r12d, %r12d
movq %rbx, %r13
decq %r13
movq %r13, %rbx
subq %r12, %rbx
jb 0x15e8a2
shrq %rbx
addq %r12, %rbx
movq %rbx, %rsi
imulq %r15, %rsi
addq %rbp, %rsi
movq %r14, %rdi
callq 0x179e0
testl %eax, %eax
js 0x15e898
je 0x15e8a9
incq %rbx
movq %rbx, %r12
jmp 0x15e86a
testq %rbx, %rbx
jne 0x15e864
jmp 0x15e9c7
incq 0x28(%rsp)
jmp 0x15e8d5
cmpq 0x18(%rsp), %rbx
jae 0x15e9f5
movq 0x2d95f5(%rip), %rax    # 0x437eb0
movq (%rax), %rdi
movq 0x10(%rsp), %rsi
movq %rbx, %rdx
leaq 0x68(%rsp), %rcx
movq 0x40(%rsp), %r8
callq 0x15e526
movq 0x30(%rsp), %r13
movq 0x58(%rsp), %r14
movq 0x38(%rsp), %rbx
movq %rbx, %rdi
callq 0xad357
incq %r14
jmp 0x15e817
leaq 0x1e8e98(%rip), %rsi    # 0x347793
movq %r13, %rdi
xorl %eax, %eax
callq 0x89dbb
movq 0x10(%rsp), %r14
jmp 0x15e96a
movq 0x28(%rsp), %rsi
testq %rsi, %rsi
movq 0x10(%rsp), %r14
movq 0x20(%rsp), %r12
je 0x15e92e
leaq 0x1e8ea2(%rip), %rdi    # 0x3477c9
xorl %eax, %eax
callq 0x17070
movb 0xf(%rsp), %bl
jmp 0x15e940
movb $0x1, %bl
movq 0x10(%rsp), %r14
movq 0x20(%rsp), %r12
movq 0x38(%rsp), %rdi
callq 0xae103
movq 0x48(%rsp), %rdi
callq 0x8a4fd
movq 0x68(%rsp), %rdi
leaq 0x1e8b62(%rip), %rsi    # 0x3474c2
movl $0x2e2, %edx            # imm = 0x2E2
callq 0x936f9
movq %r12, %rdi
callq 0x8b9fa
testq %r14, %r14
je 0x15e97f
movq %r14, %rdi
callq 0x735fd
movzbl %bl, %eax
negl %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2d95cb(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x18666c(%rip), %rsi    # 0x2e5013
leaq 0x1e8ddd(%rip), %rdx    # 0x34778b
leaq 0x1e8d94(%rip), %rcx    # 0x347749
leaq 0x1e8b06(%rip), %r8     # 0x3474c2
movl $0x2fe, %r9d            # imm = 0x2FE
jmp 0x15ea4f
movq 0x2d959a(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x18663b(%rip), %rsi    # 0x2e5013
leaq 0x1e8ee7(%rip), %rdx    # 0x3478c6
leaq 0x1e8ee8(%rip), %rcx    # 0x3478ce
leaq 0x1e8ad5(%rip), %r8     # 0x3474c2
movl $0x290, %r9d            # imm = 0x290
jmp 0x15ea4f
movq 0x2d956c(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x18660d(%rip), %rsi    # 0x2e5013
leaq 0x1e8ed7(%rip), %rdx    # 0x3478e4
leaq 0x1e8eba(%rip), %rcx    # 0x3478ce
leaq 0x1e8aa7(%rip), %r8     # 0x3474c2
movl $0x299, %r9d            # imm = 0x299
jmp 0x15ea4f
movq 0x2d953e(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1865df(%rip), %rsi    # 0x2e5013
leaq 0x186784(%rip), %rdx    # 0x2e51bf
leaq 0x1e8d07(%rip), %rcx    # 0x347749
leaq 0x1e8a79(%rip), %r8     # 0x3474c2
movl $0x2ec, %r9d            # imm = 0x2EC
xorl %eax, %eax
callq 0x17a50
callq 0x17390