// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: updateFromSelect
static void updateFromSelect(
  Parse *pParse,                  /* Parse context */
  int iEph,                       /* Cursor for open eph. table */
  Index *pPk,                     /* PK if table 0 is WITHOUT ROWID */
  ExprList *pChanges,             /* List of expressions to return */
  SrcList *pTabList,              /* List of tables to select from */
  Expr *pWhere,                   /* WHERE clause for query */
  ExprList *pOrderBy,             /* ORDER BY clause */
  Expr *pLimit                    /* LIMIT clause */
){
  int i;
  SelectDest dest;
  Select *pSelect = 0;
  ExprList *pList = 0;
  ExprList *pGrp = 0;
  Expr *pLimit2 = 0;
  ExprList *pOrderBy2 = 0;
  sqlite3 *db = pParse->db;
  Table *pTab = pTabList->a[0].pTab;
  SrcList *pSrc;
  Expr *pWhere2;
  int eDest;

#ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT
  if( pOrderBy && pLimit==0 ) {
    sqlite3ErrorMsg(pParse, "ORDER BY without LIMIT on UPDATE");
    return;
  }
  pOrderBy2 = sqlite3ExprListDup(db, pOrderBy, 0);
  pLimit2 = sqlite3ExprDup(db, pLimit, 0);
#else
  UNUSED_PARAMETER(pOrderBy);
  UNUSED_PARAMETER(pLimit);
#endif

  pSrc = sqlite3SrcListDup(db, pTabList, 0);
  pWhere2 = sqlite3ExprDup(db, pWhere, 0);

  assert( pTabList->nSrc>1 );
  if( pSrc ){
    pSrc->a[0].iCursor = -1;
    pSrc->a[0].pTab->nTabRef--;
    pSrc->a[0].pTab = 0;
  }
  if( pPk ){
    for(i=0; i<pPk->nKeyCol; i++){
      Expr *pNew = exprRowColumn(pParse, pPk->aiColumn[i]);
#ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT
      if( pLimit ){
        pGrp = sqlite3ExprListAppend(pParse, pGrp, sqlite3ExprDup(db, pNew, 0));
      }
#endif
      pList = sqlite3ExprListAppend(pParse, pList, pNew);
    }
    eDest = SRT_Upfrom;
  }else if( pTab->pSelect ){
    for(i=0; i<pTab->nCol; i++){
      pList = sqlite3ExprListAppend(pParse, pList, exprRowColumn(pParse, i));
    }
    eDest = SRT_Table;
  }else{
    eDest = IsVirtual(pTab) ? SRT_Table : SRT_Upfrom;
    pList = sqlite3ExprListAppend(pParse, 0, sqlite3PExpr(pParse,TK_ROW,0,0));
#ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT
    if( pLimit ){
      pGrp = sqlite3ExprListAppend(pParse, 0, sqlite3PExpr(pParse,TK_ROW,0,0));
    }
#endif
  }
  if( ALWAYS(pChanges) ){
    for(i=0; i<pChanges->nExpr; i++){
      pList = sqlite3ExprListAppend(pParse, pList,
          sqlite3ExprDup(db, pChanges->a[i].pExpr, 0)
      );
    }
  }
  pSelect = sqlite3SelectNew(pParse, pList,
      pSrc, pWhere2, pGrp, 0, pOrderBy2, SF_UpdateFrom|SF_IncludeHidden, pLimit2
  );
  sqlite3SelectDestInit(&dest, eDest, iEph);
  dest.iSDParm2 = (pPk ? pPk->nKeyCol : -1);
  sqlite3Select(pParse, pSelect, &dest);
  sqlite3SelectDelete(db, pSelect);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r9, %r12
movq %rcx, %r13
movq %rdx, %r15
movl %esi, 0x2c(%rsp)
movq %rdi, %r14
movq (%rdi), %rbp
movq 0x28(%r8), %rbx
movq %rbp, %rdi
movq %r8, %rsi
xorl %edx, %edx
callq 0x269ff5
movq %rbp, 0x30(%rsp)
movq %rbp, %rdi
movq %r12, %rsi
movq %rax, %r12
xorl %edx, %edx
callq 0x267197
movq %rax, 0x38(%rsp)
testq %r12, %r12
je 0x2815a0
orl $-0x1, 0x48(%r12)
movq 0x28(%r12), %rax
decl 0x3c(%rax)
andq $0x0, 0x28(%r12)
testq %r15, %r15
je 0x2815dd
xorl %ebx, %ebx
xorl %ebp, %ebp
movzwl 0x5e(%r15), %eax
cmpq %rax, %rbx
jae 0x2815d9
movq 0x8(%r15), %rax
movswl (%rax,%rbx,2), %esi
movq %r14, %rdi
callq 0x282e03
movq %r14, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x25bc95
movq %rax, %rbp
incq %rbx
jmp 0x2815a9
movb $0xf, %bl
jmp 0x28164a
cmpq $0x0, 0x18(%rbx)
je 0x281621
movq %r12, 0x20(%rsp)
xorl %ebp, %ebp
xorl %r12d, %r12d
movswl 0x46(%rbx), %eax
cmpl %eax, %r12d
jge 0x281618
movq %r14, %rdi
movl %r12d, %esi
callq 0x282e03
movq %r14, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x25bc95
movq %rax, %rbp
incl %r12d
jmp 0x2815ee
movb $0xe, %bl
movq 0x20(%rsp), %r12
jmp 0x28164a
cmpl $0x0, 0x54(%rbx)
sete %bl
pushq $0x4b
popq %rsi
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x254915
movq %r14, %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0x25bc95
movq %rax, %rbp
orb $0xe, %bl
testq %r13, %r13
je 0x28169a
movb %bl, 0x1f(%rsp)
movq %r12, 0x20(%rsp)
leaq 0x8(%r13), %rbx
xorl %r12d, %r12d
movslq (%r13), %rax
cmpq %rax, %r12
jge 0x281691
movq (%rbx), %rsi
movq 0x30(%rsp), %rdi
xorl %edx, %edx
callq 0x267197
movq %r14, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x25bc95
movq %rax, %rbp
incq %r12
addq $0x18, %rbx
jmp 0x28165f
movq 0x20(%rsp), %r12
movb 0x1f(%rsp), %bl
andq $0x0, 0x10(%rsp)
andq $0x0, (%rsp)
movl $0x820000, 0x8(%rsp)    # imm = 0x820000
movq %r14, %rdi
movq %rbp, %rsi
movq %r12, %rdx
movq 0x38(%rsp), %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x25bb53
andq $0x0, 0x58(%rsp)
andq $0x0, 0x4c(%rsp)
movq %rax, %r12
movb %bl, 0x40(%rsp)
movl 0x2c(%rsp), %eax
movl %eax, 0x44(%rsp)
testq %r15, %r15
je 0x2816ed
movzwl 0x5e(%r15), %eax
jmp 0x2816f0
pushq $-0x1
popq %rax
leaq 0x40(%rsp), %rdx
movl %eax, 0x8(%rdx)
movq %r14, %rdi
movq %r12, %rsi
callq 0x2565ce
movq 0x30(%rsp), %rdi
movq %r12, %rsi
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x24b6e9