// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
xorl %eax, %eax
leaq 0x62418(%rip), %rcx     # 0x761f0
leaq 0x621d1(%rip), %rdx     # 0x75fb0
movabsq $0x100000000, %r8       # imm = 0x100000000
leaq 0x65713(%rip), %r10     # 0x79503
leaq 0x622b9(%rip), %r11     # 0x760b0
leaq 0x6571b(%rip), %r14     # 0x79519
leaq 0x65718(%rip), %r15     # 0x7951d
movzbl (%rdi), %r9d
cmpl $0x26, %r9d
jg 0x13e3b
cmpl $0xb, %r9d
jle 0x13ed5
leal -0xc(%r9), %esi
cmpl $0x2, %esi
jb 0x13ede
cmpl $0x20, %r9d
je 0x13ede
cmpl $0x22, %r9d
je 0x13eb5
jmp 0x13f2b
cmpl $0x3a, %r9d
jg 0x13e86
cmpl $0x27, %r9d
je 0x13eb5
cmpl $0x2d, %r9d
je 0x13ef9
cmpl $0x2f, %r9d
jne 0x13f2b
movl $0x2, %ebx
cmpb $0x2a, 0x1(%rdi)
jne 0x13ee3
addq $0x3, %rdi
movzbl -0x1(%rdi), %esi
cmpl $0x2a, %esi
je 0x13e7c
testl %esi, %esi
jne 0x13e81
jmp 0x14218
cmpb $0x2f, (%rdi)
je 0x13ede
incq %rdi
jmp 0x13e6a
cmpl $0x3b, %r9d
je 0x13ef5
cmpl $0x60, %r9d
je 0x13eb5
cmpl $0x5b, %r9d
jne 0x13f2b
movzbl 0x1(%rdi), %esi
testl %esi, %esi
je 0x14218
incq %rdi
cmpl $0x5d, %esi
jne 0x13e9c
jmp 0x14000
movb 0x1(%rdi), %sil
incq %rdi
testb %sil, %sil
je 0x13ec6
cmpb %r9b, %sil
jne 0x13eb5
movl $0x2, %ebx
testb %sil, %sil
jne 0x13ee3
jmp 0x14218
leal -0x9(%r9), %esi
cmpl $0x2, %esi
jae 0x13f22
movl $0x1, %ebx
movzbl %al, %eax
leaq (%rcx,%rax,8), %rax
movb (%rbx,%rax), %al
incq %rdi
jmp 0x13e05
xorl %ebx, %ebx
jmp 0x13ee3
movl $0x2, %ebx
cmpb $0x2d, 0x1(%rdi)
jne 0x13ee3
movb $0x2d, %sil
testb %sil, %sil
je 0x1421c
movzbl %sil, %esi
cmpl $0xa, %esi
je 0x13ede
movb 0x1(%rdi), %sil
incq %rdi
jmp 0x13f07
testl %r9d, %r9d
je 0x1421c
testb $0x46, (%r9,%rdx)
je 0x14000
xorl %r13d, %r13d
movabsq $-0x100000000, %rsi     # imm = 0xFFFFFFFF00000000
addq %r8, %rsi
movzbl 0x1(%rdi,%r13), %ebx
incq %r13
testb $0x46, (%rbx,%rdx)
jne 0x13f43
movl $0x2, %ebx
addl $-0x43, %r9d
cmpl $0x31, %r9d
ja 0x1420c
movabsq $0x100000001, %r12      # imm = 0x100000001
btq %r9, %r12
jb 0x14059
movabsq $0x400000004, %r12      # imm = 0x400000004
btq %r9, %r12
jb 0x1400a
movabsq $0x2000000020000, %r12  # imm = 0x2000000020000
btq %r9, %r12
jae 0x1420c
cmpl $0x9, %r13d
je 0x141af
cmpl $0x7, %r13d
je 0x140d9
cmpl $0x4, %r13d
jne 0x14207
xorl %r9d, %r9d
movzbl (%rdi,%r9), %ebx
testq %rbx, %rbx
je 0x14188
movzbl (%rbx,%r11), %r12d
leaq 0x6552f(%rip), %rbx     # 0x7950a
movzbl (%r9,%rbx), %ebx
movb (%rbx,%r11), %bl
cmpb %bl, %r12b
jne 0x1419b
incq %r9
movl $0x5, %ebx
cmpq $0x4, %r9
jne 0x13fc1
jmp 0x1420c
movl $0x2, %ebx
jmp 0x13ee3
cmpl $0x3, %r13d
je 0x1409e
cmpl $0x7, %r13d
jne 0x14207
xorl %r9d, %r9d
movzbl (%rdi,%r9), %ebx
testq %rbx, %rbx
je 0x1412a
movzbl (%rbx,%r11), %r12d
movzbl (%r9,%r15), %ebx
movb (%rbx,%r11), %bl
cmpb %bl, %r12b
jne 0x14136
incq %r9
cmpq $0x7, %r9
jne 0x14021
movl $0x3, %ebx
jmp 0x1420c
cmpq $0x6, %r13
jne 0x14207
xorl %r9d, %r9d
movzbl (%rdi,%r9), %ebx
testq %rbx, %rbx
je 0x14113
movzbl (%rbx,%r11), %r13d
movzbl (%r9,%r10), %ebx
movb (%rbx,%r11), %bl
cmpb %bl, %r13b
jne 0x1411f
incq %r9
cmpq $0x6, %r9
jne 0x14066
movl $0x4, %ebx
jmp 0x1420c
xorl %r9d, %r9d
movzbl (%rdi,%r9), %ebx
testq %rbx, %rbx
je 0x14144
movzbl (%rbx,%r11), %r12d
movzbl (%r9,%r14), %ebx
movb (%rbx,%r11), %bl
cmpb %bl, %r12b
jne 0x14150
incq %r9
cmpq $0x3, %r9
jne 0x140a1
movl $0x7, %ebx
jmp 0x1420c
xorl %r9d, %r9d
movzbl (%rdi,%r9), %ebx
testq %rbx, %rbx
je 0x1415e
movzbl (%rbx,%r11), %r13d
leaq 0x68edb(%rip), %rbx     # 0x7cfcd
movzbl (%r9,%rbx), %ebx
movb (%rbx,%r11), %bl
cmpb %bl, %r13b
jne 0x14171
incq %r9
movl $0x6, %ebx
cmpq $0x7, %r9
jne 0x140dc
jmp 0x1420c
movzbl (%r9,%r10), %r9d
movb (%r9,%r11), %bl
xorl %r13d, %r13d
movzbl %bl, %r9d
movl $0x4, %ebx
jmp 0x1417a
movzbl (%r9,%r15), %r9d
movb (%r9,%r11), %bl
xorl %r12d, %r12d
movzbl %bl, %r9d
movl $0x3, %ebx
jmp 0x14202
movzbl (%r9,%r14), %r9d
movb (%r9,%r11), %bl
xorl %r12d, %r12d
movzbl %bl, %r9d
movl $0x7, %ebx
jmp 0x14202
leaq 0x68e68(%rip), %rbx     # 0x7cfcd
movzbl (%r9,%rbx), %r9d
movb (%r9,%r11), %bl
xorl %r13d, %r13d
movzbl %bl, %r9d
movl $0x6, %ebx
cmpl %r9d, %r13d
jne 0x14207
jmp 0x1420c
leaq 0x6537b(%rip), %rbx     # 0x7950a
movzbl (%r9,%rbx), %r9d
movb (%r9,%r11), %bl
xorl %r12d, %r12d
movzbl %bl, %r9d
movl $0x5, %ebx
cmpl %r9d, %r12d
je 0x1420c
cmpq $0x9, %r13
jne 0x14207
xorl %r9d, %r9d
movzbl (%rdi,%r9), %ebx
testq %rbx, %rbx
je 0x141e6
movzbl (%rbx,%r11), %r12d
leaq 0x65347(%rip), %rbx     # 0x7950f
movzbl (%r9,%rbx), %ebx
movb (%rbx,%r11), %bl
cmpb %bl, %r12b
jne 0x141f9
incq %r9
movl $0x5, %ebx
cmpq $0x9, %r9
jne 0x141b2
jmp 0x1420c
leaq 0x65322(%rip), %rbx     # 0x7950f
movzbl (%r9,%rbx), %r9d
movb (%r9,%r11), %bl
xorl %r12d, %r12d
movzbl %bl, %r9d
movl $0x5, %ebx
cmpl %r9d, %r12d
je 0x1420c
movl $0x2, %ebx
sarq $0x20, %rsi
addq %rsi, %rdi
jmp 0x13ee3
xorl %eax, %eax
jmp 0x14221
cmpb $0x1, %al
sete %al
movzbl %al, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq