// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/test-mergeesa.c
// Function: mergeandstoreindex
static int mergeandstoreindex(const GtStr *storeindex,
                              Emissionmergedesa *emmesa,
                              GtError *err)
{
  Mergeoutinfo mergeoutinfo;
  GtUchar smalllcpvalue;
  GtSpecialcharinfo specialcharinfo;
  GtUword *sequenceoffsettable, totallength;
  bool haserr = false;

  gt_error_check(err);
  mergeoutinfo.outsuf.fp = NULL;
  mergeoutinfo.outlcp.fp = NULL;
  mergeoutinfo.outllv.fp = NULL;
  mergeoutinfo.outsuf.outfilename = NULL;
  mergeoutinfo.outlcp.outfilename = NULL;
  mergeoutinfo.outllv.outfilename = NULL;
  if (initNameandFILE(&mergeoutinfo.outsuf,storeindex,GT_SUFTABSUFFIX,err) != 0)
  {
    haserr = true;
  }
  if (!haserr)
  {
    if (initNameandFILE(&mergeoutinfo.outlcp,storeindex,
                        GT_LCPTABSUFFIX,err) != 0)
    {
      haserr = true;
    }
  }
  if (!haserr)
  {
    if (initNameandFILE(&mergeoutinfo.outllv,storeindex,GT_LARGELCPTABSUFFIX,
                        err) != 0)
    {
      haserr = true;
    }
  }
  smalllcpvalue = 0;
  if (!haserr) {
    gt_xfwrite(&smalllcpvalue,sizeof (GtUchar),(size_t) 1,
               mergeoutinfo.outlcp.fp);
  }
  if (!haserr)
  {
    mergeoutinfo.currentlcpindex = (GtUword) 1;
    sequenceoffsettable = gt_encseqtable2sequenceoffsets(&totallength,
                                                      &specialcharinfo,
                                                      emmesa->suffixarraytable,
                                                      emmesa->numofindexes);
    gt_assert(sequenceoffsettable != NULL);
    while (emmesa->numofentries > 0)
    {
      if (gt_emissionmergedesa_stepdeleteandinsertothersuffixes(emmesa,
                                                                err) != 0)
      {
        haserr = true;
        break;
      }
      if (outputsuflcpllv(&mergeoutinfo,
                         sequenceoffsettable,
                         &emmesa->buf,
                         err) != 0)
      {
        haserr = true;
        break;
      }
    }
    gt_free(sequenceoffsettable);
  }
  freeNameandFILE(&mergeoutinfo.outsuf);
  freeNameandFILE(&mergeoutinfo.outlcp);
  freeNameandFILE(&mergeoutinfo.outllv);
  return haserr ? -1 : 0;
}

// Assembly:
subq $0x100e8, %rsp          # imm = 0x100E8
movq %rdi, 0x100e0(%rsp)
movq %rsi, 0x100d8(%rsp)
movq %rdx, 0x100d0(%rsp)
movb $0x0, 0xf(%rsp)
cmpq $0x0, 0x100d0(%rsp)
je 0x2f25ea
movq 0x100d0(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x2f25b2
jmp 0x2f25ea
movq 0x3499e7(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x223a50(%rip), %rsi    # 0x516013
leaq 0x223bf5(%rip), %rdx    # 0x5161bf
leaq 0x29d05e(%rip), %rcx    # 0x58f62f
leaq 0x29d018(%rip), %r8     # 0x58f5f0
movl $0x86, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2f25ec
movq $0x0, 0xa0(%rsp)
movq $0x0, 0xb0(%rsp)
movq $0x0, 0xc0(%rsp)
movq $0x0, 0x98(%rsp)
movq $0x0, 0xa8(%rsp)
movq $0x0, 0xb8(%rsp)
leaq 0x98(%rsp), %rdi
movq 0x100e0(%rsp), %rsi
movq 0x100d0(%rsp), %rcx
leaq 0x26729e(%rip), %rdx    # 0x5598f1
callq 0x2f2850
cmpl $0x0, %eax
je 0x2f2662
movb $0x1, 0xf(%rsp)
testb $0x1, 0xf(%rsp)
jne 0x2f269d
leaq 0x98(%rsp), %rdi
addq $0x10, %rdi
movq 0x100e0(%rsp), %rsi
movq 0x100d0(%rsp), %rcx
leaq 0x2843aa(%rip), %rdx    # 0x576a36
callq 0x2f2850
cmpl $0x0, %eax
je 0x2f269b
movb $0x1, 0xf(%rsp)
jmp 0x2f269d
testb $0x1, 0xf(%rsp)
jne 0x2f26d8
leaq 0x98(%rsp), %rdi
addq $0x20, %rdi
movq 0x100e0(%rsp), %rsi
movq 0x100d0(%rsp), %rcx
leaq 0x2843b0(%rip), %rdx    # 0x576a77
callq 0x2f2850
cmpl $0x0, %eax
je 0x2f26d6
movb $0x1, 0xf(%rsp)
jmp 0x2f26d8
movb $0x0, 0x97(%rsp)
testb $0x1, 0xf(%rsp)
jne 0x2f2704
movq 0xb0(%rsp), %rcx
leaq 0x97(%rsp), %rdi
movl $0x1, %edx
movq %rdx, %rsi
callq 0x126d30
testb $0x1, 0xf(%rsp)
jne 0x2f2806
movq $0x1, 0xc8(%rsp)
movq 0x100d8(%rsp), %rax
movq 0x30058(%rax), %rdx
movq 0x100d8(%rsp), %rax
movl 0xc(%rax), %ecx
leaq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x4b28b0
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
jne 0x2f2789
movq 0x349848(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2238b1(%rip), %rsi    # 0x516013
leaq 0x29ced9(%rip), %rdx    # 0x58f642
leaq 0x29cebf(%rip), %rcx    # 0x58f62f
leaq 0x29ce79(%rip), %r8     # 0x58f5f0
movl $0xad, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2f278b
jmp 0x2f278d
movq 0x100d8(%rsp), %rax
cmpl $0x0, 0x8(%rax)
jbe 0x2f27f0
movq 0x100d8(%rsp), %rdi
movq 0x100d0(%rsp), %rsi
callq 0x4b6380
cmpl $0x0, %eax
je 0x2f27bc
movb $0x1, 0xf(%rsp)
jmp 0x2f27f0
movq 0x18(%rsp), %rsi
movq 0x100d8(%rsp), %rdx
addq $0x18, %rdx
movq 0x100d0(%rsp), %rcx
leaq 0x98(%rsp), %rdi
callq 0x2f2940
cmpl $0x0, %eax
je 0x2f27ee
movb $0x1, 0xf(%rsp)
jmp 0x2f27f0
jmp 0x2f278d
movq 0x18(%rsp), %rdi
leaq 0x29cdf4(%rip), %rsi    # 0x58f5f0
movl $0xbf, %edx
callq 0xe88c0
leaq 0x98(%rsp), %rdi
callq 0x2f2b50
leaq 0x98(%rsp), %rdi
addq $0x10, %rdi
callq 0x2f2b50
leaq 0x98(%rsp), %rdi
addq $0x20, %rdi
callq 0x2f2b50
movb 0xf(%rsp), %dl
xorl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testb $0x1, %dl
cmovnel %ecx, %eax
addq $0x100e8, %rsp          # imm = 0x100E8
retq
nop