// File: /workspace/github_c_makefile_star2_O0/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:
subq $0xd8, %rsp
movq %rdi, 0xd0(%rsp)
movq %rsi, 0xc8(%rsp)
movq %rdx, 0xc0(%rsp)
movq %rcx, 0xb8(%rsp)
movq $0x0, 0xb0(%rsp)
movb $0x0, 0xaf(%rsp)
movb $0x1, 0xae(%rsp)
cmpq $0x0, 0xb8(%rsp)
je 0x24c649
movq 0xb8(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x24c611
jmp 0x24c649
movq 0x3ef988(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2c99f1(%rip), %rsi    # 0x516013
leaq 0x2c9b96(%rip), %rdx    # 0x5161bf
leaq 0x32c794(%rip), %rcx    # 0x578dc4
leaq 0x32c79b(%rip), %r8     # 0x578dd2
movl $0xae, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x24c64b
movq 0xd0(%rsp), %rax
movq $0x0, 0x70(%rax)
movq 0xd0(%rsp), %rax
movq $0x0, (%rax)
movq 0xd0(%rsp), %rax
movq $0x0, 0x68(%rax)
movq 0xc8(%rsp), %rdi
movq 0xb8(%rsp), %r9
leaq 0x32c729(%rip), %rsi    # 0x578dba
leaq 0x32b84d(%rip), %rdx    # 0x577ee5
leaq 0x32c733(%rip), %rcx    # 0x578dd2
movl $0xb2, %r8d
callq 0xd92c0
movq %rax, 0xb0(%rsp)
cmpq $0x0, 0xb0(%rsp)
jne 0x24c6c5
movb $0x1, 0xaf(%rsp)
testb $0x1, 0xaf(%rsp)
jne 0x24c71c
movq 0xd0(%rsp), %rdi
movq 0xc8(%rsp), %rcx
movq 0xb0(%rsp), %r8
movq 0xc0(%rsp), %r9
movq 0xb8(%rsp), %rax
leaq 0x38(%rsp), %rsi
leaq 0xae(%rsp), %rdx
movq %rax, (%rsp)
callq 0x24c930
cmpl $0x0, %eax
je 0x24c71a
movb $0x1, 0xaf(%rsp)
jmp 0x24c71c
movq 0xb0(%rsp), %rdi
callq 0xd9570
testb $0x1, 0xaf(%rsp)
jne 0x24c776
movq 0xc8(%rsp), %rdi
movq 0xc0(%rsp), %rsi
movq 0xb8(%rsp), %rdx
callq 0x24cd90
movq %rax, %rcx
movq 0xd0(%rsp), %rax
movq %rcx, (%rax)
movq 0xd0(%rsp), %rax
cmpq $0x0, (%rax)
jne 0x24c774
movb $0x1, 0xaf(%rsp)
jmp 0x24c776
testb $0x1, 0xaf(%rsp)
jne 0x24c7f9
leaq 0x38(%rsp), %rdi
callq 0x4c1360
movq %rax, %rcx
movq 0xd0(%rsp), %rax
movq %rcx, 0x60(%rax)
movq 0xd0(%rsp), %rax
movq $0x0, 0x50(%rax)
movq 0xd0(%rsp), %rax
movq $0x0, 0x58(%rax)
movq 0xd0(%rsp), %rax
movq (%rax), %rdi
callq 0xb0f00
movq %rax, %rdi
callq 0x7dc50
movq %rax, %rcx
movq 0xd0(%rsp), %rax
movq %rcx, 0x68(%rax)
movq 0xd0(%rsp), %rax
cmpq $0x0, 0x68(%rax)
jne 0x24c7f7
movb $0x1, 0xaf(%rsp)
jmp 0x24c7f9
testb $0x1, 0xaf(%rsp)
jne 0x24c8fd
movq 0xd0(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0xd0(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0xd0(%rsp), %rax
movl 0x88(%rax), %eax
movl %eax, 0x28(%rsp)
movq 0xd0(%rsp), %rax
movl 0x94(%rax), %eax
movl %eax, 0x2c(%rsp)
movq 0xd0(%rsp), %rax
movq 0x68(%rax), %rdi
callq 0x7e8c0
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rdx
movl 0x28(%rsp), %ecx
movl 0x2c(%rsp), %r8d
movl %eax, %r9d
movq 0xd0(%rsp), %rax
movl 0x98(%rax), %r10d
movb 0xae(%rsp), %al
leaq 0x38(%rsp), %rsi
andb $0x1, %al
movl %r10d, (%rsp)
movzbl %al, %eax
movl %eax, 0x8(%rsp)
callq 0x4c13c0
movq 0xc8(%rsp), %rdi
callq 0x11d510
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rdi
leaq 0x32c504(%rip), %rsi    # 0x578dbf
callq 0x11d550
movq 0xd0(%rsp), %rdi
movb 0xae(%rsp), %al
movq 0x30(%rsp), %rdx
movq 0xb8(%rsp), %rcx
andb $0x1, %al
movzbl %al, %esi
callq 0x24d090
cmpl $0x0, %eax
je 0x24c8f3
movb $0x1, 0xaf(%rsp)
movq 0x30(%rsp), %rdi
callq 0x11f560
testb $0x1, 0xaf(%rsp)
je 0x24c914
movq 0xd0(%rsp), %rdi
callq 0x24c560
movb 0xaf(%rsp), %dl
xorl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testb $0x1, %dl
cmovnel %ecx, %eax
addq $0xd8, %rsp
retq