// File: /workspace/github_c_makefile_star2_O2/thegenemyers[P]DAMASKER/tandem.c
// Function: report_thread
static void *report_thread(void *arg)
{ Report_Arg  *data   = (Report_Arg *) arg;

  DAZZ_READ   *aread  = MR_ablock->reads;
  KmerPos     *asort  = MG_alist;

  int         *score  = data->score;
  int         *scorp  = data->score + 1;
  int         *scorm  = data->score - 1;
  int         *lastp  = data->lastp;
  int         *lasta  = data->lasta;
  int          maxdiag = ( MR_ablock->maxlen >> Binshift);
  int          mindiag = (-MR_ablock->maxlen >> Binshift);

  FILE        *ofile  = data->ofile;

  char        *aseq   = (char *) (MR_ablock->bases);
  Work_Data   *work   = data->work;
  int          afirst = MR_ablock->tfirst;

  Overlap     _ovla, *ovla = &_ovla;
  Alignment   _align, *align = &_align;
  Path        *apath = &(ovla->path);
  int64        nfilt = 0;
  int64        ahits = 0;
  int          small, tbytes;

  int    novla;
  int    AOmax;
  Path  *amatch;

  Trace_Buffer _tbuf, *tbuf = &_tbuf;

  int      ar, aend;
  KmerPos *aoff;

  align->flags = ovla->flags = 0;
  align->path  = apath;

  if (MR_tspace <= TRACE_XOVR)
    { small  = 1;
      tbytes = sizeof(uint8);
    }
  else
    { small  = 0;
      tbytes = sizeof(uint16);
    }

  AOmax  = MATCH_CHUNK;
  amatch = Malloc(sizeof(Path)*AOmax,"Allocating match vector");

  tbuf->max   = 2*TRACE_CHUNK;
  tbuf->trace = Malloc(sizeof(short)*tbuf->max,"Allocating trace vector");

  if (amatch == NULL || tbuf->trace == NULL)
    Clean_Exit(1);

  fwrite(&ahits,sizeof(int64),1,ofile);
  fwrite(&MR_tspace,sizeof(int),1,ofile);

#ifdef TEST_GATHER
  printf("\nNEW THREAD %5d(%5lld)-%5d(%5lld)\n",asort[data->beg].read,data->beg,
                                                asort[data->end-1].read,data->end);
  fflush(stdout);
#endif

  aoff = asort + (data->beg - Kmer);
  aend = asort[data->end-1].read;
  for (ar = asort[data->beg].read; ar <= aend; ar++)
    { int alen, amarkb, amarke;
      int apos, diag;
      int setaln;

#ifdef TEST_GATHER
      printf("Read %5d\n",ar);
      fflush(stdout);
#endif
      setaln = 1;
      novla  = 0;
      tbuf->top = 0;

      alen   = aread[ar].rlen;
      amarkb = Kmer;
      amarke = PANEL_SIZE;
      if (amarke >= alen)
        amarke = alen+1;
      while (1)
        {
          // Accumulate diagonal scores

          for (apos = amarkb; apos < amarke; apos++)
            { diag = aoff[apos].code;
              if (diag == 0) continue;
              diag >>= Binshift;
              if (apos - lastp[diag] >= Kmer)
                score[diag] += Kmer;
              else
                score[diag] += apos - lastp[diag];
              lastp[diag] = apos;
            }

          // Examine diagonal scores for hits to check out

          for (apos = amarkb; apos < amarke; apos++)
            { diag = aoff[apos].code;
              if (diag == 0) continue;
              diag >>= Binshift;
              if (apos > lasta[diag] &&
                  (score[diag] + scorp[diag] >= Hitmin || score[diag] + scorm[diag] >= Hitmin))
                { int bpos;

                  bpos = apos - aoff[apos].code;
                  if (setaln)
                    { setaln = 0;
                      align->aseq = align->bseq = aseq + aread[ar].boff;
                      align->alen = align->blen = alen;
                      ovla->aread = ovla->bread = ar + afirst;
                    }
#ifdef TEST_GATHER
                  if (scorm[diag] > scorp[diag])
                    printf("  %5d.. x %5d.. %5d (%3d)",
                           bpos,apos,apos-bpos,score[diag]+scorm[diag]);
                  else
                    printf("  %5d.. x %5d.. %5d (%3d)",
                           bpos,apos,apos-bpos,score[diag]+scorp[diag]);
                  fflush(stdout);
#endif

                  nfilt += 1;

                  Local_Alignment(align,work,MR_spec,apos-bpos,apos-bpos,apos+bpos,-1,-1);

                  { int low, hgh, ae;

                    Diagonal_Span(apath,&low,&hgh);
                    if (diag < low)
                      low = diag;
                    else if (diag > hgh)
                      hgh = diag;
                    ae = apath->aepos;
                    for (diag = low; diag <= hgh; diag++)
                      if (ae > lasta[diag])
                        lasta[diag] = ae;
#ifdef TEST_GATHER
                    printf(" %d - %d @ %d",low,hgh,apath->aepos);
#endif
                  }

                  if ((apath->aepos-apath->abpos) + (apath->bepos-apath->bbpos) >= MINOVER)
                    { if (novla >= AOmax)
                        { AOmax = 1.2*novla + MATCH_CHUNK;
                          amatch = Realloc(amatch,sizeof(Path)*AOmax,
                                           "Reallocating match vector");
                          if (amatch == NULL)
                            Clean_Exit(1);
                        }
                      if (tbuf->top + apath->tlen > tbuf->max)
                        { tbuf->max = 1.2*(tbuf->top+apath->tlen) + TRACE_CHUNK;
                          tbuf->trace = Realloc(tbuf->trace,sizeof(short)*tbuf->max,
                                                "Reallocating trace vector");
                          if (tbuf->trace == NULL)
                            Clean_Exit(1);
                        }
                      amatch[novla] = *apath;
                      amatch[novla].trace = (void *) (tbuf->top);
                      memmove(tbuf->trace+tbuf->top,apath->trace,sizeof(short)*apath->tlen);
                      novla += 1;
                      tbuf->top += apath->tlen;

#ifdef TEST_GATHER
                      printf("  [%5d,%5d] x [%5d,%5d] = %4d",
                             apath->abpos,apath->aepos,apath->bbpos,apath->bepos,apath->diffs);
#endif
#ifdef SHOW_OVERLAP
                      printf("\n\n                    %d(%d) vs %d(%d)\n\n",
                             ovla->aread,ovla->alen,ovla->bread,ovla->blen);
                      Print_ACartoon(stdout,align,ALIGN_INDENT);
#ifdef SHOW_ALIGNMENT
                      Compute_Trace_ALL(align,work);
                      printf("\n                      Diff = %d\n",align->path->diffs);
                      Print_Alignment(stdout,align,work,
                                      ALIGN_INDENT,ALIGN_WIDTH,ALIGN_BORDER,0,5);
#endif
#endif // SHOW_OVERLAP
                    }
#ifdef TEST_GATHER
                  else
                    printf("  No alignment %d",
                            ((apath->aepos-apath->abpos) + (apath->bepos-apath->bbpos))/2);
                  printf("\n");
#endif
                }
            }

          // Clear diagonal scores

          for (apos = amarkb; apos < amarke; apos++)
            { diag = aoff[apos].code;
              if (diag == 0) continue;
              diag >>= Binshift;
              score[diag] = lastp[diag] = 0;
            }

          if (amarke > alen) break;

          amarkb = amarke - PANEL_OVERLAP;
          amarke = amarkb + PANEL_SIZE;
          if (amarke > alen)
            amarke = alen+1;
        }

      // Clear diagonal last positions

      for (apos = Kmer; apos <= alen; apos++)
        { int d;

          diag = aoff[apos].code;
          if (diag == 0) continue;
          diag >>= Binshift;
          for (d = diag; d <= maxdiag; d++)
            if (lasta[d] == 0)
              break;
            else
              lasta[d] = 0;
          for (d = diag-1; d >= mindiag; d--)
            if (lasta[d] == 0)
              break;
            else
              lasta[d] = 0;
        }

      // Merge overlapping alignments and remove redundant ones

      { int i;

#ifdef TEST_CONTAIN
        if (novla > 1)
          printf("\n%5d vs %5d:\n",ar,ar);
#endif

        if (novla > 1)
          novla = Handle_Redundancies(amatch,novla,tbuf);

        for (i = 0; i < novla; i++)
          { ovla->path = amatch[i];
            ovla->path.trace = tbuf->trace + (uint64) (ovla->path.trace);
            if (small)
              Compress_TraceTo8(ovla,1);
            Write_Overlap(ofile,ovla,tbytes);
          }
        ahits += novla;
      }

      aoff += alen - (Kmer-1);
    }

  free(tbuf->trace);
  free(amatch);

  data->nfilt  = nfilt;
  data->ncheck = ahits;

  rewind(ofile);
  fwrite(&ahits,sizeof(int64),1,ofile);
  fclose(ofile);

  return (NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq 0x1e302(%rip), %rax     # 0x22210
movq 0x60(%rax), %rcx
movq %rcx, 0xf0(%rsp)
movq 0x1e2e7(%rip), %rbx     # 0x22208
movq 0x10(%rdi), %rcx
movq %rcx, 0x18(%rsp)
movq 0x18(%rdi), %rcx
movq %rcx, 0x70(%rsp)
movb 0x1e2ab(%rip), %cl      # 0x221e4
movl 0x20(%rax), %ebp
movl %ebp, %r12d
sarl %cl, %r12d
negl %ebp
sarl %cl, %ebp
movq 0x20(%rdi), %r15
movl 0x40(%rax), %ecx
movq %rcx, 0xe8(%rsp)
movq 0x30(%rdi), %rcx
movq %rcx, 0x68(%rsp)
movq 0x58(%rax), %rax
movq %rax, 0x110(%rsp)
movq %rdi, 0xc8(%rsp)
movq 0x28(%rdi), %rax
movq %rax, 0x128(%rsp)
andq $0x0, 0x78(%rsp)
leaq 0x90(%rsp), %rax
andl $0x0, 0x20(%rax)
andl $0x0, 0x138(%rsp)
movq %rax, 0x130(%rsp)
movl 0x1e25a(%rip), %eax     # 0x22200
xorl %ecx, %ecx
movl %eax, 0x84(%rsp)
cmpl $0x7e, %eax
setge %cl
movl %ecx, 0x34(%rsp)
leaq 0x1774d(%rip), %rsi     # 0x1b70d
movl $0xc80, %edi            # imm = 0xC80
callq 0x134dd
movq %rax, %r14
movq $0x9c40, 0x50(%rsp)     # imm = 0x9C40
leaq 0x17748(%rip), %rsi     # 0x1b725
movl $0x13880, %edi          # imm = 0x13880
callq 0x134dd
movq %rax, 0x60(%rsp)
movq %r14, (%rsp)
testq %r14, %r14
sete %dl
movq %rax, 0x40(%rsp)
testq %rax, %rax
sete %cl
orb %dl, %cl
cmpb $0x1, %cl
jne 0x4010
pushq $0x1
popq %rdi
callq 0x242c
incl 0x34(%rsp)
leaq 0x78(%rsp), %rdi
pushq $0x8
popq %rsi
pushq $0x1
popq %r13
movq %r13, %rdx
movq 0x68(%rsp), %r14
movq %r14, %rcx
callq 0x22f0
leaq 0x1e1c9(%rip), %rdi     # 0x22200
pushq $0x4
popq %rsi
movq %r13, %rdx
movq %r14, %rcx
callq 0x22f0
movl 0x1e195(%rip), %eax     # 0x221e0
movq 0xc8(%rsp), %rdx
movq (%rdx), %rcx
movq 0x8(%rdx), %rdx
movq %rcx, %r10
subq %rax, %r10
shlq $0x4, %r10
addq %rbx, %r10
shlq $0x4, %rdx
movslq -0x4(%rbx,%rdx), %rdx
movq %rdx, 0xf8(%rsp)
shlq $0x4, %rcx
movslq 0xc(%rbx,%rcx), %rsi
movslq %r12d, %r13
movslq %ebp, %rbp
pushq $0x64
popq %rcx
movl %ecx, 0x3c(%rsp)
movq $0x0, 0xd0(%rsp)
movq 0x18(%rsp), %r9
movq 0x70(%rsp), %r12
movq %r13, 0xe0(%rsp)
movq %rbp, 0xd8(%rsp)
cmpq 0xf8(%rsp), %rsi
jg 0x47ef
andq $0x0, 0x58(%rsp)
imulq $0x28, %rsi, %rcx
movq 0xf0(%rsp), %rdx
leaq (%rdx,%rcx), %rdi
movq %rdi, 0x118(%rsp)
movl 0x4(%rdx,%rcx), %edx
leal 0x1(%rdx), %ecx
movq %rdx, 0x48(%rsp)
cmpl $0xc351, %edx           # imm = 0xC351
movl %ecx, 0x38(%rsp)
movl %ecx, %edi
movl $0xc350, %ecx           # imm = 0xC350
cmovgel %ecx, %edi
movl 0x1e0de(%rip), %ecx     # 0x221e4
movq 0xe8(%rsp), %rdx
movq %rsi, 0x100(%rsp)
addl %esi, %edx
movl %edx, 0x88(%rsp)
movl $0x0, 0x10(%rsp)
movl %eax, %edx
pushq $0x1
popq %r11
movq %r10, 0x20(%rsp)
movslq %edx, %rbp
movq %rdi, 0x108(%rsp)
movslq %edi, %rbx
movq %rbp, %r13
shlq $0x4, %r13
addq %r10, %r13
movq %r13, %rdx
movq %rbp, %rsi
cmpq %rbx, %rsi
jge 0x4180
movl (%rdx), %edi
testl %edi, %edi
je 0x4177
sarl %cl, %edi
movslq %edi, %rdi
movl %esi, %r8d
subl (%r12,%rdi,4), %r8d
cmpl %eax, %r8d
jl 0x416f
movl %eax, %r8d
addl %r8d, (%r9,%rdi,4)
movl %esi, (%r12,%rdi,4)
incq %rsi
addq $0x10, %rdx
jmp 0x4150
movq %rbp, %r12
movq %rbx, 0x120(%rsp)
cmpq %rbx, %r12
jge 0x447e
movq %r12, %rax
shlq $0x4, %rax
movl (%r10,%rax), %r8d
testl %r8d, %r8d
je 0x4476
movb 0x1e036(%rip), %cl      # 0x221e4
movl %r8d, %r14d
sarl %cl, %r14d
movslq %r14d, %rax
movslq (%r15,%rax,4), %rcx
cmpq %rcx, %r12
jle 0x4476
movl (%r9,%rax,4), %ecx
movl 0x4(%r9,%rax,4), %esi
addl %ecx, %esi
movl 0x1e013(%rip), %edx     # 0x221e8
cmpl %edx, %esi
jge 0x41e6
addl -0x4(%r9,%rax,4), %ecx
cmpl %edx, %ecx
jl 0x4476
testl %r11d, %r11d
je 0x4237
movq 0x118(%rsp), %rax
movq 0x10(%rax), %rax
addq 0x110(%rsp), %rax
movq %rax, 0x148(%rsp)
movq %rax, 0x140(%rsp)
movq 0x48(%rsp), %rax
movl %eax, 0x154(%rsp)
movl %eax, 0x150(%rsp)
movl 0x88(%rsp), %eax
movl %eax, 0xb8(%rsp)
movl %eax, 0xb4(%rsp)
incq 0xd0(%rsp)
movq 0x1dfd2(%rip), %rdx     # 0x22218
leal (%r12,%r12), %r9d
subl %r8d, %r9d
leaq 0x130(%rsp), %rdi
movq 0x128(%rsp), %rsi
movl %r8d, %ecx
pushq $-0x1
pushq $-0x1
callq 0x52d1
popq %rcx
popq %rdx
leaq 0x90(%rsp), %rdi
leaq 0xc(%rsp), %rsi
leaq 0x8c(%rsp), %rdx
callq 0x2f58
movl 0xc(%rsp), %eax
movl 0x8c(%rsp), %edx
cmpl %edx, %r14d
movl %edx, %esi
cmovgl %r14d, %esi
cmpl %eax, %r14d
cmovll %r14d, %eax
movslq %eax, %rcx
cmovll %edx, %esi
movl 0xa8(%rsp), %eax
movslq %esi, %rdx
movq 0x20(%rsp), %r10
cmpq %rdx, %rcx
jg 0x42c9
cmpl (%r15,%rcx,4), %eax
jle 0x42c4
movl %eax, (%r15,%rcx,4)
incq %rcx
jmp 0x42b5
movl 0xa0(%rsp), %ecx
addl 0xac(%rsp), %eax
addl 0xa4(%rsp), %ecx
subl %ecx, %eax
xorl %r11d, %r11d
leaq 0x1dee6(%rip), %rcx     # 0x221d0
cmpl (%rcx), %eax
movq 0x18(%rsp), %r9
jl 0x4476
movl 0x10(%rsp), %eax
cmpl 0x3c(%rsp), %eax
jge 0x4307
movq (%rsp), %rcx
jmp 0x434e
cvtsi2sd %eax, %xmm0
mulsd 0x16cf5(%rip), %xmm0    # 0x1b008
addsd 0x172c5(%rip), %xmm0    # 0x1b5e0
cvttsd2si %xmm0, %eax
movl %eax, 0x3c(%rsp)
movslq %eax, %rsi
shlq $0x5, %rsi
movq (%rsp), %rdi
leaq 0x17408(%rip), %rdx     # 0x1b73d
callq 0x13535
testq %rax, %rax
je 0x4344
movq %rax, %rcx
jmp 0x434e
pushq $0x1
popq %rdi
callq 0x242c
xorl %ecx, %ecx
movq 0x58(%rsp), %rdx
movq 0x60(%rsp), %rdi
movslq 0x98(%rsp), %rax
movq %rdx, 0x28(%rsp)
addq %rdx, %rax
cmpq 0x50(%rsp), %rax
movq %rcx, (%rsp)
jbe 0x43fa
movq %rax, %xmm0
punpckldq 0x1727c(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x17284(%rip), %xmm0    # 0x1b610
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x16c68(%rip), %xmm1    # 0x1b008
addsd 0x17240(%rip), %xmm1    # 0x1b5e8
cvttsd2si %xmm1, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x17234(%rip), %xmm1    # 0x1b5f0
cvttsd2si %xmm1, %rsi
andq %rcx, %rsi
orq %rax, %rsi
movq %rsi, 0x50(%rsp)
addq %rsi, %rsi
leaq 0x17381(%rip), %rdx     # 0x1b757
callq 0x13535
movq (%rsp), %rcx
movq %rax, %rdi
movq %rax, 0x60(%rsp)
testq %rax, %rax
jne 0x43fa
pushq $0x1
popq %rdi
callq 0x242c
movq (%rsp), %rcx
xorl %edi, %edi
movl 0x10(%rsp), %r14d
movslq %r14d, %rax
shlq $0x5, %rax
movaps 0x90(%rsp), %xmm0
movaps 0xa0(%rsp), %xmm1
movups %xmm0, (%rcx,%rax)
movups %xmm1, 0x10(%rcx,%rax)
movq 0x28(%rsp), %rbx
movq %rbx, (%rcx,%rax)
movq %rdi, 0x40(%rsp)
leaq (%rdi,%rbx,2), %rdi
movq 0x90(%rsp), %rsi
movslq 0x98(%rsp), %rdx
addq %rdx, %rdx
callq 0x2290
incl %r14d
movl %r14d, 0x10(%rsp)
movslq 0x98(%rsp), %rax
addq %rbx, %rax
movq %rax, 0x58(%rsp)
movq 0x18(%rsp), %r9
movq 0x20(%rsp), %r10
xorl %r11d, %r11d
movq 0x120(%rsp), %rbx
incq %r12
jmp 0x418b
movl 0x1dd60(%rip), %ecx     # 0x221e4
movq 0x70(%rsp), %r12
cmpq %rbx, %rbp
jge 0x44ad
movl (%r13), %eax
testl %eax, %eax
je 0x44a4
sarl %cl, %eax
cltq
andl $0x0, (%r12,%rax,4)
andl $0x0, (%r9,%rax,4)
incq %rbp
addq $0x10, %r13
jmp 0x4489
movq 0x48(%rsp), %r8
movq 0x108(%rsp), %rdi
cmpl %r8d, %edi
jg 0x44de
leal -0x2710(%rdi), %edx
addl $0x9c40, %edi           # imm = 0x9C40
cmpl %r8d, %edi
cmovgl 0x38(%rsp), %edi
movl 0x1dd07(%rip), %eax     # 0x221e0
jmp 0x4132
movl 0x1dcfc(%rip), %eax     # 0x221e0
movq 0xe0(%rsp), %r13
movq 0xd8(%rsp), %rbp
movl 0x10(%rsp), %edi
cmpl %eax, %r8d
jl 0x4545
movq %rax, %rdx
shlq $0x4, %rdx
movl (%r10,%rdx), %edx
testl %edx, %edx
je 0x4540
sarl %cl, %edx
movslq %edx, %rdx
movq %rdx, %rsi
cmpq %r13, %rsi
jg 0x4533
cmpl $0x0, (%r15,%rsi,4)
je 0x4533
andl $0x0, (%r15,%rsi,4)
incq %rsi
jmp 0x4514
andl $0x0, -0x4(%r15,%rdx,4)
decq %rdx
cmpq %rbp, %rdx
jle 0x4540
cmpl $0x0, -0x4(%r15,%rdx,4)
jne 0x452a
incq %rax
jmp 0x44f8
cmpl $0x2, %edi
jl 0x4729
andl $0x0, 0xc(%rsp)
movl %edi, %r8d
pushq $0x1
popq %rax
movq (%rsp), %rcx
movq %r8, 0x48(%rsp)
cmpq %r8, %rax
je 0x46dd
movq %rax, %rdx
shlq $0x5, %rdx
addq %rcx, %rdx
movq %rax, 0x28(%rsp)
movl %eax, %r12d
movq %rdx, 0x10(%rsp)
testl %r12d, %r12d
jle 0x46c6
decl %r12d
movl %r12d, %ebx
shlq $0x5, %rbx
movl 0x10(%rcx,%rbx), %r14d
testl %r14d, %r14d
js 0x4582
addq %rcx, %rbx
movl 0x10(%rdx), %r13d
cmpl %r14d, %r13d
jge 0x4624
movl 0x18(%rdx), %ebp
cmpl %ebp, %r14d
jg 0x4582
movl 0x14(%rbx), %eax
cmpl 0x1c(%rdx), %eax
jg 0x4582
movq %rdx, %rdi
movq %rbx, %rsi
leaq 0x50(%rsp), %rdx
leaq 0xc(%rsp), %rcx
callq 0x4c9b
movq 0x10(%rsp), %rdx
movq 0x20(%rsp), %r10
movq (%rsp), %rcx
movq 0x18(%rsp), %r9
testl %eax, %eax
jne 0x4582
cmpl %ebp, 0x18(%rbx)
jle 0x46bd
movl 0xc(%rsp), %esi
movq %rdx, %rdi
movq %rbx, %rdx
leaq 0x50(%rsp), %rcx
callq 0x4e3d
movq 0x10(%rsp), %rdx
movq 0x20(%rsp), %r10
movq (%rsp), %rcx
movq 0x18(%rsp), %r9
movq 0x28(%rsp), %rax
movl %eax, %r12d
jmp 0x46bd
movl 0x18(%rbx), %ebp
cmpl %ebp, %r13d
jg 0x4582
movl 0x14(%rdx), %eax
cmpl 0x1c(%rbx), %eax
jg 0x4582
movq %rbx, %rdi
movq %rdx, %rsi
leaq 0x50(%rsp), %rdx
leaq 0xc(%rsp), %rcx
callq 0x4c9b
movq 0x10(%rsp), %rdx
movq 0x20(%rsp), %r10
movq (%rsp), %rcx
movq 0x18(%rsp), %r9
testl %eax, %eax
jne 0x4582
movl 0x18(%rdx), %eax
cmpl %r13d, %r14d
jne 0x467a
cmpl %eax, %ebp
jg 0x46af
jmp 0x46bd
cmpl %ebp, %eax
jle 0x46af
movl 0xc(%rsp), %esi
movq %rbx, %rdi
movq 0x10(%rsp), %rdx
leaq 0x50(%rsp), %rcx
callq 0x4e3d
movq 0x10(%rsp), %rdx
movq 0x20(%rsp), %r10
movq (%rsp), %rcx
movq 0x18(%rsp), %r9
movq 0x28(%rsp), %rax
movl %eax, %r12d
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups %xmm1, 0x10(%rdx)
movups %xmm0, (%rdx)
orl $-0x1, 0x10(%rbx)
jmp 0x4582
movq 0x28(%rsp), %rax
incq %rax
movq 0x70(%rsp), %r12
movq 0x48(%rsp), %r8
jmp 0x4562
leaq 0x10(%rcx), %rax
shlq $0x5, %r8
xorl %ecx, %ecx
xorl %edi, %edi
cmpq %rcx, %r8
je 0x471f
cmpl $0x0, (%rax,%rcx)
js 0x4719
leaq (%rax,%rcx), %rdx
addq $-0x10, %rdx
movslq %edi, %rsi
incl %edi
shlq $0x5, %rsi
movups (%rdx), %xmm0
movups 0x10(%rdx), %xmm1
movq (%rsp), %rdx
movups %xmm1, 0x10(%rdx,%rsi)
movups %xmm0, (%rdx,%rsi)
addq $0x20, %rcx
jmp 0x46e9
movq 0x60(%rsp), %rax
movq %rax, 0x40(%rsp)
movq (%rsp), %rax
testl %edi, %edi
movl $0x0, %ebx
movl %edi, 0x10(%rsp)
cmovgl %edi, %ebx
shlq $0x5, %rbx
xorl %r14d, %r14d
cmpq %r14, %rbx
je 0x47bf
movups (%rax,%r14), %xmm0
movups 0x10(%rax,%r14), %xmm1
movaps %xmm0, 0x90(%rsp)
movaps %xmm1, 0xa0(%rsp)
movq 0x90(%rsp), %rax
movq 0x40(%rsp), %rcx
leaq (%rcx,%rax,2), %rax
movq %rax, 0x90(%rsp)
cmpl $0x7d, 0x84(%rsp)
jg 0x4795
leaq 0x90(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0xab95
movq 0x68(%rsp), %rdi
leaq 0x90(%rsp), %rsi
movl 0x34(%rsp), %edx
callq 0xab3b
addq $0x20, %r14
movq 0x18(%rsp), %r9
movq (%rsp), %rax
movq 0x20(%rsp), %r10
jmp 0x4742
movslq 0x10(%rsp), %rax
addq %rax, 0x78(%rsp)
movl 0x1da11(%rip), %eax     # 0x221e0
movl 0x38(%rsp), %ecx
subl %eax, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %r10
movq 0x100(%rsp), %rsi
incq %rsi
jmp 0x40b4
movq 0x40(%rsp), %rdi
callq 0x2030
movq (%rsp), %rdi
callq 0x2030
movq 0xc8(%rsp), %rcx
movq 0xd0(%rsp), %rax
movq %rax, 0x38(%rcx)
leaq 0x78(%rsp), %rbx
movq (%rbx), %rax
movq %rax, 0x40(%rcx)
movq 0x68(%rsp), %r14
movq %r14, %rdi
callq 0x2160
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r14, %rcx
callq 0x22f0
movq %r14, %rdi
callq 0x2100
xorl %eax, %eax
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq