// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3WhereEnd
SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
  Parse *pParse = pWInfo->pParse;
  Vdbe *v = pParse->pVdbe;
  int i;
  WhereLevel *pLevel;
  WhereLoop *pLoop;
  SrcList *pTabList = pWInfo->pTabList;
  sqlite3 *db = pParse->db;

  /* Generate loop termination code.
  */
  VdbeModuleComment((v, "End WHERE-core"));
  for(i=pWInfo->nLevel-1; i>=0; i--){
    int addr;
    pLevel = &pWInfo->a[i];
    pLoop = pLevel->pWLoop;
    if( pLevel->op!=OP_Noop ){
#ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT
      int addrSeek = 0;
      Index *pIdx;
      int n;
      if( pWInfo->eDistinct==WHERE_DISTINCT_ORDERED
       && i==pWInfo->nLevel-1  /* Ticket [ef9318757b152e3] 2017-10-21 */
       && (pLoop->wsFlags & WHERE_INDEXED)!=0
       && (pIdx = pLoop->u.btree.pIndex)->hasStat1
       && (n = pLoop->u.btree.nDistinctCol)>0
       && pIdx->aiRowLogEst[n]>=36
      ){
        int r1 = pParse->nMem+1;
        int j, op;
        for(j=0; j<n; j++){
          sqlite3VdbeAddOp3(v, OP_Column, pLevel->iIdxCur, j, r1+j);
        }
        pParse->nMem += n+1;
        op = pLevel->op==OP_Prev ? OP_SeekLT : OP_SeekGT;
        addrSeek = sqlite3VdbeAddOp4Int(v, op, pLevel->iIdxCur, 0, r1, n);
        VdbeCoverageIf(v, op==OP_SeekLT);
        VdbeCoverageIf(v, op==OP_SeekGT);
        sqlite3VdbeAddOp2(v, OP_Goto, 1, pLevel->p2);
      }
#endif /* SQLITE_DISABLE_SKIPAHEAD_DISTINCT */
      /* The common case: Advance to the next row */
      sqlite3VdbeResolveLabel(v, pLevel->addrCont);
      sqlite3VdbeAddOp3(v, pLevel->op, pLevel->p1, pLevel->p2, pLevel->p3);
      sqlite3VdbeChangeP5(v, pLevel->p5);
      VdbeCoverage(v);
      VdbeCoverageIf(v, pLevel->op==OP_Next);
      VdbeCoverageIf(v, pLevel->op==OP_Prev);
      VdbeCoverageIf(v, pLevel->op==OP_VNext);
      if( pLevel->regBignull ){
        sqlite3VdbeResolveLabel(v, pLevel->addrBignull);
        sqlite3VdbeAddOp2(v, OP_DecrJumpZero, pLevel->regBignull, pLevel->p2-1);
        VdbeCoverage(v);
      }
#ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT
      if( addrSeek ) sqlite3VdbeJumpHere(v, addrSeek);
#endif
    }else{
      sqlite3VdbeResolveLabel(v, pLevel->addrCont);
    }
    if( pLoop->wsFlags & WHERE_IN_ABLE && pLevel->u.in.nIn>0 ){
      struct InLoop *pIn;
      int j;
      sqlite3VdbeResolveLabel(v, pLevel->addrNxt);
      for(j=pLevel->u.in.nIn, pIn=&pLevel->u.in.aInLoop[j-1]; j>0; j--, pIn--){
        sqlite3VdbeJumpHere(v, pIn->addrInTop+1);
        if( pIn->eEndLoopOp!=OP_Noop ){
          if( pIn->nPrefix ){
            assert( pLoop->wsFlags & WHERE_IN_EARLYOUT );
            if( pLevel->iLeftJoin ){
              /* For LEFT JOIN queries, cursor pIn->iCur may not have been
              ** opened yet. This occurs for WHERE clauses such as
              ** "a = ? AND b IN (...)", where the index is on (a, b). If
              ** the RHS of the (a=?) is NULL, then the "b IN (...)" may
              ** never have been coded, but the body of the loop run to
              ** return the null-row. So, if the cursor is not open yet,
              ** jump over the OP_Next or OP_Prev instruction about to
              ** be coded.  */
              sqlite3VdbeAddOp2(v, OP_IfNotOpen, pIn->iCur,
                  sqlite3VdbeCurrentAddr(v) + 2 +
                     ((pLoop->wsFlags & WHERE_VIRTUALTABLE)==0)
              );
              VdbeCoverage(v);
            }
            if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 ){
              sqlite3VdbeAddOp4Int(v, OP_IfNoHope, pLevel->iIdxCur,
                  sqlite3VdbeCurrentAddr(v)+2,
                  pIn->iBase, pIn->nPrefix);
              VdbeCoverage(v);
            }
          }
          sqlite3VdbeAddOp2(v, pIn->eEndLoopOp, pIn->iCur, pIn->addrInTop);
          VdbeCoverage(v);
          VdbeCoverageIf(v, pIn->eEndLoopOp==OP_Prev);
          VdbeCoverageIf(v, pIn->eEndLoopOp==OP_Next);
        }
        sqlite3VdbeJumpHere(v, pIn->addrInTop-1);
      }
    }
    sqlite3VdbeResolveLabel(v, pLevel->addrBrk);
    if( pLevel->addrSkip ){
      sqlite3VdbeGoto(v, pLevel->addrSkip);
      VdbeComment((v, "next skip-scan on %s", pLoop->u.btree.pIndex->zName));
      sqlite3VdbeJumpHere(v, pLevel->addrSkip);
      sqlite3VdbeJumpHere(v, pLevel->addrSkip-2);
    }
