// File: /workspace/github_c_makefile_star2_O2/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 $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
testq %rsi, %rsi
je 0x2b09d9
movq %rbx, %rdi
callq 0x89eb7
testb %al, %al
jne 0x2b0d1e
movq %rbx, (%rsp)
leaq 0x30028(%r14), %r12
leaq 0x10020(%r14), %rax
movq %rax, 0x18(%rsp)
movl 0x8(%r14), %eax
xorl %ecx, %ecx
movq %r12, 0x10(%rsp)
movl %ecx, 0x1c(%r14)
testl %eax, %eax
je 0x2b0c2f
cmpl $0x1fff, %ecx           # imm = 0x1FFF
ja 0x2b0c2f
movq %r12, %rdi
callq 0x2c0ef7
movq %rax, %r13
movq 0x20(%rax), %rax
movq 0x28(%rax), %rax
movq %rax, 0x8(%rsp)
movl (%r13), %r15d
movl 0x1c(%r14), %eax
shlq $0x4, %rax
movq 0x18(%rsp), %rdx
movl %r15d, (%rdx,%rax)
movq 0x8(%r13), %rcx
movq %rcx, 0x8(%rdx,%rax)
movq 0x10(%r14), %rax
movq (%rax,%r15,8), %rbx
movq 0x30058(%r14), %rax
movq %r15, %rbp
shlq $0x8, %rbp
movq (%rax,%rbp), %rdi
callq 0x7055e
cmpq %rax, %rbx
jbe 0x2b0a8c
movq %r13, %rdi
movq %r12, %rsi
callq 0x2c0f47
movl 0x8(%r14), %eax
decl %eax
movl %eax, 0x8(%r14)
movq 0x8(%rsp), %rbx
jmp 0x2b0c05
movq 0x30058(%r14), %rax
leaq (%rax,%rbp), %rbx
addq $0xd0, %rbx
movl 0x4(%rbx), %eax
cmpl (%rbx), %eax
jb 0x2b0ae0
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %rcx
movl $0x1000, %edx           # imm = 0x1000
pushq $0x1
popq %rsi
callq 0x17ad0
movq %rax, %r12
movl %r12d, (%rbx)
movq 0x10(%rbx), %rdi
callq 0x17e70
testl %eax, %eax
jne 0x2b0cdd
andl $0x0, 0x4(%rbx)
xorl %eax, %eax
testl %r12d, %r12d
je 0x2b0c55
movq 0x8(%rbx), %rcx
leal 0x1(%rax), %edx
movl %edx, 0x4(%rbx)
movl %eax, %eax
movzbl (%rcx,%rax), %r12d
cmpq $0xff, %r12
jne 0x2b0b63
movq 0x30058(%r14), %rax
leaq (%rax,%rbp), %rbx
addq $0xe8, %rbx
movl 0x4(%rbx), %eax
cmpl (%rbx), %eax
jb 0x2b0b4e
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %rcx
movl $0x1000, %edx           # imm = 0x1000
pushq $0x10
popq %rsi
callq 0x17ad0
movq %rax, %r12
movl %r12d, (%rbx)
movq 0x10(%rbx), %rdi
callq 0x17e70
testl %eax, %eax
jne 0x2b0cf7
andl $0x0, 0x4(%rbx)
xorl %eax, %eax
testl %r12d, %r12d
je 0x2b0c77
movq 0x8(%rbx), %rcx
leal 0x1(%rax), %edx
movl %edx, 0x4(%rbx)
movl %eax, %eax
shlq $0x4, %rax
movq 0x8(%rcx,%rax), %r12
movq (%rsp), %rdi
movq 0x8(%rsp), %rbx
cmpq %rbx, %r12
cmovaq %r12, %rbx
testq %rdi, %rdi
je 0x2b0b85
callq 0x89eb7
testb %al, %al
jne 0x2b0ca7
movq 0x20(%r13), %r13
testq %r13, %r13
je 0x2b0b96
cmpq %r12, 0x28(%r13)
ja 0x2b0b85
jmp 0x2b0bab
movq (%rsp), %rdi
leaq 0xd17c5(%rip), %rsi     # 0x382366
movq %r12, %rdx
xorl %eax, %eax
callq 0x89dbb
movq 0x30058(%r14), %rax
leaq (%rax,%rbp), %rsi
addq $0xa0, %rsi
leaq 0x20(%rsp), %rdi
callq 0x2b0d4c
testl %eax, %eax
je 0x2b0c33
movq 0x10(%r14), %rax
incq (%rax,%r15,8)
movq 0x20(%rsp), %rdx
incq (%r14)
movq 0x10(%rsp), %r12
movq %r12, %rdi
movl %r15d, %esi
movq %r13, %rcx
callq 0x2b0dd6
movq %r12, %rdi
callq 0x2c0ef7
movq %rax, %rdi
movq %r12, %rsi
callq 0x2c0f47
movl 0x8(%r14), %eax
testl %eax, %eax
je 0x2b0c1c
movl 0x1c(%r14), %ecx
movq %rbx, 0x20(%r14,%rcx,8)
movb $0x0, 0x30020(%r14)
jmp 0x2b0c28
movb $0x1, 0x30020(%r14)
movl 0x1c(%r14), %ecx
incl %ecx
jmp 0x2b09fb
xorl %eax, %eax
jmp 0x2b0c98
leaq 0xd16d4(%rip), %rsi     # 0x38230e
leaq 0xd167a(%rip), %rdx     # 0x3822bb
movq (%rsp), %rdi
movl $0xd0, %ecx
xorl %eax, %eax
callq 0x89dbb
pushq $-0x6
jmp 0x2b0c97
leaq 0xd1675(%rip), %rsi     # 0x3822d1
leaq 0xd1658(%rip), %rdx     # 0x3822bb
movq (%rsp), %rdi
movl $0xae, %ecx
xorl %eax, %eax
callq 0x89dbb
pushq $-0x2
jmp 0x2b0c97
leaq 0x48e9f(%rip), %rsi     # 0x2f9b1d
leaq 0xd1636(%rip), %rdx     # 0x3822bb
movq (%rsp), %rdi
movl $0xbd, %ecx
xorl %eax, %eax
callq 0x89dbb
pushq $-0x4
popq %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1872ba(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x3435b(%rip), %rsi     # 0x2e5013
leaq 0x34500(%rip), %rdx     # 0x2e51bf
leaq 0xd1685(%rip), %rcx     # 0x38234b
leaq 0xd15ee(%rip), %r8      # 0x3822bb
pushq $0x78
popq %r9
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x187284(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x48edb(%rip), %rsi     # 0x2f9bc9
leaq 0x48ef6(%rip), %rdx     # 0x2f9beb
jmp 0x2b0d0f
movq 0x18726a(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x48ec1(%rip), %rsi     # 0x2f9bc9
leaq 0xa72ea(%rip), %rdx     # 0x357ff9
xorl %eax, %eax
callq 0x17a50
pushq $0x2
popq %rdi
callq 0x178f0
movq 0x187243(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x342e4(%rip), %rsi     # 0x2e5013
leaq 0x34489(%rip), %rdx     # 0x2e51bf
leaq 0xd1548(%rip), %rcx     # 0x382285
leaq 0xd1577(%rip), %r8      # 0x3822bb
movl $0x91, %r9d
jmp 0x2b0cd1