// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/eis-sequencemultiread.c
// Function: seqReaderSetMove2Backlog
static void
seqReaderSetMove2Backlog(void *backlogState, const void *seqData,
                         GtUword requestStart, size_t requestLen)
{
  GtUword requestMinPos;
  struct seqReaderSet *readerSet = backlogState;
  gt_assert(backlogState && (requestLen?(seqData!=NULL):1));
  requestMinPos = seqReaderSetFindMinOpenRequest(readerSet);
  /* 1. pass all data to be invalidated to automatic sinks */
  {
    int i, numAutoConsumers = readerSet->numAutoConsumers;
    struct seqSinkState *sinks = readerSet->autoConsumerList;
    /* The following must hold, as writer is not defined */
    gt_assert(numAutoConsumers == 0);
    for (i = 0; i < numAutoConsumers; ++i)
    {
      SDWWrite(sinks[i].writer, seqData, requestLen);
    }
  }
  /* 2. move still unread old values as far as possible to head of copy */
  gt_assert(requestMinPos >= readerSet->backlogStartPos);
  if (requestMinPos < readerSet->backlogStartPos + readerSet->backlogLen)
  {
    size_t backlogUnread
      = readerSet->backlogLen - requestMinPos + readerSet->backlogStartPos;
    memmove(readerSet->seqDataBacklog,
            (char *)readerSet->seqDataBacklog
            + (requestMinPos - readerSet->backlogStartPos)
            * readerSet->backlogElemSize,
            readerSet->backlogElemSize * backlogUnread);
    readerSet->backlogLen = backlogUnread;
    readerSet->backlogStartPos = requestMinPos;
  }
  else
  {
    readerSet->backlogLen = 0;
    readerSet->backlogStartPos = requestMinPos;
  }
  {
    GtUword copyStartPos = GT_MAX(requestMinPos, requestStart);
    size_t copyLen = requestLen - copyStartPos + requestStart;
    /* 3. extend backlog to also accept all invalidated values still needed */
    if (copyLen)
    {
      GtUword *destSptr;

      size_t idx, backlogSizeLeft
        = readerSet->backlogSize - readerSet->backlogLen;
      if (copyLen > backlogSizeLeft)
      {
        size_t newSize = readerSet->backlogLen + copyLen;
        readerSet->seqDataBacklog
          = gt_realloc(readerSet->seqDataBacklog, readerSet->backlogElemSize
                       * newSize);
        readerSet->backlogSize = newSize;
      }
      destSptr = ((GtUword *) readerSet->seqDataBacklog) +
                 readerSet->backlogLen;
      if (readerSet->fromSuffixsortspace)
      {
        GtSuffixsortspace *srcSptr = (GtSuffixsortspace *) seqData;
        for (idx = 0; idx< copyLen; idx++)
        {
          destSptr[idx]
            = gt_suffixsortspace_getdirect(srcSptr,
                                           copyStartPos - requestStart + idx);
        }
      } else
      {
        ESASuffixptr *srcSptr
          = ((ESASuffixptr *) seqData) + (copyStartPos - requestStart);
        for (idx = 0; idx< copyLen; idx++)
        {
          destSptr[idx] = ESASUFFIXPTRGET(srcSptr,idx);
        }
      }
      /*
      memcpy((char *)readerSet->seqDataBacklog
             + readerSet->backlogLen * readerSet->backlogElemSize,
             (char *)seqData
             + (copyStartPos - requestStart) * readerSet->backlogElemSize,
             readerSet->backlogElemSize * copyLen);
      */
      readerSet->backlogLen += copyLen;
    }
  }
}

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x90(%rsp)
movq %rsi, 0x88(%rsp)
movq %rdx, 0x80(%rsp)
movq %rcx, 0x78(%rsp)
movq 0x90(%rsp), %rax
movq %rax, 0x68(%rsp)
cmpq $0x0, 0x90(%rsp)
je 0x22c1f9
cmpq $0x0, 0x78(%rsp)
je 0x22c1f1
cmpq $0x0, 0x88(%rsp)
jne 0x22c231
jmp 0x22c1f9
movb $0x1, %al
testb $0x1, %al
jne 0x22c231
jmp 0x22c1f9
movq 0x40fda0(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2e9e09(%rip), %rsi    # 0x516013
leaq 0x349eec(%rip), %rdx    # 0x5760fd
leaq 0x349f14(%rip), %rcx    # 0x57612c
leaq 0x349dfb(%rip), %r8     # 0x57601a
movl $0x118, %r9d            # imm = 0x118
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x22c233
movq 0x68(%rsp), %rdi
callq 0x22c640
movq %rax, 0x70(%rsp)
movq 0x68(%rsp), %rax
movl 0x4(%rax), %eax
movl %eax, 0x60(%rsp)
movq 0x68(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x58(%rsp)
cmpl $0x0, 0x60(%rsp)
je 0x22c29b
movq 0x40fd36(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2e9d9f(%rip), %rsi    # 0x516013
leaq 0x349eca(%rip), %rdx    # 0x576145
leaq 0x349eaa(%rip), %rcx    # 0x57612c
leaq 0x349d91(%rip), %r8     # 0x57601a
movl $0x11f, %r9d            # imm = 0x11F
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x22c29d
movl $0x0, 0x64(%rsp)
movl 0x64(%rsp), %eax
cmpl 0x60(%rsp), %eax
jge 0x22c2e7
movq 0x58(%rsp), %rax
movslq 0x64(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x88(%rsp), %rdx
movq 0x78(%rsp), %rcx
movq 0x8(%rax), %rdi
movq 0x10(%rax), %rsi
callq 0x22c710
movl 0x64(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x64(%rsp)
jmp 0x22c2a5
jmp 0x22c2e9
movq 0x70(%rsp), %rax
movq 0x68(%rsp), %rcx
cmpq 0x20(%rcx), %rax
jae 0x22c331
movq 0x40fca0(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2e9d09(%rip), %rsi    # 0x516013
leaq 0x349e4a(%rip), %rdx    # 0x57615b
leaq 0x349e14(%rip), %rcx    # 0x57612c
leaq 0x349cfb(%rip), %r8     # 0x57601a
movl $0x126, %r9d            # imm = 0x126
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x22c333
movq 0x70(%rsp), %rax
movq 0x68(%rsp), %rcx
movq 0x20(%rcx), %rcx
movq 0x68(%rsp), %rdx
addq 0x38(%rdx), %rcx
cmpq %rcx, %rax
jae 0x22c3ca
movq 0x68(%rsp), %rax
movq 0x38(%rax), %rax
subq 0x70(%rsp), %rax
movq 0x68(%rsp), %rcx
addq 0x20(%rcx), %rax
movq %rax, 0x50(%rsp)
movq 0x68(%rsp), %rax
movq 0x48(%rax), %rdi
movq 0x68(%rsp), %rax
movq 0x48(%rax), %rsi
movq 0x70(%rsp), %rax
movq 0x68(%rsp), %rcx
subq 0x20(%rcx), %rax
movq 0x68(%rsp), %rcx
imulq 0x40(%rcx), %rax
addq %rax, %rsi
movq 0x68(%rsp), %rax
movq 0x40(%rax), %rdx
imulq 0x50(%rsp), %rdx
callq 0x19bf0
movq 0x50(%rsp), %rcx
movq 0x68(%rsp), %rax
movq %rcx, 0x38(%rax)
movq 0x70(%rsp), %rcx
movq 0x68(%rsp), %rax
movq %rcx, 0x20(%rax)
jmp 0x22c3e5
movq 0x68(%rsp), %rax
movq $0x0, 0x38(%rax)
movq 0x70(%rsp), %rcx
movq 0x68(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x70(%rsp), %rax
cmpq 0x80(%rsp), %rax
jbe 0x22c400
movq 0x70(%rsp), %rax
movq %rax, 0x8(%rsp)
jmp 0x22c40d
movq 0x80(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x78(%rsp), %rax
subq 0x48(%rsp), %rax
addq 0x80(%rsp), %rax
movq %rax, 0x40(%rsp)
cmpq $0x0, 0x40(%rsp)
je 0x22c5b3
movq 0x68(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x68(%rsp), %rcx
subq 0x38(%rcx), %rax
movq %rax, 0x28(%rsp)
movq 0x40(%rsp), %rax
cmpq 0x28(%rsp), %rax
jbe 0x22c4b3
movq 0x68(%rsp), %rax
movq 0x38(%rax), %rax
addq 0x40(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x68(%rsp), %rax
movq 0x48(%rax), %rdi
movq 0x68(%rsp), %rax
movq 0x40(%rax), %rsi
imulq 0x20(%rsp), %rsi
leaq 0x349b8b(%rip), %rdx    # 0x57601a
movl $0x147, %ecx            # imm = 0x147
callq 0xe8540
movq %rax, %rcx
movq 0x68(%rsp), %rax
movq %rcx, 0x48(%rax)
movq 0x20(%rsp), %rcx
movq 0x68(%rsp), %rax
movq %rcx, 0x30(%rax)
movq 0x68(%rsp), %rax
movq 0x48(%rax), %rax
movq 0x68(%rsp), %rcx
movq 0x38(%rcx), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0x38(%rsp)
movq 0x68(%rsp), %rax
testb $0x1, 0x28(%rax)
je 0x22c53d
movq 0x88(%rsp), %rax
movq %rax, 0x18(%rsp)
movq $0x0, 0x30(%rsp)
movq 0x30(%rsp), %rax
cmpq 0x40(%rsp), %rax
jae 0x22c53b
movq 0x18(%rsp), %rdi
movq 0x48(%rsp), %rsi
subq 0x80(%rsp), %rsi
addq 0x30(%rsp), %rsi
callq 0x2e9a60
movq %rax, %rdx
movq 0x38(%rsp), %rax
movq 0x30(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x30(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x30(%rsp)
jmp 0x22c4f2
jmp 0x22c5a1
movq 0x88(%rsp), %rax
movq 0x48(%rsp), %rcx
subq 0x80(%rsp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0x10(%rsp)
movq $0x0, 0x30(%rsp)
movq 0x30(%rsp), %rax
cmpq 0x40(%rsp), %rax
jae 0x22c59f
movq 0x10(%rsp), %rax
movq 0x30(%rsp), %rcx
movq (%rax,%rcx,8), %rdx
movq 0x38(%rsp), %rax
movq 0x30(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x30(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x30(%rsp)
jmp 0x22c567
jmp 0x22c5a1
movq 0x40(%rsp), %rcx
movq 0x68(%rsp), %rax
addq 0x38(%rax), %rcx
movq %rcx, 0x38(%rax)
addq $0x98, %rsp
retq
nopl (%rax,%rax)