// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/eis-bwtseq-extinfo.c
// Function: gt_createBWTSeqGeneric
EISeq *
gt_createBWTSeqGeneric(const struct bwtParam *params,
                       indexCreateFunc createIndex,
                       SASeqSrc *src,
                       const enum rangeSortMode rangeSort[],
                       const SpecialsRankLookup *sprTable,
                       GtError *err)
{
  struct encIdxSeq *baseSeqIdx = NULL;
  struct addLocateInfoState varState;
  bool varStateIsInitialized = false;
  unsigned locateInterval;
  BWTSeqContextRetrieverFactory *buildContextMap = NULL;
  gt_assert(src && params && err);
  gt_error_check(err);
  locateInterval = params->locateInterval;
  do
  {
    struct locateHeaderWriteInfo locHeaderData
      = { src, locateInterval, params->featureToggles };
    struct sortModeHeader sortModeHeader;
    void *p[] = { &locHeaderData , &sortModeHeader };
    uint16_t headerIDs[] = { LOCATE_INFO_IN_INDEX_HEADERID,
                             RANK_SORT_HEADERID };
    uint32_t headerSizes[] = { LOCATE_HEADER_SIZE,
                               0 };
    headerWriteFunc headerFuncs[] = { writeLocateInfoHeader,
                                      writeRankSortHeader };
    size_t numHeaders = 0;
    unsigned bitsPerOrigRank = 0;
    GtUword totalLen = SASSGetLength(src);
    const MRAEnc *alphabet = SASSGetMRAEnc(src);
    MRAEnc *baseAlphabet = SASSNewMRAEnc(src);
    /* FIXME: this  has to work also when locateInterval == 0 and
     * sprTable != NULL */
    if (params->ctxMapILog != CTX_MAP_ILOG_NOMAP)
      buildContextMap = gt_newBWTSeqContextRetrieverFactory(totalLen,
                                                         params->ctxMapILog);
    if (locateInterval)
    {
      ++numHeaders;
      if (sortModeHeaderNeeded(alphabet, rangeSort, sprTable))
      {
        GtUword
#ifndef NDEBUG
          origSeqLen = gt_encseq_total_length(
                                                gt_SPRTGetOrigEncseq(sprTable)),
#endif
          maxRank;
        gt_assert(origSeqLen == totalLen - 1);
        maxRank = specialsRank(sprTable, totalLen - 1);
        bitsPerOrigRank = sortModeHeader.bitsPerOrigRank
          = requiredUlongBits(maxRank);
        sortModeHeader.alphabet = alphabet;
        sortModeHeader.rangeSort = rangeSort;
        headerSizes[1] = computeSortModeHeaderSize(alphabet);
        ++numHeaders;
      }
      {
        SeqDataReader readSfxIdx = SASSCreateReader(src, SFX_REQUEST_SUFTAB);
        if (SDRIsValid(readSfxIdx))
        {
          initAddLocateInfoState(
            &varState, SASSGetOrigSeqAccessor(src), readSfxIdx,
            alphabet, SASSGetSeqStats(src), rangeSort, totalLen, params,
            bitsPerOrigRank?sprTable:NULL, bitsPerOrigRank,
            buildContextMap);
          varStateIsInitialized = true;
        }
        else
        {
          gt_error_set(err, "error: locate sampling requested but not available"
                       " for project %s\n", gt_str_get(params->projectName));
        }
      }
    }
    if (!(baseSeqIdx
          = createIndex(totalLen, gt_str_get(params->projectName), baseAlphabet,
                        SASSGetSeqStats(src),
                        SASSCreateReader(src, SFX_REQUEST_BWTTAB),
                        &params->seqParams, numHeaders,
                        headerIDs, headerSizes, headerFuncs, p,
                        locateInterval?addLocateInfo:NULL,
                        /* one bit per position if using bitmap */
                        (params->featureToggles & BWTLocateBitmap)?1:0,
                        locateInterval?locBitsUpperBounds:NULL, &varState,
                        err)))
      break;
    if (buildContextMap)
    {
      if (!gt_BWTSCRFFinished(buildContextMap))
      {
        fputs("error: context table construction incomplete!\n", stderr);
      }
      else
      {
        BWTSeqContextRetriever *ctxRetrieve =
          gt_BWTSCRFGet(buildContextMap, NULL, gt_str_get(params->projectName));
        gt_deleteBWTSeqCR(ctxRetrieve);
      }
    }
  } while (0);
  if (buildContextMap)
    gt_deleteBWTSeqContextRetrieverFactory(buildContextMap);
  if (varStateIsInitialized)
    destructAddLocateInfoState(&varState);
  return baseSeqIdx;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %r8, 0x8(%rsp)
testq %rdi, %rdi
je 0x1a2b21
movq %rdx, %r13
testq %rdx, %rdx
je 0x1a2b21
testq %r9, %r9
je 0x1a2b21
movq %rcx, %r14
movq %rdi, %rbx
movq %rsi, 0x70(%rsp)
movq %r9, 0x40(%rsp)
movq %r9, %rdi
callq 0x101a9a
testb %al, %al
jne 0x1a2b26
movl 0x14(%rbx), %ebp
leaq 0x148(%rsp), %rax
movq %r13, (%rax)
movl %ebp, 0x8(%rax)
movl 0x10(%rbx), %ecx
movl %ecx, 0xc(%rax)
movq %rax, 0x100(%rsp)
leaq 0x118(%rsp), %rax
movq %rax, 0x108(%rsp)
movl $0x4580457, 0x34(%rsp)  # imm = 0x4580457
movq $0x10, 0x48(%rsp)
movaps 0x31d0d9(%rip), %xmm0   # 0x4bf6c0
movaps %xmm0, 0x130(%rsp)
movq (%r13), %rax
movq %rax, 0x28(%rsp)
movq 0x48(%r13), %r15
testq %r15, %r15
jne 0x1a260f
movq %r13, %rdi
callq *0x40(%r13)
movq %rax, %r15
movq %rax, 0x48(%r13)
movq %r13, %rdi
callq *0x40(%r13)
movq %rax, 0x68(%rsp)
movl 0x1c(%rbx), %eax
cmpl $-0x2, %eax
jne 0x1a262e
movq $0x0, 0x20(%rsp)
jmp 0x1a2640
movswl %ax, %esi
movq 0x28(%rsp), %rdi
callq 0x1a1944
movq %rax, 0x20(%rsp)
testl %ebp, %ebp
je 0x1a266f
movl 0x4(%r15), %eax
movl $0x0, 0x10(%rsp)
testq %rax, %rax
je 0x1a2698
xorl %edx, %edx
xorl %ecx, %ecx
cmpl $0x2, (%r14,%rdx,4)
sete %sil
orb %sil, %cl
incq %rdx
cmpq %rdx, %rax
jne 0x1a2659
jmp 0x1a269a
movq $0x0, 0x18(%rsp)
movq $0x0, 0x10(%rsp)
movq $0x0, 0x38(%rsp)
movq $0x0, 0x8(%rsp)
jmp 0x1a29e4
xorl %ecx, %ecx
movl $0x1, %eax
cmpq $0x0, 0x8(%rsp)
je 0x1a270e
testb $0x1, %cl
je 0x1a270e
movq 0x8(%rsp), %rdi
callq 0x1a73e0
movq %rax, %rdi
callq 0xec1d8
movq 0x28(%rsp), %rcx
leaq -0x1(%rcx), %rsi
cmpq %rsi, %rax
jne 0x1a2b2b
movq 0x8(%rsp), %rdi
callq *(%rdi)
movq %rax, %rdi
callq 0x2f9d41
movl %eax, 0x10(%rsp)
movl %eax, 0x118(%rsp)
movq %r15, 0x120(%rsp)
movq %r14, 0x128(%rsp)
movl 0x4(%r15), %eax
leal 0x4(,%rax,2), %eax
movl %eax, 0x4c(%rsp)
movl $0x2, %eax
movq %rax, 0x38(%rsp)
movq %r13, %rdi
movl $0x1, %esi
callq *0x8(%r13)
testq %rdx, %rdx
je 0x1a2754
movq %rax, %rcx
movq %rdx, %rbp
movups 0x28(%r13), %xmm0
movq 0x20(%r13), %rax
testq %rax, %rax
je 0x1a2781
movq %r13, %rdi
movq %rcx, %r12
movaps %xmm0, 0x50(%rsp)
callq *%rax
movaps 0x50(%rsp), %xmm0
movq %r12, %rcx
movq %rax, 0x18(%rsp)
jmp 0x1a278a
movq 0x20(%rbx), %rdi
callq 0x120d23
leaq 0x209446(%rip), %rsi    # 0x3abbaa
movq $0x0, 0x8(%rsp)
movq 0x40(%rsp), %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x1019cf
jmp 0x1a29cc
movq $0x0, 0x18(%rsp)
xorl %eax, %eax
cmpl $0x0, 0x10(%rsp)
movq 0x8(%rsp), %rdx
cmoveq %rax, %rdx
movq %rdx, 0x8(%rsp)
movq %r15, 0x88(%rsp)
movq 0x28(%rsp), %r12
movq %r12, 0x78(%rsp)
movq %r14, 0x90(%rsp)
movq %rcx, 0x98(%rsp)
movq %rbp, 0xa0(%rsp)
movups %xmm0, 0xa8(%rsp)
movl 0x10(%rbx), %eax
movl %eax, 0xd0(%rsp)
movq %rbx, %rdi
callq 0x1a5f68
movl %eax, 0x50(%rsp)
movl 0x14(%rbx), %ebp
decq %r12
movl %ebp, 0xb8(%rsp)
movq %r12, %rdi
callq 0x2f9d41
movl %eax, 0xc0(%rsp)
movl 0x10(%rsp), %eax
movl %eax, 0xc4(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0xc8(%rsp)
testq %rbp, %rbp
je 0x1a2962
testb $0x4, 0x10(%rbx)
je 0x1a2835
movq %r12, %rax
xorl %edx, %edx
divq %rbp
movq %rax, %r12
movq %r12, %rdi
callq 0x2f9d41
movl %eax, 0xbc(%rsp)
movl 0x50(%rsp), %edi
movq %rdi, 0xd8(%rsp)
movq %rdi, 0xe8(%rsp)
shlq $0x4, %rdi
leaq 0x20930d(%rip), %r12    # 0x3abb70
movq %r12, %rsi
movl $0x120, %edx            # imm = 0x120
callq 0x1092b2
movq %rax, 0xe0(%rsp)
movq 0xe8(%rsp), %rdi
shlq $0x3, %rdi
movq %r12, %rsi
movl $0x122, %edx            # imm = 0x122
callq 0x1092b2
movq %rax, 0xf0(%rsp)
movl 0x10(%rsp), %eax
movl %eax, 0xc4(%rsp)
testb $0x4, 0x10(%rbx)
sete %al
cmpl $0x1, %ebp
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x1a2993
movq 0x28(%rsp), %rsi
movq %rsi, %rax
xorl %edx, %edx
divq %rbp
movq %rsi, %rcx
shrq %rcx
subq %rax, %rsi
cmpq %rsi, %rcx
cmovbq %rcx, %rsi
cmpq $0x0, 0x18(%rsp)
je 0x1a29b0
movq %rsi, 0x8(%rsp)
movl $0x18, %r12d
xorl %ebp, %ebp
cmpl $0x1, (%r15)
jne 0x1a2b1c
movq 0x8(%r15), %rax
movl 0x4(%r15), %ecx
decl %ecx
cmpw $0xff, (%rax,%rcx,2)
je 0x1a2915
cmpb $-0x1, (%r15,%r12)
je 0x1a293b
movzbl (%r15,%r12), %esi
movq %r15, %rdi
xorl %edx, %edx
movq %r14, %rcx
callq 0x1a6a6a
testl %eax, %eax
jne 0x1a293b
movq 0x18(%rsp), %rax
movq (%rax), %rax
addq -0xc0(%rax,%r12,8), %rbp
incq %r12
cmpq $0x118, %r12            # imm = 0x118
jne 0x1a28f2
movq 0x28(%rsp), %rax
subq %rbp, %rax
movq 0x8(%rsp), %rsi
cmpq %rbp, %rsi
jae 0x1a29a6
cmpq %rax, %rsi
cmovaeq %rax, %rsi
jmp 0x1a29b0
movq $0x0, 0x80(%rsp)
xorl %eax, %eax
movl %eax, 0xc4(%rsp)
movl %eax, 0xbc(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0xd8(%rsp)
movups %xmm0, 0xe8(%rsp)
jmp 0x1a299f
movq $0x0, 0x80(%rsp)
movq 0x20(%rsp), %rax
jmp 0x1a29bd
cmpq %rax, %rbp
cmovbq %rbp, %rax
movq %rax, %rsi
movq 0x20(%rsp), %rax
movq %rsi, 0x80(%rsp)
movq %rax, 0xf8(%rsp)
movb $0x1, %al
movq %rax, 0x8(%rsp)
leaq 0x23d(%rip), %rax       # 0x1a2c10
movq %rax, 0x10(%rsp)
leaq 0x753(%rip), %rax       # 0x1a3132
movq %rax, 0x18(%rsp)
movq 0x20(%rbx), %rdi
callq 0x120d23
movq %rax, %r14
movq 0x20(%r13), %rax
testq %rax, %rax
je 0x1a2a03
movq %r13, %rdi
callq *%rax
movq %rax, %r15
jmp 0x1a2a06
xorl %r15d, %r15d
movq %r13, %rdi
movl $0x2, %esi
callq *0x8(%r13)
movq %rdx, %r9
movl 0x10(%rbx), %r10d
andl $0x1, %r10d
subq $0x8, %rsp
leaq 0x80(%rsp), %r11
leaq 0x108(%rsp), %r13
leaq 0x138(%rsp), %r12
leaq 0x50(%rsp), %rbp
movq 0x30(%rsp), %rdi
movq %r14, %rsi
movq 0x70(%rsp), %rdx
movq %r15, %rcx
movq %rax, %r8
pushq 0x48(%rsp)
pushq %r11
pushq 0x30(%rsp)
pushq %r10
pushq 0x38(%rsp)
pushq %r13
pushq %r12
pushq %rbp
leaq 0x7c(%rsp), %rax
pushq %rax
pushq 0x88(%rsp)
pushq %rbx
callq *0xd0(%rsp)
addq $0x60, %rsp
movq %rax, %r14
testq %rax, %rax
movq 0x20(%rsp), %r15
je 0x1a2abb
testq %r15, %r15
je 0x1a2abb
movq %r15, %rdi
callq 0x1a1c3c
testb %al, %al
je 0x1a2b15
movq 0x20(%rbx), %rdi
callq 0x120d23
movq %r15, %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0x1a1c47
movq %rax, %rdi
callq 0x1a21b6
testq %r15, %r15
je 0x1a2ac8
movq %r15, %rdi
callq 0x1a1aad
cmpb $0x0, 0x8(%rsp)
je 0x1a2b00
movq 0xe0(%rsp), %rdi
leaq 0x209092(%rip), %rbx    # 0x3abb70
movq %rbx, %rsi
movl $0x151, %edx            # imm = 0x151
callq 0x109670
movq 0xf0(%rsp), %rdi
movq %rbx, %rsi
movl $0x152, %edx            # imm = 0x152
callq 0x109670
movq %r14, %rax
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x60129
jmp 0x1a2abb
callq 0x173b0
callq 0x600b7
callq 0x60145
callq 0x600f0