// File: /workspace/github_c_makefile_star2_O1/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 $0xa8, %rsp
movq %rcx, %r14
movq %rdx, 0x20(%rsp)
movq %rsi, (%rsp)
movq %rdi, %r12
testq %rcx, %rcx
je 0x1b68dd
movq %r14, %rdi
callq 0x101a9a
testb %al, %al
jne 0x1b6df2
movq $0x0, (%r12)
xorps %xmm0, %xmm0
movups %xmm0, 0x68(%r12)
leaq 0x1f9285(%rip), %rsi    # 0x3afb7a
leaq 0x1f83c3(%rip), %rdx    # 0x3aecbf
leaq 0x1f928f(%rip), %rcx    # 0x3afb92
movq (%rsp), %rdi
movl $0xb2, %r8d
movq %r14, %r9
callq 0x101dff
movq %rax, 0x10(%rsp)
testq %rax, %rax
sete %r13b
je 0x1b6bcf
testq %r14, %r14
je 0x1b693c
movq %r14, %rdi
callq 0x101a9a
testb %al, %al
jne 0x1b6df7
callq 0x1adb04
movq %rax, %rbp
leaq 0x10(%r12), %rdx
leaq 0x1f926c(%rip), %rsi    # 0x3afbbc
movq %r12, %rbx
xorl %r12d, %r12d
movl $0x8, %ecx
movq %rax, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1adb51
leaq 0x30(%rbx), %rdx
leaq 0x1a3a0c(%rip), %rsi    # 0x35a380
movl $0x8, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1adb51
leaq 0x1f9238(%rip), %rsi    # 0x3afbc6
leaq 0x1c(%rsp), %rdx
movl $0x4, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1adb51
leaq 0x88(%rbx), %rdx
leaq 0x1f9220(%rip), %rsi    # 0x3afbd4
movl $0x4, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1adb51
leaq 0x94(%rbx), %rdx
leaq 0x1f920d(%rip), %rsi    # 0x3afbe2
movl $0x4, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1adb51
leaq 0x20cbf3(%rip), %rsi    # 0x3c35e2
leaq 0x38(%rsp), %rdx
movl $0x8, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1adb51
leaq 0x40(%rsp), %rdx
leaq 0x1b7095(%rip), %rsi    # 0x36daa8
movl $0x8, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1adb51
leaq 0x48(%rsp), %rdx
leaq 0x1f6e5b(%rip), %rsi    # 0x3ad88d
movl $0x8, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1adb51
leaq 0x50(%rsp), %rdx
leaq 0x1b7251(%rip), %rsi    # 0x36dca2
movl $0x8, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1adb51
leaq 0x58(%rsp), %rdx
leaq 0x1b7284(%rip), %rsi    # 0x36dcf4
movl $0x8, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1adb51
leaq 0x60(%rsp), %rdx
leaq 0x1aad3f(%rip), %rsi    # 0x3617ce
movl $0x8, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1adb51
leaq 0x68(%rsp), %rdx
leaq 0x1f6df5(%rip), %rsi    # 0x3ad8a3
movl $0x8, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1adb51
leaq 0x70(%rsp), %rdx
leaq 0x1f6dd2(%rip), %rsi    # 0x3ad89f
movl $0x8, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1adb51
leaq 0x78(%rsp), %rdx
leaq 0x1f6dc6(%rip), %rsi    # 0x3ad8b2
movl $0x8, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1adb51
leaq 0x80(%rsp), %rdx
leaq 0x1f6dbb(%rip), %rsi    # 0x3ad8c9
movl $0x8, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1adb51
movq %rbx, 0x28(%rsp)
leaq 0x98(%rbx), %rdx
leaq 0x20eb2a(%rip), %rsi    # 0x3c565e
movl $0x4, %ecx
movq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1adb51
callq 0x1208f8
movq %rax, %r15
movq %rax, %rdi
movq 0x10(%rsp), %rsi
callq 0x120e88
cmpl $-0x1, %eax
je 0x1b6bdf
movl %r13d, 0xc(%rsp)
leaq 0x1f900d(%rip), %rbx    # 0x3afb7a
movq %r15, %rdi
callq 0x120d23
movq %r14, %r13
movq %rax, %r14
movq %r15, %rdi
callq 0x120d4c
subq $0x8, %rsp
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
movl %r12d, %edx
movq %r14, %rcx
movq %r13, %r14
movq %rax, %r8
movq %rbp, %r9
pushq %r13
callq 0x1add45
addq $0x10, %rsp
testl %eax, %eax
jne 0x1b6bd7
movq %r15, %rdi
callq 0x120db4
incl %r12d
movq %r15, %rdi
movq 0x10(%rsp), %rsi
callq 0x120e88
cmpl $-0x1, %eax
jne 0x1b6b6d
xorl %r12d, %r12d
jmp 0x1b6bda
movb $0x1, %r15b
jmp 0x1b6c6a
movb $0x1, %r12b
movl 0xc(%rsp), %r13d
movq %r15, %rdi
callq 0x121b03
testb %r12b, %r12b
jne 0x1b6c17
leaq 0x1f8f87(%rip), %rsi    # 0x3afb7a
movq (%rsp), %rdi
movq %rbp, %rdx
movq 0x20(%rsp), %rcx
movq %r14, %r8
callq 0x1adbe6
testl %eax, %eax
movzbl %r12b, %eax
movl $0x1, %r12d
cmovel %eax, %r12d
movb $0x1, %r15b
testb %r12b, %r12b
jne 0x1b6c48
movl 0x1c(%rsp), %eax
cmpl $0x1, %eax
je 0x1b6c48
testl %eax, %eax
jne 0x1b6c31
xorl %r15d, %r15d
jmp 0x1b6c48
leaq 0x1f8fb7(%rip), %rsi    # 0x3afbef
movq %r14, %rdi
xorl %eax, %eax
callq 0x1019cf
movb $0x1, %r15b
movb $0x1, %r12b
movq %rbp, %rdi
callq 0x1adb30
testb %r12b, %r12b
movl $0x0, %eax
movb %r13b, %al
movl $0x1, %r13d
cmovel %eax, %r13d
movq 0x28(%rsp), %r12
movq 0x10(%rsp), %rdi
callq 0x101f02
testb %r13b, %r13b
movq %r14, 0x30(%rsp)
jne 0x1b6cef
testq %r14, %r14
je 0x1b6c93
movq %r14, %rdi
callq 0x101a9a
testb %al, %al
jne 0x1b6dfc
callq 0xf36ef
movq %rax, %rbx
movq %rax, %rdi
callq 0xf69ed
movq %rbx, %rdi
callq 0xf6a1a
movq %rbx, %rdi
callq 0xf6a49
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
callq 0xf6add
movq %rbx, %rdi
movq (%rsp), %rsi
movq %r14, %rdx
callq 0xf374b
movq %rax, %r14
movq %rbx, %rdi
callq 0xf424d
movq %r14, (%r12)
testq %r14, %r14
movzbl %r13b, %eax
movl $0x1, %r13d
cmovnel %eax, %r13d
testb %r13b, %r13b
jne 0x1b6d33
leaq 0x38(%rsp), %rdi
callq 0x321f34
movq %rax, 0x60(%r12)
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%r12)
movq (%r12), %rdi
callq 0xf02da
movq %rax, %rdi
callq 0xd3007
movq %rax, 0x68(%r12)
testq %rax, %rax
movzbl %r13b, %eax
movl $0x1, %r13d
cmovnel %eax, %r13d
testb %r13b, %r13b
jne 0x1b6dcd
movl 0x88(%r12), %ebx
movl 0x94(%r12), %ebp
movq 0x10(%r12), %r14
movq 0x68(%r12), %rdi
callq 0xd3713
movl 0x98(%r12), %r10d
movzbl %r15b, %r15d
leaq 0x38(%rsp), %rsi
movq %r12, %rdi
movq %r14, %rdx
movl %ebx, %ecx
movl %ebp, %r8d
movl %eax, %r9d
pushq %r15
pushq %r10
callq 0x321f5b
addq $0x10, %rsp
movq (%rsp), %rdi
callq 0x120955
movq %rax, %rbx
leaq 0x1f8de5(%rip), %rsi    # 0x3afb7f
movq %rax, %rdi
callq 0x12097f
movq %r12, %rdi
movl %r15d, %esi
movq %rbx, %rdx
movq 0x30(%rsp), %rcx
callq 0x1b6f0f
testl %eax, %eax
movzbl %r13b, %eax
movl $0x1, %r13d
cmovel %eax, %r13d
movq %rbx, %rdi
callq 0x121b03
testb %r13b, %r13b
je 0x1b6dda
movq %r12, %rdi
callq 0x1b6878
movzbl %r13b, %eax
negl %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x65de7
callq 0x65e20
callq 0x65e57
nopl (%rax)