// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x248, %rsp            # imm = 0x248
movq %rdx, %r12
movq %rdi, 0x30(%rsp)
movq (%rdi), %rax
movq 0x28(%rax), %r14
movq (%rdx), %rdi
movl $0x1, %esi
callq 0x278305
movq %rax, %rbx
movq 0x18(%r12), %rdi
movl $0x1, %esi
callq 0x278305
movq %rax, 0x38(%rsp)
movq 0x20(%r12), %rdi
movl $0x1, %esi
callq 0x278305
movq %rax, %rbp
movq 0x28(%r12), %rdi
callq 0x27828c
movq %rax, %r13
movq 0x30(%r12), %rdi
movl $0x1, %esi
callq 0x278305
movq %rax, %r15
movq 0x38(%r12), %rdi
callq 0x27828c
movq %rax, 0x88(%rsp)
movq %r12, 0x98(%rsp)
movq 0x40(%r12), %rdi
callq 0x27828c
movq %rax, %r12
testq %rbx, %rbx
sete %al
testq %rbp, %rbp
sete %cl
orb %al, %cl
movq %r15, 0x90(%rsp)
testq %r15, %r15
sete %al
movq %r13, 0x40(%rsp)
testl %r13d, %r13d
sets %dl
orb %al, %dl
orb %cl, %dl
jne 0x2ec8ea
movq %rbx, 0x48(%rsp)
movq 0x1c8(%r14), %rax
movq %rax, 0x80(%rsp)
movslq 0x28(%r14), %rax
testq %rax, %rax
jle 0x2ec2ad
movq 0x20(%r14), %rcx
shlq $0x5, %rax
xorl %edx, %edx
movq 0x8(%rcx,%rdx), %rsi
testq %rsi, %rsi
je 0x2ec2a4
movq (%rsi), %rdi
movq 0x8(%rsi), %rsi
movq %rdi, 0x8(%rsi)
addq $0x20, %rdx
cmpq %rdx, %rax
jne 0x2ec28f
movq %r14, %rdi
movq %rbp, %rsi
movq 0x38(%rsp), %rdx
callq 0x2811f8
testq %rax, %rax
movq 0x48(%rsp), %rcx
je 0x2ec8ea
movq %rax, %rbx
movswl 0x46(%rax), %eax
cmpl %eax, 0x40(%rsp)
jge 0x2ec8ea
movq 0x8(%rbx), %rax
movq 0x40(%rsp), %rsi
movl %esi, %r15d
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
shlq $0x5, %r15
movq %r14, %rdx
movq (%rax,%r15), %r13
xorps %xmm0, %xmm0
movq %rsp, %r14
movaps %xmm0, 0x10(%r14)
movaps %xmm0, (%r14)
movswl 0x44(%rbx), %eax
cmpl %eax, %esi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovnel %esi, %eax
movl %eax, 0xc(%r14)
movq $0x0, 0x1c8(%rdx)
leaq 0xa0(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq %rdx, 0x28(%rsp)
movl %r12d, %r8d
callq 0x2ed106
xorps %xmm0, %xmm0
movups %xmm0, 0x68(%rsp)
leaq 0xa0(%rsp), %rcx
movq %rcx, 0x50(%rsp)
leaq 0xe96(%rip), %rcx       # 0x2ed1f2
movq %rcx, 0x58(%rsp)
leaq 0xf3f(%rip), %rcx       # 0x2ed2a7
movq %rcx, 0x60(%rsp)
movq %r14, 0x78(%rsp)
movq %rbx, 0x10(%r14)
testl %eax, %eax
je 0x2ec3ba
movq 0x28(%rsp), %r14
movq 0x30(%rsp), %r12
cmpq $0x0, 0xa8(%rsp)
je 0x2ec428
movq 0x98(%rsp), %rax
movq 0x8(%rax), %rdx
movq 0x10(%rax), %rcx
leaq 0xa0(%rsp), %r8
movq %r12, %rdi
xorl %esi, %esi
callq 0x2ed9da
jmp 0x2ec8b1
movq 0x1e8(%rsp), %rax
testq %rax, %rax
je 0x2ec437
movq 0x18(%rax), %rbx
testq %rbx, %rbx
je 0x2ec476
andb $-0x21, 0x6(%rbx)
leaq 0xa0(%rsp), %rdi
movl $0x0, 0x18(%rdi)
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2c6ee7
movq 0x28(%rsp), %r14
cmpb $0x0, 0x61(%r14)
movl $0x7, %eax
jne 0x2ec409
movl 0xb8(%rsp), %eax
testl %eax, %eax
movq 0x30(%rsp), %r12
jne 0x2ec384
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x2c0b5b
jmp 0x2ec87f
movq %r12, %rdi
movl %eax, %esi
callq 0x278a51
jmp 0x2ec8b1
movq 0x1f0(%rsp), %rax
testq %rax, %rax
je 0x2ec4bc
movq 0x50(%rax), %rsi
leaq 0x50(%rsp), %rdi
callq 0x2c0cc0
movq 0x1f0(%rsp), %rax
movq 0x48(%rax), %rsi
testq %rsi, %rsi
je 0x2ec87f
leaq 0x50(%rsp), %rdi
callq 0x2c0a8c
jmp 0x2ec87f
movq (%rax), %rcx
testq %rcx, %rcx
je 0x2ec4af
xorl %edx, %edx
leaq 0xe4e59(%rip), %rsi     # 0x3d12e0
movzbl (%rbp,%rdx), %edi
movzbl (%rcx,%rdx), %r8d
cmpb %r8b, %dil
jne 0x2ec4a0
testq %rdi, %rdi
jne 0x2ec4aa
jmp 0x2ec597
movb (%rdi,%rsi), %dil
cmpb (%r8,%rsi), %dil
jne 0x2ec4af
incq %rdx
jmp 0x2ec487
movq %rax, 0x10(%rsp)
xorl %r12d, %r12d
jmp 0x2ec6a6
leaq 0xa0(%rsp), %rdi
callq 0x2ed2c3
testl %eax, %eax
jne 0x2ec37a
movq 0x1f8(%rsp), %rsi
movq 0x38(%rsi), %rbp
testq %rbp, %rbp
je 0x2ec55d
leaq 0xa0(%rsp), %r14
movq %rsp, %r12
movq 0x38(%rsp), %r15
movq 0x18(%rbp), %rdx
testq %rdx, %rdx
je 0x2ec54c
movq %r14, %rdi
xorl %esi, %esi
movq %r15, %rcx
callq 0x27b1c7
cmpq %rbx, %rax
jne 0x2ec54c
movq 0x40(%rbp), %rax
testq %rax, %rax
je 0x2ec528
movq 0x10(%rax), %rdx
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rcx
callq 0x2ed55b
movq 0x38(%rbp), %rdx
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rcx
callq 0x2ed617
movq 0x30(%rbp), %rdx
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rcx
callq 0x2ed55b
movq 0x50(%rbp), %rbp
testq %rbp, %rbp
jne 0x2ec4f2
movq 0x1f8(%rsp), %rsi
cmpq %rbx, 0x148(%rsp)
jne 0x2ec588
movq 0x20(%rsi), %rdx
leaq 0xa0(%rsp), %rbx
movq %rsp, %rsi
movq %rbx, %rdi
movq %r13, %rcx
callq 0x2ed617
movq 0x158(%rbx), %rsi
leaq 0x50(%rsp), %rdi
callq 0x2ed6cf
jmp 0x2ec87f
movq %rax, 0x10(%rsp)
leaq 0x240(%rsp), %rcx
movq (%rcx), %rdx
testq %rdx, %rdx
je 0x2ec5f2
movq 0x8(%rax), %rsi
movq (%rsi,%r15), %rdi
cmpq %rdi, (%rdx)
je 0x2ec5d0
movq %rdx, %rsi
movq 0x18(%rdx), %rdx
testq %rdx, %rdx
je 0x2ec5f2
cmpq %rdi, (%rdx)
jne 0x2ec5b9
addq $0x18, %rsi
jmp 0x2ec5d3
movq %rcx, %rsi
movq 0x18(%rdx), %rax
movq %rax, (%rsi)
movq (%rsp), %rax
movq %rax, 0x18(%rdx)
movq %rdx, (%rsp)
incl 0x8(%rsp)
movq 0x1e8(%rsp), %rax
cmpl $0x0, 0xc(%rsp)
jns 0x2ec643
movq 0x240(%rsp), %rdx
testq %rdx, %rdx
je 0x2ec643
leaq 0x44(%rax), %rsi
cmpq %rsi, (%rdx)
je 0x2ec624
movq %rdx, %rcx
movq 0x18(%rdx), %rdx
testq %rdx, %rdx
je 0x2ec643
cmpq %rsi, (%rdx)
jne 0x2ec60f
addq $0x18, %rcx
movq 0x18(%rdx), %rax
movq %rax, (%rcx)
movq (%rsp), %rax
movq %rax, 0x18(%rdx)
movq %rdx, (%rsp)
incl 0x8(%rsp)
movq 0x1e8(%rsp), %rax
movq 0x30(%rax), %rsi
leaq 0x50(%rsp), %rdi
callq 0x2c0cc0
movq 0x1e8(%rsp), %rax
movq 0x10(%rax), %r14
testq %r14, %r14
je 0x2ec67c
leaq 0x50(%rsp), %rbx
movq 0x50(%r14), %rsi
movq %rbx, %rdi
callq 0x2c0cc0
movq 0x28(%r14), %r14
testq %r14, %r14
jne 0x2ec667
movq 0x1f0(%rsp), %r14
movb $0x1, %r12b
testq %r14, %r14
je 0x2ec6a6
leaq 0x50(%rsp), %rbx
movq 0x50(%r14), %rsi
movq %rbx, %rdi
callq 0x2c0cc0
movq 0x28(%r14), %r14
testq %r14, %r14
jne 0x2ec691
movq 0x1e8(%rsp), %rax
cmpw $0x0, 0x46(%rax)
jle 0x2ec6f0
movl $0x8, %r14d
xorl %ebx, %ebx
leaq 0x50(%rsp), %r15
movq 0x8(%rax), %rcx
movq (%rcx,%r14), %rsi
testq %rsi, %rsi
je 0x2ec6df
movq %r15, %rdi
callq 0x2c0a8c
movq 0x1e8(%rsp), %rax
incq %rbx
movswq 0x46(%rax), %rcx
addq $0x20, %r14
cmpq %rcx, %rbx
jl 0x2ec6c2
movq 0x20(%rax), %rax
testq %rax, %rax
je 0x2ec87f
movl 0x8(%rsp), %edx
movq (%rsp), %rdi
leaq 0xe4bd4(%rip), %rsi     # 0x3d12e0
movslq 0x28(%rax), %r8
testq %r8, %r8
jle 0x2ec872
leaq 0x40(%rax), %r9
xorl %r10d, %r10d
testb %r12b, %r12b
je 0x2ec789
movq %r10, %rbx
shlq $0x4, %rbx
movq 0x40(%rsp), %rcx
cmpl %ecx, (%r9,%rbx)
setne %cl
movq 0x240(%rsp), %r11
testq %r11, %r11
sete %r14b
orb %cl, %r14b
jne 0x2ec789
addq %r9, %rbx
leaq 0x240(%rsp), %r14
cmpq %rbx, (%r11)
je 0x2ec771
movq %r11, %r14
movq 0x18(%r11), %r11
testq %r11, %r11
je 0x2ec789
cmpq %rbx, (%r11)
jne 0x2ec75c
addq $0x18, %r14
movq 0x18(%r11), %rcx
movq %rcx, (%r14)
movq %rdi, 0x18(%r11)
movq %r11, (%rsp)
incl %edx
movl %edx, 0x8(%rsp)
movq %r11, %rdi
movq 0x10(%rax), %r11
testq %r11, %r11
je 0x2ec866
xorl %ebx, %ebx
movzbl (%r11,%rbx), %r14d
movzbl (%rbp,%rbx), %ecx
cmpb %cl, %r14b
jne 0x2ec7ae
testq %r14, %r14
jne 0x2ec7bc
jmp 0x2ec7c1
movb (%r14,%rsi), %r14b
cmpb (%rcx,%rsi), %r14b
jne 0x2ec866
incq %rbx
jmp 0x2ec798
movq %r10, %rcx
shlq $0x4, %rcx
movq 0x8(%r9,%rcx), %r11
testq %r11, %r11
je 0x2ec803
testq %r13, %r13
je 0x2ec866
xorl %ebx, %ebx
movzbl (%r11,%rbx), %r14d
movzbl (%r13,%rbx), %ecx
cmpb %cl, %r14b
jne 0x2ec7f4
testq %r14, %r14
jne 0x2ec7fe
jmp 0x2ec81f
movb (%r14,%rsi), %r14b
cmpb (%rcx,%rsi), %r14b
jne 0x2ec866
incq %rbx
jmp 0x2ec7dd
testq %r13, %r13
setne %cl
movq 0x240(%rsp), %rbx
testq %rbx, %rbx
sete %r14b
orb %cl, %r14b
je 0x2ec82c
jmp 0x2ec866
movq 0x240(%rsp), %rbx
testq %rbx, %rbx
je 0x2ec866
leaq 0x240(%rsp), %r14
cmpq %r11, (%rbx)
je 0x2ec84e
movq %rbx, %r14
movq 0x18(%rbx), %rbx
testq %rbx, %rbx
je 0x2ec866
cmpq %r11, (%rbx)
jne 0x2ec839
addq $0x18, %r14
movq 0x18(%rbx), %rcx
movq %rcx, (%r14)
movq %rdi, 0x18(%rbx)
movq %rbx, (%rsp)
incl %edx
movl %edx, 0x8(%rsp)
movq %rbx, %rdi
incq %r10
cmpq %r8, %r10
jne 0x2ec720
movq 0x8(%rax), %rax
testq %rax, %rax
jne 0x2ec70c
movq %rsp, %rsi
movq 0x30(%rsp), %r12
movq %r12, %rdi
movq 0x48(%rsp), %rdx
movq 0x90(%rsp), %rcx
movq 0x88(%rsp), %r8
callq 0x2ed76b
testl %eax, %eax
movq 0x28(%rsp), %r14
jne 0x2ec384
leaq 0xa0(%rsp), %rdi
callq 0x2eda6c
movq (%rsp), %rsi
testq %rsi, %rsi
je 0x2ec8db
movq 0x18(%rsi), %rbx
movq %r14, %rdi
callq 0x282904
movq %rbx, %rsi
testq %rbx, %rbx
jne 0x2ec8c7
movq 0x80(%rsp), %rax
movq %rax, 0x1c8(%r14)
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq