// File: /workspace/github_c_makefile_star2_O1/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 0x2c00fe
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %r12
movq 0x8(%rsi), %rsi
movsbq 0x1(%rsi), %rax
testq %rax, %rax
je 0x2bff42
movl %edx, %r13d
cmpb $0x3f, (%rsi)
movq %rsi, 0x20(%rsp)
jne 0x2bff56
cmpl $0x2, %r13d
jne 0x2bff84
addq $-0x30, %rax
movq %rax, 0x8(%rsp)
xorl %eax, %eax
jmp 0x2bffa0
movl 0x118(%rbx), %ebp
incl %ebp
movw %bp, 0x118(%rbx)
jmp 0x2c00cd
movq 0x130(%rbx), %rdi
movl %r13d, %edx
callq 0x2b18d0
movl %eax, %ebp
xorl %eax, %eax
testw %bp, %bp
jne 0x2bffe3
movl 0x118(%rbx), %ebp
incl %ebp
movw %bp, 0x118(%rbx)
movl $0x1, %eax
jmp 0x2bffe3
leaq 0x1(%rsi), %rdi
leal -0x1(%r13), %edx
leaq 0x8(%rsp), %rsi
movl $0x1, %ecx
callq 0x29c4f4
testl %eax, %eax
setne %al
movq 0x8(%rsp), %rbp
testq %rbp, %rbp
setle %cl
orb %al, %cl
jne 0x2bffc0
movslq 0xa0(%r12), %rax
cmpq %rax, %rbp
jle 0x2c010d
movl 0xa0(%r12), %edx
leaq 0x12266e(%rip), %rsi    # 0x3e263d
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %eax, %eax
callq 0x284eb8
xorl %eax, %eax
testb %r15b, %r15b
je 0x2c0031
movb $0x1, %cl
testl %eax, %eax
je 0x2c00c9
movq %r12, (%rsp)
movq %r13, %rax
addl $0x3, %r13d
testl %eax, %eax
movq %rax, 0x10(%rsp)
cmovnsl %eax, %r13d
movq 0x130(%rbx), %r12
sarl $0x2, %r13d
addl $0x3, %r13d
testq %r12, %r12
movq %r14, 0x18(%rsp)
je 0x2c0038
movl 0x4(%r12), %ecx
addl %r13d, %ecx
movslq (%r12), %rax
cmpl %eax, %ecx
jle 0x2c0078
addq %rax, %rax
jmp 0x2c003d
xorl %ecx, %ecx
jmp 0x2c00c9
movl $0xa, %eax
movslq %r13d, %r14
addq %rax, %r14
leaq (,%r14,4), %rdx
movq (%rsp), %rdi
movq %r12, %rsi
callq 0x28c4c8
movq %r12, %r15
testq %rax, %rax
je 0x2c0071
testq %r12, %r12
jne 0x2c006b
movl $0x2, 0x4(%rax)
movl %r14d, (%rax)
movq %rax, %r15
testq %rax, %rax
jne 0x2c007b
jmp 0x2c00b7
movq %r12, %r15
movswl %bp, %eax
movslq 0x4(%r15), %rcx
leaq (%r15,%rcx,4), %r14
leaq (%r15,%rcx,4), %rdi
addq $0x8, %rdi
movl %eax, -0x8(%rdi)
movl %r13d, -0x4(%rdi)
addl %ecx, %r13d
movl %r13d, 0x4(%r15)
movslq 0x10(%rsp), %r12
movq 0x20(%rsp), %rsi
movq %r12, %rdx
callq 0x17660
movb $0x0, 0x8(%r12,%r14)
movq %r15, %r12
movq %r12, 0x130(%rbx)
movq 0x18(%rsp), %r14
movq (%rsp), %r12
movb $0x1, %cl
testb %cl, %cl
je 0x2c00fe
movw %bp, 0x30(%r14)
movswl %bp, %eax
cmpl %eax, 0xa0(%r12)
jge 0x2c00fe
leaq 0x122582(%rip), %rsi    # 0x3e2668
movq %rbx, %rdi
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x284eb8
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpw %bp, 0x118(%rbx)
jge 0x2c012a
movw %bp, 0x118(%rbx)
movl $0x1, %eax
movb $0x1, %r15b
jmp 0x2bffde
movq 0x130(%rbx), %rcx
movl $0x1, %eax
movb $0x1, %r15b
testq %rcx, %rcx
je 0x2bffde
movswl %bp, %edx
movl 0x4(%rcx), %esi
movl $0x2, %edi
movslq %edi, %r8
leaq (%rcx,%r8,4), %r8
cmpl %edx, (%r8)
je 0x2c0166
addl 0x4(%r8), %edi
cmpl %esi, %edi
jl 0x2c014d
jmp 0x2bffde
xorl %eax, %eax
cmpq $-0x8, %r8
sete %al
jmp 0x2bffde