// File: /workspace/github_c_makefile_star2_O0/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 $0x268, %rsp            # imm = 0x268
movq %rdi, 0x260(%rsp)
movq %rsi, 0x258(%rsp)
movq %rdx, 0x250(%rsp)
movq %rcx, 0x248(%rsp)
movq %r8, 0x240(%rsp)
movq %r9, 0x238(%rsp)
movq $0x0, 0x230(%rsp)
movb $0x0, 0x1a7(%rsp)
movq $0x0, 0x198(%rsp)
cmpq $0x0, 0x250(%rsp)
je 0x221452
cmpq $0x0, 0x260(%rsp)
je 0x221452
cmpq $0x0, 0x238(%rsp)
jne 0x22148a
movq 0x41ab47(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2f4bb0(%rip), %rsi    # 0x516013
leaq 0x3537fe(%rip), %rdx    # 0x574c68
leaq 0x35380c(%rip), %rcx    # 0x574c7d
leaq 0x35381c(%rip), %r8     # 0x574c94
movl $0x21f, %r9d            # imm = 0x21F
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x22148c
jmp 0x22148e
cmpq $0x0, 0x238(%rsp)
je 0x2214e4
movq 0x238(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x2214ac
jmp 0x2214e4
movq 0x41aaed(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2f4b56(%rip), %rsi    # 0x516013
leaq 0x2f4cfb(%rip), %rdx    # 0x5161bf
leaq 0x3537b2(%rip), %rcx    # 0x574c7d
leaq 0x3537c2(%rip), %r8     # 0x574c94
movl $0x220, %r9d            # imm = 0x220
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2214e6
movq 0x260(%rsp), %rax
movl 0x14(%rax), %eax
movl %eax, 0x1a0(%rsp)
movq 0x250(%rsp), %rax
movq %rax, 0x188(%rsp)
movl 0x1a0(%rsp), %eax
movl %eax, 0x190(%rsp)
movq 0x260(%rsp), %rax
movl 0x10(%rax), %eax
movl %eax, 0x194(%rsp)
leaq 0x188(%rsp), %rax
movq %rax, 0x160(%rsp)
leaq 0x170(%rsp), %rax
movq %rax, 0x168(%rsp)
movl 0x353b4a(%rip), %eax    # 0x575098
movl %eax, 0x15c(%rsp)
movq 0x353b40(%rip), %rax    # 0x57509c
movq %rax, 0x154(%rsp)
movq 0x4158e5(%rip), %rax    # 0x636e50
movq %rax, 0x140(%rsp)
movq 0x4158de(%rip), %rax    # 0x636e58
movq %rax, 0x148(%rsp)
movq $0x0, 0x138(%rsp)
movl $0x0, 0x134(%rsp)
movq 0x250(%rsp), %rdi
callq 0x221d50
movq %rax, 0x128(%rsp)
movq 0x250(%rsp), %rdi
callq 0x221d60
movq %rax, 0x120(%rsp)
movq 0x250(%rsp), %rdi
callq 0x221db0
movq %rax, 0x118(%rsp)
movq 0x260(%rsp), %rax
cmpl $-0x2, 0x1c(%rax)
je 0x221609
movq 0x128(%rsp), %rdi
movq 0x260(%rsp), %rax
movl 0x1c(%rax), %eax
movswl %ax, %esi
callq 0x21f570
movq %rax, 0x198(%rsp)
cmpl $0x0, 0x1a0(%rsp)
je 0x2218f4
movq 0x138(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x138(%rsp)
movq 0x120(%rsp), %rdi
movq 0x248(%rsp), %rsi
movq 0x240(%rsp), %rdx
callq 0x221dd0
cmpl $0x0, %eax
je 0x221745
movq 0x240(%rsp), %rdi
callq 0x22cf80
movq %rax, %rdi
callq 0xa9d00
movq %rax, 0x110(%rsp)
movq 0x110(%rsp), %rax
movq 0x128(%rsp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
je 0x2216bf
movq 0x41a912(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2f497b(%rip), %rsi    # 0x516013
leaq 0x353614(%rip), %rdx    # 0x574cb3
leaq 0x3535d7(%rip), %rcx    # 0x574c7d
leaq 0x3535e7(%rip), %r8     # 0x574c94
movl $0x243, %r9d            # imm = 0x243
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2216c1
movq 0x240(%rsp), %rdi
movq 0x128(%rsp), %rsi
subq $0x1, %rsi
callq 0x221e70
movq %rax, 0x108(%rsp)
movq 0x108(%rsp), %rdi
callq 0x46ec80
movl %eax, 0x170(%rsp)
movl %eax, 0x134(%rsp)
movq 0x120(%rsp), %rax
movq %rax, 0x178(%rsp)
movq 0x248(%rsp), %rax
movq %rax, 0x180(%rsp)
movq 0x120(%rsp), %rdi
callq 0x221ea0
movl %eax, 0x158(%rsp)
movq 0x138(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x138(%rsp)
movq 0x250(%rsp), %rdi
movl $0x1, %esi
callq 0x221ec0
movq %rax, 0xf8(%rsp)
movq %rdx, 0x100(%rsp)
movq 0xf8(%rsp), %rdi
movq 0x100(%rsp), %rsi
callq 0x221f00
cmpl $0x0, %eax
je 0x2218b8
movq 0x250(%rsp), %rdi
callq 0x2223d0
movq %rax, 0xe8(%rsp)
movq %rdx, 0xf0(%rsp)
movq 0x120(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0x250(%rsp), %rdi
callq 0x2223f0
movq %rax, 0xb0(%rsp)
movq 0x248(%rsp), %rax
movq %rax, 0xb8(%rsp)
movq 0x128(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0x260(%rsp), %rax
movq %rax, 0xc8(%rsp)
cmpl $0x0, 0x134(%rsp)
je 0x221813
movq 0x240(%rsp), %rax
movq %rax, 0xa0(%rsp)
jmp 0x22181f
xorl %eax, %eax
movq %rax, 0xa0(%rsp)
jmp 0x22181f
movq 0xc8(%rsp), %rbx
movq 0xc0(%rsp), %r14
movq 0xb8(%rsp), %r15
movq 0xb0(%rsp), %r12
movq 0xa8(%rsp), %r9
movq 0xa0(%rsp), %r11
movl 0x134(%rsp), %r10d
movq 0x198(%rsp), %rax
movq 0xe8(%rsp), %rsi
movq 0xf0(%rsp), %rdx
movq 0xf8(%rsp), %rcx
movq 0x100(%rsp), %r8
leaq 0x1a8(%rsp), %rdi
movq %r12, (%rsp)
movq %r15, 0x8(%rsp)
movq %r14, 0x10(%rsp)
movq %rbx, 0x18(%rsp)
movq %r11, 0x20(%rsp)
movl %r10d, 0x28(%rsp)
movq %rax, 0x30(%rsp)
callq 0x221f20
movb $0x1, 0x1a7(%rsp)
jmp 0x2218f2
movq 0x238(%rsp), %rax
movq %rax, 0x98(%rsp)
movq 0x260(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x11dee0
movq 0x98(%rsp), %rdi
movq %rax, %rdx
leaq 0x3533e3(%rip), %rsi    # 0x574cce
movb $0x0, %al
callq 0xd88c0
jmp 0x2218f4
movq 0x258(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x128(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x260(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x11dee0
movq %rax, 0x68(%rsp)
movq 0x118(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x250(%rsp), %rdi
callq 0x2223f0
movq %rax, 0x70(%rsp)
movq 0x250(%rsp), %rdi
movl $0x2, %esi
callq 0x221ec0
movq 0x60(%rsp), %rdi
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rcx
movq %rax, %r8
movq %rdx, %rax
movq 0x78(%rsp), %rdx
movq %r8, 0xd8(%rsp)
movq %rax, 0xe0(%rsp)
movq 0x260(%rsp), %rax
movq 0x138(%rsp), %r8
movq %r8, 0x80(%rsp)
leaq 0x15c(%rsp), %r8
movq %r8, 0x88(%rsp)
leaq 0x154(%rsp), %rbp
leaq 0x140(%rsp), %r13
leaq 0x160(%rsp), %r12
movl 0x1a0(%rsp), %r9d
xorl %r8d, %r8d
movl %r8d, %r15d
leaq 0xa59(%rip), %r8        # 0x222430
cmpl $0x0, %r9d
cmovneq %r8, %r15
movq 0x260(%rsp), %r8
movl 0x10(%r8), %r10d
andl $0x1, %r10d
xorl %r8d, %r8d
movl $0x1, %r9d
cmpl $0x0, %r10d
cmovnel %r9d, %r8d
movslq %r8d, %r14
movl 0x1a0(%rsp), %r9d
xorl %r8d, %r8d
movl %r8d, %ebx
leaq 0x1108(%rip), %r8       # 0x222b20
cmpl $0x0, %r9d
cmovneq %r8, %rbx
movq 0x238(%rsp), %r10
movq 0xd8(%rsp), %r8
movq 0xe0(%rsp), %r9
leaq 0x1a8(%rsp), %r11
movq %rax, (%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x88(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x90(%rsp), %rax
movq %rbp, 0x18(%rsp)
movq %r13, 0x20(%rsp)
movq %r12, 0x28(%rsp)
movq %r15, 0x30(%rsp)
movq %r14, 0x38(%rsp)
movq %rbx, 0x40(%rsp)
movq %r11, 0x48(%rsp)
movq %r10, 0x50(%rsp)
callq *%rax
movq %rax, 0x230(%rsp)
cmpq $0x0, %rax
jne 0x221aa0
jmp 0x221b1c
cmpq $0x0, 0x198(%rsp)
je 0x221b1a
movq 0x198(%rsp), %rdi
callq 0x21fb70
testb $0x1, %al
jne 0x221ad4
movq 0x41a4dd(%rip), %rax    # 0x63bfa0
movq (%rax), %rsi
leaq 0x353244(%rip), %rdi    # 0x574d11
callq 0x19810
jmp 0x221b18
movq 0x198(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x260(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x11dee0
movq 0x58(%rsp), %rdi
movq %rax, %rdx
xorl %eax, %eax
movl %eax, %esi
callq 0x21fb90
movq %rax, 0xd0(%rsp)
movq 0xd0(%rsp), %rdi
callq 0x2204c0
jmp 0x221b1a
jmp 0x221b1c
cmpq $0x0, 0x198(%rsp)
je 0x221b34
movq 0x198(%rsp), %rdi
callq 0x21f7d0
testb $0x1, 0x1a7(%rsp)
je 0x221b4b
leaq 0x1a8(%rsp), %rdi
callq 0x222e60
movq 0x230(%rsp), %rax
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopw %cs:(%rax,%rax)