// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: renameColumnFunc
static void renameColumnFunc(
  sqlite3_context *context,
  int NotUsed,
  sqlite3_value **argv
){
  sqlite3 *db = sqlite3_context_db_handle(context);
  RenameCtx sCtx;
  const char *zSql = (const char*)sqlite3_value_text(argv[0]);
  const char *zDb = (const char*)sqlite3_value_text(argv[3]);
  const char *zTable = (const char*)sqlite3_value_text(argv[4]);
  int iCol = sqlite3_value_int(argv[5]);
  const char *zNew = (const char*)sqlite3_value_text(argv[6]);
  int bQuote = sqlite3_value_int(argv[7]);
  int bTemp = sqlite3_value_int(argv[8]);
  const char *zOld;
  int rc;
  Parse sParse;
  Walker sWalker;
  Index *pIdx;
  int i;
  Table *pTab;
#ifndef SQLITE_OMIT_AUTHORIZATION
  sqlite3_xauth xAuth = db->xAuth;
#endif

  UNUSED_PARAMETER(NotUsed);
  if( zSql==0 ) return;
  if( zTable==0 ) return;
  if( zNew==0 ) return;
  if( iCol<0 ) return;
  sqlite3BtreeEnterAll(db);
  pTab = sqlite3FindTable(db, zTable, zDb);
  if( pTab==0 || iCol>=pTab->nCol ){
    sqlite3BtreeLeaveAll(db);
    return;
  }
  zOld = pTab->aCol[iCol].zName;
  memset(&sCtx, 0, sizeof(sCtx));
  sCtx.iCol = ((iCol==pTab->iPKey) ? -1 : iCol);

#ifndef SQLITE_OMIT_AUTHORIZATION
  db->xAuth = 0;
#endif
  rc = renameParseSql(&sParse, zDb, db, zSql, bTemp);

  /* Find tokens that need to be replaced. */
  memset(&sWalker, 0, sizeof(Walker));
  sWalker.pParse = &sParse;
  sWalker.xExprCallback = renameColumnExprCb;
  sWalker.xSelectCallback = renameColumnSelectCb;
  sWalker.u.pRename = &sCtx;

  sCtx.pTab = pTab;
  if( rc!=SQLITE_OK ) goto renameColumnFunc_done;
  if( sParse.pNewTable ){
    Select *pSelect = sParse.pNewTable->pSelect;
    if( pSelect ){
      pSelect->selFlags &= ~SF_View;
      sParse.rc = SQLITE_OK;
      sqlite3SelectPrep(&sParse, pSelect, 0);
      rc = (db->mallocFailed ? SQLITE_NOMEM : sParse.rc);
      if( rc==SQLITE_OK ){
        sqlite3WalkSelect(&sWalker, pSelect);
      }
      if( rc!=SQLITE_OK ) goto renameColumnFunc_done;
    }else{
      /* A regular table */
      int bFKOnly = sqlite3_stricmp(zTable, sParse.pNewTable->zName);
      FKey *pFKey;
      assert( sParse.pNewTable->pSelect==0 );
      sCtx.pTab = sParse.pNewTable;
      if( bFKOnly==0 ){
        renameTokenFind(
            &sParse, &sCtx, (void*)sParse.pNewTable->aCol[iCol].zName
        );
        if( sCtx.iCol<0 ){
          renameTokenFind(&sParse, &sCtx, (void*)&sParse.pNewTable->iPKey);
        }
        sqlite3WalkExprList(&sWalker, sParse.pNewTable->pCheck);
        for(pIdx=sParse.pNewTable->pIndex; pIdx; pIdx=pIdx->pNext){
          sqlite3WalkExprList(&sWalker, pIdx->aColExpr);
        }
        for(pIdx=sParse.pNewIndex; pIdx; pIdx=pIdx->pNext){
          sqlite3WalkExprList(&sWalker, pIdx->aColExpr);
        }
      }
#ifndef SQLITE_OMIT_GENERATED_COLUMNS
      for(i=0; i<sParse.pNewTable->nCol; i++){
        sqlite3WalkExpr(&sWalker, sParse.pNewTable->aCol[i].pDflt);
      }
#endif

      for(pFKey=sParse.pNewTable->pFKey; pFKey; pFKey=pFKey->pNextFrom){
        for(i=0; i<pFKey->nCol; i++){
          if( bFKOnly==0 && pFKey->aCol[i].iFrom==iCol ){
            renameTokenFind(&sParse, &sCtx, (void*)&pFKey->aCol[i]);
          }
          if( 0==sqlite3_stricmp(pFKey->zTo, zTable)
           && 0==sqlite3_stricmp(pFKey->aCol[i].zCol, zOld)
          ){
            renameTokenFind(&sParse, &sCtx, (void*)pFKey->aCol[i].zCol);
          }
        }
      }
    }
  }else if( sParse.pNewIndex ){
    sqlite3WalkExprList(&sWalker, sParse.pNewIndex->aColExpr);
    sqlite3WalkExpr(&sWalker, sParse.pNewIndex->pPartIdxWhere);
  }else{
    /* A trigger */
    TriggerStep *pStep;
    rc = renameResolveTrigger(&sParse);
    if( rc!=SQLITE_OK ) goto renameColumnFunc_done;

    for(pStep=sParse.pNewTrigger->step_list; pStep; pStep=pStep->pNext){
      if( pStep->zTarget ){
        Table *pTarget = sqlite3LocateTable(&sParse, 0, pStep->zTarget, zDb);
        if( pTarget==pTab ){
          if( pStep->pUpsert ){
            ExprList *pUpsertSet = pStep->pUpsert->pUpsertSet;
            renameColumnElistNames(&sParse, &sCtx, pUpsertSet, zOld);
          }
          renameColumnIdlistNames(&sParse, &sCtx, pStep->pIdList, zOld);
          renameColumnElistNames(&sParse, &sCtx, pStep->pExprList, zOld);
        }
      }
    }


    /* Find tokens to edit in UPDATE OF clause */
    if( sParse.pTriggerTab==pTab ){
      renameColumnIdlistNames(&sParse, &sCtx,sParse.pNewTrigger->pColumns,zOld);
    }

    /* Find tokens to edit in various expressions and selects */
    renameWalkTrigger(&sWalker, sParse.pNewTrigger);
  }

  assert( rc==SQLITE_OK );
  rc = renameEditSql(context, &sCtx, zSql, zNew, bQuote);

renameColumnFunc_done:
  if( rc!=SQLITE_OK ){
    if( sParse.zErrMsg ){
      renameColumnParseError(context, 0, argv[1], argv[2], &sParse);
    }else{
      sqlite3_result_error_code(context, rc);
    }
  }

  renameParseCleanup(&sParse);
  renameTokenFree(db, sCtx.pList);
#ifndef SQLITE_OMIT_AUTHORIZATION
  db->xAuth = xAuth;
#endif
  sqlite3BtreeLeaveAll(db);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2b0, %rsp            # imm = 0x2B0
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3c9230
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x3c7880
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x3c7880
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x3c7880
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x3c7a40
movl %eax, -0x5c(%rbp)
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x3c7880
movq %rax, -0x68(%rbp)
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x3c7a40
movl %eax, -0x6c(%rbp)
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x3c7a40
movl %eax, -0x70(%rbp)
movq -0x20(%rbp), %rax
movq 0x1c8(%rax), %rax
movq %rax, -0x278(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x4686e4
jmp 0x468dc5
cmpq $0x0, -0x58(%rbp)
jne 0x4686f0
jmp 0x468dc5
cmpq $0x0, -0x68(%rbp)
jne 0x4686fc
jmp 0x468dc5
cmpl $0x0, -0x5c(%rbp)
jge 0x468707
jmp 0x468dc5
movq -0x20(%rbp), %rdi
callq 0x3bfd40
movq -0x20(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
callq 0x3d38b0
movq %rax, -0x270(%rbp)
cmpq $0x0, -0x270(%rbp)
je 0x468744
movl -0x5c(%rbp), %eax
movq -0x270(%rbp), %rcx
movswl 0x46(%rcx), %ecx
cmpl %ecx, %eax
jl 0x468749
jmp 0x468dc5
movq -0x270(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x5c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x78(%rbp)
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x19360
movl -0x5c(%rbp), %eax
movq -0x270(%rbp), %rcx
movswl 0x44(%rcx), %ecx
cmpl %ecx, %eax
jne 0x468795
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x2ac(%rbp)
jmp 0x46879e
movl -0x5c(%rbp), %eax
movl %eax, -0x2ac(%rbp)
movl -0x2ac(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rax
movq $0x0, 0x1c8(%rax)
movq -0x50(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x48(%rbp), %rcx
movl -0x70(%rbp), %r8d
leaq -0x228(%rbp), %rdi
callq 0x469540
movl %eax, -0x7c(%rbp)
leaq -0x258(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x19360
leaq -0x228(%rbp), %rax
movq %rax, -0x258(%rbp)
leaq 0xe53(%rip), %rax       # 0x469650
movq %rax, -0x250(%rbp)
leaq 0xf05(%rip), %rax       # 0x469710
movq %rax, -0x248(%rbp)
leaq -0x40(%rbp), %rax
movq %rax, -0x230(%rbp)
movq -0x270(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpl $0x0, -0x7c(%rbp)
je 0x468833
jmp 0x468d58
cmpq $0x0, -0xe0(%rbp)
je 0x468ba3
movq -0xe0(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x280(%rbp)
cmpq $0x0, -0x280(%rbp)
je 0x4688ed
movq -0x280(%rbp), %rax
movl 0x4(%rax), %ecx
andl $0xffdfffff, %ecx       # imm = 0xFFDFFFFF
movl %ecx, 0x4(%rax)
movl $0x0, -0x210(%rbp)
movq -0x280(%rbp), %rsi
leaq -0x228(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0x438710
movq -0x20(%rbp), %rax
movzbl 0x61(%rax), %eax
cmpl $0x0, %eax
je 0x4688af
movl $0x7, %eax
movl %eax, -0x2b0(%rbp)
jmp 0x4688bb
movl -0x210(%rbp), %eax
movl %eax, -0x2b0(%rbp)
movl -0x2b0(%rbp), %eax
movl %eax, -0x7c(%rbp)
cmpl $0x0, -0x7c(%rbp)
jne 0x4688dd
movq -0x280(%rbp), %rsi
leaq -0x258(%rbp), %rdi
callq 0x42f7d0
cmpl $0x0, -0x7c(%rbp)
je 0x4688e8
jmp 0x468d58
jmp 0x468b9e
movq -0x58(%rbp), %rdi
movq -0xe0(%rbp), %rax
movq (%rax), %rsi
callq 0x3c3e00
movl %eax, -0x284(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpl $0x0, -0x284(%rbp)
jne 0x468a0b
movq -0xe0(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x5c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdx
leaq -0x228(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x469760
cmpl $0x0, -0x34(%rbp)
jge 0x468968
movq -0xe0(%rbp), %rdx
addq $0x44, %rdx
leaq -0x228(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x469760
movq -0xe0(%rbp), %rax
movq 0x30(%rax), %rsi
leaq -0x258(%rbp), %rdi
callq 0x42f8b0
movq -0xe0(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x260(%rbp)
cmpq $0x0, -0x260(%rbp)
je 0x4689c6
movq -0x260(%rbp), %rax
movq 0x50(%rax), %rsi
leaq -0x258(%rbp), %rdi
callq 0x42f8b0
movq -0x260(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x260(%rbp)
jmp 0x468991
movq -0xd8(%rbp), %rax
movq %rax, -0x260(%rbp)
cmpq $0x0, -0x260(%rbp)
je 0x468a09
movq -0x260(%rbp), %rax
movq 0x50(%rax), %rsi
leaq -0x258(%rbp), %rdi
callq 0x42f8b0
movq -0x260(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x260(%rbp)
jmp 0x4689d4
jmp 0x468a0b
movl $0x0, -0x264(%rbp)
movl -0x264(%rbp), %eax
movq -0xe0(%rbp), %rcx
movswl 0x46(%rcx), %ecx
cmpl %ecx, %eax
jge 0x468a64
movq -0xe0(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x264(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
leaq -0x258(%rbp), %rdi
callq 0x42f650
movl -0x264(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x264(%rbp)
jmp 0x468a15
movq -0xe0(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x290(%rbp)
cmpq $0x0, -0x290(%rbp)
je 0x468b9c
movl $0x0, -0x264(%rbp)
movl -0x264(%rbp), %eax
movq -0x290(%rbp), %rcx
cmpl 0x28(%rcx), %eax
jge 0x468b83
cmpl $0x0, -0x284(%rbp)
jne 0x468af6
movq -0x290(%rbp), %rax
addq $0x40, %rax
movslq -0x264(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %eax
cmpl -0x5c(%rbp), %eax
jne 0x468af6
movq -0x290(%rbp), %rdx
addq $0x40, %rdx
movslq -0x264(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdx
leaq -0x228(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x469760
movq -0x290(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x58(%rbp), %rsi
callq 0x3c3e00
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x468b6d
movq -0x290(%rbp), %rax
addq $0x40, %rax
movslq -0x264(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
movq -0x78(%rbp), %rsi
callq 0x3c3e00
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x468b6d
movq -0x290(%rbp), %rax
addq $0x40, %rax
movslq -0x264(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdx
leaq -0x228(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x469760
jmp 0x468b6f
movl -0x264(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x264(%rbp)
jmp 0x468a8e
jmp 0x468b85
movq -0x290(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x290(%rbp)
jmp 0x468a76
jmp 0x468b9e
jmp 0x468d3c
cmpq $0x0, -0xd8(%rbp)
je 0x468be0
movq -0xd8(%rbp), %rax
movq 0x50(%rax), %rsi
leaq -0x258(%rbp), %rdi
callq 0x42f8b0
movq -0xd8(%rbp), %rax
movq 0x48(%rax), %rsi
leaq -0x258(%rbp), %rdi
callq 0x42f650
jmp 0x468d3a
leaq -0x228(%rbp), %rdi
callq 0x4697f0
movl %eax, -0x7c(%rbp)
cmpl $0x0, -0x7c(%rbp)
je 0x468bfa
jmp 0x468d58
movq -0xd0(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x298(%rbp)
cmpq $0x0, -0x298(%rbp)
je 0x468cf8
movq -0x298(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x468cdf
movq -0x298(%rbp), %rax
movq 0x18(%rax), %rdx
movq -0x50(%rbp), %rcx
leaq -0x228(%rbp), %rdi
xorl %esi, %esi
callq 0x3cb4b0
movq %rax, -0x2a0(%rbp)
movq -0x2a0(%rbp), %rax
cmpq -0x270(%rbp), %rax
jne 0x468cdd
movq -0x298(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x468c9f
movq -0x298(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x2a8(%rbp)
movq -0x2a8(%rbp), %rdx
movq -0x78(%rbp), %rcx
leaq -0x228(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x469ba0
movq -0x298(%rbp), %rax
movq 0x38(%rax), %rdx
movq -0x78(%rbp), %rcx
leaq -0x228(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x469c60
movq -0x298(%rbp), %rax
movq 0x30(%rax), %rdx
movq -0x78(%rbp), %rcx
leaq -0x228(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x469ba0
jmp 0x468cdf
jmp 0x468ce1
movq -0x298(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x298(%rbp)
jmp 0x468c0c
movq -0x180(%rbp), %rax
cmpq -0x270(%rbp), %rax
jne 0x468d27
movq -0xd0(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x78(%rbp), %rcx
leaq -0x228(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x469c60
movq -0xd0(%rbp), %rsi
leaq -0x258(%rbp), %rdi
callq 0x469cf0
jmp 0x468d3c
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rdx
movq -0x68(%rbp), %rcx
movl -0x6c(%rbp), %r8d
leaq -0x40(%rbp), %rsi
callq 0x469dd0
movl %eax, -0x7c(%rbp)
cmpl $0x0, -0x7c(%rbp)
je 0x468d9a
cmpq $0x0, -0x220(%rbp)
je 0x468d8c
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
xorl %esi, %esi
leaq -0x228(%rbp), %r8
callq 0x469ff0
jmp 0x468d98
movq -0x8(%rbp), %rdi
movl -0x7c(%rbp), %esi
callq 0x3c8a00
jmp 0x468d9a
leaq -0x228(%rbp), %rdi
callq 0x46a080
movq -0x20(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x46a150
movq -0x278(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x1c8(%rax)
addq $0x2b0, %rsp            # imm = 0x2B0
popq %rbp
retq
nop