// File: /workspace/github_c_makefile_star2_O3/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, %r14
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
testq %rcx, %rcx
je 0x1ade0e
movq %r14, %rdi
callq 0xfcc32
testb %al, %al
jne 0x1ae2f7
movq $0x0, (%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x68(%rbx)
leaq 0x1f87b3(%rip), %rsi    # 0x3a65d6
leaq 0x1f78f3(%rip), %rdx    # 0x3a571d
leaq 0x1f87bd(%rip), %rcx    # 0x3a65ee
movq %r15, %rdi
movl $0xb2, %r8d
movq %r14, %r9
callq 0xfcf97
movq %rax, %r13
testq %rax, %rax
je 0x1ae2d0
movq %r12, 0x20(%rsp)
movq %r15, 0x10(%rsp)
testq %r14, %r14
je 0x1ade6d
movq %r14, %rdi
callq 0xfcc32
testb %al, %al
jne 0x1ae2fc
callq 0x1a5020
movq %rax, %rbp
leaq 0x10(%rbx), %rdx
leaq 0x1f8798(%rip), %rsi    # 0x3a6618
xorl %r12d, %r12d
movl $0x8, %ecx
movq %rax, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1a506d
leaq 0x30(%rbx), %rdx
leaq 0x1a34a4(%rip), %rsi    # 0x351345
movl $0x8, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1a506d
leaq 0x1f8767(%rip), %rsi    # 0x3a6622
leaq 0x1c(%rsp), %rdx
movl $0x4, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1a506d
leaq 0x88(%rbx), %rdx
leaq 0x1f874f(%rip), %rsi    # 0x3a6630
movl $0x4, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1a506d
leaq 0x94(%rbx), %rdx
leaq 0x1f873c(%rip), %rsi    # 0x3a663e
movl $0x4, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1a506d
leaq 0x20c062(%rip), %rsi    # 0x3b9f7e
leaq 0x28(%rsp), %rdx
movl $0x8, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1a506d
leaq 0x30(%rsp), %rdx
leaq 0x1b69b4(%rip), %rsi    # 0x3648f4
movl $0x8, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1a506d
leaq 0x38(%rsp), %rdx
leaq 0x1f638f(%rip), %rsi    # 0x3a42ee
movl $0x8, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1a506d
leaq 0x40(%rsp), %rdx
leaq 0x1b6b70(%rip), %rsi    # 0x364aee
movl $0x8, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1a506d
leaq 0x48(%rsp), %rdx
leaq 0x1b6ba3(%rip), %rsi    # 0x364b40
movl $0x8, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1a506d
leaq 0x50(%rsp), %rdx
leaq 0x1aa7bf(%rip), %rsi    # 0x35877b
movl $0x8, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1a506d
leaq 0x58(%rsp), %rdx
leaq 0x1f6329(%rip), %rsi    # 0x3a4304
movl $0x8, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1a506d
leaq 0x60(%rsp), %rdx
leaq 0x1f6306(%rip), %rsi    # 0x3a4300
movl $0x8, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1a506d
leaq 0x68(%rsp), %rdx
leaq 0x1f62fa(%rip), %rsi    # 0x3a4313
movl $0x8, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1a506d
leaq 0x70(%rsp), %rdx
leaq 0x1f62f2(%rip), %rsi    # 0x3a432a
movl $0x8, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1a506d
movq %rbx, 0x8(%rsp)
leaq 0x98(%rbx), %rdx
leaq 0x20df90(%rip), %rsi    # 0x3bbfee
movl $0x4, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1a506d
callq 0x11ac6c
movq %rax, %rbx
movq %rax, %rdi
movq %r13, %rsi
callq 0x11b1ff
cmpl $-0x1, %eax
je 0x1ae0dd
movq %rbx, %rdi
callq 0x11b0a1
movq %r14, %r15
movq %rax, %r14
movq %rbx, %rdi
callq 0x11b0ca
subq $0x8, %rsp
movq 0x18(%rsp), %rdi
leaq 0x1f8527(%rip), %rsi    # 0x3a65d6
movl %r12d, %edx
movq %r14, %rcx
movq %r15, %r14
movq %rax, %r8
movq %rbp, %r9
pushq %r15
callq 0x1a5261
addq $0x10, %rsp
testl %eax, %eax
jne 0x1ae127
movq %rbx, %rdi
callq 0x11b132
incl %r12d
movq %rbx, %rdi
jmp 0x1ae07c
movq %rbx, %rdi
callq 0x11bdbf
leaq 0x1f84ea(%rip), %rsi    # 0x3a65d6
movq 0x10(%rsp), %rdi
movq %rbp, %rdx
movq 0x20(%rsp), %r12
movq %r12, %rcx
movq %r14, %r8
callq 0x1a5102
testl %eax, %eax
movq 0x8(%rsp), %rbx
jne 0x1ae2c8
movl 0x1c(%rsp), %eax
cmpl $0x1, %eax
je 0x1ae139
testl %eax, %eax
jne 0x1ae2b7
xorl %r15d, %r15d
jmp 0x1ae13c
movq %rbx, %rdi
callq 0x11bdbf
movq 0x8(%rsp), %rbx
jmp 0x1ae2c8
movb $0x1, %r15b
movq %rbp, %rdi
callq 0x1a504c
movq %r13, %rdi
callq 0xfd09a
testq %r13, %r13
je 0x1ae2d8
testq %r14, %r14
je 0x1ae16a
movq %r14, %rdi
callq 0xfcc32
testb %al, %al
jne 0x1ae301
testq %r13, %r13
sete %bpl
callq 0xef0cd
movq %rax, %rbx
movq %rax, %rdi
callq 0xf23ac
movq %rbx, %rdi
callq 0xf23d9
movq %rbx, %rdi
callq 0xf2408
movq %rbx, %rdi
movq %r12, %rsi
callq 0xf249c
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
movq %r14, %r13
movq %r14, %rdx
callq 0xef129
movq %rax, %r14
movq %rbx, %rdi
callq 0xefbe3
movq 0x8(%rsp), %rbx
movq %r14, (%rbx)
testq %r14, %r14
sete %r12b
orb %bpl, %r12b
jne 0x1ae200
leaq 0x28(%rsp), %rdi
callq 0x317b90
movq %rax, 0x60(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rbx)
movq (%rbx), %rdi
callq 0xebcd9
movq %rax, %rdi
callq 0xd0a3f
movq %rax, 0x68(%rbx)
testq %rax, %rax
sete %al
orb %al, %r12b
testb %r12b, %r12b
jne 0x1ae2d8
movq 0x8(%rsp), %rax
movl 0x88(%rax), %ebx
movq 0x8(%rsp), %rax
movl 0x94(%rax), %ebp
movq 0x8(%rsp), %rax
movq 0x10(%rax), %r14
movq 0x8(%rsp), %rax
movq 0x68(%rax), %rdi
callq 0xd11be
movq 0x8(%rsp), %rcx
movl 0x98(%rcx), %r10d
movzbl %r15b, %r15d
leaq 0x28(%rsp), %rsi
movq 0x8(%rsp), %rdi
movq %r14, %rdx
movl %ebx, %ecx
movl %ebp, %r8d
movl %eax, %r9d
pushq %r15
pushq %r10
callq 0x317bb7
addq $0x10, %rsp
movq 0x10(%rsp), %rdi
callq 0x11acc9
movq %rax, %rbx
leaq 0x1f835f(%rip), %rsi    # 0x3a65db
movq %rax, %rdi
callq 0x11acf3
movq 0x8(%rsp), %rdi
movl %r15d, %esi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x1ae413
testl %eax, %eax
sete %bpl
movq %rbx, %rdi
movq 0x8(%rsp), %rbx
callq 0x11bdbf
xorb $0x1, %r12b
xorl %eax, %eax
testb %r12b, %bpl
je 0x1ae2d8
jmp 0x1ae2e5
leaq 0x1f838d(%rip), %rsi    # 0x3a664b
movq %r14, %rdi
xorl %eax, %eax
callq 0xfcb67
movq %rbp, %rdi
callq 0x1a504c
movq %r13, %rdi
callq 0xfd09a
movq %rbx, %rdi
callq 0x1addac
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x6465f
callq 0x64698
callq 0x646cf
nop