// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3_complete
SQLITE_API int sqlite3_complete(const char *zSql){
  u8 state = 0;   /* Current state, using numbers defined in header comment */
  u8 token;       /* Value of the next token */

#ifndef SQLITE_OMIT_TRIGGER
  /* A complex statement machine used to detect the end of a CREATE TRIGGER
  ** statement.  This is the normal case.
  */
  static const u8 trans[8][8] = {
                     /* Token:                                                */
     /* State:       **  SEMI  WS  OTHER  EXPLAIN  CREATE  TEMP  TRIGGER  END */
     /* 0 INVALID: */ {    1,  0,     2,       3,      4,    2,       2,   2, },
     /* 1   START: */ {    1,  1,     2,       3,      4,    2,       2,   2, },
     /* 2  NORMAL: */ {    1,  2,     2,       2,      2,    2,       2,   2, },
     /* 3 EXPLAIN: */ {    1,  3,     3,       2,      4,    2,       2,   2, },
     /* 4  CREATE: */ {    1,  4,     2,       2,      2,    4,       5,   2, },
     /* 5 TRIGGER: */ {    6,  5,     5,       5,      5,    5,       5,   5, },
     /* 6    SEMI: */ {    6,  6,     5,       5,      5,    5,       5,   7, },
     /* 7     END: */ {    1,  7,     5,       5,      5,    5,       5,   5, },
  };
#else
  /* If triggers are not supported by this compile then the statement machine
  ** used to detect the end of a statement is much simplier
  */
  static const u8 trans[3][3] = {
                     /* Token:           */
     /* State:       **  SEMI  WS  OTHER */
     /* 0 INVALID: */ {    1,  0,     2, },
     /* 1   START: */ {    1,  1,     2, },
     /* 2  NORMAL: */ {    1,  2,     2, },
  };
#endif /* SQLITE_OMIT_TRIGGER */

  while( *zSql ){
    switch( *zSql ){
      case ';': {  /* A semicolon */
        token = tkSEMI;
        break;
      }
      case ' ':
      case '\r':
      case '\t':
      case '\n':
      case '\f': {  /* White space is ignored */
        token = tkWS;
        break;
      }
      case '/': {   /* C-style comments */
        if( zSql[1]!='*' ){
          token = tkOTHER;
          break;
        }
        zSql += 2;
        while( zSql[0] && (zSql[0]!='*' || zSql[1]!='/') ){ zSql++; }
        if( zSql[0]==0 ) return 0;
        zSql++;
        token = tkWS;
        break;
      }
      case '-': {   /* SQL-style comments from "--" to end of line */
        if( zSql[1]!='-' ){
          token = tkOTHER;
          break;
        }
        while( *zSql && *zSql!='\n' ){ zSql++; }
        if( *zSql==0 ) return state==1;
        token = tkWS;
        break;
      }
      case '[': {   /* Microsoft-style identifiers in [...] */
        zSql++;
        while( *zSql && *zSql!=']' ){ zSql++; }
        if( *zSql==0 ) return 0;
        token = tkOTHER;
        break;
      }
      case '`':     /* Grave-accent quoted symbols used by MySQL */
      case '"':     /* single- and double-quoted strings */
      case '\'': {
        int c = *zSql;
        zSql++;
        while( *zSql && *zSql!=c ){ zSql++; }
        if( *zSql==0 ) return 0;
        token = tkOTHER;
        break;
      }
      default: {
#ifdef SQLITE_EBCDIC
        unsigned char c;
#endif
        if( IdChar((u8)*zSql) ){
          /* Keywords and unquoted identifiers */
          int nId;
          for(nId=1; IdChar(zSql[nId]); nId++){}
#ifdef SQLITE_OMIT_TRIGGER
          token = tkOTHER;
#else
          switch( *zSql ){
            case 'c': case 'C': {
              if( nId==6 && sqlite3StrNICmp(zSql, "create", 6)==0 ){
                token = tkCREATE;
              }else{
                token = tkOTHER;
              }
              break;
            }
            case 't': case 'T': {
              if( nId==7 && sqlite3StrNICmp(zSql, "trigger", 7)==0 ){
                token = tkTRIGGER;
              }else if( nId==4 && sqlite3StrNICmp(zSql, "temp", 4)==0 ){
                token = tkTEMP;
              }else if( nId==9 && sqlite3StrNICmp(zSql, "temporary", 9)==0 ){
                token = tkTEMP;
              }else{
                token = tkOTHER;
              }
              break;
            }
            case 'e':  case 'E': {
              if( nId==3 && sqlite3StrNICmp(zSql, "end", 3)==0 ){
                token = tkEND;
              }else
#ifndef SQLITE_OMIT_EXPLAIN
              if( nId==7 && sqlite3StrNICmp(zSql, "explain", 7)==0 ){
                token = tkEXPLAIN;
              }else
#endif
              {
                token = tkOTHER;
              }
              break;
            }
            default: {
              token = tkOTHER;
              break;
            }
          }
#endif /* SQLITE_OMIT_TRIGGER */
          zSql += nId-1;
        }else{
          /* Operators and special symbols */
          token = tkOTHER;
        }
        break;
      }
    }
    state = trans[state][token];
    zSql++;
  }
  return state==1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movb $0x0, -0x11(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
je 0x16eac
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
addl $-0x9, %eax
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0x57, %eax
ja 0x16cbb
movq -0x28(%rbp), %rax
leaq 0x9261f(%rip), %rcx     # 0xa90d0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb $0x0, -0x12(%rbp)
jmp 0x16e7d
movb $0x1, -0x12(%rbp)
jmp 0x16e7d
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x2a, %eax
je 0x16ae2
movb $0x2, -0x12(%rbp)
jmp 0x16e7d
movq -0x10(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x29(%rbp)
je 0x16b27
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x2a, %ecx
movb %al, -0x2a(%rbp)
jne 0x16b21
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x2f, %eax
setne %al
movb %al, -0x2a(%rbp)
movb -0x2a(%rbp), %al
movb %al, -0x29(%rbp)
movb -0x29(%rbp), %al
testb $0x1, %al
jne 0x16b30
jmp 0x16b3e
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x16aee
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x16b56
movl $0x0, -0x4(%rbp)
jmp 0x16ebe
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movb $0x1, -0x12(%rbp)
jmp 0x16e7d
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x2d, %eax
je 0x16b81
movb $0x2, -0x12(%rbp)
jmp 0x16e7d
jmp 0x16b83
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x2b(%rbp)
je 0x16ba4
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
setne %al
movb %al, -0x2b(%rbp)
movb -0x2b(%rbp), %al
testb $0x1, %al
jne 0x16bad
jmp 0x16bbb
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x16b83
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x16bde
movzbl -0x11(%rbp), %eax
cmpl $0x1, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
jmp 0x16ebe
movb $0x1, -0x12(%rbp)
jmp 0x16e7d
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x2c(%rbp)
je 0x16c14
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5d, %eax
setne %al
movb %al, -0x2c(%rbp)
movb -0x2c(%rbp), %al
testb $0x1, %al
jne 0x16c1d
jmp 0x16c2b
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x16bf3
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x16c43
movl $0x0, -0x4(%rbp)
jmp 0x16ebe
movb $0x2, -0x12(%rbp)
jmp 0x16e7d
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x2d(%rbp)
je 0x16c83
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl -0x18(%rbp), %eax
setne %al
movb %al, -0x2d(%rbp)
movb -0x2d(%rbp), %al
testb $0x1, %al
jne 0x16c8c
jmp 0x16c9a
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x16c62
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x16cb2
movl $0x0, -0x4(%rbp)
jmp 0x16ebe
movb $0x2, -0x12(%rbp)
jmp 0x16e7d
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x93d75(%rip), %rax     # 0xaaa40
movzbl (%rax,%rcx), %eax
andl $0x46, %eax
cmpl $0x0, %eax
je 0x16e77
movl $0x1, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, %ecx
leaq 0x93d49(%rip), %rax     # 0xaaa40
movzbl (%rax,%rcx), %eax
andl $0x46, %eax
cmpl $0x0, %eax
je 0x16d10
jmp 0x16d05
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x16ce2
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x34(%rbp)
subl $0x43, %eax
je 0x16d5e
jmp 0x16d21
movl -0x34(%rbp), %eax
subl $0x45, %eax
je 0x16e09
jmp 0x16d2f
movl -0x34(%rbp), %eax
subl $0x54, %eax
je 0x16d8d
jmp 0x16d39
movl -0x34(%rbp), %eax
subl $0x63, %eax
je 0x16d5e
jmp 0x16d43
movl -0x34(%rbp), %eax
subl $0x65, %eax
je 0x16e09
jmp 0x16d51
movl -0x34(%rbp), %eax
subl $0x74, %eax
je 0x16d8d
jmp 0x16e5d
cmpl $0x6, -0x1c(%rbp)
jne 0x16d84
movq -0x10(%rbp), %rdi
leaq 0x97294(%rip), %rsi     # 0xae003
movl $0x6, %edx
callq 0x9210
cmpl $0x0, %eax
jne 0x16d84
movb $0x4, -0x12(%rbp)
jmp 0x16d88
movb $0x2, -0x12(%rbp)
jmp 0x16e61
cmpl $0x7, -0x1c(%rbp)
jne 0x16db3
movq -0x10(%rbp), %rdi
leaq 0x9ad38(%rip), %rsi     # 0xb1ad6
movl $0x7, %edx
callq 0x9210
cmpl $0x0, %eax
jne 0x16db3
movb $0x6, -0x12(%rbp)
jmp 0x16e07
cmpl $0x4, -0x1c(%rbp)
jne 0x16dd9
movq -0x10(%rbp), %rdi
leaq 0x97246(%rip), %rsi     # 0xae00a
movl $0x4, %edx
callq 0x9210
cmpl $0x0, %eax
jne 0x16dd9
movb $0x5, -0x12(%rbp)
jmp 0x16e05
cmpl $0x9, -0x1c(%rbp)
jne 0x16dff
movq -0x10(%rbp), %rdi
leaq 0x97225(%rip), %rsi     # 0xae00f
movl $0x9, %edx
callq 0x9210
cmpl $0x0, %eax
jne 0x16dff
movb $0x5, -0x12(%rbp)
jmp 0x16e03
movb $0x2, -0x12(%rbp)
jmp 0x16e05
jmp 0x16e07
jmp 0x16e61
cmpl $0x3, -0x1c(%rbp)
jne 0x16e2f
movq -0x10(%rbp), %rdi
leaq 0x971ff(%rip), %rsi     # 0xae019
movl $0x3, %edx
callq 0x9210
cmpl $0x0, %eax
jne 0x16e2f
movb $0x7, -0x12(%rbp)
jmp 0x16e5b
cmpl $0x7, -0x1c(%rbp)
jne 0x16e55
movq -0x10(%rbp), %rdi
leaq 0x971dd(%rip), %rsi     # 0xae01d
movl $0x7, %edx
callq 0x9210
cmpl $0x0, %eax
jne 0x16e55
movb $0x3, -0x12(%rbp)
jmp 0x16e59
movb $0x2, -0x12(%rbp)
jmp 0x16e5b
jmp 0x16e61
movb $0x2, -0x12(%rbp)
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x16e7b
movb $0x2, -0x12(%rbp)
jmp 0x16e7d
movzbl -0x11(%rbp), %eax
movl %eax, %ecx
leaq 0x93df6(%rip), %rax     # 0xaac80
shlq $0x3, %rcx
addq %rcx, %rax
movzbl -0x12(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x11(%rbp)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x16a80
movzbl -0x11(%rbp), %eax
cmpl $0x1, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)