// File: /workspace/github_c_makefile_star2_O2/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 0x30b48
leaq 0x36a25(%rip), %rdx     # 0x6748c
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movl $0x81, (%rbx)
pushq $-0x1
popq %rax
movzbl 0x1(%rdi,%rax), %ecx
leaq -0x3a(%rcx), %rdx
incq %rax
cmpq $-0xb, %rdx
ja 0x30a79
cmpb $0x2e, %cl
jne 0x30aa8
movzbl 0x1(%rdi,%rax), %ecx
incq %rax
addq $-0x3a, %rcx
cmpq $-0xb, %rcx
ja 0x30a90
movl $0x82, (%rbx)
movslq %eax, %r14
movzbl (%rdi,%r14), %ecx
orl $0x20, %ecx
cmpl $0x65, %ecx
jne 0x30b27
movzbl 0x1(%rdi,%r14), %ecx
leaq -0x3a(%rcx), %rdx
cmpq $-0xb, %rdx
ja 0x30ae2
cmpl $0x2d, %ecx
je 0x30ad2
cmpl $0x2b, %ecx
jne 0x30b27
movzbl 0x2(%rdi,%r14), %ecx
addq $-0x3a, %rcx
cmpq $-0xa, %rcx
jb 0x30b27
shlq $0x20, %rax
movabsq $0x200000000, %rcx      # imm = 0x200000000
addq %rax, %rcx
sarq $0x20, %rcx
movabsq $0x100000000, %rdx      # imm = 0x100000000
addq %rdx, %rax
addq %rdi, %rcx
movzbl (%rcx), %esi
addq $-0x3a, %rsi
addq %rdx, %rax
incq %rcx
cmpq $-0xb, %rsi
ja 0x30b07
movl $0x82, (%rbx)
sarq $0x20, %rax
movq %rax, %r14
leaq 0x37442(%rip), %rax     # 0x67f70
movzbl (%rdi,%r14), %ecx
testb $0x46, (%rcx,%rax)
je 0x30f51
movl $0x94, (%rbx)
incq %r14
jmp 0x30b2e
cmpl $0xd, %eax
ja 0x30bf4
movl $0x3600, %ecx           # imm = 0x3600
btl %eax, %ecx
jae 0x30bf4
xorl %r14d, %r14d
leaq 0x37407(%rip), %rax     # 0x67f70
movzbl 0x1(%rdi,%r14), %ecx
incq %r14
testb $0x1, (%rcx,%rax)
jne 0x30b69
movl $0x95, (%rbx)
jmp 0x30f51
pushq $0x1
popq %r14
movslq %r14d, %rcx
movb (%rdi,%rcx), %dl
testb %dl, %dl
je 0x30ee4
cmpb %al, %dl
jne 0x30ba7
leaq 0x1(%rcx), %r14
cmpb %al, 0x1(%rdi,%rcx)
jne 0x30e6d
incl %r14d
jmp 0x30b87
cmpb $0x27, 0x1(%rdi)
jne 0x30bf4
movl $0x83, (%rbx)
pushq $0x1
popq %rax
leaq 0x373ae(%rip), %rcx     # 0x67f70
movzbl 0x1(%rdi,%rax), %edx
incq %rax
testb $0x8, (%rdx,%rcx)
jne 0x30bc2
cmpb $0x27, %dl
setne %cl
movl %eax, %edx
orb %cl, %dl
testb $0x1, %dl
jne 0x30eec
movslq %eax, %r14
cmpb $0x1, (%rdi,%r14)
sbbl $-0x1, %r14d
jmp 0x30f51
leaq 0x37375(%rip), %rcx     # 0x67f70
testb $0x46, (%rax,%rcx)
je 0x30e81
xorl %r14d, %r14d
movzbl 0x1(%rdi,%r14), %eax
incq %r14
testb $0x46, (%rax,%rcx)
jne 0x30c08
movl %r14d, %esi
callq 0x30f61
jmp 0x30f21
movl $0x4c, (%rbx)
xorl %r14d, %r14d
cmpb $0x3d, 0x1(%rdi)
sete %r14b
incl %r14d
jmp 0x30f51
movl $0x19, (%rbx)
jmp 0x30f4d
movl $0x52, (%rbx)
jmp 0x30f4d
movl $0x17, (%rbx)
jmp 0x30f4d
movl $0x58, (%rbx)
jmp 0x30f4d
movl $0x5a, (%rbx)
jmp 0x30f4d
xorl %r14d, %r14d
movzbl 0x1(%rdi,%r14), %eax
addq $-0x3a, %rax
incq %r14
cmpq $-0xb, %rax
ja 0x30c77
cmpq $0x2, %r14
jb 0x30c9b
movl $0x84, (%rbx)
jmp 0x30f51
movl $0x85, (%rbx)
xorl %eax, %eax
pushq $0x1
popq %r14
leaq 0x372c2(%rip), %rcx     # 0x67f70
movslq %r14d, %rdx
movzbl (%rdi,%rdx), %esi
testq %rsi, %rsi
je 0x30ee0
testb $0x46, (%rsi,%rcx)
je 0x30cc8
incl %eax
jmp 0x30cfc
cmpl $0x28, %esi
sete %r8b
testl %eax, %eax
setg %r9b
andb %r8b, %r9b
cmpb $0x1, %r9b
je 0x30ea2
cmpl $0x3a, %esi
jne 0x30ee0
cmpb $0x3a, 0x1(%rdi,%rdx)
jne 0x30ee0
incq %rdx
movl %edx, %r14d
incl %r14d
jmp 0x30cae
movl $0x5d, (%rbx)
jmp 0x30f4d
movl $0x16, (%rbx)
jmp 0x30f4d
movl $0x56, (%rbx)
jmp 0x30f4d
cmpb $0x2d, 0x1(%rdi)
jne 0x30f0c
pushq $0x2
popq %r14
movzbl (%rdi,%r14), %eax
testl %eax, %eax
je 0x30b78
cmpl $0xa, %eax
je 0x30b78
incq %r14
jmp 0x30d30
movzbl 0x1(%rdi), %eax
addq $-0x3a, %rax
cmpq $-0xb, %rax
ja 0x30a70
movl $0x76, (%rbx)
jmp 0x30f4d
cmpb $0x3d, 0x1(%rdi)
je 0x30e8c
movl $0x94, (%rbx)
jmp 0x30f43
movzbl 0x1(%rdi), %eax
cmpl $0x3e, %eax
je 0x30f2d
cmpl $0x3d, %eax
jne 0x30f35
movl $0x50, (%rbx)
jmp 0x30f43
cmpb $0x2a, 0x1(%rdi)
jne 0x30e97
movb 0x2(%rdi), %cl
testb %cl, %cl
je 0x30e97
pushq $0x3
popq %rax
pushq $0x4
popq %r14
xorb $0x2a, %cl
movb (%rdi,%rax), %dl
movl %edx, %esi
xorb $0x2f, %sil
orb %cl, %sil
je 0x30b78
testb %dl, %dl
je 0x30f59
incq %rax
incl %r14d
movl %edx, %ecx
jmp 0x30dba
movl $0x1, (%rbx)
jmp 0x30f4d
movl $0x85, (%rbx)
xorl %r14d, %r14d
movzbl 0x1(%rdi,%r14), %eax
addq $-0x3a, %rax
incq %r14
cmpq $-0xa, %rax
jae 0x30df5
jmp 0x30f51
movzbl 0x1(%rdi), %eax
cmpl $0x3c, %eax
je 0x30f3d
cmpl $0x3e, %eax
je 0x30e8c
cmpl $0x3d, %eax
jne 0x30f47
movl $0x4e, (%rbx)
jmp 0x30f43
cmpb $0x7c, 0x1(%rdi)
jne 0x30f14
movl $0x5b, (%rbx)
jmp 0x30f43
pushq $0x5b
popq %rcx
pushq $0x1
popq %r14
pushq $0x1a
popq %rax
cmpl $0x5d, %ecx
je 0x30f21
movzbl (%rdi,%r14), %ecx
testl %ecx, %ecx
je 0x30f1c
incq %r14
jmp 0x30e52
cmpl $0x27, %eax
jne 0x30f25
movl $0x5e, (%rbx)
jmp 0x30f51
movl $0x94, (%rbx)
jmp 0x30f4d
movl $0x4b, (%rbx)
jmp 0x30f43
movl $0x59, (%rbx)
jmp 0x30f4d
leal 0x1(%rdx), %r14d
leaq (%rdi,%rdx), %rsi
incq %rsi
movl %r14d, %edx
movzbl (%rsi), %edi
testq %rdi, %rdi
je 0x30ed7
leal 0x1(%rdx), %r14d
cmpq $0x29, %rdi
je 0x30ed2
movb (%rdi,%rcx), %r8b
andb $0x1, %r8b
incq %rsi
testb %r8b, %r8b
je 0x30ead
cmpl $0x29, %edi
je 0x30ee0
movl $0x94, (%rbx)
movl %edx, %r14d
testl %eax, %eax
jne 0x30f51
movl $0x94, (%rbx)
jmp 0x30f51
movl $0x94, (%rbx)
movzbl (%rdi,%rax), %ecx
testl %ecx, %ecx
je 0x30be3
cmpl $0x27, %ecx
je 0x30be3
incq %rax
jmp 0x30ef2
movl $0x57, (%rbx)
jmp 0x30f4d
movl $0x53, (%rbx)
jmp 0x30f4d
movl $0x94, %eax
movl %eax, (%rbx)
jmp 0x30f51
movl $0x1a, (%rbx)
jmp 0x30f51
movl $0x55, (%rbx)
jmp 0x30f43
movl $0x4d, (%rbx)
jmp 0x30f4d
movl $0x54, (%rbx)
pushq $0x2
jmp 0x30f4f
movl $0x4f, (%rbx)
pushq $0x1
popq %r14
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
movl %eax, %r14d
jmp 0x30b78