// File: /workspace/github_c_makefile_star2_O3/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, %rbp
movq %rdx, %r14
movq %rsi, 0x40(%rsp)
movq %rdi, %r15
callq 0xef0cd
movq %rax, %rbx
movq %rax, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0xef129
movq %rax, %r13
movq %rbx, %rdi
callq 0xefbe3
testq %r13, %r13
je 0x1b0d77
movq %r14, 0x38(%rsp)
movq %r13, %rdi
callq 0xe7bac
movq %rax, 0x18(%rsp)
movb $0x0, 0x68(%rsp)
testq %rbp, %rbp
je 0x1b0cf7
movq %rbp, %rdi
callq 0xfcc32
testb %al, %al
jne 0x1b1040
leaq 0x1f645a(%rip), %rsi    # 0x3a7158
leaq 0x1f4a18(%rip), %rdx    # 0x3a571d
leaq 0x1f6436(%rip), %rcx    # 0x3a7142
movq %r15, %rdi
movl $0x2ed, %r8d            # imm = 0x2ED
movq %rbp, %r9
callq 0xfcf97
movq %rax, %r12
movb $0x1, %r14b
testq %rax, %rax
je 0x1b0d81
leaq 0x68(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %r12, %rcx
callq 0x17b40
movq %r12, %rdi
callq 0x17f00
testl %eax, %eax
je 0x1b0d7e
callq 0x17060
movl (%rax), %edi
callq 0x17240
leaq 0x1f6677(%rip), %rsi    # 0x3a73d5
leaq 0x1f63f3(%rip), %rcx    # 0x3a7158
movq %rbp, %rdi
movq %r15, %rdx
movq %rax, %r8
xorl %eax, %eax
callq 0xfcb67
jmp 0x1b0d81
movb $0x1, %bl
jmp 0x1b0fdb
xorl %r14d, %r14d
movsbq 0x68(%rsp), %rbx
testq %rbx, %rbx
js 0x1b103b
movq %r13, 0x8(%rsp)
testq %r13, %r13
sete %r13b
movq %r12, %rdi
callq 0xfd09a
orb %r14b, %r13b
testb %r14b, %r14b
movq $-0x1, %rax
cmovneq %rax, %rbx
movb %r13b, 0x7(%rsp)
testb %r13b, %r13b
je 0x1b0dc8
movb 0x7(%rsp), %bl
jmp 0x1b0fce
leaq 0x1(%rbx), %r13
movq 0x18(%rsp), %rdx
imulq %r13, %rdx
incq %rdx
leaq 0x1f6379(%rip), %rsi    # 0x3a7158
movl $0x1, %ecx
movq %r15, %rdi
movq %rbp, %r8
callq 0xfdd83
testq %rax, %rax
je 0x1b0fc4
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x38(%rsp)
je 0x1b0fae
movq 0x40(%rsp), %rdi
callq 0x11b0a1
leaq 0x1aa03b(%rip), %rsi    # 0x35ae55
leaq 0x1f6321(%rip), %rdx    # 0x3a7142
movq %rax, %rdi
movl $0x2b5, %ecx            # imm = 0x2B5
movq %rbp, %r8
callq 0xfcdbb
testq %rax, %rax
je 0x1b0fbf
movq %rax, %r15
callq 0x11ac6c
movq %rax, %r12
leaq 0x1f62f6(%rip), %rsi    # 0x3a7142
movq %r13, %rdi
movl $0x2bb, %edx            # imm = 0x2BB
callq 0x104226
movq %rax, 0x68(%rsp)
movq %r12, %rdi
movq %r15, %rsi
callq 0x11b1ff
cmpl $-0x1, %eax
je 0x1b0ff2
movq 0x18(%rsp), %rax
decq %rax
movq %rax, 0x58(%rsp)
movq 0x10(%rsp), %r14
incq %r14
movq $0x0, 0x20(%rsp)
xorl %ecx, %ecx
movq %rbp, 0x50(%rsp)
movq %rbx, 0x30(%rsp)
movq %r15, 0x28(%rsp)
movq %r12, 0x48(%rsp)
leaq 0x68(%rsp), %rdi
movq %rbx, %rsi
movq %r12, %rdx
movq %rcx, 0x60(%rsp)
movq 0x40(%rsp), %r8
movq %rbp, %r9
callq 0x1b185b
testl %eax, %eax
jne 0x1b0ff8
movq 0x68(%rsp), %rbx
xorl %ebp, %ebp
movq 0x58(%rsp), %r15
movq %r15, %r12
subq %rbp, %r12
shrq %r12
addq %rbp, %r12
movq %r12, %rsi
imulq %r13, %rsi
addq %r14, %rsi
movq %rbx, %rdi
callq 0x17a40
testl %eax, %eax
jns 0x1b0f0a
testq %r12, %r12
je 0x1b1036
decq %r12
movq %r12, %r15
jmp 0x1b0f12
je 0x1b0f1e
incq %r12
movq %r12, %rbp
cmpq %r15, %rbp
jbe 0x1b0ed7
incq 0x20(%rsp)
jmp 0x1b0f4a
cmpq 0x18(%rsp), %r12
jae 0x1b1045
movq 0x307fa8(%rip), %rax    # 0x4b8ed8
movq (%rax), %rdi
movq 0x8(%rsp), %rsi
movq %r12, %rdx
leaq 0x68(%rsp), %rcx
movq 0x38(%rsp), %r8
callq 0x1b0b8a
movq 0x30(%rsp), %rbp
movq 0x28(%rsp), %rbx
movq 0x48(%rsp), %r12
movq %r12, %rdi
callq 0x11b132
movq 0x60(%rsp), %r15
incq %r15
movq %r12, %rdi
movq %rbx, %rsi
callq 0x11b1ff
movq %r15, %rcx
cmpl $-0x1, %eax
movq %rbx, %r15
movq %rbp, %rbx
movq 0x50(%rsp), %rbp
jne 0x1b0ea6
movq 0x20(%rsp), %rsi
testq %rsi, %rsi
movq 0x8(%rsp), %r14
movb 0x7(%rsp), %bl
je 0x1b0fff
leaq 0x1f64a4(%rip), %rdi    # 0x3a7449
xorl %eax, %eax
callq 0x17070
jmp 0x1b0fff
leaq 0x1f645e(%rip), %rsi    # 0x3a7413
movq %rbp, %rdi
xorl %eax, %eax
callq 0xfcb67
movq 0x10(%rsp), %rax
movq %rax, %rdi
callq 0xfdc54
movb $0x1, %bl
movq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xea375
movzbl %bl, %eax
negl %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb 0x7(%rsp), %bl
jmp 0x1b0ffa
movb $0x1, %bl
movq 0x8(%rsp), %r14
movq %r12, %rdi
callq 0x11bdbf
movq %r15, %rdi
callq 0xfd018
movq 0x68(%rsp), %rdi
leaq 0x1f6127(%rip), %rsi    # 0x3a7142
movl $0x2e2, %edx            # imm = 0x2E2
callq 0x1045eb
movq 0x10(%rsp), %rdi
callq 0xfdc54
testq %r14, %r14
jne 0x1b0fd3
jmp 0x1b0fdb
callq 0x650bb
callq 0x65049
callq 0x65010
callq 0x65082