// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3ExprAssignVarNumber
SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr, u32 n){
  sqlite3 *db = pParse->db;
  const char *z;
  ynVar x;

  if( pExpr==0 ) return;
  assert( !ExprHasProperty(pExpr, EP_IntValue|EP_Reduced|EP_TokenOnly) );
  z = pExpr->u.zToken;
  assert( z!=0 );
  assert( z[0]!=0 );
  assert( n==(u32)sqlite3Strlen30(z) );
  if( z[1]==0 ){
    /* Wildcard of the form "?".  Assign the next variable number */
    assert( z[0]=='?' );
    x = (ynVar)(++pParse->nVar);
  }else{
    int doAdd = 0;
    if( z[0]=='?' ){
      /* Wildcard of the form "?nnn".  Convert "nnn" to an integer and
      ** use it as the variable number */
      i64 i;
      int bOk;
      if( n==2 ){ /*OPTIMIZATION-IF-TRUE*/
        i = z[1]-'0';  /* The common case of ?N for a single digit N */
        bOk = 1;
      }else{
        bOk = 0==sqlite3Atoi64(&z[1], &i, n-1, SQLITE_UTF8);
      }
      testcase( i==0 );
      testcase( i==1 );
      testcase( i==db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]-1 );
      testcase( i==db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] );
      if( bOk==0 || i<1 || i>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){
        sqlite3ErrorMsg(pParse, "variable number must be between ?1 and ?%d",
            db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]);
        return;
      }
      x = (ynVar)i;
      if( x>pParse->nVar ){
        pParse->nVar = (int)x;
        doAdd = 1;
      }else if( sqlite3VListNumToName(pParse->pVList, x)==0 ){
        doAdd = 1;
      }
    }else{
      /* Wildcards like ":aaa", "$aaa" or "@aaa".  Reuse the same variable
      ** number as the prior appearance of the same name, or if the name
      ** has never appeared before, reuse the same variable number
      */
      x = (ynVar)sqlite3VListNameToNum(pParse->pVList, z, n);
      if( x==0 ){
        x = (ynVar)(++pParse->nVar);
        doAdd = 1;
      }
    }
    if( doAdd ){
      pParse->pVList = sqlite3VListAdd(db, pParse->pVList, z, n, x);
    }
  }
  pExpr->iColumn = x;
  if( x>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){
    sqlite3ErrorMsg(pParse, "too many SQL variables");
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
testq %rsi, %rsi
je 0x2b6980
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %r12
movq 0x8(%rsi), %rbp
movsbq 0x1(%rbp), %r13
testq %r13, %r13
je 0x2b6748
movl %edx, %r8d
cmpb $0x3f, (%rbp)
jne 0x2b675f
cmpl $0x2, %r8d
jne 0x2b67a7
addq $-0x30, %r13
xorl %eax, %eax
jmp 0x2b67cf
movl 0x118(%rbx), %r13d
incl %r13d
movw %r13w, 0x118(%rbx)
jmp 0x2b694e
movq 0x130(%rbx), %r15
movq %r15, %rdi
movq %rbp, %rsi
movl %r8d, %edx
movq %r8, 0x8(%rsp)
callq 0x2a7cd1
movl %eax, %r13d
testw %r13w, %r13w
jne 0x2b694e
movq %r12, 0x10(%rsp)
movl 0x118(%rbx), %r13d
incl %r13d
movw %r13w, 0x118(%rbx)
movq 0x8(%rsp), %r8
jmp 0x2b685a
leaq 0x1(%rbp), %rdi
leal -0x1(%r8), %edx
leaq 0x20(%rsp), %r15
movq %r15, %rsi
movl $0x1, %ecx
movq %r8, %r13
callq 0x2927e4
movq %r13, %r8
testl %eax, %eax
setne %al
movq (%r15), %r13
movl 0xa0(%r12), %edx
testb %al, %al
jne 0x2b6803
testq %r13, %r13
jle 0x2b6803
movslq %edx, %rax
cmpq %rax, %r13
jg 0x2b6803
cmpw %r13w, 0x118(%rbx)
jge 0x2b6819
movw %r13w, 0x118(%rbx)
movq 0x130(%rbx), %r15
jmp 0x2b6855
leaq 0x1226de(%rip), %rsi    # 0x3d8ee8
movq %rbx, %rdi
xorl %eax, %eax
callq 0x27b48d
jmp 0x2b6980
movq 0x130(%rbx), %r15
testq %r15, %r15
je 0x2b6846
movswl %r13w, %eax
movl 0x4(%r15), %ecx
movl $0x2, %edx
movslq %edx, %rsi
leaq (%r15,%rsi,4), %rsi
cmpl %eax, (%rsi)
je 0x2b684b
addl 0x4(%rsi), %edx
cmpl %ecx, %edx
jl 0x2b6832
jmp 0x2b6855
xorl %r15d, %r15d
jmp 0x2b6855
cmpq $-0x8, %rsi
jne 0x2b694e
movq %r12, 0x10(%rsp)
leal 0x3(%r8), %r12d
testl %r8d, %r8d
cmovnsl %r8d, %r12d
sarl $0x2, %r12d
leal 0x3(%r12), %esi
testq %r15, %r15
je 0x2b68bc
movl 0x4(%r15), %ecx
leal (%rcx,%rsi), %eax
movslq (%r15), %rdx
cmpl %edx, %eax
jle 0x2b6907
movq %r8, 0x8(%rsp)
movq %rsi, 0x18(%rsp)
movslq %esi, %rax
leaq (%rax,%rdx,2), %r12
leaq (,%r12,4), %rdx
movq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x2829e5
testq %rax, %rax
je 0x2b6942
movl 0x4(%rax), %ecx
movq %rax, %r15
jmp 0x2b68f7
movq %rsi, 0x18(%rsp)
movq %r8, 0x8(%rsp)
movslq %r12d, %rax
leaq 0x34(,%rax,4), %rsi
movq 0x10(%rsp), %rdi
callq 0x282a35
testq %rax, %rax
je 0x2b698f
movq %rax, %r15
addl $0xd, %r12d
movl $0x2, 0x4(%rax)
movl $0x2, %ecx
movq 0x8(%rsp), %r8
movl %r12d, (%r15)
movq 0x18(%rsp), %rsi
leal (%rcx,%rsi), %eax
movswl %r13w, %edx
movslq %ecx, %rcx
leaq (%r15,%rcx,4), %rdi
movq %rdi, 0x8(%rsp)
leaq (%r15,%rcx,4), %rdi
addq $0x8, %rdi
movl %edx, -0x8(%rdi)
movl %esi, -0x4(%rdi)
movl %eax, 0x4(%r15)
movslq %r8d, %r12
movq %rbp, %rsi
movq %r12, %rdx
callq 0x17660
movq 0x8(%rsp), %rax
movb $0x0, 0x8(%r12,%rax)
movq %r15, 0x130(%rbx)
movq 0x10(%rsp), %r12
movw %r13w, 0x30(%r14)
movswl %r13w, %eax
cmpl %eax, 0xa0(%r12)
jge 0x2b6980
leaq 0x1225ab(%rip), %rsi    # 0x3d8f13
movq %rbx, %rdi
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x27b48d
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
jmp 0x2b6942