// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/esa-merge.c
// Function: gt_emissionmergedesa_stepdeleteandinsertothersuffixes
int gt_emissionmergedesa_stepdeleteandinsertothersuffixes(
                                 Emissionmergedesa *emmesa, GtError *err)
{
  Mergertrienode *tmpsmallestleaf, *tmplcpnode;
  Largelcpvalue tmpexception;
  GtUchar tmpsmalllcpvalue;
  int retval;
  GtUword tmpsuftabvalue,
         tmplcpvalue,
         tmplastbranchdepth;
  unsigned int tmpidx;

  gt_error_check(err);
  for (emmesa->buf.nextstoreidx = 0;
      emmesa->numofentries > 0 &&
      emmesa->buf.nextstoreidx < (unsigned int) SIZEOFMERGERESULTBUFFER;
      emmesa->buf.nextstoreidx++)
  {
    tmpsmallestleaf = gt_mergertrie_findsmallestnode(&emmesa->trierep);
    tmplastbranchdepth = tmpsmallestleaf->parent->depth;
    tmpidx = tmpsmallestleaf->suffixinfo.idx;
    emmesa->buf.suftabstore[emmesa->buf.nextstoreidx].idx = tmpidx;
    emmesa->buf.suftabstore[emmesa->buf.nextstoreidx].startpos
      = tmpsmallestleaf->suffixinfo.startpos;
    if (emmesa->nextpostable[tmpidx] >
       gt_encseq_total_length(emmesa->suffixarraytable[tmpidx].encseq))
    {
      gt_mergertrie_deletesmallestpath(tmpsmallestleaf,&emmesa->trierep);
      emmesa->numofentries--;
    } else
    {
      retval = gt_readnextfromstream_GtUchar(&tmpsmalllcpvalue,
                                       &emmesa->suffixarraytable[tmpidx].
                                                lcptabstream);
      if (retval < 0)
      {
        return -1;
      }
      if (retval == 0)
      {
        gt_error_set(err,"file %s: line %d: unexpected end of file when "
                        "reading lcptab",__FILE__,__LINE__);
        return -2;
      }
      if (tmpsmalllcpvalue == (GtUchar) LCPOVERFLOW)
      {
        retval = gt_readnextfromstream_Largelcpvalue(
                               &tmpexception,
                               &emmesa->suffixarraytable[tmpidx].llvtabstream);
        if (retval < 0)
        {
          return -3;
        }
        if (retval == 0)
        {
          gt_error_set(err,"file %s: line %d: unexpected end of file when "
                        "reading llvtab",__FILE__,__LINE__);
          return -4;
        }
        tmplcpvalue = tmpexception.value;
      } else
      {
        tmplcpvalue = (GtUword) tmpsmalllcpvalue;
      }
      if (tmplcpvalue > tmplastbranchdepth)
      {
        tmplastbranchdepth = tmplcpvalue;
      }
      tmplcpnode = findlargestnodeleqlcpvalue(tmpsmallestleaf,tmplcpvalue,err);
      retval = gt_readnextfromstream_GtUword(&tmpsuftabvalue,
                                         &emmesa->suffixarraytable[tmpidx].
                                         suftabstream_GtUword);
      if (retval == 0)
      {
        gt_error_set(err,"file %s: line %d: unexpected end of file when "
                      "reading suftab",__FILE__,__LINE__);
        return -6;
      }
      emmesa->nextpostable[tmpidx]++;
      fillandinsert(&emmesa->trierep,
                    tmpidx,
                    tmpsuftabvalue,
                    tmplcpnode,
                    emmesa->ident++);
      tmpsmallestleaf = gt_mergertrie_findsmallestnode(&emmesa->trierep);
      gt_mergertrie_deletesmallestpath(tmpsmallestleaf,&emmesa->trierep);
    }
    if (emmesa->numofentries > 0)
    {
      emmesa->buf.lcptabstore[emmesa->buf.nextstoreidx]
        = tmplastbranchdepth;
      emmesa->buf.lastpage = false;
    } else
    {
      emmesa->buf.lastpage = true;
    }
  }
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %r14
testq %rsi, %rsi
movq %rsi, 0x8(%rsp)
je 0x31b8ab
movq %rsi, %rdi
callq 0x101a9a
testb %al, %al
jne 0x31bbf1
movl $0x0, 0x1c(%r14)
cmpl $0x0, 0x8(%r14)
je 0x31bb69
leaq 0x30028(%r14), %rbp
leaq 0x10020(%r14), %rax
movq %rax, 0x28(%rsp)
movq %rbp, 0x20(%rsp)
movq %rbp, %rdi
callq 0x32a190
movq %rax, %r12
movq 0x20(%rax), %rax
movq 0x28(%rax), %rax
movq %rax, 0x10(%rsp)
movl (%r12), %r15d
movl 0x1c(%r14), %eax
shlq $0x4, %rax
movq 0x28(%rsp), %rdx
movl %r15d, (%rdx,%rax)
movq 0x8(%r12), %rcx
movq %rcx, 0x8(%rdx,%rax)
movq 0x10(%r14), %rax
movq (%rax,%r15,8), %rbx
movq 0x30058(%r14), %rax
movq %r15, %r13
shlq $0x8, %r13
movq (%rax,%r13), %rdi
callq 0xec1d8
cmpq %rax, %rbx
jbe 0x31b94a
movq %r12, %rdi
movq %rbp, %rsi
callq 0x32a1ad
decl 0x8(%r14)
movq 0x10(%rsp), %rbx
jmp 0x31bb03
movq 0x30058(%r14), %rax
leaq (%rax,%r13), %rbx
addq $0xd0, %rbx
movl 0x4(%rbx), %eax
cmpl (%rbx), %eax
jb 0x31b99f
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %rcx
movl $0x1, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x17b40
movq %rax, %rbp
movl %ebp, (%rbx)
movq 0x10(%rbx), %rdi
callq 0x17f00
testl %eax, %eax
jne 0x31bbe7
movl $0x0, 0x4(%rbx)
testl %ebp, %ebp
je 0x31bb4d
movq 0x8(%rbx), %rax
movl 0x4(%rbx), %ecx
leal 0x1(%rcx), %edx
movl %edx, 0x4(%rbx)
movb (%rax,%rcx), %cl
xorl %eax, %eax
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rbx
testb %al, %al
jne 0x31bb6d
cmpb $-0x1, %cl
movb %cl, 0x7(%rsp)
je 0x31b9d4
movzbl %cl, %ebp
jmp 0x31ba58
movq 0x30058(%r14), %rax
leaq (%rax,%r13), %rbx
addq $0xe8, %rbx
movl 0x4(%rbx), %eax
cmpl (%rbx), %eax
jb 0x31ba29
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %rcx
movl $0x10, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x17b40
movq %rax, %rbp
movl %ebp, (%rbx)
movq 0x10(%rbx), %rdi
callq 0x17f00
testl %eax, %eax
jne 0x31bbec
movl $0x0, 0x4(%rbx)
testl %ebp, %ebp
je 0x31bb5d
movq 0x8(%rbx), %rax
movl 0x4(%rbx), %ecx
leal 0x1(%rcx), %edx
movl %edx, 0x4(%rbx)
shlq $0x4, %rcx
movq 0x8(%rax,%rcx), %rbp
xorl %eax, %eax
movq 0x10(%rsp), %rbx
movq %rbp, 0x18(%rsp)
testb %al, %al
movq 0x8(%rsp), %rdi
jne 0x31bbb4
cmpq %rbx, %rbp
cmovaq %rbp, %rbx
testq %rdi, %rdi
je 0x31ba71
callq 0x101a9a
testb %al, %al
jne 0x31bbe2
movq 0x20(%r12), %r12
testq %r12, %r12
je 0x31ba84
cmpq %rbp, 0x28(%r12)
ja 0x31ba71
jmp 0x31ba9d
movq 0x8(%rsp), %rdi
leaq 0xcfc1a(%rip), %rsi     # 0x3eb6aa
movq %rbp, %rdx
xorl %eax, %eax
callq 0x1019cf
xorl %r12d, %r12d
movq 0x30058(%r14), %rax
leaq (%rax,%r13), %rsi
addq $0xa0, %rsi
leaq 0x30(%rsp), %rdi
callq 0x31bbf6
testl %eax, %eax
je 0x31bb8e
movq 0x10(%r14), %rax
incq (%rax,%r15,8)
movq 0x30(%rsp), %rax
incq (%r14)
movl %r15d, 0x38(%rsp)
movq %rax, 0x40(%rsp)
movq 0x20(%rsp), %rbp
movq %rbp, %rdi
movq %r12, %rsi
leaq 0x38(%rsp), %rdx
callq 0x329cc8
movq %rbp, %rdi
callq 0x32a190
movq %rax, %rdi
movq %rbp, %rsi
callq 0x32a1ad
cmpl $0x0, 0x8(%r14)
je 0x31bb1d
movl 0x1c(%r14), %eax
movq %rbx, 0x20(%r14,%rax,8)
movb $0x0, 0x30020(%r14)
jmp 0x31bb25
movb $0x1, 0x30020(%r14)
movl 0x1c(%r14), %ecx
incl %ecx
movl %ecx, 0x1c(%r14)
xorl %eax, %eax
cmpl $0x0, 0x8(%r14)
je 0x31bbd3
cmpl $0x2000, %ecx           # imm = 0x2000
jb 0x31b8d6
jmp 0x31bbd3
movb $0x1, %al
movq 0x8(%rsp), %rdi
movb 0x7(%rsp), %cl
jmp 0x31b9b6
movb $0x1, %al
movq 0x18(%rsp), %rbp
jmp 0x31ba41
xorl %eax, %eax
jmp 0x31bbd3
leaq 0xcfaa1(%rip), %rsi     # 0x3eb615
leaq 0xcfa84(%rip), %rdx     # 0x3eb5ff
movl $0xae, %ecx
xorl %eax, %eax
callq 0x1019cf
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x31bbd3
leaq 0xcfabd(%rip), %rsi     # 0x3eb652
leaq 0xcfa63(%rip), %rdx     # 0x3eb5ff
movq 0x8(%rsp), %rdi
movl $0xd0, %ecx
xorl %eax, %eax
callq 0x1019cf
movl $0xfffffffa, %eax       # imm = 0xFFFFFFFA
jmp 0x31bbd3
leaq 0x46fe7(%rip), %rsi     # 0x362ba2
leaq 0xcfa3d(%rip), %rdx     # 0x3eb5ff
movl $0xbd, %ecx
xorl %eax, %eax
callq 0x1019cf
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x92c63
callq 0x92c13
callq 0x92c3b
callq 0x92bda