// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/fmi-map.c
// Function: gt_mapfmindex
int gt_mapfmindex (Fmindex *fmindex,const char *indexname,
                GtLogger *logger,GtError *err)
{
  FILE *fpin = NULL;
  bool haserr = false, storeindexpos = true;
  GtSpecialcharinfo specialcharinfo;

  gt_error_check(err);
  fmindex->mappedptr = NULL;
  fmindex->bwtformatching = NULL;
  fmindex->alphabet = NULL;
  fpin = gt_fa_fopen_with_suffix(indexname,FMASCIIFILESUFFIX,"rb",err);
  if (fpin == NULL)
  {
    haserr = true;
  }
  if (!haserr)
  {
    if (scanfmafileviafileptr(fmindex,
                              &specialcharinfo,
                              &storeindexpos,
                              indexname,
                              fpin,
                              logger,
                              err) != 0)
    {
      haserr = true;
    }
  }
  gt_fa_xfclose(fpin);
  if (!haserr)
  {
    fmindex->bwtformatching = mapbwtencoding(indexname,logger,err);
    if (fmindex->bwtformatching == NULL)
    {
      haserr = true;
    }
  }
  if (!haserr)
  {
    fmindex->specpos.nextfreeGtPairBwtidx
      = (GtUword) gt_determinenumberofspecialstostore(&specialcharinfo);
    fmindex->specpos.spaceGtPairBwtidx = NULL;
    fmindex->specpos.allocatedGtPairBwtidx = 0;
    fmindex->alphabet = gt_alphabet_ref(
                                  gt_encseq_alphabet(fmindex->bwtformatching));
    if (fmindex->alphabet == NULL)
    {
      haserr = true;
    }
  }
  if (!haserr)
  {
    GtStr *tmpfilename;

    gt_computefmkeyvalues (fmindex,
                           &specialcharinfo,
                           fmindex->bwtlength,
                           fmindex->log2bsize,
                           fmindex->log2markdist,
                           gt_alphabet_num_of_chars(fmindex->alphabet),
                           fmindex->suffixlength,
                           storeindexpos);
    tmpfilename = gt_str_new_cstr(indexname);
    gt_str_append_cstr(tmpfilename,FMDATAFILESUFFIX);
    if (gt_fillfmmapspecstartptr(fmindex,storeindexpos,tmpfilename,err) != 0)
    {
      haserr = true;
    }
    gt_str_delete(tmpfilename);
  }
  if (haserr)
  {
    gt_freefmindex(fmindex);
  }
  return haserr ? -1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rcx, %rbp
movq %rdx, 0x20(%rsp)
movq %rsi, 0x8(%rsp)
movq %rdi, %rbx
testq %rcx, %rcx
je 0x15b1eb
movq %rbp, %rdi
callq 0x89eb7
testb %al, %al
jne 0x15b6ad
andq $0x0, (%rbx)
xorps %xmm0, %xmm0
movq %rbx, 0x10(%rsp)
movups %xmm0, 0x68(%rbx)
leaq 0x1eb754(%rip), %rsi    # 0x346956
leaq 0x1ea894(%rip), %rdx    # 0x345a9d
leaq 0x1eb75e(%rip), %rcx    # 0x34696e
movq 0x8(%rsp), %rdi
movl $0xb2, %r8d
movq %rbp, %r9
callq 0x8a449
movq %rax, %r13
testq %rax, %rax
movq %rbp, (%rsp)
je 0x15b499
testq %rbp, %rbp
je 0x15b248
movq %rbp, %rdi
callq 0x89eb7
testb %al, %al
jne 0x15b6db
callq 0x1510c4
movq %rax, %rbp
movq 0x10(%rsp), %r14
leaq 0x10(%r14), %rdx
leaq 0x1eb738(%rip), %rsi    # 0x346998
xorl %r12d, %r12d
pushq $0x8
popq %rbx
movq %rax, %rdi
movq %rbx, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x151109
leaq 0x30(%r14), %rdx
leaq 0x1960d6(%rip), %rsi    # 0x2f1358
movq %rbp, %rdi
movq %rbx, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x151109
leaq 0x1eb708(%rip), %rsi    # 0x3469a2
leaq 0x1c(%rsp), %rdx
pushq $0x4
popq %r15
movq %rbp, %rdi
movq %r15, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x151109
leaq 0x88(%r14), %rdx
leaq 0x1eb6ee(%rip), %rsi    # 0x3469b0
movq %rbp, %rdi
movq %r15, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x151109
leaq 0x94(%r14), %rdx
leaq 0x1eb6dd(%rip), %rsi    # 0x3469be
movq %rbp, %rdi
movq %r15, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x151109
leaq 0x1ff0e5(%rip), %rsi    # 0x35a3de
leaq 0x28(%rsp), %rdx
movq %rbp, %rdi
movq %rbx, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x151109
leaq 0x30(%rsp), %rdx
leaq 0x1a9509(%rip), %rsi    # 0x304824
movq %rbp, %rdi
movq %rbx, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x151109
leaq 0x38(%rsp), %rdx
leaq 0x1e9326(%rip), %rsi    # 0x34465e
movq %rbp, %rdi
movq %rbx, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x151109
leaq 0x40(%rsp), %rdx
leaq 0x1a96c9(%rip), %rsi    # 0x304a1e
movq %rbp, %rdi
movq %rbx, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x151109
leaq 0x48(%rsp), %rdx
leaq 0x1a96fe(%rip), %rsi    # 0x304a70
movq %rbp, %rdi
movq %rbx, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x151109
leaq 0x50(%rsp), %rdx
leaq 0x19d3fc(%rip), %rsi    # 0x2f878b
movq %rbp, %rdi
movq %rbx, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x151109
leaq 0x58(%rsp), %rdx
leaq 0x1e92c8(%rip), %rsi    # 0x344674
movq %rbp, %rdi
movq %rbx, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x151109
leaq 0x60(%rsp), %rdx
leaq 0x1e92a7(%rip), %rsi    # 0x344670
movq %rbp, %rdi
movq %rbx, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x151109
leaq 0x68(%rsp), %rdx
leaq 0x1e929d(%rip), %rsi    # 0x344683
movq %rbp, %rdi
movq %rbx, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x151109
leaq 0x70(%rsp), %rdx
leaq 0x1e9297(%rip), %rsi    # 0x34469a
movq %rbp, %rdi
movq %rbx, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x151109
leaq 0x98(%r14), %rdx
leaq 0x20101e(%rip), %rsi    # 0x35c440
movq %rbp, %rdi
movq %r15, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x151109
callq 0xacb84
movq %rax, %rbx
leaq 0x1eb514(%rip), %r15    # 0x346956
movq %rbx, %rdi
movq %r13, %rsi
callq 0xad4de
cmpl $-0x1, %eax
je 0x15b4a4
movq %rbx, %rdi
callq 0xad1fa
movq %rax, %r14
movq %rbx, %rdi
callq 0xad289
subq $0x8, %rsp
movq 0x10(%rsp), %rdi
movq %r15, %rsi
movl %r12d, %edx
movq %r14, %rcx
movq %rax, %r8
movq %rbp, %r9
pushq 0x8(%rsp)
callq 0x151387
popq %rcx
popq %rdx
testl %eax, %eax
jne 0x15b4a9
movq %rbx, %rdi
callq 0xad357
incl %r12d
jmp 0x15b442
movb $0x1, %r15b
movb $0x1, %r12b
jmp 0x15b531
xorl %r14d, %r14d
jmp 0x15b4ac
movb $0x1, %r14b
movq %rbx, %rdi
callq 0xae103
testb %r14b, %r14b
jne 0x15b4e3
leaq 0x1eb496(%rip), %rsi    # 0x346956
movq 0x8(%rsp), %rdi
movq %rbp, %rdx
movq 0x20(%rsp), %rcx
movq (%rsp), %r8
callq 0x1511ec
testl %eax, %eax
movzbl %r14b, %r14d
pushq $0x1
popq %rax
cmovnel %eax, %r14d
movb $0x1, %r15b
testb %r14b, %r14b
jne 0x15b515
movl 0x1c(%rsp), %eax
cmpl $0x1, %eax
je 0x15b515
testl %eax, %eax
jne 0x15b4fd
xorl %r15d, %r15d
jmp 0x15b515
leaq 0x1eb4c7(%rip), %rsi    # 0x3469cb
movq (%rsp), %rdi
xorl %eax, %eax
callq 0x89dbb
movb $0x1, %r15b
movb $0x1, %r14b
testq %r13, %r13
sete %bl
movq %rbp, %rdi
callq 0x1510ea
testb %r14b, %r14b
setne %r12b
orb %bl, %r12b
movq (%rsp), %rbp
movq %r13, %rdi
callq 0x8a5e5
testb %r12b, %r12b
je 0x15b545
movq 0x10(%rsp), %r13
jmp 0x15b5b9
testq %rbp, %rbp
movq 0x10(%rsp), %r13
je 0x15b55f
movq %rbp, %rdi
callq 0x89eb7
testb %al, %al
jne 0x15b707
callq 0x791cd
movq %rax, %rbx
movq %rax, %rdi
callq 0x7d0cd
movq %rbx, %rdi
callq 0x7d193
movq %rbx, %rdi
callq 0x7d25b
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
callq 0x7d487
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
movq %rbp, %rdx
callq 0x7921d
movq %rax, %r14
movq %rbx, %rdi
callq 0x79f01
movq %r14, (%r13)
testq %r14, %r14
movzbl %r12b, %r12d
pushq $0x1
popq %rax
cmovel %eax, %r12d
testb %r12b, %r12b
jne 0x15b5f7
leaq 0x28(%rsp), %rdi
callq 0x2b77a0
movq %rax, 0x60(%r13)
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%r13)
movq (%r13), %rdi
callq 0x754dd
movq %rax, %rdi
callq 0x5644e
movq %rax, 0x68(%r13)
testq %rax, %rax
movzbl %r12b, %r12d
pushq $0x1
popq %rax
cmovel %eax, %r12d
testb %r12b, %r12b
jne 0x15b688
movl 0x88(%r13), %ebx
movl 0x94(%r13), %ebp
movq 0x10(%r13), %r14
movq 0x68(%r13), %rdi
callq 0x56c8e
movl 0x98(%r13), %r10d
movzbl %r15b, %r15d
leaq 0x28(%rsp), %rsi
movq %r13, %rdi
movq %r14, %rdx
movl %ebx, %ecx
movl %ebp, %r8d
movl %eax, %r9d
pushq %r15
pushq %r10
callq 0x2b77c7
popq %rax
popq %rcx
movq 0x8(%rsp), %rdi
callq 0xacbd1
movq %rax, %rbx
leaq 0x1eb303(%rip), %rsi    # 0x34695b
movq %rax, %rdi
callq 0xacbfb
movq %r13, %rdi
movl %r15d, %esi
movq %rbx, %rdx
movq (%rsp), %rcx
callq 0x15b87c
testl %eax, %eax
movzbl %r12b, %eax
pushq $0x1
popq %r12
cmovel %eax, %r12d
movq %rbx, %rdi
callq 0xae103
testb %r12b, %r12b
je 0x15b695
movq %r13, %rdi
callq 0x15b188
movzbl %r12b, %eax
negl %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2dc8b4(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x189955(%rip), %rsi    # 0x2e5013
leaq 0x189afa(%rip), %rdx    # 0x2e51bf
leaq 0x1eb294(%rip), %rcx    # 0x346960
leaq 0x1eb29b(%rip), %r8     # 0x34696e
movl $0xae, %r9d
jmp 0x15b733
movq 0x2dc886(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x189927(%rip), %rsi    # 0x2e5013
leaq 0x189acc(%rip), %rdx    # 0x2e51bf
leaq 0x1eb288(%rip), %rcx    # 0x346982
leaq 0x1eb26d(%rip), %r8     # 0x34696e
pushq $0x3b
popq %r9
jmp 0x15b733
movq 0x2dc85a(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1898fb(%rip), %rsi    # 0x2e5013
leaq 0x189aa0(%rip), %rdx    # 0x2e51bf
leaq 0x1eb2d5(%rip), %rcx    # 0x3469fb
leaq 0x1eb241(%rip), %r8     # 0x34696e
movl $0x9b, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390
nop