// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3ExprAssignVarNumber
SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr){
  sqlite3 *db = pParse->db;
  const char *z;

  if( pExpr==0 ) return;
  assert( !ExprHasAnyProperty(pExpr, EP_IntValue|EP_Reduced|EP_TokenOnly) );
  z = pExpr->u.zToken;
  assert( z!=0 );
  assert( z[0]!=0 );
  if( z[1]==0 ){
    /* Wildcard of the form "?".  Assign the next variable number */
    assert( z[0]=='?' );
    pExpr->iColumn = (ynVar)(++pParse->nVar);
  }else{
    ynVar x = 0;
    u32 n = sqlite3Strlen30(z);
    if( z[0]=='?' ){
      /* Wildcard of the form "?nnn".  Convert "nnn" to an integer and
      ** use it as the variable number */
      i64 i;
      int bOk = 0==sqlite3Atoi64(&z[1], &i, n-1, SQLITE_UTF8);
      pExpr->iColumn = x = (ynVar)i;
      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]);
        x = 0;
      }
      if( i>pParse->nVar ){
        pParse->nVar = (int)i;
      }
    }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
      */
      ynVar i;
      for(i=0; i<pParse->nzVar; i++){
        if( pParse->azVar[i] && strcmp(pParse->azVar[i],z)==0 ){
          pExpr->iColumn = x = (ynVar)i+1;
          break;
        }
      }
      if( x==0 ) x = pExpr->iColumn = (ynVar)(++pParse->nVar);
    }
    if( x>0 ){
      if( x>pParse->nzVar ){
        char **a;
        a = sqlite3DbRealloc(db, pParse->azVar, x*sizeof(a[0]));
        if( a==0 ) return;  /* Error reported through db->mallocFailed */
        pParse->azVar = a;
        memset(&a[pParse->nzVar], 0, (x-pParse->nzVar)*sizeof(a[0]));
        pParse->nzVar = x;
      }
      if( z[0]!='?' || pParse->azVar[x-1]==0 ){
        sqlite3DbFree(db, pParse->azVar[x-1]);
        pParse->azVar[x-1] = sqlite3DbStrNDup(db, z, n);
      }
    }
  } 
  if( !pParse->nErr && pParse->nVar>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)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x57b17
jmp 0x57e09
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x0, %eax
jne 0x57b53
movq -0x8(%rbp), %rcx
movl 0x1f8(%rcx), %eax
addl $0x1, %eax
movl %eax, 0x1f8(%rcx)
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x30(%rax)
jmp 0x57dd7
movw $0x0, -0x22(%rbp)
movq -0x20(%rbp), %rdi
callq 0x92f0
movl %eax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3f, %eax
jne 0x57c21
movq -0x20(%rbp), %rdi
addq $0x1, %rdi
movl -0x28(%rbp), %edx
subl $0x1, %edx
leaq -0x30(%rbp), %rsi
movl $0x1, %ecx
callq 0x1b4d0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x34(%rbp)
movq -0x30(%rbp), %rax
movw %ax, %cx
movw %cx, -0x22(%rbp)
movq -0x10(%rbp), %rax
movw %cx, 0x30(%rax)
cmpl $0x0, -0x34(%rbp)
je 0x57bd6
cmpq $0x1, -0x30(%rbp)
jl 0x57bd6
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq 0x8c(%rcx), %rcx
cmpq %rcx, %rax
jle 0x57bf8
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x8c(%rax), %edx
leaq 0x58def(%rip), %rsi     # 0xb09da
movb $0x0, %al
callq 0x136f0
movw $0x0, -0x22(%rbp)
movq -0x30(%rbp), %rax
movq -0x8(%rbp), %rcx
movslq 0x1f8(%rcx), %rcx
cmpq %rcx, %rax
jle 0x57c1c
movq -0x30(%rbp), %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x1f8(%rax)
jmp 0x57cc2
movw $0x0, -0x36(%rbp)
movswl -0x36(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x1fc(%rcx), %eax
jge 0x57c98
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
movswq -0x36(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x57c88
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
movswq -0x36(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x20(%rbp), %rsi
callq 0x85d0
cmpl $0x0, %eax
jne 0x57c88
movswl -0x36(%rbp), %eax
addl $0x1, %eax
movw %ax, %cx
movw %cx, -0x22(%rbp)
movq -0x10(%rbp), %rax
movw %cx, 0x30(%rax)
jmp 0x57c98
jmp 0x57c8a
movw -0x36(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x36(%rbp)
jmp 0x57c27
movswl -0x22(%rbp), %eax
cmpl $0x0, %eax
jne 0x57cc0
movq -0x8(%rbp), %rcx
movl 0x1f8(%rcx), %eax
addl $0x1, %eax
movl %eax, 0x1f8(%rcx)
movq -0x10(%rbp), %rcx
movw %ax, 0x30(%rcx)
movw %ax, -0x22(%rbp)
jmp 0x57cc2
movswl -0x22(%rbp), %eax
cmpl $0x0, %eax
jle 0x57dd5
movswl -0x22(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x1fc(%rcx), %eax
jle 0x57d5d
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rsi
movswq -0x22(%rbp), %rax
shlq $0x3, %rax
movl %eax, %edx
callq 0x1bee0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x57d0e
jmp 0x57e09
movq -0x40(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x218(%rax)
movq -0x40(%rbp), %rdi
movq -0x8(%rbp), %rax
movslq 0x1fc(%rax), %rax
shlq $0x3, %rax
addq %rax, %rdi
movswl -0x22(%rbp), %eax
movq -0x8(%rbp), %rcx
subl 0x1fc(%rcx), %eax
movslq %eax, %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x8200
movswl -0x22(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x1fc(%rax)
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3f, %eax
jne 0x57d85
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
movswl -0x22(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x57dd3
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
movswl -0x22(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
callq 0x9cd0
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl -0x28(%rbp), %edx
callq 0x4a7a0
movq %rax, %rdx
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
movswl -0x22(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x57dd5
jmp 0x57dd7
movq -0x8(%rbp), %rax
cmpl $0x0, 0x50(%rax)
jne 0x57e09
movq -0x8(%rbp), %rax
movl 0x1f8(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x8c(%rcx), %eax
jle 0x57e09
movq -0x8(%rbp), %rdi
leaq 0x58c03(%rip), %rsi     # 0xb0a05
movb $0x0, %al
callq 0x136f0
addq $0x40, %rsp
popq %rbp
retq
nop