// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/esa-maxpairs.c
// Function: processleafedge_maxpairs
static int processleafedge_maxpairs(bool firstsucc,
                                    GtUword fatherdepth,
                                    GtBUinfo_maxpairs *father,
                                    GtUword leafnumber,
                                    GtBUstate_maxpairs *state,
                                    GtError *err)
{
  unsigned int base;
  GtUword *start, *spptr;
  GtUchar leftchar;

#undef SKDEBUG
#ifdef SKDEBUG
  printf("%s "GT_WU" firstsucc=%s, depth(father)= "GT_WU"\n",
         __func__,
         leafnumber,
         firstsucc ? "true" : "false",
         fatherdepth);
#endif
  if (fatherdepth < (GtUword) state->searchlength)
  {
    setpostabto0_maxpairs(state);
    return 0;
  }
  if (leafnumber == 0)
  {
    leftchar = INITIALCHAR;
  } else
  {
    /* Random access */
    if (state->genericencseq.hasencseq)
    {
      leftchar = gt_encseq_get_encoded_char(state->genericencseq.seqptr.encseq,
                                            leafnumber - 1,
                                            state->readmode);
    } else
    {
      leftchar = state->sequence[leafnumber-1];
    }
  }
  state->initialized = false;
#ifdef SKDEBUG
  printf("%s: leftchar %u\n",__func__,(unsigned int) leftchar);
#endif
  if (firstsucc)
  {
    father->commonchar = leftchar;
    father->uniquecharposlength = 0;
    father->uniquecharposstart = state->uniquechar.nextfreeGtUword;
    for (base = 0; base < state->alphabetsize; base++)
    {
      NODEPOSLISTSTART(father,base) = state->poslist[base].nextfreeGtUword;
      NODEPOSLISTLENGTH(father,base) = 0;
    }
    add2poslist_maxpairs(state,father,(unsigned int) leftchar,leafnumber);
    return 0;
  }
  if (father->commonchar != ISLEFTDIVERSE)
  {
    CHECKCHAR(leftchar);
  }
  if (father->commonchar == ISLEFTDIVERSE)
  {
    for (base = 0; base < state->alphabetsize; base++)
    {
      if (leftchar != (GtUchar) base)
      {
        if (cartproduct1_maxpairs(state,fatherdepth,father,base,leafnumber,
                                  err) != 0)
        {
          return -1;
        }
      }
    }
    start = state->uniquechar.spaceGtUword +
            father->uniquecharposstart;
    for (spptr = start; spptr < start + father->uniquecharposlength; spptr++)
    {
      if (state->processmaxpairs(state->processmaxpairsinfo,
                                 &state->genericencseq,
                                 fatherdepth,
                                 GT_MIN(leafnumber,*spptr),
                                 GT_MAX(leafnumber,*spptr),err) != 0)
      {
        return -2;
      }
    }
  }
  add2poslist_maxpairs(state,father,(unsigned int) leftchar,leafnumber);
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, 0x8(%rsp)
movq %r8, %rbx
movl 0x4(%r8), %eax
cmpq %rsi, %rax
jbe 0x1abce7
xorl %eax, %eax
cmpb $0x0, (%rbx)
jne 0x1abe5f
movl 0x8(%rbx), %edx
testq %rdx, %rdx
je 0x1abcd7
movq 0x28(%rbx), %rcx
leaq -0x1(%rdx), %rsi
movq %rsi, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
leaq 0x8(,%rdx,8), %rdx
andq $-0x10, %rdx
leaq (%rdx,%rdx,2), %rdx
movdqa 0x1b5e13(%rip), %xmm1   # 0x361a70
xorl %esi, %esi
movdqa 0x1b5e19(%rip), %xmm2   # 0x361a80
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movdqa 0x1b5e19(%rip), %xmm4   # 0x361a90
movdqa %xmm1, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
movd %xmm5, %edi
notl %edi
testb $0x1, %dil
je 0x1abcb2
movq $0x0, 0x10(%rcx,%rsi)
pxor %xmm3, %xmm5
pextrw $0x4, %xmm5, %edi
testb $0x1, %dil
je 0x1abcca
movq $0x0, 0x28(%rcx,%rsi)
paddq %xmm4, %xmm1
addq $0x30, %rsi
cmpq %rsi, %rdx
jne 0x1abc77
movq $0x0, 0x20(%rbx)
movb $0x1, (%rbx)
jmp 0x1abe5f
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r13
movl %edi, %r12d
testq %rcx, %rcx
je 0x1abd12
cmpb $0x1, 0x30(%rbx)
jne 0x1abd1b
movq 0x38(%rbx), %rdi
leaq -0x1(%r14), %rsi
movl 0x48(%rbx), %edx
callq 0xec1f8
movl %eax, %ebp
jmp 0x1abd24
movb 0x8(%rbx), %bpl
incb %bpl
jmp 0x1abd24
movq 0x40(%rbx), %rax
movb -0x1(%rax,%r14), %bpl
movb $0x0, (%rbx)
testb %r12b, %r12b
je 0x1abd89
movb %bpl, (%r15)
movq $0x0, 0x10(%r15)
movq 0x20(%rbx), %rax
movq %rax, 0x8(%r15)
movl 0x8(%rbx), %edx
testq %rdx, %rdx
je 0x1abd7a
movq 0x28(%rbx), %rax
movq 0x18(%r15), %rcx
addq $0x8, %rcx
shlq $0x3, %rdx
leaq (%rdx,%rdx,2), %rdx
xorl %esi, %esi
movq 0x10(%rax,%rsi), %rdi
movq %rdi, -0x8(%rcx)
movq $0x0, (%rcx)
addq $0x10, %rcx
addq $0x18, %rsi
cmpq %rsi, %rdx
jne 0x1abd5d
movzbl %bpl, %edx
movq %rbx, %rdi
movq %r15, %rsi
jmp 0x1abe55
movb (%r15), %cl
movl 0x8(%rbx), %eax
movzbl %bpl, %esi
cmpb %al, %cl
je 0x1abdac
movzbl %al, %edx
cmpb %sil, %cl
sete %cl
cmpl %esi, %edx
seta %dl
testb %dl, %cl
jne 0x1abdac
movb %al, (%r15)
movl %esi, 0x4(%rsp)
cmpb %al, (%r15)
jne 0x1abe4b
cmpl $0x0, 0x8(%rbx)
je 0x1abdf1
xorl %r12d, %r12d
cmpb %r12b, %bpl
je 0x1abde8
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
movl %r12d, %ecx
movq %r14, %r8
movq 0x8(%rsp), %r9
callq 0x1ac43b
testl %eax, %eax
jne 0x1abe75
incl %r12d
cmpl 0x8(%rbx), %r12d
jb 0x1abdc2
cmpq $0x0, 0x10(%r15)
jle 0x1abe4b
movq 0x8(%r15), %r12
shlq $0x3, %r12
addq 0x10(%rbx), %r12
leaq 0x30(%rbx), %rax
movq %rax, 0x10(%rsp)
movq %r12, %rbp
movq (%rbp), %r8
cmpq %r14, %r8
movq %r14, %rcx
cmovbq %r8, %rcx
movq 0x68(%rbx), %rdi
cmovbeq %r14, %r8
movq 0x10(%rsp), %rsi
movq %r13, %rdx
movq 0x8(%rsp), %r9
callq *0x50(%rbx)
testl %eax, %eax
jne 0x1abe6e
addq $0x8, %rbp
movq 0x10(%r15), %rax
leaq (%r12,%rax,8), %rax
cmpq %rax, %rbp
jb 0x1abe10
movq %rbx, %rdi
movq %r15, %rsi
movl 0x4(%rsp), %edx
movq %r14, %rcx
callq 0x1ac350
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x1abe5f
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x1abe5f