// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/eis-blockcomp.c
// Function: finalizeIdxOutput
static int
finalizeIdxOutput(struct blockCompositionSeq *seqIdx,
                  struct appendState *aState)
{
  off_t rangeEncPos;
  size_t recordsExpected;
  gt_assert(aState && seqIdx);
  gt_assert(aState->cwMemOldBits < bitElemBits
         && aState->cwMemOldBits + cwPreCompIdxBits(seqIdx)
         == aState->cwMemPos);
  gt_assert(aState->varMemOldBits < bitElemBits
         && aState->varMemOldBits == aState->varMemPos);
  if (aState->cwMemOldBits)
  {
    /* seek2/write variable width indices */
    if (fseeko(seqIdx->externalData.idxFP,
               seqIdx->externalData.cwDataPos
               + aState->cwDiskOffset * sizeof (BitElem), SEEK_SET))
      return 0;
    recordsExpected = 1;
    gt_xfwrite(aState->compCache, sizeof (BitElem), recordsExpected,
               seqIdx->externalData.idxFP);
    ++(aState->cwDiskOffset);
  }
  if (aState->varMemOldBits)
  {
    /* seek2/write variable width indices */
    if (fseeko(seqIdx->externalData.idxFP,
               seqIdx->externalData.varDataPos
               + aState->varDiskOffset/bitElemBits * sizeof (BitElem),
               SEEK_SET))
      return 0;
    recordsExpected = 1;
    gt_xfwrite(aState->permCache, sizeof (BitElem),
               recordsExpected,
               seqIdx->externalData.idxFP);
  }
  rangeEncPos = seqIdx->externalData.varDataPos
    + aState->varDiskOffset / bitElemBits * sizeof (BitElem)
    + ((aState->varDiskOffset%bitElemBits)?sizeof (BitElem):0);
  seqIdx->externalData.rangeEncPos = rangeEncPos;
  /* insert terminator so every search for a next range will find a
   * range just beyond the sequence end */
  gt_SRLAppendNewRange(seqIdx->rangeEncs,
                    seqIdx->baseClass.seqLen + seqIdx->blockSize, 1, 0);
  gt_SRLCompact(seqIdx->rangeEncs);
  if (fseeko(seqIdx->externalData.idxFP, rangeEncPos, SEEK_SET))
    return 0;
  if (!(gt_SRLSaveToStream(seqIdx->rangeEncs, seqIdx->externalData.idxFP)))
     return 0;
  return 1;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
je 0x4a6f6e
cmpq $0x0, 0x28(%rsp)
jne 0x4a6fa6
movq 0x19502b(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x6f094(%rip), %rsi     # 0x516013
leaq 0x10f727(%rip), %rdx    # 0x5b66ad
leaq 0x10f731(%rip), %rcx    # 0x5b66be
leaq 0x10ef74(%rip), %r8     # 0x5b5f08
movl $0x97a, %r9d            # imm = 0x97A
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4a6fa8
jmp 0x4a6faa
movq 0x20(%rsp), %rax
cmpl $0x8, 0x44(%rax)
jae 0x4a6fe2
movq 0x20(%rsp), %rax
movl 0x44(%rax), %eax
movq %rax, 0x8(%rsp)
movq 0x28(%rsp), %rdi
callq 0x4aa080
movq %rax, %rcx
movq 0x8(%rsp), %rax
addq %rcx, %rax
movq 0x20(%rsp), %rcx
cmpq 0x20(%rcx), %rax
je 0x4a701a
movq 0x194fb7(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x6f020(%rip), %rsi     # 0x516013
leaq 0x10f6d6(%rip), %rdx    # 0x5b66d0
leaq 0x10f6bd(%rip), %rcx    # 0x5b66be
leaq 0x10ef00(%rip), %r8     # 0x5b5f08
movl $0x97d, %r9d            # imm = 0x97D
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4a701c
jmp 0x4a701e
movq 0x20(%rsp), %rax
cmpl $0x8, 0x40(%rax)
jae 0x4a703c
movq 0x20(%rsp), %rax
movl 0x40(%rax), %eax
movq 0x20(%rsp), %rcx
cmpq 0x28(%rcx), %rax
je 0x4a7074
movq 0x194f5d(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x6efc6(%rip), %rsi     # 0x516013
leaq 0x10f6e6(%rip), %rdx    # 0x5b673a
leaq 0x10f663(%rip), %rcx    # 0x5b66be
leaq 0x10eea6(%rip), %r8     # 0x5b5f08
movl $0x97f, %r9d            # imm = 0x97F
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4a7076
movq 0x20(%rsp), %rax
cmpl $0x0, 0x44(%rax)
je 0x4a70f6
movq 0x28(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x28(%rsp), %rax
movq 0x30(%rax), %rsi
movq 0x20(%rsp), %rax
movq 0x38(%rax), %rax
shlq $0x0, %rax
addq %rax, %rsi
xorl %edx, %edx
callq 0x19c10
cmpl $0x0, %eax
je 0x4a70bc
movl $0x0, 0x34(%rsp)
jmp 0x4a7245
movq $0x1, 0x10(%rsp)
movq 0x20(%rsp), %rax
movq (%rax), %rdi
movq 0x10(%rsp), %rdx
movq 0x28(%rsp), %rax
movq 0x18(%rax), %rcx
movl $0x1, %esi
callq 0x126d30
movq 0x20(%rsp), %rax
movq 0x38(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x38(%rax)
movq 0x20(%rsp), %rax
cmpl $0x0, 0x40(%rax)
je 0x4a716a
movq 0x28(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x28(%rsp), %rax
movq 0x38(%rax), %rsi
movq 0x20(%rsp), %rax
movq 0x30(%rax), %rax
shrq $0x3, %rax
shlq $0x0, %rax
addq %rax, %rsi
xorl %edx, %edx
callq 0x19c10
cmpl $0x0, %eax
je 0x4a7140
movl $0x0, 0x34(%rsp)
jmp 0x4a7245
movq $0x1, 0x10(%rsp)
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x10(%rsp), %rdx
movq 0x28(%rsp), %rax
movq 0x18(%rax), %rcx
movl $0x1, %esi
callq 0x126d30
movq 0x28(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x30(%rcx), %rcx
shrq $0x3, %rcx
shlq $0x0, %rcx
addq %rcx, %rax
movq 0x20(%rsp), %rcx
movq 0x30(%rcx), %rsi
andq $0x7, %rsi
xorl %ecx, %ecx
movl $0x1, %edx
cmpq $0x0, %rsi
cmovneq %rdx, %rcx
addq %rcx, %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x40(%rax)
movq 0x28(%rsp), %rax
movq 0x70(%rax), %rdi
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0x28(%rsp), %rax
movl 0xb4(%rax), %eax
addq %rax, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x4aff50
movq 0x28(%rsp), %rax
movq 0x70(%rax), %rdi
callq 0x4afda0
movq 0x28(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x18(%rsp), %rsi
xorl %edx, %edx
callq 0x19c10
cmpl $0x0, %eax
je 0x4a7217
movl $0x0, 0x34(%rsp)
jmp 0x4a7245
movq 0x28(%rsp), %rax
movq 0x70(%rax), %rdi
movq 0x28(%rsp), %rax
movq 0x18(%rax), %rsi
callq 0x4b1630
cmpl $0x0, %eax
jne 0x4a723d
movl $0x0, 0x34(%rsp)
jmp 0x4a7245
movl $0x1, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nop