#ifndef SQLITE_LIKE_DOESNT_MATCH_BLOBS
    if( pLevel->addrLikeRep ){
      sqlite3VdbeAddOp2(v, OP_DecrJumpZero, (int)(pLevel->iLikeRepCntr>>1),
                        pLevel->addrLikeRep);
      VdbeCoverage(v);
    }
#endif
    if( pLevel->iLeftJoin ){
      int ws = pLoop->wsFlags;
      addr = sqlite3VdbeAddOp1(v, OP_IfPos, pLevel->iLeftJoin); VdbeCoverage(v);
      assert( (ws & WHERE_IDX_ONLY)==0 || (ws & WHERE_INDEXED)!=0 );
      if( (ws & WHERE_IDX_ONLY)==0 ){
        assert( pLevel->iTabCur==pTabList->a[pLevel->iFrom].iCursor );
        sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iTabCur);
      }
      if( (ws & WHERE_INDEXED)
       || ((ws & WHERE_MULTI_OR) && pLevel->u.pCovidx)
      ){
        sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iIdxCur);
      }
      if( pLevel->op==OP_Return ){
        sqlite3VdbeAddOp2(v, OP_Gosub, pLevel->p1, pLevel->addrFirst);
      }else{
        sqlite3VdbeGoto(v, pLevel->addrFirst);
      }
      sqlite3VdbeJumpHere(v, addr);
    }
    VdbeModuleComment((v, "End WHERE-loop%d: %s", i,
                     pWInfo->pTabList->a[pLevel->iFrom].pTab->zName));
  }

  /* The "break" point is here, just past the end of the outer loop.
  ** Set it.
  */
  sqlite3VdbeResolveLabel(v, pWInfo->iBreak);

  assert( pWInfo->nLevel<=pTabList->nSrc );
  for(i=0, pLevel=pWInfo->a; i<pWInfo->nLevel; i++, pLevel++){
    int k, last;
    VdbeOp *pOp;
    Index *pIdx = 0;
    struct SrcList_item *pTabItem = &pTabList->a[pLevel->iFrom];
    Table *pTab = pTabItem->pTab;
    assert( pTab!=0 );
    pLoop = pLevel->pWLoop;

    /* For a co-routine, change all OP_Column references to the table of
    ** the co-routine into OP_Copy of result contained in a register.
    ** OP_Rowid becomes OP_Null.
    */
    if( pTabItem->fg.viaCoroutine ){
      testcase( pParse->db->mallocFailed );
      translateColumnToCopy(pParse, pLevel->addrBody, pLevel->iTabCur,
                            pTabItem->regResult, 0);
      continue;
    }

#ifdef SQLITE_ENABLE_EARLY_CURSOR_CLOSE
    /* Close all of the cursors that were opened by sqlite3WhereBegin.
    ** Except, do not close cursors that will be reused by the OR optimization
    ** (WHERE_OR_SUBCLAUSE).  And do not close the OP_OpenWrite cursors
    ** created for the ONEPASS optimization.
    */
    if( (pTab->tabFlags & TF_Ephemeral)==0
     && pTab->pSelect==0
     && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0
    ){
      int ws = pLoop->wsFlags;
      if( pWInfo->eOnePass==ONEPASS_OFF && (ws & WHERE_IDX_ONLY)==0 ){
        sqlite3VdbeAddOp1(v, OP_Close, pTabItem->iCursor);
      }
      if( (ws & WHERE_INDEXED)!=0
       && (ws & (WHERE_IPK|WHERE_AUTO_INDEX))==0
       && pLevel->iIdxCur!=pWInfo->aiCurOnePass[1]
      ){
        sqlite3VdbeAddOp1(v, OP_Close, pLevel->iIdxCur);
      }
    }
#endif

    /* If this scan uses an index, make VDBE code substitutions to read data
    ** from the index instead of from the table where possible.  In some cases
    ** this optimization prevents the table from ever being read, which can
    ** yield a significant performance boost.
    **
    ** Calls to the code generator in between sqlite3WhereBegin and
    ** sqlite3WhereEnd will have created code that references the table
    ** directly.  This loop scans all that code looking for opcodes
    ** that reference the table and converts them into opcodes that
    ** reference the index.
    */
    if( pLoop->wsFlags & (WHERE_INDEXED|WHERE_IDX_ONLY) ){
      pIdx = pLoop->u.btree.pIndex;
    }else if( pLoop->wsFlags & WHERE_MULTI_OR ){
      pIdx = pLevel->u.pCovidx;
    }
    if( pIdx
     && (pWInfo->eOnePass==ONEPASS_OFF || !HasRowid(pIdx->pTable))
     && !db->mallocFailed
    ){
      last = sqlite3VdbeCurrentAddr(v);
      k = pLevel->addrBody;
#ifdef SQLITE_DEBUG
      if( db->flags & SQLITE_VdbeAddopTrace ){
        printf("TRANSLATE opcodes in range %d..%d\n", k, last-1);
      }
#endif
      pOp = sqlite3VdbeGetOp(v, k);
      for(; k<last; k++, pOp++){
        if( pOp->p1!=pLevel->iTabCur ) continue;
        if( pOp->opcode==OP_Column
#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC
         || pOp->opcode==OP_Offset
#endif
        ){
          int x = pOp->p2;
          assert( pIdx->pTable==pTab );
          if( !HasRowid(pTab) ){
            Index *pPk = sqlite3PrimaryKeyIndex(pTab);
            x = pPk->aiColumn[x];
            assert( x>=0 );
          }else{
            testcase( x!=sqlite3StorageColumnToTable(pTab,x) );
            x = sqlite3StorageColumnToTable(pTab,x);
          }
          x = sqlite3TableColumnToIndex(pIdx, x);
          if( x>=0 ){
            pOp->p2 = x;
            pOp->p1 = pLevel->iIdxCur;
            OpcodeRewriteTrace(db, k, pOp);
          }
          assert( (pLoop->wsFlags & WHERE_IDX_ONLY)==0 || x>=0
              || pWInfo->eOnePass );
        }else if( pOp->opcode==OP_Rowid ){
          pOp->p1 = pLevel->iIdxCur;
          pOp->opcode = OP_IdxRowid;
          OpcodeRewriteTrace(db, k, pOp);
        }else if( pOp->opcode==OP_IfNullRow ){
          pOp->p1 = pLevel->iIdxCur;
          OpcodeRewriteTrace(db, k, pOp);
        }
      }
#ifdef SQLITE_DEBUG
      if( db->flags & SQLITE_VdbeAddopTrace ) printf("TRANSLATE complete\n");
#endif
    }
  }

  /* Undo all Expr node modifications */
  while( pWInfo->pExprMods ){
    WhereExprMod *p = pWInfo->pExprMods;
    pWInfo->pExprMods = p->pNext;
    memcpy(p->pExpr, &p->orig, sizeof(p->orig));
    sqlite3DbFree(db, p);
  }

  /* Final cleanup
  */
  pParse->nQueryLoop = pWInfo->savedNQueryLoop;
  whereInfoFree(db, pWInfo);
  return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
