// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
cmpq $0x0, 0x50(%rsp)
je 0x4b63de
movq 0x50(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x4b63a6
jmp 0x4b63de
movq 0x185bf3(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x5fc5c(%rip), %rsi     # 0x516013
leaq 0x5fe01(%rip), %rdx     # 0x5161bf
leaq 0x101132(%rip), %rcx    # 0x5b74f7
leaq 0x101161(%rip), %r8     # 0x5b752d
movl $0x91, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4b63e0
movq 0x58(%rsp), %rax
movl $0x0, 0x1c(%rax)
movq 0x58(%rsp), %rcx
xorl %eax, %eax
cmpl $0x0, 0x8(%rcx)
movb %al, 0xb(%rsp)
jbe 0x4b6410
movq 0x58(%rsp), %rax
cmpl $0x2000, 0x1c(%rax)     # imm = 0x2000
setb %al
movb %al, 0xb(%rsp)
movb 0xb(%rsp), %al
testb $0x1, %al
jne 0x4b641d
jmp 0x4b6765
movq 0x58(%rsp), %rdi
addq $0x30028, %rdi          # imm = 0x30028
callq 0x4d2b20
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x28(%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %rax
movl (%rax), %eax
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %ecx
movq 0x58(%rsp), %rax
addq $0x18, %rax
addq $0x10008, %rax          # imm = 0x10008
movq 0x58(%rsp), %rdx
movl 0x1c(%rdx), %edx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq 0x48(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0x58(%rsp), %rax
addq $0x18, %rax
addq $0x10008, %rax          # imm = 0x10008
movq 0x58(%rsp), %rdx
movl 0x1c(%rdx), %edx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq 0x58(%rsp), %rax
movq 0x10(%rax), %rax
movl 0xc(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, (%rsp)
movq 0x58(%rsp), %rax
movq 0x30058(%rax), %rax
movl 0xc(%rsp), %ecx
shlq $0x8, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0xa9d00
movq %rax, %rcx
movq (%rsp), %rax
cmpq %rcx, %rax
jbe 0x4b6508
movq 0x48(%rsp), %rdi
movq 0x58(%rsp), %rsi
addq $0x30028, %rsi          # imm = 0x30028
callq 0x4d2bb0
movq 0x58(%rsp), %rax
movl 0x8(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x8(%rax)
jmp 0x4b6714
movq 0x58(%rsp), %rax
movq 0x30058(%rax), %rsi
movl 0xc(%rsp), %eax
shlq $0x8, %rax
addq %rax, %rsi
addq $0xd0, %rsi
leaq 0x2f(%rsp), %rdi
callq 0x4b6780
movl %eax, 0x28(%rsp)
cmpl $0x0, 0x28(%rsp)
jge 0x4b6548
movl $0xffffffff, 0x64(%rsp) # imm = 0xFFFFFFFF
jmp 0x4b676d
cmpl $0x0, 0x28(%rsp)
jne 0x4b657b
movq 0x50(%rsp), %rdi
leaq 0x100fe8(%rip), %rsi    # 0x5b7543
leaq 0x100fcb(%rip), %rdx    # 0x5b752d
movl $0xae, %ecx
movb $0x0, %al
callq 0xd88c0
movl $0xfffffffe, 0x64(%rsp) # imm = 0xFFFFFFFE
jmp 0x4b676d
movzbl 0x2f(%rsp), %eax
cmpl $0xff, %eax
jne 0x4b6606
movq 0x58(%rsp), %rax
movq 0x30058(%rax), %rsi
movl 0xc(%rsp), %eax
shlq $0x8, %rax
addq %rax, %rsi
addq $0xe8, %rsi
leaq 0x30(%rsp), %rdi
callq 0x4b6860
movl %eax, 0x28(%rsp)
cmpl $0x0, 0x28(%rsp)
jge 0x4b65c7
movl $0xfffffffd, 0x64(%rsp) # imm = 0xFFFFFFFD
jmp 0x4b676d
cmpl $0x0, 0x28(%rsp)
jne 0x4b65fa
movq 0x50(%rsp), %rdi
leaq 0x7468e(%rip), %rsi     # 0x52ac68
leaq 0x100f4c(%rip), %rdx    # 0x5b752d
movl $0xbd, %ecx
movb $0x0, %al
callq 0xd88c0
movl $0xfffffffc, 0x64(%rsp) # imm = 0xFFFFFFFC
jmp 0x4b676d
movq 0x38(%rsp), %rax
movq %rax, 0x18(%rsp)
jmp 0x4b6610
movzbl 0x2f(%rsp), %eax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
jbe 0x4b6626
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x50(%rsp), %rdx
callq 0x4b6950
movq %rax, 0x40(%rsp)
movq 0x58(%rsp), %rax
movq 0x30058(%rax), %rsi
movl 0xc(%rsp), %eax
shlq $0x8, %rax
addq %rax, %rsi
addq $0xa0, %rsi
leaq 0x20(%rsp), %rdi
callq 0x4b6a20
movl %eax, 0x28(%rsp)
cmpl $0x0, 0x28(%rsp)
jne 0x4b669e
movq 0x50(%rsp), %rdi
leaq 0x100f02(%rip), %rsi    # 0x5b7580
leaq 0x100ea8(%rip), %rdx    # 0x5b752d
movl $0xd0, %ecx
movb $0x0, %al
callq 0xd88c0
movl $0xfffffffa, 0x64(%rsp) # imm = 0xFFFFFFFA
jmp 0x4b676d
movq 0x58(%rsp), %rax
movq 0x10(%rax), %rax
movl 0xc(%rsp), %ecx
movq (%rax,%rcx,8), %rdx
addq $0x1, %rdx
movq %rdx, (%rax,%rcx,8)
movq 0x58(%rsp), %rdi
addq $0x30028, %rdi          # imm = 0x30028
movl 0xc(%rsp), %esi
movq 0x20(%rsp), %rdx
movq 0x40(%rsp), %rcx
movq 0x58(%rsp), %rax
movq (%rax), %r8
movq %r8, %r9
addq $0x1, %r9
movq %r9, (%rax)
callq 0x4b6b00
movq 0x58(%rsp), %rdi
addq $0x30028, %rdi          # imm = 0x30028
callq 0x4d2b20
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rdi
movq 0x58(%rsp), %rsi
addq $0x30028, %rsi          # imm = 0x30028
callq 0x4d2bb0
movq 0x58(%rsp), %rax
cmpl $0x0, 0x8(%rax)
jbe 0x4b6744
movq 0x10(%rsp), %rdx
movq 0x58(%rsp), %rax
movq 0x58(%rsp), %rcx
movl 0x1c(%rcx), %ecx
movq %rdx, 0x20(%rax,%rcx,8)
movq 0x58(%rsp), %rax
movb $0x0, 0x30020(%rax)
jmp 0x4b6750
movq 0x58(%rsp), %rax
movb $0x1, 0x30020(%rax)
jmp 0x4b6752
movq 0x58(%rsp), %rax
movl 0x1c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x1c(%rax)
jmp 0x4b63ec
movl $0x0, 0x64(%rsp)
movl 0x64(%rsp), %eax
addq $0x68, %rsp
retq
nopw %cs:(%rax,%rax)