// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3GetToken
SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){
  int i, c;
  switch( *z ){
    case ' ': case '\t': case '\n': case '\f': case '\r': {
      testcase( z[0]==' ' );
      testcase( z[0]=='\t' );
      testcase( z[0]=='\n' );
      testcase( z[0]=='\f' );
      testcase( z[0]=='\r' );
      for(i=1; sqlite3Isspace(z[i]); i++){}
      *tokenType = TK_SPACE;
      return i;
    }
    case '-': {
      if( z[1]=='-' ){
        for(i=2; (c=z[i])!=0 && c!='\n'; i++){}
        *tokenType = TK_SPACE;   /* IMP: R-22934-25134 */
        return i;
      }
      *tokenType = TK_MINUS;
      return 1;
    }
    case '(': {
      *tokenType = TK_LP;
      return 1;
    }
    case ')': {
      *tokenType = TK_RP;
      return 1;
    }
    case ';': {
      *tokenType = TK_SEMI;
      return 1;
    }
    case '+': {
      *tokenType = TK_PLUS;
      return 1;
    }
    case '*': {
      *tokenType = TK_STAR;
      return 1;
    }
    case '/': {
      if( z[1]!='*' || z[2]==0 ){
        *tokenType = TK_SLASH;
        return 1;
      }
      for(i=3, c=z[2]; (c!='*' || z[i]!='/') && (c=z[i])!=0; i++){}
      if( c ) i++;
      *tokenType = TK_SPACE;   /* IMP: R-22934-25134 */
      return i;
    }
    case '%': {
      *tokenType = TK_REM;
      return 1;
    }
    case '=': {
      *tokenType = TK_EQ;
      return 1 + (z[1]=='=');
    }
    case '<': {
      if( (c=z[1])=='=' ){
        *tokenType = TK_LE;
        return 2;
      }else if( c=='>' ){
        *tokenType = TK_NE;
        return 2;
      }else if( c=='<' ){
        *tokenType = TK_LSHIFT;
        return 2;
      }else{
        *tokenType = TK_LT;
        return 1;
      }
    }
    case '>': {
      if( (c=z[1])=='=' ){
        *tokenType = TK_GE;
        return 2;
      }else if( c=='>' ){
        *tokenType = TK_RSHIFT;
        return 2;
      }else{
        *tokenType = TK_GT;
        return 1;
      }
    }
    case '!': {
      if( z[1]!='=' ){
        *tokenType = TK_ILLEGAL;
        return 2;
      }else{
        *tokenType = TK_NE;
        return 2;
      }
    }
    case '|': {
      if( z[1]!='|' ){
        *tokenType = TK_BITOR;
        return 1;
      }else{
        *tokenType = TK_CONCAT;
        return 2;
      }
    }
    case ',': {
      *tokenType = TK_COMMA;
      return 1;
    }
    case '&': {
      *tokenType = TK_BITAND;
      return 1;
    }
    case '~': {
      *tokenType = TK_BITNOT;
      return 1;
    }
    case '`':
    case '\'':
    case '"': {
      int delim = z[0];
      testcase( delim=='`' );
      testcase( delim=='\'' );
      testcase( delim=='"' );
      for(i=1; (c=z[i])!=0; i++){
        if( c==delim ){
          if( z[i+1]==delim ){
            i++;
          }else{
            break;
          }
        }
      }
      if( c=='\'' ){
        *tokenType = TK_STRING;
        return i+1;
      }else if( c!=0 ){
        *tokenType = TK_ID;
        return i+1;
      }else{
        *tokenType = TK_ILLEGAL;
        return i;
      }
    }
    case '.': {
#ifndef SQLITE_OMIT_FLOATING_POINT
      if( !sqlite3Isdigit(z[1]) )
#endif
      {
        *tokenType = TK_DOT;
        return 1;
      }
      /* If the next character is a digit, this is a floating point
      ** number that begins with ".".  Fall thru into the next case */
    }
    case '0': case '1': case '2': case '3': case '4':
    case '5': case '6': case '7': case '8': case '9': {
      testcase( z[0]=='0' );  testcase( z[0]=='1' );  testcase( z[0]=='2' );
      testcase( z[0]=='3' );  testcase( z[0]=='4' );  testcase( z[0]=='5' );
      testcase( z[0]=='6' );  testcase( z[0]=='7' );  testcase( z[0]=='8' );
      testcase( z[0]=='9' );
      *tokenType = TK_INTEGER;
      for(i=0; sqlite3Isdigit(z[i]); i++){}
#ifndef SQLITE_OMIT_FLOATING_POINT
      if( z[i]=='.' ){
        i++;
        while( sqlite3Isdigit(z[i]) ){ i++; }
        *tokenType = TK_FLOAT;
      }
      if( (z[i]=='e' || z[i]=='E') &&
           ( sqlite3Isdigit(z[i+1]) 
            || ((z[i+1]=='+' || z[i+1]=='-') && sqlite3Isdigit(z[i+2]))
           )
      ){
        i += 2;
        while( sqlite3Isdigit(z[i]) ){ i++; }
        *tokenType = TK_FLOAT;
      }
#endif
      while( IdChar(z[i]) ){
        *tokenType = TK_ILLEGAL;
        i++;
      }
      return i;
    }
    case '[': {
      for(i=1, c=z[0]; c!=']' && (c=z[i])!=0; i++){}
      *tokenType = c==']' ? TK_ID : TK_ILLEGAL;
      return i;
    }
    case '?': {
      *tokenType = TK_VARIABLE;
      for(i=1; sqlite3Isdigit(z[i]); i++){}
      return i;
    }
    case '#': {
      for(i=1; sqlite3Isdigit(z[i]); i++){}
      if( i>1 ){
        /* Parameters of the form #NNN (where NNN is a number) are used
        ** internally by sqlite3NestedParse.  */
        *tokenType = TK_REGISTER;
        return i;
      }
      /* Fall through into the next case if the '#' is not followed by
      ** a digit. Try to match #AAAA where AAAA is a parameter name. */
    }
#ifndef SQLITE_OMIT_TCL_VARIABLE
    case '$':
#endif
    case '@':  /* For compatibility with MS SQL Server */
    case ':': {
      int n = 0;
      testcase( z[0]=='$' );  testcase( z[0]=='@' );  testcase( z[0]==':' );
      *tokenType = TK_VARIABLE;
      for(i=1; (c=z[i])!=0; i++){
        if( IdChar(c) ){
          n++;
#ifndef SQLITE_OMIT_TCL_VARIABLE
        }else if( c=='(' && n>0 ){
          do{
            i++;
          }while( (c=z[i])!=0 && !sqlite3Isspace(c) && c!=')' );
          if( c==')' ){
            i++;
          }else{
            *tokenType = TK_ILLEGAL;
          }
          break;
        }else if( c==':' && z[i+1]==':' ){
          i++;
#endif
        }else{
          break;
        }
      }
      if( n==0 ) *tokenType = TK_ILLEGAL;
      return i;
    }
#ifndef SQLITE_OMIT_BLOB_LITERAL
    case 'x': case 'X': {
      testcase( z[0]=='x' ); testcase( z[0]=='X' );
      if( z[1]=='\'' ){
        *tokenType = TK_BLOB;
        for(i=2; sqlite3Isxdigit(z[i]); i++){}
        if( z[i]!='\'' || i%2 ){
          *tokenType = TK_ILLEGAL;
          while( z[i] && z[i]!='\'' ){ i++; }
        }
        if( z[i] ) i++;
        return i;
      }
      /* Otherwise fall through to the next case */
    }
#endif
    default: {
      if( !IdChar(*z) ){
        break;
      }
      for(i=1; IdChar(z[i]); i++){}
      *tokenType = keywordCode((char*)z, i);
      return i;
    }
  }
  *tokenType = TK_ILLEGAL;
  return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movzbl (%rdi), %eax
leal -0x20(%rax), %ecx
cmpl $0x5e, %ecx
ja 0x360f4
leaq 0x3f4e1(%rip), %rdx     # 0x754d0
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movl $0x81, (%rbx)
movq $-0x1, %r14
movzbl 0x1(%rdi,%r14), %eax
leaq -0x3a(%rax), %rcx
incq %r14
cmpq $-0xb, %rcx
ja 0x36005
cmpb $0x2e, %al
jne 0x36035
movzbl 0x1(%rdi,%r14), %eax
incq %r14
addq $-0x3a, %rax
cmpq $-0xb, %rax
ja 0x3601c
movl $0x82, (%rbx)
movslq %r14d, %rax
movzbl (%rdi,%rax), %ecx
movl %ecx, %edx
orl $0x20, %edx
cmpl $0x65, %edx
jne 0x360bc
movzbl 0x1(%rdi,%rax), %edx
leaq -0x3a(%rdx), %rsi
cmpq $-0xb, %rsi
ja 0x3606e
cmpl $0x2d, %edx
je 0x3605f
cmpl $0x2b, %edx
jne 0x360bc
movzbl 0x2(%rdi,%rax), %edx
addq $-0x3a, %rdx
cmpq $-0xa, %rdx
jb 0x360bc
shlq $0x20, %r14
movabsq $0x200000000, %rdx      # imm = 0x200000000
addq %r14, %rdx
sarq $0x20, %rdx
decq %rdx
movabsq $0x100000000, %rcx      # imm = 0x100000000
addq %rcx, %r14
movq %r14, %rax
movq %rdx, %r14
movzbl 0x1(%rdi,%r14), %edx
addq $-0x3a, %rdx
incq %r14
addq %rcx, %rax
cmpq $-0xb, %rdx
ja 0x36099
movl $0x82, (%rbx)
sarq $0x20, %rax
movb (%rdi,%rax), %cl
movzbl %cl, %edx
leaq 0x3feea(%rip), %rcx     # 0x75fb0
testb $0x46, (%rdx,%rcx)
je 0x3652b
leaq (%rax,%rdi), %rdx
incq %rdx
movl %eax, %r14d
movl $0x94, (%rbx)
movzbl (%rdx), %eax
incl %r14d
incq %rdx
testb $0x46, (%rax,%rcx)
jne 0x360da
jmp 0x3652b
cmpl $0xd, %eax
ja 0x361ac
movl $0x3600, %ecx           # imm = 0x3600
btl %eax, %ecx
jae 0x361ac
xorl %r14d, %r14d
leaq 0x3fe9b(%rip), %rax     # 0x75fb0
movzbl 0x1(%rdi,%r14), %ecx
incq %r14
testb $0x1, (%rcx,%rax)
jne 0x36115
movl $0x95, (%rbx)
jmp 0x3652b
movb 0x1(%rdi), %cl
movl $0x1, %r14d
testb %cl, %cl
je 0x362c2
cmpb %al, %cl
jne 0x36155
movslq %r14d, %rcx
leaq 0x1(%rcx), %r14
cmpb %al, 0x1(%rdi,%rcx)
jne 0x36467
movslq %r14d, %r14
movb 0x1(%rdi,%r14), %cl
incq %r14
jmp 0x36138
cmpb $0x27, 0x1(%rdi)
jne 0x361ac
movl $0x83, (%rbx)
movl $0x1, %eax
leaq 0x3fe36(%rip), %rcx     # 0x75fb0
movzbl 0x1(%rdi,%rax), %edx
incq %rax
testb $0x8, (%rdx,%rcx)
jne 0x3617a
cmpb $0x27, %dl
setne %cl
movl %eax, %edx
orb %cl, %dl
testb $0x1, %dl
jne 0x36487
movslq %eax, %r14
cmpb $0x1, (%rdi,%r14)
sbbl $-0x1, %r14d
jmp 0x3652b
leaq 0x3fdfd(%rip), %rcx     # 0x75fb0
testb $0x46, (%rax,%rcx)
je 0x36446
xorl %r14d, %r14d
movzbl 0x1(%rdi,%r14), %eax
incq %r14
testb $0x46, (%rax,%rcx)
jne 0x361c0
movl %r14d, %esi
callq 0x3653c
jmp 0x36480
movl $0x4c, (%rbx)
xorl %r14d, %r14d
cmpb $0x3d, 0x1(%rdi)
sete %r14b
incl %r14d
jmp 0x3652b
movl $0x19, (%rbx)
jmp 0x36525
movl $0x52, (%rbx)
jmp 0x36525
movl $0x17, (%rbx)
jmp 0x36525
movl $0x58, (%rbx)
jmp 0x36525
movl $0x5a, (%rbx)
jmp 0x36525
xorl %r14d, %r14d
movzbl 0x1(%rdi,%r14), %eax
addq $-0x3a, %rax
incq %r14
cmpq $-0xb, %rax
ja 0x3622f
cmpq $0x2, %r14
jb 0x36253
movl $0x84, (%rbx)
jmp 0x3652b
movl $0x85, (%rbx)
movb 0x1(%rdi), %dl
movl $0x1, %r14d
testb %dl, %dl
je 0x362c2
xorl %ecx, %ecx
leaq 0x3fd41(%rip), %rax     # 0x75fb0
movzbl %dl, %esi
testb $0x46, (%rsi,%rax)
je 0x3627c
incl %ecx
jmp 0x362ab
cmpb $0x28, %dl
sete %sil
testl %ecx, %ecx
setg %r8b
andb %sil, %r8b
cmpb $0x1, %r8b
je 0x364b7
cmpb $0x3a, %dl
jne 0x362ba
movslq %r14d, %rdx
cmpb $0x3a, 0x1(%rdi,%rdx)
jne 0x362ba
incq %rdx
movl %edx, %r14d
movslq %r14d, %r14
movb 0x1(%rdi,%r14), %dl
incq %r14
testb %dl, %dl
jne 0x3626f
testl %ecx, %ecx
jne 0x3652b
movl $0x94, (%rbx)
jmp 0x3652b
movl $0x5d, (%rbx)
jmp 0x36525
movl $0x16, (%rbx)
jmp 0x36525
movl $0x56, (%rbx)
jmp 0x36525
cmpb $0x2d, 0x1(%rdi)
jne 0x364a7
movl $0x2, %r14d
movzbl (%rdi,%r14), %eax
testl %eax, %eax
je 0x36124
cmpl $0xa, %eax
je 0x36124
incq %r14
jmp 0x362fe
movzbl 0x1(%rdi), %eax
addq $-0x3a, %rax
cmpq $-0xb, %rax
ja 0x35ff8
movl $0x76, (%rbx)
jmp 0x36525
cmpb $0x3d, 0x1(%rdi)
je 0x36451
movl $0x94, (%rbx)
jmp 0x36517
movzbl 0x1(%rdi), %eax
cmpl $0x3e, %eax
je 0x364f9
cmpl $0x3d, %eax
jne 0x36501
movl $0x50, (%rbx)
jmp 0x36517
cmpb $0x2a, 0x1(%rdi)
jne 0x3645c
movb 0x2(%rdi), %cl
testb %cl, %cl
je 0x3645c
xorb $0x2a, %cl
movb 0x3(%rdi), %al
movl %eax, %edx
xorb $0x2f, %dl
movl $0x4, %r14d
orb %cl, %dl
je 0x36124
xorl %r14d, %r14d
testb %al, %al
je 0x36533
xorb $0x2a, %al
movb 0x4(%rdi,%r14), %cl
movl %ecx, %edx
xorb $0x2f, %dl
incq %r14
orb %al, %dl
movl %ecx, %eax
jne 0x3639d
addl $0x4, %r14d
jmp 0x36124
movl $0x1, (%rbx)
jmp 0x36525
movl $0x85, (%rbx)
xorl %r14d, %r14d
movzbl 0x1(%rdi,%r14), %eax
addq $-0x3a, %rax
incq %r14
cmpq $-0xa, %rax
jae 0x363d7
jmp 0x3652b
movzbl 0x1(%rdi), %eax
cmpl $0x3c, %eax
je 0x36511
cmpl $0x3e, %eax
je 0x36451
cmpl $0x3d, %eax
jne 0x3651f
movl $0x4e, (%rbx)
jmp 0x36517
cmpb $0x7c, 0x1(%rdi)
jne 0x364af
movl $0x5b, (%rbx)
jmp 0x36517
movl $0x1, %r14d
movb (%rdi,%r14), %al
testb %al, %al
je 0x3647b
incq %r14
cmpb $0x5d, %al
jne 0x36430
movl $0x1a, %eax
jmp 0x36480
movl $0x94, (%rbx)
jmp 0x36525
movl $0x4b, (%rbx)
jmp 0x36517
movl $0x59, (%rbx)
jmp 0x36525
cmpl $0x27, %eax
jne 0x36509
movl $0x5e, (%rbx)
jmp 0x3652b
movl $0x94, %eax
movl %eax, (%rbx)
jmp 0x3652b
movl $0x94, (%rbx)
movzbl (%rdi,%rax), %ecx
testl %ecx, %ecx
je 0x3619b
cmpl $0x27, %ecx
je 0x3619b
incq %rax
jmp 0x3648d
movl $0x57, (%rbx)
jmp 0x36525
movl $0x53, (%rbx)
jmp 0x36525
movslq %r14d, %rcx
incl %r14d
leaq (%rdi,%rcx), %rdx
incq %rdx
movl %r14d, %ecx
movzbl (%rdx), %esi
testq %rsi, %rsi
je 0x364ee
leal 0x1(%rcx), %r14d
cmpq $0x29, %rsi
je 0x364e9
movb (%rsi,%rax), %dil
andb $0x1, %dil
incq %rdx
testb %dil, %dil
je 0x364c4
cmpl $0x29, %esi
je 0x3652b
movl $0x94, (%rbx)
movl %ecx, %r14d
jmp 0x3652b
movl $0x55, (%rbx)
jmp 0x36517
movl $0x4d, (%rbx)
jmp 0x36525
movl $0x1a, (%rbx)
jmp 0x3652b
movl $0x54, (%rbx)
movl $0x2, %r14d
jmp 0x3652b
movl $0x4f, (%rbx)
movl $0x1, %r14d
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
addl $0x3, %r14d
jmp 0x36124