// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/eis-bwtseq-context.c
// Function: initBWTSeqContextRetrieverFactory
static void
initBWTSeqContextRetrieverFactory(BWTSeqContextRetrieverFactory *newFactory,
                                  GtUword seqLen,
                                  short mapIntervalLog2)
{
  FILE *fp;
  gt_assert(ctxMapILogIsValid(seqLen, mapIntervalLog2));
  if (mapIntervalLog2 == CTX_MAP_ILOG_AUTOSIZE)
  {
    mapIntervalLog2 = gt_requiredUIntBits(requiredUlongBits(seqLen));
  }
  newFactory->seqLen = seqLen;
  newFactory->currentSfxPos = 0;
  newFactory->moduloMask = (1 << mapIntervalLog2) - 1;
  newFactory->mapIntervalLog2 = mapIntervalLog2;
  newFactory->constructionComplete = false;
  newFactory->mapTableDBSPath = gt_str_new();
  fp = newFactory->mapTableDiskBackingStore
    = gt_xtmpfp_generic(newFactory->mapTableDBSPath,
                        GT_TMPFP_AUTOREMOVE | GT_TMPFP_OPENBINARY);
  {
    off_t backingStoreSize = numMapEntries(seqLen, mapIntervalLog2), i;
    GtUword buf[BLOCK_IO_SIZE];
    memset(buf, 0, sizeof (buf));
    for (i = BLOCK_IO_SIZE; i < backingStoreSize; i += BLOCK_IO_SIZE)
    {
      gt_xfwrite(buf, sizeof (buf[0]), BLOCK_IO_SIZE, fp);
    }
    {
      unsigned leftOver = backingStoreSize % BLOCK_IO_SIZE;
      if (leftOver > 0) {
        gt_xfwrite(buf, sizeof (buf[0]), leftOver, fp);
      }
    }
  }
}

// Assembly:
subq $0x2048, %rsp           # imm = 0x2048
movw %dx, %ax
movq %rdi, 0x2040(%rsp)
movq %rsi, 0x2038(%rsp)
movw %ax, 0x2036(%rsp)
movq 0x2038(%rsp), %rdi
movswl 0x2036(%rsp), %esi
callq 0x220b60
testb $0x1, %al
jne 0x21f633
movq 0x41c99e(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2f6a07(%rip), %rsi    # 0x516013
leaq 0x355144(%rip), %rdx    # 0x574757
leaq 0x355168(%rip), %rcx    # 0x574782
leaq 0x354fd1(%rip), %r8     # 0x5745f2
movl $0x41, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x21f635
movswl 0x2036(%rsp), %eax
cmpl $-0x1, %eax
jne 0x21f65e
movq 0x2038(%rsp), %rdi
callq 0x46ec80
movl %eax, %edi
callq 0x46ec00
movw %ax, 0x2036(%rsp)
movq 0x2038(%rsp), %rcx
movq 0x2040(%rsp), %rax
movq %rcx, (%rax)
movq 0x2040(%rsp), %rax
movq $0x0, 0x8(%rax)
movswl 0x2036(%rsp), %ecx
movl $0x1, %eax
shll %cl, %eax
subl $0x1, %eax
movslq %eax, %rcx
movq 0x2040(%rsp), %rax
movq %rcx, 0x10(%rax)
movw 0x2036(%rsp), %cx
movq 0x2040(%rsp), %rax
movw %cx, 0x1a(%rax)
movq 0x2040(%rsp), %rax
movb $0x0, 0x18(%rax)
callq 0x11d4a0
movq %rax, %rcx
movq 0x2040(%rsp), %rax
movq %rcx, 0x28(%rax)
movq 0x2040(%rsp), %rax
movq 0x28(%rax), %rdi
movl $0x5, %esi
leaq 0x354f04(%rip), %rdx    # 0x5745f2
movl $0x4e, %ecx
callq 0xd9e50
movq 0x2040(%rsp), %rcx
movq %rax, 0x20(%rcx)
movq %rax, 0x2028(%rsp)
movq 0x2038(%rsp), %rdi
movzwl 0x2036(%rsp), %esi
callq 0x220c10
movq %rax, 0x2020(%rsp)
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
movl $0x2000, %edx           # imm = 0x2000
callq 0x19360
movq $0x400, 0x2018(%rsp) # imm = 0x400
movq 0x2018(%rsp), %rax
cmpq 0x2020(%rsp), %rax
jge 0x21f78c
leaq 0x10(%rsp), %rdi
movq 0x2028(%rsp), %rcx
movl $0x8, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x126d30
movq 0x2018(%rsp), %rax
addq $0x400, %rax            # imm = 0x400
movq %rax, 0x2018(%rsp)
jmp 0x21f746
movq 0x2020(%rsp), %rax
movl $0x400, %ecx            # imm = 0x400
cqto
idivq %rcx
movl %edx, %eax
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
jbe 0x21f7c8
leaq 0x10(%rsp), %rdi
movl 0xc(%rsp), %eax
movl %eax, %edx
movq 0x2028(%rsp), %rcx
movl $0x8, %esi
callq 0x126d30
addq $0x2048, %rsp           # imm = 0x2048
retq