// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x42254a
jmp 0x42272e
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x0, %eax
jne 0x422582
movq -0x8(%rbp), %rcx
movw 0x118(%rcx), %ax
addw $0x1, %ax
movw %ax, 0x118(%rcx)
movw %ax, -0x2a(%rbp)
jmp 0x422700
movl $0x0, -0x30(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3f, %eax
jne 0x422683
cmpl $0x2, -0x14(%rbp)
jne 0x4225b9
movq -0x28(%rbp), %rax
movsbl 0x1(%rax), %eax
subl $0x30, %eax
cltq
movq %rax, -0x38(%rbp)
movl $0x1, -0x3c(%rbp)
jmp 0x4225e6
movq -0x28(%rbp), %rdi
addq $0x1, %rdi
movl -0x14(%rbp), %edx
subl $0x1, %edx
leaq -0x38(%rbp), %rsi
movl $0x1, %ecx
callq 0x3efb50
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x422607
cmpq $0x1, -0x38(%rbp)
jl 0x422607
movq -0x38(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq 0xa0(%rcx), %rcx
cmpq %rcx, %rax
jle 0x422628
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movl 0xa0(%rax), %edx
leaq 0x18bd66(%rip), %rsi    # 0x5ae382
movb $0x0, %al
callq 0x3cb660
jmp 0x42272e
movq -0x38(%rbp), %rax
movw %ax, -0x2a(%rbp)
movswl -0x2a(%rbp), %eax
movq -0x8(%rbp), %rcx
movswl 0x118(%rcx), %ecx
cmpl %ecx, %eax
jle 0x42265e
movswl -0x2a(%rbp), %eax
movw %ax, %cx
movq -0x8(%rbp), %rax
movw %cx, 0x118(%rax)
movl $0x1, -0x30(%rbp)
jmp 0x422681
movq -0x8(%rbp), %rax
movq 0x130(%rax), %rdi
movswl -0x2a(%rbp), %esi
callq 0x3ca390
cmpq $0x0, %rax
jne 0x42267f
movl $0x1, -0x30(%rbp)
jmp 0x422681
jmp 0x4226ca
movq -0x8(%rbp), %rax
movq 0x130(%rax), %rdi
movq -0x28(%rbp), %rsi
movl -0x14(%rbp), %edx
callq 0x40f300
movw %ax, -0x2a(%rbp)
movswl -0x2a(%rbp), %eax
cmpl $0x0, %eax
jne 0x4226c8
movq -0x8(%rbp), %rcx
movw 0x118(%rcx), %ax
addw $0x1, %ax
movw %ax, 0x118(%rcx)
movw %ax, -0x2a(%rbp)
movl $0x1, -0x30(%rbp)
jmp 0x4226ca
cmpl $0x0, -0x30(%rbp)
je 0x4226fe
movq -0x20(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x130(%rax), %rsi
movq -0x28(%rbp), %rdx
movl -0x14(%rbp), %ecx
movswl -0x2a(%rbp), %r8d
callq 0x461e40
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x130(%rax)
jmp 0x422700
movw -0x2a(%rbp), %cx
movq -0x10(%rbp), %rax
movw %cx, 0x30(%rax)
movswl -0x2a(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0xa0(%rcx), %eax
jle 0x42272e
movq -0x8(%rbp), %rdi
leaq 0x18bc86(%rip), %rsi    # 0x5ae3ad
movb $0x0, %al
callq 0x3cb660
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)