// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/eis-blockcomp.c
// Function: updateIdxOutput
static int
updateIdxOutput(struct blockCompositionSeq *seqIdx,
                struct appendState *aState,
                const partialSymSum *buck)
{
  size_t recordsExpected, cwBitElems;
  AlphabetRangeSize blockAlphabetSize;
  gt_assert(seqIdx && aState && buck);
  /* seek2/write constant width indices */
  if (!(seqIdx->externalData.cwDataPos + aState->cwDiskOffset
         < seqIdx->externalData.varDataPos
         + aState->varDiskOffset/bitElemBits * sizeof (BitElem)))
  {
    fprintf(stderr,"cwDatapos="GT_WU"\n",
           (GtUword) seqIdx->externalData.cwDataPos);
    fprintf(stderr,"cwDiskOffset="GT_WU"\n",(GtUword) aState->cwDiskOffset);
    fprintf(stderr,"varDataPos="GT_WU"\n",
                   (GtUword) seqIdx->externalData.varDataPos);
    fprintf(stderr,"bitElemBits="GT_WU"\n",(GtUword) bitElemBits);
    fprintf(stderr,"aState->varDiskOffset="GT_WU"\n",
                    (GtUword) aState->varDiskOffset);
    fprintf(stderr,"aState->varDiskOffset/bitElemBits="GT_WU"\n",
                    (GtUword) (aState->varDiskOffset/bitElemBits));
    fprintf(stderr,"sizeof (BitElem)="GT_WU"\n",(GtUword) sizeof (BitElem));
    fprintf(stderr,"aState->varDiskOffset/bitElemBits * sizeof (BitElem)="
            GT_WU"\n", (GtUword) (aState->varDiskOffset/bitElemBits * sizeof
                                  (BitElem)));
    fprintf(stderr,"seqIdx->externalData.varDataPos + "
            "aState->varDiskOffset/bitElemBits * sizeof (BitElem)=" GT_WU"\n",
            (GtUword) (seqIdx->externalData.varDataPos +
                       aState->varDiskOffset/bitElemBits * sizeof (BitElem)));
    exit(GT_EXIT_PROGRAMMING_ERROR);
  }
  gt_assert(seqIdx->externalData.cwDataPos + aState->cwDiskOffset
         < seqIdx->externalData.varDataPos
         + aState->varDiskOffset/bitElemBits * sizeof (BitElem));
  blockAlphabetSize = seqIdx->blockMapAlphabetSize;
  /* put bucket data for count up to the beginning of the current
   * block into the cw BitString */
  gt_assert(sizeof (GtUword) * CHAR_BIT >= seqIdx->bitsPerUlong);
  {
    Symbol i;
    for (i = 0; i < blockAlphabetSize; ++i)
    {
      gt_bsStoreUlong(aState->compCache,
                    aState->cwMemOldBits + seqIdx->partialSymSumBitsSums[i],
                    seqIdx->partialSymSumBits[i], buck[i]);
    }
  }
  /* append variable width offset position */
  gt_bsStoreUInt64(aState->compCache, aState->cwMemOldBits
                + cwPreVarIdxBits(seqIdx), seqIdx->bitsPerVarDiskOffset,
                aState->varDiskOffset);
  if (fseeko(seqIdx->externalData.idxFP,
            seqIdx->externalData.cwDataPos + aState->cwDiskOffset,
            SEEK_SET))
    return 0;
  cwBitElems = recordsExpected = aState->cwMemPos / bitElemBits;
  gt_xfwrite(aState->compCache, sizeof (BitElem), recordsExpected,
             seqIdx->externalData.idxFP);
  if ((aState->cwMemOldBits = aState->cwMemPos % bitElemBits))
    aState->compCache[0] = aState->compCache[recordsExpected];
  /* seek2/write variable width indices */
  if (fseeko(seqIdx->externalData.idxFP, seqIdx->externalData.varDataPos
            + aState->varDiskOffset/bitElemBits * sizeof (BitElem), SEEK_SET))
    return 0;
  recordsExpected = aState->varMemPos/bitElemBits;
  gt_xfwrite(aState->permCache, sizeof (BitElem), recordsExpected,
             seqIdx->externalData.idxFP);
  /* move last elem of permCache with unwritten bits to front */
  if (aState->varMemPos % bitElemBits)
    aState->permCache[0] = aState->permCache[recordsExpected];
  /* FIXME: this assumes that the string of variable width date does
   * indeed occupy at least one full bitElem */
  aState->cwDiskOffset += cwBitElems;
  aState->cwMemPos = cwPreCompIdxBits(seqIdx) + aState->cwMemOldBits;
  aState->varDiskOffset += aState->varMemPos - aState->varMemOldBits;
  aState->varMemOldBits = (aState->varMemPos %= bitElemBits);
  return 1;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
cmpq $0x0, 0x38(%rsp)
je 0x4a9aeb
cmpq $0x0, 0x30(%rsp)
je 0x4a9aeb
cmpq $0x0, 0x28(%rsp)
jne 0x4a9b23
movq 0x1924ae(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x6c517(%rip), %rsi     # 0x516013
leaq 0x10c8d3(%rip), %rdx    # 0x5b63d6
leaq 0x10c8e5(%rip), %rcx    # 0x5b63ef
leaq 0x10c3f7(%rip), %r8     # 0x5b5f08
movl $0x716, %r9d            # imm = 0x716
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4a9b25
movq 0x38(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x30(%rsp), %rcx
addq 0x38(%rcx), %rax
movq 0x38(%rsp), %rcx
movq 0x38(%rcx), %rcx
movq 0x30(%rsp), %rdx
movq 0x30(%rdx), %rdx
shrq $0x3, %rdx
shlq $0x0, %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jb 0x4a9ca8
movq 0x19243c(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x30(%rax), %rdx
leaq 0x10c888(%rip), %rsi    # 0x5b63ff
movb $0x0, %al
callq 0x199f0
movq 0x19241b(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
movq 0x30(%rsp), %rax
movq 0x38(%rax), %rdx
leaq 0x10c876(%rip), %rsi    # 0x5b640e
movb $0x0, %al
callq 0x199f0
movq 0x1923fa(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x38(%rax), %rdx
leaq 0x10c867(%rip), %rsi    # 0x5b6420
movb $0x0, %al
callq 0x199f0
movq 0x1923d9(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x10c890(%rip), %rsi    # 0x5b6461
movl $0x8, %edx
movb $0x0, %al
callq 0x199f0
movq 0x1923bc(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
movq 0x30(%rsp), %rax
movq 0x30(%rax), %rdx
leaq 0x10c839(%rip), %rsi    # 0x5b6430
movb $0x0, %al
callq 0x199f0
movq 0x19239b(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
movq 0x30(%rsp), %rax
movq 0x30(%rax), %rdx
shrq $0x3, %rdx
leaq 0x10c82f(%rip), %rsi    # 0x5b644b
movb $0x0, %al
callq 0x199f0
movq 0x192376(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x10c884(%rip), %rsi    # 0x5b64b8
movl $0x1, %edx
movb $0x0, %al
callq 0x199f0
movq 0x192359(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
movq 0x30(%rsp), %rax
movq 0x30(%rax), %rdx
shrq $0x3, %rdx
shlq $0x0, %rdx
leaq 0x10c832(%rip), %rsi    # 0x5b6494
movb $0x0, %al
callq 0x199f0
movq 0x192330(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x38(%rax), %rdx
movq 0x30(%rsp), %rax
movq 0x30(%rax), %rax
shrq $0x3, %rax
shlq $0x0, %rax
addq %rax, %rdx
leaq 0x10c7db(%rip), %rsi    # 0x5b6472
movb $0x0, %al
callq 0x199f0
movl $0x2, %edi
callq 0x19890
jmp 0x4a9caa
movq 0x38(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x30(%rsp), %rcx
addq 0x38(%rcx), %rax
movq 0x38(%rsp), %rcx
movq 0x38(%rcx), %rcx
movq 0x30(%rsp), %rdx
movq 0x30(%rdx), %rdx
shrq $0x3, %rdx
shlq $0x0, %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jb 0x4a9d16
movq 0x1922bb(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x6c324(%rip), %rsi     # 0x516013
leaq 0x10c7d8(%rip), %rdx    # 0x5b64ce
leaq 0x10c6f2(%rip), %rcx    # 0x5b63ef
leaq 0x10c204(%rip), %r8     # 0x5b5f08
movl $0x732, %r9d            # imm = 0x732
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4a9d18
movq 0x38(%rsp), %rax
movw 0xc4(%rax), %ax
movw %ax, 0x16(%rsp)
movq 0x38(%rsp), %rax
movl 0xbc(%rax), %eax
movl %eax, %ecx
movl $0x40, %eax
cmpq %rcx, %rax
jae 0x4a9d78
movq 0x192259(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x6c2c2(%rip), %rsi     # 0x516013
leaq 0x10c805(%rip), %rdx    # 0x5b655d
leaq 0x10c690(%rip), %rcx    # 0x5b63ef
leaq 0x10c1a2(%rip), %r8     # 0x5b5f08
movl $0x736, %r9d            # imm = 0x736
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4a9d7a
movb $0x0, 0x15(%rsp)
movzbl 0x15(%rsp), %eax
movzwl 0x16(%rsp), %ecx
cmpl %ecx, %eax
jge 0x4a9de8
movq 0x30(%rsp), %rax
movq (%rax), %rdi
movq 0x30(%rsp), %rax
movl 0x44(%rax), %eax
movq 0x38(%rsp), %rcx
movq 0xd8(%rcx), %rcx
movzbl 0x15(%rsp), %edx
addl (%rcx,%rdx,4), %eax
movl %eax, %eax
movl %eax, %esi
movq 0x38(%rsp), %rax
movq 0xd0(%rax), %rax
movzbl 0x15(%rsp), %ecx
movl (%rax,%rcx,4), %edx
movq 0x28(%rsp), %rax
movzbl 0x15(%rsp), %ecx
movq (%rax,%rcx,8), %rcx
callq 0x4770f0
movb 0x15(%rsp), %al
addb $0x1, %al
movb %al, 0x15(%rsp)
jmp 0x4a9d7f
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x30(%rsp), %rax
movl 0x44(%rax), %eax
movq %rax, (%rsp)
movq 0x38(%rsp), %rdi
callq 0x4aa060
movq (%rsp), %rsi
movq 0x8(%rsp), %rdi
addq %rax, %rsi
movq 0x38(%rsp), %rax
movl 0xc0(%rax), %edx
movq 0x30(%rsp), %rax
movq 0x30(%rax), %rcx
callq 0x4770f0
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x30(%rax), %rsi
movq 0x30(%rsp), %rax
addq 0x38(%rax), %rsi
xorl %edx, %edx
callq 0x19c10
cmpl $0x0, %eax
je 0x4a9e64
movl $0x0, 0x44(%rsp)
jmp 0x4a9fe7
movq 0x30(%rsp), %rax
movq 0x20(%rax), %rax
shrq $0x3, %rax
movq %rax, 0x20(%rsp)
movq %rax, 0x18(%rsp)
movq 0x30(%rsp), %rax
movq (%rax), %rdi
movq 0x20(%rsp), %rdx
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rcx
movl $0x1, %esi
callq 0x126d30
movq 0x30(%rsp), %rax
movq 0x20(%rax), %rax
andq $0x7, %rax
movq 0x30(%rsp), %rcx
movl %eax, 0x44(%rcx)
cmpl $0x0, %eax
je 0x4a9ecf
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq 0x20(%rsp), %rcx
movb (%rax,%rcx), %cl
movq 0x30(%rsp), %rax
movq (%rax), %rax
movb %cl, (%rax)
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x38(%rax), %rsi
movq 0x30(%rsp), %rax
movq 0x30(%rax), %rax
shrq $0x3, %rax
shlq $0x0, %rax
addq %rax, %rsi
xorl %edx, %edx
callq 0x19c10
cmpl $0x0, %eax
je 0x4a9f0e
movl $0x0, 0x44(%rsp)
jmp 0x4a9fe7
movq 0x30(%rsp), %rax
movq 0x28(%rax), %rax
shrq $0x3, %rax
movq %rax, 0x20(%rsp)
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x20(%rsp), %rdx
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rcx
movl $0x1, %esi
callq 0x126d30
movq 0x30(%rsp), %rax
movq 0x28(%rax), %rax
andq $0x7, %rax
cmpq $0x0, %rax
je 0x4a9f70
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rsp), %rcx
movb (%rax,%rcx), %cl
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rax
movb %cl, (%rax)
movq 0x18(%rsp), %rcx
movq 0x30(%rsp), %rax
addq 0x38(%rax), %rcx
movq %rcx, 0x38(%rax)
movq 0x38(%rsp), %rdi
callq 0x4aa080
movq %rax, %rcx
movq 0x30(%rsp), %rax
movl 0x44(%rax), %eax
addq %rax, %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x30(%rsp), %rax
movq 0x28(%rax), %rcx
movq 0x30(%rsp), %rax
movl 0x40(%rax), %eax
subq %rax, %rcx
movq 0x30(%rsp), %rax
addq 0x30(%rax), %rcx
movq %rcx, 0x30(%rax)
movq 0x30(%rsp), %rcx
movq 0x28(%rcx), %rax
andq $0x7, %rax
movq %rax, 0x28(%rcx)
movl %eax, %ecx
movq 0x30(%rsp), %rax
movl %ecx, 0x40(%rax)
movl $0x1, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq