// File: /workspace/github_c_makefile_star2_O0/ukontainer[P]sqlite-bench/sqlite3.c
// Function: flattenSubquery
static int flattenSubquery(
  Parse *pParse,       /* Parsing context */
  Select *p,           /* The parent or outer SELECT statement */
  int iFrom,           /* Index in p->pSrc->a[] of the inner subquery */
  int isAgg            /* True if outer SELECT uses aggregate functions */
){
  const char *zSavedAuthContext = pParse->zAuthContext;
  Select *pParent;    /* Current UNION ALL term of the other query */
  Select *pSub;       /* The inner query or "subquery" */
  Select *pSub1;      /* Pointer to the rightmost select in sub-query */
  SrcList *pSrc;      /* The FROM clause of the outer query */
  SrcList *pSubSrc;   /* The FROM clause of the subquery */
  int iParent;        /* VDBE cursor number of the pSub result set temp table */
  int iNewParent = -1;/* Replacement table for iParent */
  int isLeftJoin = 0; /* True if pSub is the right side of a LEFT JOIN */    
  int i;              /* Loop counter */
  Expr *pWhere;                    /* The WHERE clause */
  struct SrcList_item *pSubitem;   /* The subquery */
  sqlite3 *db = pParse->db;

  /* Check to see if flattening is permitted.  Return 0 if not.
  */
  assert( p!=0 );
  assert( p->pPrior==0 );
  if( OptimizationDisabled(db, SQLITE_QueryFlattener) ) return 0;
  pSrc = p->pSrc;
  assert( pSrc && iFrom>=0 && iFrom<pSrc->nSrc );
  pSubitem = &pSrc->a[iFrom];
  iParent = pSubitem->iCursor;
  pSub = pSubitem->pSelect;
  assert( pSub!=0 );

#ifndef SQLITE_OMIT_WINDOWFUNC
  if( p->pWin || pSub->pWin ) return 0;                  /* Restriction (25) */
#endif

  pSubSrc = pSub->pSrc;
  assert( pSubSrc );
  /* Prior to version 3.1.2, when LIMIT and OFFSET had to be simple constants,
  ** not arbitrary expressions, we allowed some combining of LIMIT and OFFSET
  ** because they could be computed at compile-time.  But when LIMIT and OFFSET
  ** became arbitrary expressions, we were forced to add restrictions (13)
  ** and (14). */
  if( pSub->pLimit && p->pLimit ) return 0;              /* Restriction (13) */
  if( pSub->pLimit && pSub->pLimit->pRight ) return 0;   /* Restriction (14) */
  if( (p->selFlags & SF_Compound)!=0 && pSub->pLimit ){
    return 0;                                            /* Restriction (15) */
  }
  if( pSubSrc->nSrc==0 ) return 0;                       /* Restriction (7)  */
  if( pSub->selFlags & SF_Distinct ) return 0;           /* Restriction (4)  */
  if( pSub->pLimit && (pSrc->nSrc>1 || isAgg) ){
     return 0;         /* Restrictions (8)(9) */
  }
  if( p->pOrderBy && pSub->pOrderBy ){
     return 0;                                           /* Restriction (11) */
  }
  if( isAgg && pSub->pOrderBy ) return 0;                /* Restriction (16) */
  if( pSub->pLimit && p->pWhere ) return 0;              /* Restriction (19) */
  if( pSub->pLimit && (p->selFlags & SF_Distinct)!=0 ){
     return 0;         /* Restriction (21) */
  }
  if( pSub->selFlags & (SF_Recursive) ){
    return 0; /* Restrictions (22) */
  }

  /*
  ** If the subquery is the right operand of a LEFT JOIN, then the
  ** subquery may not be a join itself (3a). Example of why this is not
  ** allowed:
  **
  **         t1 LEFT OUTER JOIN (t2 JOIN t3)
  **
  ** If we flatten the above, we would get
  **
  **         (t1 LEFT OUTER JOIN t2) JOIN t3
  **
  ** which is not at all the same thing.
  **
  ** If the subquery is the right operand of a LEFT JOIN, then the outer
  ** query cannot be an aggregate. (3c)  This is an artifact of the way
  ** aggregates are processed - there is no mechanism to determine if
  ** the LEFT JOIN table should be all-NULL.
  **
  ** See also tickets #306, #350, and #3300.
  */
  if( (pSubitem->fg.jointype & JT_OUTER)!=0 ){
    isLeftJoin = 1;
    if( pSubSrc->nSrc>1 || isAgg || IsVirtual(pSubSrc->a[0].pTab) ){
      /*  (3a)             (3c)     (3b) */
      return 0;
    }
  }
#ifdef SQLITE_EXTRA_IFNULLROW
  else if( iFrom>0 && !isAgg ){
    /* Setting isLeftJoin to -1 causes OP_IfNullRow opcodes to be generated for
    ** every reference to any result column from subquery in a join, even
    ** though they are not necessary.  This will stress-test the OP_IfNullRow 
    ** opcode. */
    isLeftJoin = -1;
  }
#endif

  /* Restriction (17): If the sub-query is a compound SELECT, then it must
  ** use only the UNION ALL operator. And none of the simple select queries
  ** that make up the compound SELECT are allowed to be aggregate or distinct
  ** queries.
  */
  if( pSub->pPrior ){
    if( pSub->pOrderBy ){
      return 0;  /* Restriction (20) */
    }
    if( isAgg || (p->selFlags & SF_Distinct)!=0 || pSrc->nSrc!=1 ){
      return 0; /* (17d1), (17d2), or (17d3) */
    }
    for(pSub1=pSub; pSub1; pSub1=pSub1->pPrior){
      testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct );
      testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Aggregate );
      assert( pSub->pSrc!=0 );
      assert( pSub->pEList->nExpr==pSub1->pEList->nExpr );
      if( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))!=0    /* (17b) */
       || (pSub1->pPrior && pSub1->op!=TK_ALL)                 /* (17a) */
       || pSub1->pSrc->nSrc<1                                  /* (17c) */
      ){
        return 0;
      }
      testcase( pSub1->pSrc->nSrc>1 );
    }

    /* Restriction (18). */
    if( p->pOrderBy ){
      int ii;
      for(ii=0; ii<p->pOrderBy->nExpr; ii++){
        if( p->pOrderBy->a[ii].u.x.iOrderByCol==0 ) return 0;
      }
    }
  }

  /* Ex-restriction (23):
  ** The only way that the recursive part of a CTE can contain a compound
  ** subquery is for the subquery to be one term of a join.  But if the
  ** subquery is a join, then the flattening has already been stopped by
  ** restriction (17d3)
  */
  assert( (p->selFlags & SF_Recursive)==0 || pSub->pPrior==0 );

  /***** If we reach this point, flattening is permitted. *****/
  SELECTTRACE(1,pParse,p,("flatten %u.%p from term %d\n",
                   pSub->selId, pSub, iFrom));

  /* Authorize the subquery */
  pParse->zAuthContext = pSubitem->zName;
  TESTONLY(i =) sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0);
  testcase( i==SQLITE_DENY );
  pParse->zAuthContext = zSavedAuthContext;

  /* If the sub-query is a compound SELECT statement, then (by restrictions
  ** 17 and 18 above) it must be a UNION ALL and the parent query must 
  ** be of the form:
  **
  **     SELECT <expr-list> FROM (<sub-query>) <where-clause> 
  **
  ** followed by any ORDER BY, LIMIT and/or OFFSET clauses. This block
  ** creates N-1 copies of the parent query without any ORDER BY, LIMIT or 
  ** OFFSET clauses and joins them to the left-hand-side of the original
  ** using UNION ALL operators. In this case N is the number of simple
  ** select statements in the compound sub-query.
  **
  ** Example:
  **
  **     SELECT a+1 FROM (
  **        SELECT x FROM tab
  **        UNION ALL
  **        SELECT y FROM tab
  **        UNION ALL
  **        SELECT abs(z*2) FROM tab2
  **     ) WHERE a!=5 ORDER BY 1
  **
  ** Transformed into:
  **
  **     SELECT x+1 FROM tab WHERE x+1!=5
  **     UNION ALL
  **     SELECT y+1 FROM tab WHERE y+1!=5
  **     UNION ALL
  **     SELECT abs(z*2)+1 FROM tab2 WHERE abs(z*2)+1!=5
  **     ORDER BY 1
  **
  ** We call this the "compound-subquery flattening".
  */
  for(pSub=pSub->pPrior; pSub; pSub=pSub->pPrior){
    Select *pNew;
    ExprList *pOrderBy = p->pOrderBy;
    Expr *pLimit = p->pLimit;
    Select *pPrior = p->pPrior;
    p->pOrderBy = 0;
    p->pSrc = 0;
    p->pPrior = 0;
    p->pLimit = 0;
    pNew = sqlite3SelectDup(db, p, 0);
    p->pLimit = pLimit;
    p->pOrderBy = pOrderBy;
    p->pSrc = pSrc;
    p->op = TK_ALL;
    if( pNew==0 ){
      p->pPrior = pPrior;
    }else{
      pNew->pPrior = pPrior;
      if( pPrior ) pPrior->pNext = pNew;
      pNew->pNext = p;
      p->pPrior = pNew;
      SELECTTRACE(2,pParse,p,("compound-subquery flattener"
                              " creates %u as peer\n",pNew->selId));
    }
    if( db->mallocFailed ) return 1;
  }

  /* Begin flattening the iFrom-th entry of the FROM clause 
  ** in the outer query.
  */
  pSub = pSub1 = pSubitem->pSelect;

  /* Delete the transient table structure associated with the
  ** subquery
  */
  sqlite3DbFree(db, pSubitem->zDatabase);
  sqlite3DbFree(db, pSubitem->zName);
  sqlite3DbFree(db, pSubitem->zAlias);
  pSubitem->zDatabase = 0;
  pSubitem->zName = 0;
  pSubitem->zAlias = 0;
  pSubitem->pSelect = 0;

  /* Defer deleting the Table object associated with the
  ** subquery until code generation is
  ** complete, since there may still exist Expr.pTab entries that
  ** refer to the subquery even after flattening.  Ticket #3346.
  **
  ** pSubitem->pTab is always non-NULL by test restrictions and tests above.
  */
  if( ALWAYS(pSubitem->pTab!=0) ){
    Table *pTabToDel = pSubitem->pTab;
    if( pTabToDel->nTabRef==1 ){
      Parse *pToplevel = sqlite3ParseToplevel(pParse);
      pTabToDel->pNextZombie = pToplevel->pZombieTab;
      pToplevel->pZombieTab = pTabToDel;
    }else{
      pTabToDel->nTabRef--;
    }
    pSubitem->pTab = 0;
  }

  /* The following loop runs once for each term in a compound-subquery
  ** flattening (as described above).  If we are doing a different kind
  ** of flattening - a flattening other than a compound-subquery flattening -
  ** then this loop only runs once.
  **
  ** This loop moves all of the FROM elements of the subquery into the
  ** the FROM clause of the outer query.  Before doing this, remember
  ** the cursor number for the original outer query FROM element in
  ** iParent.  The iParent cursor will never be used.  Subsequent code
  ** will scan expressions looking for iParent references and replace
  ** those references with expressions that resolve to the subquery FROM
  ** elements we are now copying in.
  */
  for(pParent=p; pParent; pParent=pParent->pPrior, pSub=pSub->pPrior){
    int nSubSrc;
    u8 jointype = 0;
    pSubSrc = pSub->pSrc;     /* FROM clause of subquery */
    nSubSrc = pSubSrc->nSrc;  /* Number of terms in subquery FROM clause */
    pSrc = pParent->pSrc;     /* FROM clause of the outer query */

    if( pSrc ){
      assert( pParent==p );  /* First time through the loop */
      jointype = pSubitem->fg.jointype;
    }else{
      assert( pParent!=p );  /* 2nd and subsequent times through the loop */
      pSrc = pParent->pSrc = sqlite3SrcListAppend(db, 0, 0, 0);
      if( pSrc==0 ){
        assert( db->mallocFailed );
        break;
      }
    }

    /* The subquery uses a single slot of the FROM clause of the outer
    ** query.  If the subquery has more than one element in its FROM clause,
    ** then expand the outer query to make space for it to hold all elements
    ** of the subquery.
    **
    ** Example:
    **
    **    SELECT * FROM tabA, (SELECT * FROM sub1, sub2), tabB;
    **
    ** The outer query has 3 slots in its FROM clause.  One slot of the
    ** outer query (the middle slot) is used by the subquery.  The next
    ** block of code will expand the outer query FROM clause to 4 slots.
    ** The middle slot is expanded to two slots in order to make space
    ** for the two elements in the FROM clause of the subquery.
    */
    if( nSubSrc>1 ){
      pParent->pSrc = pSrc = sqlite3SrcListEnlarge(db, pSrc, nSubSrc-1,iFrom+1);
      if( db->mallocFailed ){
        break;
      }
    }

    /* Transfer the FROM clause terms from the subquery into the
    ** outer query.
    */
    for(i=0; i<nSubSrc; i++){
      sqlite3IdListDelete(db, pSrc->a[i+iFrom].pUsing);
      assert( pSrc->a[i+iFrom].fg.isTabFunc==0 );
      pSrc->a[i+iFrom] = pSubSrc->a[i];
      iNewParent = pSubSrc->a[i].iCursor;
      memset(&pSubSrc->a[i], 0, sizeof(pSubSrc->a[i]));
    }
    pSrc->a[iFrom].fg.jointype = jointype;
  
    /* Now begin substituting subquery result set expressions for 
    ** references to the iParent in the outer query.
    ** 
    ** Example:
    **
    **   SELECT a+5, b*10 FROM (SELECT x*3 AS a, y+10 AS b FROM t1) WHERE a>b;
    **   \                     \_____________ subquery __________/          /
    **    \_____________________ outer query ______________________________/
    **
    ** We look at every expression in the outer query and every place we see
    ** "a" we substitute "x*3" and every place we see "b" we substitute "y+10".
    */
    if( pSub->pOrderBy ){
      /* At this point, any non-zero iOrderByCol values indicate that the
      ** ORDER BY column expression is identical to the iOrderByCol'th
      ** expression returned by SELECT statement pSub. Since these values
      ** do not necessarily correspond to columns in SELECT statement pParent,
      ** zero them before transfering the ORDER BY clause.
      **
      ** Not doing this may cause an error if a subsequent call to this
      ** function attempts to flatten a compound sub-query into pParent
      ** (the only way this can happen is if the compound sub-query is
      ** currently part of pSub->pSrc). See ticket [d11a6e908f].  */
      ExprList *pOrderBy = pSub->pOrderBy;
      for(i=0; i<pOrderBy->nExpr; i++){
        pOrderBy->a[i].u.x.iOrderByCol = 0;
      }
      assert( pParent->pOrderBy==0 );
      pParent->pOrderBy = pOrderBy;
      pSub->pOrderBy = 0;
    }
    pWhere = sqlite3ExprDup(db, pSub->pWhere, 0);
    if( isLeftJoin>0 ){
      setJoinExpr(pWhere, iNewParent);
    }
    pParent->pWhere = sqlite3ExprAnd(db, pWhere, pParent->pWhere);
    if( db->mallocFailed==0 ){
      SubstContext x;
      x.pParse = pParse;
      x.iTable = iParent;
      x.iNewTable = iNewParent;
      x.isLeftJoin = isLeftJoin;
      x.pEList = pSub->pEList;
      substSelect(&x, pParent, 0);
    }
  
    /* The flattened query is distinct if either the inner or the
    ** outer query is distinct. 
    */
    pParent->selFlags |= pSub->selFlags & SF_Distinct;
  
    /*
    ** SELECT ... FROM (SELECT ... LIMIT a OFFSET b) LIMIT x OFFSET y;
    **
    ** One is tempted to try to add a and b to combine the limits.  But this
    ** does not work if either limit is negative.
    */
    if( pSub->pLimit ){
      pParent->pLimit = pSub->pLimit;
      pSub->pLimit = 0;
    }
  }

  /* Finially, delete what is left of the subquery and return
  ** success.
  */
  sqlite3SelectDelete(db, pSub1);

