// File: /workspace/github_c_makefile_star2_O1/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 0x624ce(%rip), %rcx     # 0x761a0
leaq 0x62287(%rip), %rdx     # 0x75f60
movabsq $-0x100000000, %r13     # imm = 0xFFFFFFFF00000000
movabsq $0x100000000, %r8       # imm = 0x100000000
movabsq $0x100000001, %rbx      # imm = 0x100000001
leaq 0x65805(%rip), %r14     # 0x79503
leaq 0x6235b(%rip), %r11     # 0x76060
movl $0x2, %r9d
movzbl (%rdi), %r12d
cmpl $0x26, %r12d
jg 0x13d46
cmpl $0xb, %r12d
jle 0x13de9
leal -0xc(%r12), %esi
cmpl $0x2, %esi
jb 0x13df3
cmpl $0x20, %r12d
je 0x13df3
cmpl $0x22, %r12d
je 0x13dc6
jmp 0x13e38
cmpl $0x3a, %r12d
jg 0x13d97
cmpl $0x27, %r12d
je 0x13dc6
cmpl $0x2d, %r12d
je 0x13e11
cmpl $0x2f, %r12d
jne 0x13e38
movb $0x2, %r10b
cmpb $0x2a, 0x1(%rdi)
jne 0x13df6
addq $0x3, %rdi
movzbl -0x1(%rdi), %esi
cmpl $0x2a, %esi
je 0x13d89
testl %esi, %esi
jne 0x13d92
jmp 0x14299
cmpb $0x2f, (%rdi)
je 0x13f22
incq %rdi
jmp 0x13d77
cmpl $0x3b, %r12d
je 0x13e0c
cmpl $0x60, %r12d
je 0x13dc6
cmpl $0x5b, %r12d
jne 0x13e38
movzbl 0x1(%rdi), %esi
testl %esi, %esi
je 0x14299
incq %rdi
cmpl $0x5d, %esi
jne 0x13dad
jmp 0x13f1a
movb 0x1(%rdi), %sil
incq %rdi
testb %sil, %sil
je 0x13dd7
cmpb %r12b, %sil
jne 0x13dc6
movzbl %r10b, %r10d
testb %sil, %sil
cmovnel %r9d, %r10d
jne 0x13df6
jmp 0x14299
leal -0x9(%r12), %esi
cmpl $0x2, %esi
jae 0x13e2f
movb $0x1, %r10b
movzbl %r10b, %esi
movzbl %al, %eax
leaq (%rcx,%rax,8), %rax
movb (%rsi,%rax), %al
incq %rdi
jmp 0x13d0b
xorl %r10d, %r10d
jmp 0x13df6
movb $0x2, %r10b
cmpb $0x2d, 0x1(%rdi)
jne 0x13df6
movzbl (%rdi), %esi
testl %esi, %esi
je 0x1429d
cmpl $0xa, %esi
je 0x13df3
incq %rdi
jmp 0x13e1a
testl %r12d, %r12d
je 0x1429d
testb $0x46, (%r12,%rdx)
je 0x13f1a
xorl %r15d, %r15d
movq %r13, %rsi
addq %r8, %rsi
movzbl 0x1(%rdi,%r15), %r9d
incq %r15
testb $0x46, (%r9,%rdx)
jne 0x13e49
movb $0x2, %r10b
leal -0x43(%r12), %r9d
cmpl $0x31, %r9d
ja 0x14287
btq %r9, %rbx
jb 0x13fa2
movabsq $0x400000004, %r12      # imm = 0x400000004
btq %r9, %r12
jb 0x13f33
movabsq $0x2000000020000, %r12  # imm = 0x2000000020000
btq %r9, %r12
jae 0x14287
cmpl $0x4, %r15d
je 0x14136
cmpl $0x9, %r15d
je 0x141da
cmpl $0x7, %r15d
jne 0x14267
leaq 0x7(%rdi), %r9
movq %r9, -0x30(%rbp)
movl $0x7, %r12d
leaq 0x690fa(%rip), %rbx     # 0x7cfcd
xorl %r9d, %r9d
movq %rdi, %r14
movzbl (%r14), %r10d
testq %r10, %r10
je 0x140d9
movb (%r10,%r11), %r10b
movzbl (%rbx), %r13d
cmpb (%r13,%r11), %r10b
jne 0x140e6
incq %r14
incq %r9
incq %rbx
decq %r12
jne 0x13ed9
xorl %r12d, %r12d
movq -0x30(%rbp), %r14
leaq 0x690bf(%rip), %rbx     # 0x7cfd4
jmp 0x140e6
movb $0x2, %r10b
jmp 0x13df6
movb $0x1, %r10b
testb %sil, %sil
jne 0x13df6
jmp 0x14299
cmpl $0x7, %r15d
je 0x14079
cmpl $0x3, %r15d
jne 0x14267
leaq 0x3(%rdi), %r9
movq %r9, -0x30(%rbp)
movl $0x3, %r12d
leaq 0x655bd(%rip), %r9      # 0x79519
xorl %ebx, %ebx
movq %rdi, %r14
movzbl (%r14), %r10d
testq %r10, %r10
je 0x14025
movb (%r10,%r11), %r10b
movzbl (%r9), %r13d
cmpb (%r13,%r11), %r10b
jne 0x14032
incq %r14
incq %rbx
incq %r9
decq %r12
jne 0x13f61
xorl %r12d, %r12d
movq -0x30(%rbp), %r14
leaq 0x6557f(%rip), %r9      # 0x7951c
jmp 0x14032
cmpq $0x6, %r15
jne 0x14267
leaq 0x6(%rdi), %r9
movq %r9, -0x30(%rbp)
movl $0x6, %r15d
xorl %r10d, %r10d
movq %rdi, %r12
movzbl (%r12), %ebx
testq %rbx, %rbx
je 0x13ff6
movb (%rbx,%r11), %bl
movzbl (%r14), %r9d
cmpb (%r9,%r11), %bl
jne 0x14003
incq %r12
incq %r10
incq %r14
decq %r15
jne 0x13fc0
xorl %r15d, %r15d
movq -0x30(%rbp), %r12
leaq 0x65515(%rip), %r14     # 0x79509
jmp 0x14003
leaq 0x65506(%rip), %r9      # 0x79503
addq %r9, %r10
movq %r10, %r14
movb $0x4, %r10b
testl %r15d, %r15d
jle 0x14276
movzbl (%r12), %r9d
movb (%r9,%r11), %r9b
movzbl (%r14), %ebx
cmpb (%rbx,%r11), %r9b
jmp 0x14254
leaq 0x654ed(%rip), %r9      # 0x79519
addq %r9, %rbx
movq %rbx, %r9
movb $0x7, %r10b
testl %r12d, %r12d
jle 0x1426c
movzbl (%r14), %ebx
movb (%rbx,%r11), %bl
movzbl (%r9), %r9d
cmpb (%r9,%r11), %bl
movabsq $-0x100000000, %r13     # imm = 0xFFFFFFFF00000000
movabsq $0x100000001, %rbx      # imm = 0x100000001
leaq 0x6549a(%rip), %r14     # 0x79503
je 0x14287
cmpq $0x7, %r15
jne 0x14267
leaq 0x7(%rdi), %r10
movl $0x7, %r15d
leaq 0x65493(%rip), %r9      # 0x7951d
xorl %ebx, %ebx
movq %rdi, %r14
movzbl (%r14), %r12d
testq %r12, %r12
je 0x140c4
movb (%r12,%r11), %r12b
movzbl (%r9), %r13d
cmpb (%r13,%r11), %r12b
jne 0x140d1
incq %r14
incq %rbx
incq %r9
decq %r15
jne 0x1408f
xorl %r15d, %r15d
movq %r10, %r14
leaq 0x65462(%rip), %r9      # 0x79524
jmp 0x140d1
leaq 0x65452(%rip), %r9      # 0x7951d
addq %r9, %rbx
movq %rbx, %r9
movb $0x3, %r10b
jmp 0x14235
leaq 0x68eed(%rip), %r10     # 0x7cfcd
addq %r10, %r9
movq %r9, %rbx
movb $0x6, %r10b
testl %r12d, %r12d
jle 0x1426c
movzbl (%r14), %r9d
movb (%r9,%r11), %r9b
movzbl (%rbx), %ebx
cmpb (%rbx,%r11), %r9b
movabsq $-0x100000000, %r13     # imm = 0xFFFFFFFF00000000
movabsq $0x100000001, %rbx      # imm = 0x100000001
leaq 0x653e7(%rip), %r14     # 0x79503
je 0x14287
cmpl $0x9, %r15d
je 0x141da
cmpl $0x4, %r15d
jne 0x14267
leaq 0x4(%rdi), %r9
movq %r9, -0x30(%rbp)
movl $0x4, %r12d
leaq 0x653bf(%rip), %r9      # 0x7950a
xorl %ebx, %ebx
movq %rdi, %r14
movzbl (%r14), %r10d
testq %r10, %r10
je 0x14186
movb (%r10,%r11), %r10b
movzbl (%r9), %r13d
cmpb (%r13,%r11), %r10b
jne 0x14193
incq %r14
incq %rbx
incq %r9
decq %r12
jne 0x14150
xorl %r12d, %r12d
movq -0x30(%rbp), %r14
leaq 0x6538a(%rip), %r9      # 0x7950e
jmp 0x14193
leaq 0x6537d(%rip), %r9      # 0x7950a
addq %r9, %rbx
movq %rbx, %r9
movb $0x5, %r10b
testl %r12d, %r12d
jle 0x1426c
movzbl (%r14), %ebx
movb (%rbx,%r11), %bl
movzbl (%r9), %r9d
cmpb (%r9,%r11), %bl
movabsq $-0x100000000, %r13     # imm = 0xFFFFFFFF00000000
movabsq $0x100000001, %rbx      # imm = 0x100000001
leaq 0x65339(%rip), %r14     # 0x79503
je 0x14287
cmpq $0x9, %r15
jne 0x14267
leaq 0x9(%rdi), %r10
movl $0x9, %r15d
leaq 0x65324(%rip), %r9      # 0x7950f
xorl %ebx, %ebx
movq %rdi, %r14
movzbl (%r14), %r12d
testq %r12, %r12
je 0x14225
movb (%r12,%r11), %r12b
movzbl (%r9), %r13d
cmpb (%r13,%r11), %r12b
jne 0x14232
incq %r14
incq %rbx
incq %r9
decq %r15
jne 0x141f0
xorl %r15d, %r15d
movq %r10, %r14
leaq 0x652f5(%rip), %r9      # 0x79518
jmp 0x14232
leaq 0x652e3(%rip), %r9      # 0x7950f
addq %r9, %rbx
movq %rbx, %r9
movb $0x5, %r10b
testl %r15d, %r15d
jle 0x1426c
movzbl (%r14), %ebx
movb (%rbx,%r11), %bl
movzbl (%r9), %r9d
cmpb (%r9,%r11), %bl
movabsq $-0x100000000, %r13     # imm = 0xFFFFFFFF00000000
movabsq $0x100000001, %rbx      # imm = 0x100000001
leaq 0x6529e(%rip), %r14     # 0x79503
je 0x14287
movb $0x2, %r10b
jmp 0x14287
movabsq $-0x100000000, %r13     # imm = 0xFFFFFFFF00000000
movabsq $0x100000001, %rbx      # imm = 0x100000001
leaq 0x6527c(%rip), %r14     # 0x79503
sarq $0x20, %rsi
addq %rsi, %rdi
movl $0x2, %r9d
jmp 0x13df6
xorl %eax, %eax
jmp 0x142a2
cmpb $0x1, %al
sete %al
movzbl %al, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq