// File: /workspace/github_c_makefile_star2_O1/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, %r14
movq %rdx, 0x48(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdi, %r13
callq 0xf36ef
movq %rax, %rbx
movq %rax, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0xf374b
movq %rax, %r15
movq %rbx, %rdi
callq 0xf424d
xorl %ebx, %ebx
testq %r15, %r15
sete %r12b
je 0x1b98f9
movl %r12d, 0x4(%rsp)
movq %r15, 0x28(%rsp)
movq %r15, %rdi
callq 0xec1e8
movq %rax, 0x8(%rsp)
movb $0x0, 0x50(%rsp)
testq %r14, %r14
je 0x1b9872
movq %r14, %rdi
callq 0x101a9a
testb %al, %al
jne 0x1b9c1a
leaq 0x1f6e9b(%rip), %rsi    # 0x3b0714
leaq 0x1f543f(%rip), %rdx    # 0x3aecbf
leaq 0x1f6e77(%rip), %rcx    # 0x3b06fe
movq %r13, %rdi
movl $0x2ed, %r8d            # imm = 0x2ED
movq %r14, %r15
movq %r14, %r9
callq 0x101dff
movq %rax, %r12
testq %rax, %rax
sete %r14b
je 0x1b9902
leaq 0x50(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %r12, %rcx
callq 0x17b40
movq %r12, %rdi
callq 0x17f00
testl %eax, %eax
je 0x1b98ff
callq 0x17060
movl (%rax), %edi
callq 0x17240
leaq 0x1f70b4(%rip), %rsi    # 0x3b0991
leaq 0x1f6e30(%rip), %rcx    # 0x3b0714
movq %r15, %rdi
movq %r13, %rdx
movq %rax, %r8
xorl %eax, %eax
callq 0x1019cf
movb $0x1, %r14b
jmp 0x1b9902
xorl %ebp, %ebp
xorl %edx, %edx
jmp 0x1b9944
xorl %r14d, %r14d
movsbq 0x50(%rsp), %rbp
testq %rbp, %rbp
js 0x1b9c15
movq %r12, %rdi
callq 0x101f02
movl 0x4(%rsp), %eax
movb %al, %bl
testb %r14b, %r14b
movl $0x1, %r12d
cmovel %ebx, %r12d
movq $-0x1, %rax
cmovneq %rax, %rbp
movq %r15, %r14
movq 0x28(%rsp), %r15
movq 0x8(%rsp), %rdx
testb %r12b, %r12b
jne 0x1b9beb
movl %r12d, 0x4(%rsp)
movq %rbp, 0x40(%rsp)
leaq 0x1(%rbp), %r12
movq %rdx, 0x8(%rsp)
imulq %r12, %rdx
incq %rdx
leaq 0x1f6da6(%rip), %rsi    # 0x3b0714
movl $0x1, %ecx
movq %r13, %rdi
movq %r14, %r8
callq 0x102c41
movq %rax, %rbx
testq %rax, %rax
je 0x1b9b76
cmpq $0x0, 0x48(%rsp)
je 0x1b9b65
movq 0x20(%rsp), %rdi
callq 0x120d23
leaq 0x1aa522(%rip), %rsi    # 0x363ec9
leaq 0x1f6d50(%rip), %rdx    # 0x3b06fe
movq %rax, %rdi
movl $0x2b5, %ecx            # imm = 0x2B5
movq %r14, %r8
callq 0x101c23
testq %rax, %rax
je 0x1b9b76
movq %rax, %r13
movq %rbx, 0x30(%rsp)
callq 0x1208f8
movq %rax, %rbp
leaq 0x1f6d20(%rip), %rsi    # 0x3b06fe
movq %r12, %rdi
movl $0x2bb, %edx            # imm = 0x2BB
callq 0x1092b2
movq %rax, 0x50(%rsp)
movq %rbp, %rdi
movq %r13, 0x38(%rsp)
movq %r13, %rsi
callq 0x120e88
cmpl $-0x1, %eax
sete %bl
movq %rbp, 0x18(%rsp)
je 0x1b9b7b
movq $0x0, 0x10(%rsp)
leaq 0x50(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq %rbp, %rdx
xorl %ecx, %ecx
movq 0x20(%rsp), %r8
movq %r14, 0x78(%rsp)
movq %r14, %r9
callq 0x1ba400
movl $0x0, %ebx
testl %eax, %eax
jne 0x1b9b84
movq 0x8(%rsp), %rax
decq %rax
movq %rax, 0x70(%rsp)
movq 0x30(%rsp), %rax
leaq 0x1(%rax), %r14
xorl %r13d, %r13d
movq $0x0, 0x10(%rsp)
movq %r15, 0x28(%rsp)
movq %r13, 0x80(%rsp)
movq 0x50(%rsp), %rbp
xorl %r15d, %r15d
movq 0x70(%rsp), %r13
movq %r13, %rbx
subq %r15, %rbx
shrq %rbx
addq %r15, %rbx
movq %rbx, %rsi
imulq %r12, %rsi
addq %r14, %rsi
movq %rbp, %rdi
callq 0x17a40
testl %eax, %eax
jns 0x1b9ab7
testq %rbx, %rbx
je 0x1b9c10
decq %rbx
movq %rbx, %r13
jmp 0x1b9abf
je 0x1b9ace
incq %rbx
movq %rbx, %r15
cmpq %r13, %r15
jbe 0x1b9a84
movq 0x8(%rsp), %rax
movq %rax, %rbx
jmp 0x1b9adc
movq 0x8(%rsp), %rax
cmpq %rax, %rbx
jae 0x1b9c1f
cmpq %rax, %rbx
movq 0x28(%rsp), %r15
movq 0x38(%rsp), %r13
jae 0x1b9b0c
movq 0x30a3f6(%rip), %rax    # 0x4c3ee8
movq (%rax), %rdi
movq %r15, %rsi
movq %rbx, %rdx
leaq 0x50(%rsp), %rcx
movq 0x48(%rsp), %r8
callq 0x1b96f7
jmp 0x1b9b11
incq 0x10(%rsp)
movq 0x18(%rsp), %rbp
movq %rbp, %rdi
callq 0x120db4
movq %rbp, %rdi
movq %r13, %rsi
callq 0x120e88
cmpl $-0x1, %eax
sete %bl
movq 0x80(%rsp), %r13
je 0x1b9b84
incq %r13
leaq 0x50(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq %rbp, %rdx
movq %r13, %rcx
movq 0x20(%rsp), %r8
movq 0x78(%rsp), %r9
callq 0x1ba400
testl %eax, %eax
je 0x1b9a6f
jmp 0x1b9b84
leaq 0x1f6e63(%rip), %rsi    # 0x3b09cf
movq %r14, %rdi
xorl %eax, %eax
callq 0x1019cf
movb $0x1, %r12b
jmp 0x1b9be3
movq $0x0, 0x10(%rsp)
movq 0x10(%rsp), %rsi
testq %rsi, %rsi
setne %al
andb %bl, %al
cmpb $0x1, %al
jne 0x1b9ba3
leaq 0x1f6e69(%rip), %rdi    # 0x3b0a05
xorl %eax, %eax
callq 0x17070
movq 0x18(%rsp), %rdi
callq 0x121b03
movq 0x38(%rsp), %rdi
callq 0x101e80
movq 0x50(%rsp), %rdi
leaq 0x1f6b3b(%rip), %rsi    # 0x3b06fe
movl $0x2e2, %edx            # imm = 0x2E2
callq 0x109670
movzbl 0x4(%rsp), %eax
testb %bl, %bl
movl $0x1, %r12d
cmovnel %eax, %r12d
movq 0x30(%rsp), %rbx
movq %rbx, %rdi
callq 0x102b12
testq %r15, %r15
je 0x1b9bf8
movq %r15, %rdi
callq 0xee90c
movzbl %r12b, %eax
negl %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x6687a
callq 0x66808
callq 0x667cf
callq 0x66841