#if SELECTTRACE_ENABLED
  if( sqlite3SelectTrace & 0x100 ){
    SELECTTRACE(0x100,pParse,p,("After flattening:\n"));
    sqlite3TreeViewSelect(0, p, 0);
  }
#endif

  return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x150(%rax), %rax
movq %rax, -0x28(%rbp)
movl $0xffffffff, -0x58(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x5c(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movzwl 0x5c(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x47e30d
movl $0x0, -0x4(%rbp)
jmp 0x47ebeb
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
addq $0x8, %rax
movslq -0x1c(%rbp), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movl 0x40(%rax), %eax
movl %eax, -0x54(%rbp)
movq -0x70(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x70(%rax)
jne 0x47e35c
movq -0x38(%rbp), %rax
cmpq $0x0, 0x70(%rax)
je 0x47e368
movl $0x0, -0x4(%rbp)
jmp 0x47ebeb
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x47e396
movq -0x18(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x47e396
movl $0x0, -0x4(%rbp)
jmp 0x47ebeb
movq -0x38(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x47e3bc
movq -0x38(%rbp), %rax
movq 0x60(%rax), %rax
cmpq $0x0, 0x18(%rax)
je 0x47e3bc
movl $0x0, -0x4(%rbp)
jmp 0x47ebeb
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x47e3e4
movq -0x38(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x47e3e4
movl $0x0, -0x4(%rbp)
jmp 0x47ebeb
movq -0x50(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x47e3f9
movl $0x0, -0x4(%rbp)
jmp 0x47ebeb
movq -0x38(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x47e414
movl $0x0, -0x4(%rbp)
jmp 0x47ebeb
movq -0x38(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x47e43a
movq -0x48(%rbp), %rax
cmpl $0x1, (%rax)
jg 0x47e42e
cmpl $0x0, -0x20(%rbp)
je 0x47e43a
movl $0x0, -0x4(%rbp)
jmp 0x47ebeb
movq -0x18(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x47e45c
movq -0x38(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x47e45c
movl $0x0, -0x4(%rbp)
jmp 0x47ebeb
cmpl $0x0, -0x20(%rbp)
je 0x47e479
movq -0x38(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x47e479
movl $0x0, -0x4(%rbp)
jmp 0x47ebeb
movq -0x38(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x47e49b
movq -0x18(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x47e49b
movl $0x0, -0x4(%rbp)
jmp 0x47ebeb
movq -0x38(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x47e4c1
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x47e4c1
movl $0x0, -0x4(%rbp)
jmp 0x47ebeb
movq -0x38(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
je 0x47e4de
movl $0x0, -0x4(%rbp)
jmp 0x47ebeb
movq -0x70(%rbp), %rax
movzbl 0x3c(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x47e520
movl $0x1, -0x5c(%rbp)
movq -0x50(%rbp), %rax
cmpl $0x1, (%rax)
jg 0x47e512
cmpl $0x0, -0x20(%rbp)
jne 0x47e512
movq -0x50(%rbp), %rax
movq 0x28(%rax), %rax
cmpl $0x0, 0x54(%rax)
je 0x47e51e
movl $0x0, -0x4(%rbp)
jmp 0x47ebeb
jmp 0x47e520
movq -0x38(%rbp), %rax
cmpq $0x0, 0x50(%rax)
je 0x47e62d
movq -0x38(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x47e546
movl $0x0, -0x4(%rbp)
jmp 0x47ebeb
cmpl $0x0, -0x20(%rbp)
jne 0x47e564
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x47e564
movq -0x48(%rbp), %rax
cmpl $0x1, (%rax)
je 0x47e570
movl $0x0, -0x4(%rbp)
jmp 0x47ebeb
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x47e5cf
movq -0x40(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x9, %eax
cmpl $0x0, %eax
jne 0x47e5b3
movq -0x40(%rbp), %rax
cmpq $0x0, 0x50(%rax)
je 0x47e5a6
movq -0x40(%rbp), %rax
movzbl 0x8(%rax), %eax
cmpl $0x7c, %eax
jne 0x47e5b3
movq -0x40(%rbp), %rax
movq 0x28(%rax), %rax
cmpl $0x1, (%rax)
jge 0x47e5bf
movl $0x0, -0x4(%rbp)
jmp 0x47ebeb
jmp 0x47e5c1
movq -0x40(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x47e578
movq -0x18(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x47e62b
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x48(%rcx), %rcx
cmpl (%rcx), %eax
jge 0x47e629
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
addq $0x8, %rax
movslq -0x7c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movzwl 0x1c(%rax), %eax
cmpl $0x0, %eax
jne 0x47e61c
movl $0x0, -0x4(%rbp)
jmp 0x47ebeb
jmp 0x47e61e
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x47e5e1
jmp 0x47e62b
jmp 0x47e62d
movq -0x70(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x150(%rax)
movq -0x10(%rbp), %rdi
movl $0x15, %esi
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rdx
movq %r8, %rcx
callq 0x4741b0
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x150(%rax)
movq -0x38(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x47e7b4
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x90(%rbp)
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0xa0(%rbp)
movq -0x18(%rbp), %rax
movq $0x0, 0x48(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x50(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x60(%rax)
movq -0x78(%rbp), %rdi
movq -0x18(%rbp), %rsi
xorl %edx, %edx
callq 0x472110
movq %rax, -0x88(%rbp)
movq -0x98(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x90(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x48(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x18(%rbp), %rax
movb $0x7c, 0x8(%rax)
cmpq $0x0, -0x88(%rbp)
jne 0x47e73f
movq -0xa0(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x50(%rax)
jmp 0x47e78b
movq -0xa0(%rbp), %rcx
movq -0x88(%rbp), %rax
movq %rcx, 0x50(%rax)
cmpq $0x0, -0xa0(%rbp)
je 0x47e76d
movq -0x88(%rbp), %rcx
movq -0xa0(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x18(%rbp), %rcx
movq -0x88(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x88(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x78(%rbp), %rax
cmpb $0x0, 0x61(%rax)
je 0x47e7a1
movl $0x1, -0x4(%rbp)
jmp 0x47ebeb
jmp 0x47e7a3
movq -0x38(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x47e674
movq -0x70(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x40(%rbp)
movq %rax, -0x38(%rbp)
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x4058a0
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x4058a0
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x4058a0
movq -0x70(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x70(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x70(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x70(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x70(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x47e8d9
movq -0x70(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
cmpl $0x1, 0x3c(%rax)
jne 0x47e8bd
movq -0x10(%rbp), %rax
cmpq $0x0, 0xa0(%rax)
je 0x47e874
movq -0x10(%rbp), %rax
movq 0xa0(%rax), %rax
movq %rax, -0xe8(%rbp)
jmp 0x47e87f
movq -0x10(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
movq 0x170(%rax), %rcx
movq -0xa8(%rbp), %rax
movq %rcx, 0x78(%rax)
movq -0xa8(%rbp), %rcx
movq -0xb0(%rbp), %rax
movq %rcx, 0x170(%rax)
jmp 0x47e8cd
movq -0xa8(%rbp), %rax
movl 0x3c(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x3c(%rax)
movq -0x70(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x47ebd7
movb $0x0, -0xb5(%rbp)
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xb4(%rbp)
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x47e92d
movq -0x70(%rbp), %rax
movb 0x3c(%rax), %al
movb %al, -0xb5(%rbp)
jmp 0x47e95a
movq -0x78(%rbp), %rdi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rsi
movq %rcx, %rdx
callq 0x460db0
movq -0x30(%rbp), %rcx
movq %rax, 0x28(%rcx)
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x47e958
jmp 0x47ebd7
jmp 0x47e95a
cmpl $0x1, -0xb4(%rbp)
jle 0x47e99f
movq -0x78(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl -0xb4(%rbp), %edx
subl $0x1, %edx
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
callq 0x483910
movq %rax, %rcx
movq %rcx, -0x48(%rbp)
movq -0x30(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x78(%rbp), %rax
cmpb $0x0, 0x61(%rax)
je 0x47e99d
jmp 0x47ebd7
jmp 0x47e99f
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
cmpl -0xb4(%rbp), %eax
jge 0x47ea54
movq -0x78(%rbp), %rdi
movq -0x48(%rbp), %rax
addq $0x8, %rax
movl -0x60(%rbp), %ecx
addl -0x1c(%rbp), %ecx
movslq %ecx, %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq 0x50(%rax), %rsi
callq 0x4502f0
movq -0x48(%rbp), %rdi
addq $0x8, %rdi
movl -0x60(%rbp), %eax
addl -0x1c(%rbp), %eax
cltq
imulq $0x70, %rax, %rax
addq %rax, %rdi
movq -0x50(%rbp), %rsi
addq $0x8, %rsi
movslq -0x60(%rbp), %rax
imulq $0x70, %rax, %rax
addq %rax, %rsi
movl $0x70, %edx
callq 0x401040
movq -0x50(%rbp), %rax
addq $0x8, %rax
movslq -0x60(%rbp), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl 0x40(%rax), %eax
movl %eax, -0x58(%rbp)
movq -0x50(%rbp), %rdi
addq $0x8, %rdi
movslq -0x60(%rbp), %rax
imulq $0x70, %rax, %rax
addq %rax, %rdi
xorl %esi, %esi
movl $0x70, %edx
callq 0x4010b0
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x47e9a6
movb -0xb5(%rbp), %cl
movq -0x48(%rbp), %rax
addq $0x8, %rax
movslq -0x1c(%rbp), %rdx
imulq $0x70, %rdx, %rdx
addq %rdx, %rax
movb %cl, 0x3c(%rax)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x47eae1
movq -0x38(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0xc0(%rbp)
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
movq -0xc0(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x47eac6
movq -0xc0(%rbp), %rax
addq $0x8, %rax
movslq -0x60(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movw $0x0, 0x1c(%rax)
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x47ea91
movq -0xc0(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x38(%rbp), %rax
movq $0x0, 0x48(%rax)
movq -0x78(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rsi
xorl %edx, %edx
callq 0x4717d0
movq %rax, -0x68(%rbp)
cmpl $0x0, -0x5c(%rbp)
jle 0x47eb0a
movq -0x68(%rbp), %rdi
movl -0x58(%rbp), %esi
callq 0x47b230
movq -0x78(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rdx
callq 0x47b2f0
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x78(%rbp), %rax
movzbl 0x61(%rax), %eax
cmpl $0x0, %eax
jne 0x47eb7d
movq -0x10(%rbp), %rax
movq %rax, -0xe0(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0xd8(%rbp)
movl -0x58(%rbp), %eax
movl %eax, -0xd4(%rbp)
movl -0x5c(%rbp), %eax
movl %eax, -0xd0(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xc8(%rbp)
movq -0x30(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
xorl %edx, %edx
callq 0x483a80
movq -0x38(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x1, %ecx
movq -0x30(%rbp), %rax
orl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x47ebb8
movq -0x38(%rbp), %rax
movq 0x60(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x38(%rbp), %rax
movq $0x0, 0x60(%rax)
jmp 0x47ebba
movq -0x30(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x47e8e1
movq -0x78(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x44ff20
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xf0, %rsp
popq %rbp
retq
nopw (%rax,%rax)