movq %rcx, 0x8(%rsp)
movq (%rax), %rcx
movq %rcx, 0x28(%rsp)
movq %rax, 0x10(%rsp)
movq 0x10(%rax), %r12
movq %rdi, 0x18(%rsp)
movzbl 0x40(%rdi), %ecx
testq %rcx, %rcx
je 0x2d1713
movq 0x18(%rsp), %rax
addq $0x398, %rax            # imm = 0x398
movq %rax, 0x30(%rsp)
leaq 0x1edc3a(%rip), %rbx    # 0x4bee88
leaq -0x1(%rcx), %rsi
leaq (%rsi,%rsi,2), %rax
shlq $0x5, %rax
movq 0x30(%rsp), %rdx
leaq (%rdx,%rax), %r13
movq 0x50(%rdx,%rax), %r14
cmpb $-0x53, 0x35(%rdx,%rax)
movq %r14, 0x20(%rsp)
movq %rcx, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
jne 0x2d128f
movl 0x18(%r13), %esi
movq %r12, %rdi
callq 0x2bfa39
jmp 0x2d1433
xorl %ebp, %ebp
movq 0x18(%rsp), %rax
cmpb $0x2, 0x43(%rax)
jne 0x2d1381
movzbl 0x40(%rax), %eax
cmpq %rax, %rcx
jne 0x2d1381
testb $0x2, 0x29(%r14)
je 0x2d1381
movq 0x20(%r14), %rax
testb $-0x80, 0x63(%rax)
je 0x2d1381
movzwl 0x1e(%r14), %r15d
testl %r15d, %r15d
je 0x2d1381
movq 0x10(%rax), %rax
movl %r15d, %ecx
cmpw $0x24, (%rax,%rcx,2)
jl 0x2d1381
movq 0x10(%rsp), %rax
movl 0x38(%rax), %r14d
incl %r14d
xorl %ebp, %ebp
movl 0x8(%r13), %edx
leal (%r14,%rbp), %r8d
movq %r12, %rdi
movl $0x59, %esi
movl %ebp, %ecx
callq 0x2a83e1
incl %ebp
cmpl %ebp, %r15d
jne 0x2d12f4
movq 0x10(%rsp), %rcx
movl 0x38(%rcx), %eax
addl %r15d, %eax
incl %eax
movl %eax, 0x38(%rcx)
xorl %eax, %eax
cmpb $0x4, 0x35(%r13)
setne %al
leal (%rax,%rax,2), %esi
addl $0x16, %esi
movl 0x8(%r13), %edx
movq %r12, %rdi
xorl %ecx, %ecx
movl %r14d, %r8d
callq 0x2a83e1
movl %eax, %ebp
movq (%r12), %rax
cmpb $0x0, 0x61(%rax)
jne 0x2d1368
movq 0x88(%r12), %rax
movslq %ebp, %rcx
leaq (%rcx,%rcx,2), %rcx
movb $-0x3, 0x1(%rax,%rcx,8)
movl %r15d, 0x10(%rax,%rcx,8)
movl 0x3c(%r13), %ecx
movq %r12, %rdi
movl $0xb, %esi
movl $0x1, %edx
xorl %r8d, %r8d
callq 0x2a83e1
movl 0x18(%r13), %esi
movq %r12, %rdi
callq 0x2bfa39
movzbl 0x35(%r13), %esi
movl 0x38(%r13), %edx
movl 0x3c(%r13), %ecx
movzbl 0x36(%r13), %r8d
movq %r12, %rdi
callq 0x2a83e1
movslq 0x90(%r12), %rax
testq %rax, %rax
jle 0x2d13ca
movzbl 0x37(%r13), %ecx
movq 0x88(%r12), %rdx
leaq (%rax,%rax,2), %rax
movw %cx, -0x16(%rdx,%rax,8)
cmpl $0x0, 0x24(%r13)
movq 0x20(%rsp), %r14
je 0x2d13fc
movl 0x28(%r13), %esi
movq %r12, %rdi
callq 0x2bfa39
movl 0x24(%r13), %edx
movl 0x3c(%r13), %ecx
decl %ecx
movq %r12, %rdi
movl $0x3b, %esi
xorl %r8d, %r8d
callq 0x2a83e1
testl %ebp, %ebp
je 0x2d1433
movl 0x90(%r12), %eax
movq (%r12), %rcx
cmpb $0x0, 0x61(%rcx)
movq %rbx, %rcx
jne 0x2d1430
leal -0x1(%rax), %ecx
testl %ebp, %ebp
cmovnsl %ebp, %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x3, %rcx
addq 0x88(%r12), %rcx
movl %eax, 0x8(%rcx)
testb $0x8, 0x29(%r14)
je 0x2d1597
cmpl $0x0, 0x40(%r13)
jle 0x2d1597
movl 0x10(%r13), %esi
movq %r12, %rdi
callq 0x2bfa39
movslq 0x40(%r13), %rdx
testq %rdx, %rdx
jle 0x2d1597
movq 0x48(%r13), %rsi
movl 0x90(%r12), %ecx
movq (%r12), %rax
movb 0x61(%rax), %al
leaq (%rdx,%rdx,4), %rdi
leaq (%rsi,%rdi,4), %rbp
addq $-0x4, %rbp
leal 0x1(%rdx), %r15d
movq %rbx, %rdx
testb %al, %al
jne 0x2d14ae
movl -0xc(%rbp), %edx
leal 0x1(%rdx), %esi
leal -0x1(%rcx), %edi
cmpl $-0x1, %edx
cmovgel %esi, %edi
movslq %edi, %rdx
leaq (%rdx,%rdx,2), %rdx
shlq $0x3, %rdx
addq 0x88(%r12), %rdx
movl %ecx, 0x8(%rdx)
cmpb $-0x53, (%rbp)
je 0x2d155d
cmpl $0x0, -0x4(%rbp)
je 0x2d1539
cmpl $0x0, (%r13)
movq 0x20(%rsp), %r14
je 0x2d14ec
btl $0xa, 0x28(%r14)
movl -0x10(%rbp), %edx
sbbl $-0x1, %ecx
addl $0x2, %ecx
movq %r12, %rdi
movl $0x1a, %esi
xorl %r8d, %r8d
callq 0x2a83e1
testb $0x4, 0x29(%r14)
jne 0x2d1539
movl 0x8(%r13), %edx
movl 0x90(%r12), %ecx
addl $0x2, %ecx
movl -0x8(%rbp), %r8d
movl -0x4(%rbp), %r14d
movq %r12, %rdi
movl $0x1b, %esi
callq 0x2a83e1
movq (%r12), %rcx
cmpb $0x0, 0x61(%rcx)
jne 0x2d1539
movq 0x88(%r12), %rcx
cltq
leaq (%rax,%rax,2), %rax
movb $-0x3, 0x1(%rcx,%rax,8)
movl %r14d, 0x10(%rcx,%rax,8)
movzbl (%rbp), %esi
movl -0x10(%rbp), %edx
movl -0xc(%rbp), %ecx
movq %r12, %rdi
xorl %r8d, %r8d
callq 0x2a83e1
movl 0x90(%r12), %ecx
movq (%r12), %rax
movb 0x61(%rax), %al
movq %rbx, %rdx
testb %al, %al
jne 0x2d1583
movl -0xc(%rbp), %edx
testl %edx, %edx
cmovlel %ecx, %edx
movq 0x88(%r12), %rsi
movslq %edx, %rdx
leaq (%rdx,%rdx,2), %rdx
leaq (%rsi,%rdx,8), %rdx
addq $-0x18, %rdx
movl %ecx, 0x8(%rdx)
addq $-0x14, %rbp
decl %r15d
cmpl $0x1, %r15d
jg 0x2d1485
movl 0xc(%r13), %esi
movq %r12, %rdi
callq 0x2bfa39
movl 0x14(%r13), %ecx
testl %ecx, %ecx
je 0x2d1612
movq %r12, %rdi
movl $0xb, %esi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x2a83e1
movl 0x90(%r12), %eax
movq (%r12), %rcx
cmpb $0x0, 0x61(%rcx)
je 0x2d15da
movl %eax, 0x1ed8bb(%rip)    # 0x4bee90
movq %rbx, %rcx
jmp 0x2d160f
movl 0x14(%r13), %ecx
leal -0x1(%rax), %edx
testl %ecx, %ecx
movl %ecx, %esi
cmovsl %edx, %esi
movq 0x88(%r12), %rdi
movslq %esi, %rsi
leaq (%rsi,%rsi,2), %rsi
cmpl $0x2, %ecx
leal -0x2(%rcx), %ecx
cmovll %edx, %ecx
movl %eax, 0x8(%rdi,%rsi,8)
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rdi,%rcx,8), %rcx
movl %eax, 0x8(%rcx)
movl 0x30(%r13), %ecx
testl %ecx, %ecx
je 0x2d1630
movl 0x2c(%r13), %edx
shrl %edx
movq %r12, %rdi
movl $0x3b, %esi
xorl %r8d, %r8d
callq 0x2a83e1
movl (%r13), %edx
testl %edx, %edx
movq 0x20(%rsp), %rax
je 0x2d1702
movl 0x28(%rax), %r14d
movq %r12, %rdi
movl $0x30, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x2a83e1
movl %eax, %ebp
testb $0x40, %r14b
jne 0x2d1675
movl 0x4(%r13), %edx
movq %r12, %rdi
movl $0x80, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x2a83e1
btl $0x9, %r14d
jb 0x2d168a
btl $0xd, %r14d
jae 0x2d16a0
cmpq $0x0, 0x40(%r13)
je 0x2d16a0
movl 0x8(%r13), %edx
movq %r12, %rdi
movl $0x80, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x2a83e1
cmpb $0x41, 0x35(%r13)
jne 0x2d16b9
movl 0x1c(%r13), %ecx
movl 0x38(%r13), %edx
movq %r12, %rdi
movl $0xc, %esi
jmp 0x2d16c7
movl 0x1c(%r13), %ecx
movq %r12, %rdi
movl $0xb, %esi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x2a83e1
movl 0x90(%r12), %eax
movq (%r12), %rcx
cmpb $0x0, 0x61(%rcx)
movq %rbx, %rcx
jne 0x2d16ff
leal -0x1(%rax), %ecx
testl %ebp, %ebp
cmovnsl %ebp, %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x3, %rcx
addq 0x88(%r12), %rcx
movl %eax, 0x8(%rcx)
cmpq $0x1, 0x40(%rsp)
movq 0x38(%rsp), %rcx
jg 0x2d124e
movq 0x18(%rsp), %r15
movl 0x34(%r15), %esi
movq %r12, %rdi
callq 0x2bfa39
movb 0x40(%r15), %al
testb %al, %al
movq 0x10(%rsp), %r13
movq 0x8(%rsp), %rdi
je 0x2d1939
leaq 0x398(%r15), %rbx
addq $0x8, %rdi
xorl %r14d, %r14d
leaq 0x1ed739(%rip), %rbp    # 0x4bee88
movq %rdi, 0x8(%rsp)
movzbl 0x34(%rbx), %ecx
imulq $0x70, %rcx, %rcx
testb $0x10, 0x3d(%rdi,%rcx)
jne 0x2d177d
movq 0x20(%rdi,%rcx), %rcx
movq 0x50(%rbx), %rdx
movl 0x28(%rdx), %esi
testl $0x240, %esi            # imm = 0x240
je 0x2d17a2
addq $0x20, %rdx
jmp 0x2d17b0
addq %rdi, %rcx
movl 0x4(%rbx), %edx
movl 0x20(%rbx), %esi
movl 0x38(%rcx), %ecx
movq %r13, %rdi
xorl %r8d, %r8d
callq 0x2dcfe6
movq 0x8(%rsp), %rdi
movb 0x40(%r15), %al
jmp 0x2d1926
btl $0xd, %esi
jae 0x2d1926
leaq 0x40(%rbx), %rdx
movq (%rdx), %rdx
testq %rdx, %rdx
je 0x2d1926
cmpb $0x0, 0x42(%r15)
je 0x2d17d1
movq 0x18(%rdx), %rsi
testb $-0x80, 0x40(%rsi)
je 0x2d1926
movq 0x28(%rsp), %rsi
cmpb $0x0, 0x61(%rsi)
jne 0x2d1926
movl 0x90(%r12), %esi
movl 0x20(%rbx), %edi
movq (%r12), %r8
cmpb $0x0, 0x61(%r8)
movq %rbp, %r8
jne 0x2d1816
leal -0x1(%rsi), %r8d
testl %edi, %edi
cmovnsl %edi, %r8d
movslq %r8d, %r8
leaq (%r8,%r8,2), %r8
shlq $0x3, %r8
addq 0x88(%r12), %r8
cmpl %esi, %edi
jge 0x2d1921
movl 0x4(%rbx), %r9d
leaq 0x10(%rcx), %r10
cmpl %r9d, 0x4(%r8)
jne 0x2d18fb
movzbl (%r8), %r11d
cmpl $0x15, %r11d
je 0x2d18f3
cmpl $0x7f, %r11d
je 0x2d1891
cmpl $0x59, %r11d
jne 0x2d18fb
movslq 0x8(%r8), %r11
movl 0x40(%rcx), %ebp
testb %bpl, %bpl
js 0x2d189f
testw %r11w, %r11w
js 0x2d18c1
andl $0x20, %ebp
je 0x2d18c1
movq 0x8(%rcx), %r13
addq $0x1c, %r13
movq $-0x1, %rbp
btl $0x5, (%r13)
adcw $0x0, %r11w
movswq %r11w, %r15
incq %rbp
addq $0x20, %r13
cmpq %r15, %rbp
jl 0x2d1874
jmp 0x2d18c1
movl 0x8(%rbx), %r11d
movl %r11d, 0x4(%r8)
movb $-0x7a, (%r8)
jmp 0x2d18fb
movq %r10, %r13
movq (%r13), %r15
movzwl 0x63(%r15), %ebp
andl $0x3, %ebp
leaq 0x28(%r15), %r13
cmpw $0x2, %bp
jne 0x2d18a2
movq 0x8(%r15), %r15
movzwl (%r15,%r11,2), %r11d
movzwl 0x60(%rdx), %ebp
testq %rbp, %rbp
je 0x2d18fb
movq 0x8(%rdx), %r15
xorl %r13d, %r13d
cmpw %r11w, (%r15,%r13,2)
je 0x2d18e2
incq %r13
cmpq %r13, %rbp
jne 0x2d18d1
jmp 0x2d18fb
testw %r13w, %r13w
js 0x2d18fb
andl $0x7fff, %r13d          # imm = 0x7FFF
movl %r13d, 0x8(%r8)
movl 0x8(%rbx), %r11d
movl %r11d, 0x4(%r8)
incl %edi
addq $0x18, %r8
cmpl %esi, %edi
jne 0x2d1826
movq 0x18(%rsp), %r15
movq 0x10(%rsp), %r13
movq 0x8(%rsp), %rdi
leaq 0x1ed569(%rip), %rbp    # 0x4bee88
jmp 0x2d1926
movq 0x8(%rsp), %rdi
incl %r14d
addq $0x60, %rbx
movzbl %al, %ecx
cmpl %ecx, %r14d
jb 0x2d1754
movq 0x58(%r15), %rax
testq %rax, %rax
movq 0x28(%rsp), %rbx
je 0x2d1972
movq (%rax), %rcx
movq %rcx, 0x58(%r15)
movq 0x8(%rax), %rdi
leaq 0x10(%rax), %rsi
movl $0x9, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x282904
movq 0x58(%r15), %rax
testq %rax, %rax
jne 0x2d1947
movl 0x38(%r15), %eax
movl %eax, 0xc4(%r13)
movq %rbx, %rdi
movq %r15, %rsi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2d762d