// File: /workspace/github_c_makefile_star2_O1/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 0x35a07
leaq 0x3fb70(%rip), %rdx     # 0x7549c
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 0x35942
cmpb $0x2e, %al
jne 0x35972
movzbl 0x1(%rdi,%r14), %eax
incq %r14
addq $-0x3a, %rax
cmpq $-0xb, %rax
ja 0x35959
movl $0x82, (%rbx)
movslq %r14d, %rax
movzbl (%rdi,%rax), %ecx
orl $0x20, %ecx
cmpl $0x65, %ecx
jne 0x359cc
movzbl 0x1(%rdi,%rax), %ecx
leaq -0x3a(%rcx), %rdx
cmpq $-0xb, %rdx
ja 0x359a9
cmpl $0x2d, %ecx
je 0x3599a
cmpl $0x2b, %ecx
jne 0x359cc
movzbl 0x2(%rdi,%rax), %eax
addq $-0x3a, %rax
cmpq $-0xa, %rax
jb 0x359cc
addl $0x2, %r14d
movslq %r14d, %r14
decq %r14
movzbl 0x1(%rdi,%r14), %eax
addq $-0x3a, %rax
incq %r14
cmpq $-0xb, %rax
ja 0x359b3
movl $0x82, (%rbx)
movslq %r14d, %rax
movzbl (%rdi,%rax), %ecx
leaq 0x40586(%rip), %rax     # 0x75f60
testb $0x46, (%rcx,%rax)
je 0x35e53
movslq %r14d, %rcx
addq %rdi, %rcx
incq %rcx
movl $0x94, (%rbx)
movzbl (%rcx), %edx
incl %r14d
incq %rcx
testb $0x46, (%rdx,%rax)
jne 0x359ed
jmp 0x35e53
cmpl $0xd, %eax
ja 0x35ad0
movl $0x3600, %ecx           # imm = 0x3600
btl %eax, %ecx
jae 0x35ad0
xorl %r14d, %r14d
leaq 0x40538(%rip), %rax     # 0x75f60
movzbl 0x1(%rdi,%r14), %ecx
incq %r14
testb $0x1, (%rcx,%rax)
jne 0x35a28
movl $0x95, (%rbx)
jmp 0x35e53
movb 0x1(%rdi), %dl
testb %dl, %dl
sete %cl
je 0x35b00
movl $0x1, %r14d
cmpb %al, %dl
jne 0x35a69
movslq %r14d, %rsi
cmpb %al, 0x1(%rdi,%rsi)
jne 0x35a7b
incq %rsi
movl %esi, %r14d
movslq %r14d, %r14
movb 0x1(%rdi,%r14), %dl
incq %r14
testb %dl, %dl
sete %cl
jne 0x35a56
cmpb $0x27, %dl
sete %al
jmp 0x35b08
cmpb $0x27, 0x1(%rdi)
jne 0x35ad0
movl $0x83, (%rbx)
movl $0x1, %eax
leaq 0x404c2(%rip), %rcx     # 0x75f60
movzbl 0x1(%rdi,%rax), %edx
incq %rax
testb $0x8, (%rdx,%rcx)
jne 0x35a9e
cmpb $0x27, %dl
setne %cl
movl %eax, %edx
orb %cl, %dl
testb $0x1, %dl
jne 0x35da9
movslq %eax, %r14
cmpb $0x1, (%rdi,%r14)
sbbl $-0x1, %r14d
jmp 0x35e53
leaq 0x40489(%rip), %rcx     # 0x75f60
testb $0x46, (%rax,%rcx)
je 0x35d7c
xorl %r14d, %r14d
movzbl 0x1(%rdi,%r14), %eax
incq %r14
testb $0x46, (%rax,%rcx)
jne 0x35ae4
movl %r14d, %esi
callq 0x35e68
jmp 0x35da2
xorl %eax, %eax
movl $0x1, %r14d
testb %al, %al
je 0x35b14
movl $0x5e, (%rbx)
jmp 0x35b36
testb $0x1, %cl
jne 0x35c14
movl $0x1a, (%rbx)
jmp 0x35b36
movl $0x4c, (%rbx)
xorl %r14d, %r14d
cmpb $0x3d, 0x1(%rdi)
sete %r14b
incl %r14d
jmp 0x35e53
movl $0x19, (%rbx)
jmp 0x35e4d
movl $0x52, (%rbx)
jmp 0x35e4d
movl $0x17, (%rbx)
jmp 0x35e4d
movl $0x58, (%rbx)
jmp 0x35e4d
movl $0x5a, (%rbx)
jmp 0x35e4d
xorl %r14d, %r14d
movzbl 0x1(%rdi,%r14), %eax
addq $-0x3a, %rax
incq %r14
cmpq $-0xb, %rax
ja 0x35b78
cmpq $0x2, %r14
jb 0x35b9c
movl $0x84, (%rbx)
jmp 0x35e53
movl $0x85, (%rbx)
movb 0x1(%rdi), %dl
movl $0x1, %r14d
testb %dl, %dl
je 0x35c0a
xorl %ecx, %ecx
leaq 0x403a8(%rip), %rax     # 0x75f60
movzbl %dl, %esi
testb $0x46, (%rsi,%rax)
je 0x35bc5
incl %ecx
jmp 0x35bf4
cmpb $0x28, %dl
sete %sil
testl %ecx, %ecx
setg %r8b
andb %sil, %r8b
cmpb $0x1, %r8b
je 0x35dd9
cmpb $0x3a, %dl
jne 0x35c03
movslq %r14d, %rdx
cmpb $0x3a, 0x1(%rdi,%rdx)
jne 0x35c03
incq %rdx
movl %edx, %r14d
movslq %r14d, %r14
movb 0x1(%rdi,%r14), %dl
incq %r14
testb %dl, %dl
jne 0x35bb8
testl %ecx, %ecx
sete %al
jmp 0x35c0c
movb $0x1, %al
testb %al, %al
je 0x35e53
movl $0x94, (%rbx)
jmp 0x35e53
movl $0x5d, (%rbx)
jmp 0x35e4d
movl $0x16, (%rbx)
jmp 0x35e4d
movl $0x56, (%rbx)
jmp 0x35e4d
cmpb $0x2d, 0x1(%rdi)
jne 0x35dc9
movl $0x2, %r14d
movzbl (%rdi,%r14), %eax
testl %eax, %eax
je 0x35a37
cmpl $0xa, %eax
je 0x35a37
incq %r14
jmp 0x35c50
movzbl 0x1(%rdi), %eax
addq $-0x3a, %rax
cmpq $-0xb, %rax
ja 0x35935
movl $0x76, (%rbx)
jmp 0x35e4d
cmpb $0x3d, 0x1(%rdi)
je 0x35d87
movl $0x94, (%rbx)
jmp 0x35e3f
movzbl 0x1(%rdi), %eax
cmpl $0x3e, %eax
je 0x35e1c
cmpl $0x3d, %eax
jne 0x35e24
movl $0x50, (%rbx)
jmp 0x35e3f
cmpb $0x2a, 0x1(%rdi)
jne 0x35d92
movb 0x2(%rdi), %al
testb %al, %al
je 0x35d92
movl $0x3, %ecx
movq %rcx, %r14
cmpb $0x2a, %al
jne 0x35cea
cmpb $0x2f, (%rdi,%r14)
je 0x35e5b
movb (%rdi,%r14), %al
leaq 0x1(%r14), %rcx
testb %al, %al
jne 0x35cd8
xorl %eax, %eax
jmp 0x35e60
movl $0x1, (%rbx)
jmp 0x35e4d
movl $0x85, (%rbx)
xorl %r14d, %r14d
movzbl 0x1(%rdi,%r14), %eax
addq $-0x3a, %rax
incq %r14
cmpq $-0xa, %rax
jae 0x35d11
jmp 0x35e53
movzbl 0x1(%rdi), %eax
cmpl $0x3c, %eax
je 0x35e39
cmpl $0x3e, %eax
je 0x35d87
cmpl $0x3d, %eax
jne 0x35e47
movl $0x4e, (%rbx)
jmp 0x35e3f
cmpb $0x7c, 0x1(%rdi)
jne 0x35dd1
movl $0x5b, (%rbx)
jmp 0x35e3f
movl $0x1, %r14d
movb (%rdi,%r14), %al
testb %al, %al
je 0x35d9d
incq %r14
cmpb $0x5d, %al
jne 0x35d66
movl $0x1a, %eax
jmp 0x35da2
movl $0x94, (%rbx)
jmp 0x35e4d
movl $0x4b, (%rbx)
jmp 0x35e3f
movl $0x59, (%rbx)
jmp 0x35e4d
movl $0x94, %eax
movl %eax, (%rbx)
jmp 0x35e53
movl $0x94, (%rbx)
movzbl (%rdi,%rax), %ecx
testl %ecx, %ecx
je 0x35abf
cmpl $0x27, %ecx
je 0x35abf
incq %rax
jmp 0x35daf
movl $0x57, (%rbx)
jmp 0x35e4d
movl $0x53, (%rbx)
jmp 0x35e4d
movslq %r14d, %rcx
incl %r14d
addq %rdi, %rcx
incq %rcx
movl %r14d, %edx
movl %edx, %r14d
movzbl (%rcx), %esi
testq %rsi, %rsi
je 0x35e2c
leal 0x1(%r14), %edx
cmpq $0x29, %rsi
je 0x35e0d
movb (%rsi,%rax), %dil
andb $0x1, %dil
incq %rcx
testb %dil, %dil
je 0x35de8
cmpl $0x29, %esi
jne 0x35e2c
xorl %eax, %eax
movl %edx, %r14d
jmp 0x35c0c
movl $0x55, (%rbx)
jmp 0x35e3f
movl $0x4d, (%rbx)
jmp 0x35e4d
movl $0x94, (%rbx)
xorl %eax, %eax
jmp 0x35c0c
movl $0x54, (%rbx)
movl $0x2, %r14d
jmp 0x35e53
movl $0x4f, (%rbx)
movl $0x1, %r14d
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
movl $0x1, %eax
addl %eax, %r14d
jmp 0x35a37