// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3VtabOverloadFunction
SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction(
  sqlite3 *db,    /* Database connection for reporting malloc problems */
  FuncDef *pDef,  /* Function to possibly overload */
  int nArg,       /* Number of arguments to the function */
  Expr *pExpr     /* First argument to the function */
){
  Table *pTab;
  sqlite3_vtab *pVtab;
  sqlite3_module *pMod;
  void (*xSFunc)(sqlite3_context*,int,sqlite3_value**) = 0;
  void *pArg = 0;
  FuncDef *pNew;
  int rc = 0;

  /* Check to see the left operand is a column in a virtual table */
  if( NEVER(pExpr==0) ) return pDef;
  if( pExpr->op!=TK_COLUMN ) return pDef;
  pTab = pExpr->y.pTab;
  if( pTab==0 ) return pDef;
  if( !IsVirtual(pTab) ) return pDef;
  pVtab = sqlite3GetVTable(db, pTab)->pVtab;
  assert( pVtab!=0 );
  assert( pVtab->pModule!=0 );
  pMod = (sqlite3_module *)pVtab->pModule;
  if( pMod->xFindFunction==0 ) return pDef;

  /* Call the xFindFunction method on the virtual table implementation
  ** to see if the implementation wants to overload this function.
  **
  ** Though undocumented, we have historically always invoked xFindFunction
  ** with an all lower-case function name.  Continue in this tradition to
  ** avoid any chance of an incompatibility.
  */
#ifdef SQLITE_DEBUG
  {
    int i;
    for(i=0; pDef->zName[i]; i++){
      unsigned char x = (unsigned char)pDef->zName[i];
      assert( x==sqlite3UpperToLower[x] );
    }
  }
#endif
  rc = pMod->xFindFunction(pVtab, nArg, pDef->zName, &xSFunc, &pArg);
  if( rc==0 ){
    return pDef;
  }

  /* Create a new ephemeral function definition for the overloaded
  ** function */
  pNew = sqlite3DbMallocZero(db, sizeof(*pNew)
                             + sqlite3Strlen30(pDef->zName) + 1);
  if( pNew==0 ){
    return pDef;
  }
  *pNew = *pDef;
  pNew->zName = (const char*)&pNew[1];
  memcpy((char*)&pNew[1], pDef->zName, sqlite3Strlen30(pDef->zName)+1);
  pNew->xSFunc = xSFunc;
  pNew->pUserData = pArg;
  pNew->funcFlags |= SQLITE_FUNC_EPHEM;
  return pNew;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movl $0x0, -0x5c(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x42cdf5
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x42cf84
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xa4, %eax
je 0x42ce10
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x42cf84
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x42ce30
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x42cf84
movq -0x30(%rbp), %rax
cmpl $0x0, 0x54(%rax)
jne 0x42ce47
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x42cf84
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x40f150
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq $0x0, 0x90(%rax)
jne 0x42ce82
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x42cf84
movq -0x40(%rbp), %rax
movq 0x90(%rax), %rax
movq -0x38(%rbp), %rdi
movl -0x1c(%rbp), %esi
movq -0x18(%rbp), %rcx
movq 0x38(%rcx), %rdx
leaq -0x48(%rbp), %rcx
leaq -0x50(%rbp), %r8
callq *%rax
movl %eax, -0x5c(%rbp)
cmpl $0x0, -0x5c(%rbp)
jne 0x42cebc
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x42cf84
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x3c3400
movq -0x68(%rbp), %rdi
movslq %eax, %rsi
addq $0x48, %rsi
addq $0x1, %rsi
callq 0x3c9520
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
jne 0x42cefd
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x42cf84
movq -0x58(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x48, %edx
callq 0x19610
movq -0x58(%rbp), %rcx
addq $0x48, %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x58(%rbp), %rax
addq $0x48, %rax
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x3c3400
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rsi
addl $0x1, %eax
movslq %eax, %rdx
callq 0x19610
movq -0x48(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x50(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x58(%rbp), %rax
movl 0x4(%rax), %ecx
orl $0x10, %ecx
movl %ecx, 0x4(%rax)
movq -0x58(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)