// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3RunParser
SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
  int nErr = 0;                   /* Number of errors encountered */
  int i;                          /* Loop counter */
  void *pEngine;                  /* The LEMON-generated LALR(1) parser */
  int tokenType;                  /* type of the next token */
  int lastTokenParsed = -1;       /* type of the previous token */
  u8 enableLookaside;             /* Saved value of db->lookaside.bEnabled */
  sqlite3 *db = pParse->db;       /* The database connection */
  int mxSqlLen;                   /* Max length of an SQL string */


  mxSqlLen = db->aLimit[SQLITE_LIMIT_SQL_LENGTH];
  if( db->nVdbeActive==0 ){
    db->u1.isInterrupted = 0;
  }
  pParse->rc = SQLITE_OK;
  pParse->zTail = zSql;
  i = 0;
  assert( pzErrMsg!=0 );
  pEngine = sqlite3ParserAlloc((void*(*)(size_t))sqlite3Malloc);
  if( pEngine==0 ){
    db->mallocFailed = 1;
    return SQLITE_NOMEM;
  }
  assert( pParse->pNewTable==0 );
  assert( pParse->pNewTrigger==0 );
  assert( pParse->nVar==0 );
  assert( pParse->nzVar==0 );
  assert( pParse->azVar==0 );
  enableLookaside = db->lookaside.bEnabled;
  if( db->lookaside.pStart ) db->lookaside.bEnabled = 1;
  while( !db->mallocFailed && zSql[i]!=0 ){
    assert( i>=0 );
    pParse->sLastToken.z = &zSql[i];
    pParse->sLastToken.n = sqlite3GetToken((unsigned char*)&zSql[i],&tokenType);
    i += pParse->sLastToken.n;
    if( i>mxSqlLen ){
      pParse->rc = SQLITE_TOOBIG;
      break;
    }
    switch( tokenType ){
      case TK_SPACE: {
        if( db->u1.isInterrupted ){
          sqlite3ErrorMsg(pParse, "interrupt");
          pParse->rc = SQLITE_INTERRUPT;
          goto abort_parse;
        }
        break;
      }
      case TK_ILLEGAL: {
        sqlite3DbFree(db, *pzErrMsg);
        *pzErrMsg = sqlite3MPrintf(db, "unrecognized token: \"%T\"",
                        &pParse->sLastToken);
        nErr++;
        goto abort_parse;
      }
      case TK_SEMI: {
        pParse->zTail = &zSql[i];
        /* Fall thru into the default case */
      }
      default: {
        sqlite3Parser(pEngine, tokenType, pParse->sLastToken, pParse);
        lastTokenParsed = tokenType;
        if( pParse->rc!=SQLITE_OK ){
          goto abort_parse;
        }
        break;
      }
    }
  }
abort_parse:
  if( zSql[i]==0 && nErr==0 && pParse->rc==SQLITE_OK ){
    if( lastTokenParsed!=TK_SEMI ){
      sqlite3Parser(pEngine, TK_SEMI, pParse->sLastToken, pParse);
      pParse->zTail = &zSql[i];
    }
    sqlite3Parser(pEngine, 0, pParse->sLastToken, pParse);
  }
#ifdef YYTRACKMAXSTACKDEPTH
  sqlite3StatusSet(SQLITE_STATUS_PARSER_STACK,
      sqlite3ParserStackPeak(pEngine)
  );
#endif /* YYDEBUG */
  sqlite3ParserFree(pEngine, sqlite3_free);
  db->lookaside.bEnabled = enableLookaside;
  if( db->mallocFailed ){
    pParse->rc = SQLITE_NOMEM;
  }
  if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){
    sqlite3SetString(&pParse->zErrMsg, db, "%s", sqlite3ErrStr(pParse->rc));
  }
  assert( pzErrMsg!=0 );
  if( pParse->zErrMsg ){
    *pzErrMsg = pParse->zErrMsg;
    sqlite3_log(pParse->rc, "%s", *pzErrMsg);
    pParse->zErrMsg = 0;
    nErr++;
  }
  if( pParse->pVdbe && pParse->nErr>0 && pParse->nested==0 ){
    sqlite3VdbeDelete(pParse->pVdbe);
    pParse->pVdbe = 0;
  }
#ifndef SQLITE_OMIT_SHARED_CACHE
  if( pParse->nested==0 ){
    sqlite3DbFree(db, pParse->aTableLock);
    pParse->aTableLock = 0;
    pParse->nTableLock = 0;
  }
#endif
#ifndef SQLITE_OMIT_VIRTUALTABLE
  sqlite3_free(pParse->apVtabLock);
#endif

  if( !IN_DECLARE_VTAB ){
    /* If the pParse->declareVtab flag is set, do not delete any table 
    ** structure built up in pParse->pNewTable. The calling code (see vtab.c)
    ** will take responsibility for freeing the Table structure.
    */
    sqlite3DeleteTable(db, pParse->pNewTable);
  }

  sqlite3DeleteTrigger(db, pParse->pNewTrigger);
  for(i=pParse->nzVar-1; i>=0; i--) sqlite3DbFree(db, pParse->azVar[i]);
  sqlite3DbFree(db, pParse->azVar);
  sqlite3DbFree(db, pParse->aAlias);
  while( pParse->pAinc ){
    AutoincInfo *p = pParse->pAinc;
    pParse->pAinc = p->pNext;
    sqlite3DbFree(db, p);
  }
  while( pParse->pZombieTab ){
    Table *p = pParse->pZombieTab;
    pParse->pZombieTab = p->pNextZombie;
    sqlite3DeleteTable(db, p);
  }
  if( nErr>0 && pParse->rc==SQLITE_OK ){
    pParse->rc = SQLITE_ERROR;
  }
  return nErr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r14
movq %rdi, %rbx
movq (%rdi), %r12
movl 0x6c(%r12), %eax
movl %eax, -0x4c(%rbp)
cmpl $0x0, 0x9c(%r12)
jne 0x13877
movl $0x0, 0x148(%r12)
movl $0x0, 0x18(%rbx)
movq %rsi, -0x40(%rbp)
movq %rsi, 0x230(%rbx)
movl $0xc90, %edi            # imm = 0xC90
callq 0xa38c
testq %rax, %rax
je 0x139c4
movq %rax, %r13
movq %r14, -0x58(%rbp)
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movb 0x152(%r12), %al
movb %al, -0x2d(%rbp)
cmpq $0x0, 0x170(%r12)
je 0x138c8
movb $0x1, 0x152(%r12)
movl $0x0, -0x2c(%rbp)
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpb $0x0, 0x50(%r12)
movl $0x0, %r15d
movq -0x40(%rbp), %rcx
jne 0x13a4c
leaq 0x260(%rbx), %rax
movq %rax, -0x60(%rbp)
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
xorl %r15d, %r15d
movq %r12, -0x48(%rbp)
movslq %r15d, %r14
cmpb $0x0, (%rcx,%r14)
je 0x139d5
leaq (%rcx,%r14), %r12
movq %r12, 0x260(%rbx)
movq %r12, %rdi
leaq -0x50(%rbp), %rsi
callq 0x35fcf
movl %eax, 0x268(%rbx)
movl %r14d, %r15d
addl %eax, %r15d
cmpl -0x4c(%rbp), %r15d
jg 0x139e2
movl -0x50(%rbp), %r14d
cmpl $0x95, %r14d
jne 0x13964
movq -0x48(%rbp), %r12
cmpl $0x0, 0x148(%r12)
movq -0x40(%rbp), %rcx
je 0x13904
jmp 0x13a24
cmpl $0x1, %r14d
movl $0x0, -0x2c(%rbp)
je 0x1397c
cmpl $0x94, %r14d
je 0x139ed
jmp 0x1398a
movslq %r15d, %rcx
addq -0x40(%rbp), %rcx
movq %rcx, 0x230(%rbx)
movq %r13, %rdi
movl %r14d, %esi
movq %r12, %rdx
movl %eax, %ecx
movq %rbx, %r8
callq 0x376a1
cmpl $0x0, 0x18(%rbx)
jne 0x13ca8
movq -0x48(%rbp), %r12
cmpb $0x0, 0x50(%r12)
movl %r14d, -0x34(%rbp)
movq -0x40(%rbp), %rcx
je 0x13904
jmp 0x13a4c
movb $0x1, 0x50(%r12)
movl $0x7, %r14d
jmp 0x13c96
movl -0x34(%rbp), %r14d
movl $0x0, -0x2c(%rbp)
jmp 0x13a4c
movl $0x12, %eax
movq -0x48(%rbp), %r12
jmp 0x13a3a
movq -0x58(%rbp), %r14
movq (%r14), %rsi
movq -0x48(%rbp), %r12
movq %r12, %rdi
callq 0x9ca4
leaq 0x67197(%rip), %rsi     # 0x7ab9e
movq %r12, %rdi
movq -0x60(%rbp), %rdx
xorl %eax, %eax
callq 0x11900
movq %rax, (%r14)
movl $0x1, -0x2c(%rbp)
jmp 0x13ab6
leaq 0x67169(%rip), %rsi     # 0x7ab94
movq %rbx, %rdi
xorl %eax, %eax
callq 0x11842
movl $0x9, %eax
movl %eax, 0x18(%rbx)
movl -0x34(%rbp), %r14d
movl $0x0, -0x2c(%rbp)
movq -0x40(%rbp), %rcx
movslq %r15d, %rax
cmpb $0x0, (%rcx,%rax)
jne 0x13ab6
cmpl $0x0, 0x18(%rbx)
jne 0x13ab6
cmpl $0x1, %r14d
je 0x13a8b
addq %rax, %rcx
movq 0x260(%rbx), %rdx
movq %rcx, %r14
movl 0x268(%rbx), %ecx
movq %r13, %rdi
movl $0x1, %esi
movq %rbx, %r8
callq 0x376a1
movq %r14, 0x230(%rbx)
movq 0x260(%rbx), %rdx
movl 0x268(%rbx), %ecx
movl $0x0, -0x2c(%rbp)
movq %r13, %rdi
xorl %esi, %esi
movq %rbx, %r8
callq 0x376a1
jmp 0x13ab6
movq %r13, %rdi
callq 0x39421
cmpl $0x0, (%r13)
jns 0x13aae
movq %r13, %rdi
callq 0xa3c7
movb -0x2d(%rbp), %al
movb %al, 0x152(%r12)
cmpb $0x0, 0x50(%r12)
je 0x13b0f
movl $0x7, 0x18(%rbx)
cmpq $0x0, 0x8(%rbx)
movl -0x2c(%rbp), %r14d
jne 0x13b58
leaq 0x8(%rbx), %rdi
movl $0x7, %eax
movzbl %al, %eax
cmpl $0x1b, %eax
setae %cl
cmpl $0x2, %eax
sete %dl
orb %cl, %dl
je 0x13b3a
leaq 0x697bd(%rip), %rcx     # 0x7d2ca
jmp 0x13b47
movl 0x18(%rbx), %eax
testl %eax, %eax
movl -0x2c(%rbp), %r14d
je 0x13b58
cmpl $0x65, %eax
je 0x13b58
cmpq $0x0, 0x8(%rbx)
jne 0x13b58
leaq 0x8(%rbx), %rdi
cmpl $0x204, %eax            # imm = 0x204
jne 0x13af3
leaq 0x697a0(%rip), %rcx     # 0x7d2d8
jmp 0x13b47
movl %eax, %eax
leaq 0x7fcbd(%rip), %rcx     # 0x93800
movq (%rcx,%rax,8), %rcx
leaq 0x65b8b(%rip), %rdx     # 0x796d9
movq %r12, %rsi
xorl %eax, %eax
callq 0x24129
movq 0x8(%rbx), %rdx
testq %rdx, %rdx
je 0x13b84
movq -0x58(%rbp), %rax
movq %rdx, (%rax)
movl 0x18(%rbx), %edi
leaq 0x65b67(%rip), %rsi     # 0x796d9
xorl %eax, %eax
callq 0xb9c7
movq $0x0, 0x8(%rbx)
incl %r14d
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x13ba6
cmpl $0x0, 0x50(%rbx)
jle 0x13ba6
cmpb $0x0, 0x1e(%rbx)
jne 0x13ba6
callq 0x22dfd
movq $0x0, 0x10(%rbx)
cmpb $0x0, 0x1e(%rbx)
jne 0x13bd0
movq 0x1c8(%rbx), %rsi
movq %r12, %rdi
callq 0x9ca4
movq $0x0, 0x1c8(%rbx)
movl $0x0, 0x1c0(%rbx)
movq 0x280(%rbx), %rdi
callq 0xa3c7
cmpb $0x0, 0x201(%rbx)
jne 0x13bf4
movq 0x238(%rbx), %rsi
movq %r12, %rdi
callq 0x9975
movq 0x240(%rbx), %rsi
movq %r12, %rdi
callq 0x991b
movslq 0x1fc(%rbx), %r15
testq %r15, %r15
jle 0x13c2f
incq %r15
movq 0x218(%rbx), %rax
movq -0x10(%rax,%r15,8), %rsi
movq %r12, %rdi
callq 0x9ca4
decq %r15
cmpq $0x1, %r15
ja 0x13c12
movq 0x218(%rbx), %rsi
movq %r12, %rdi
callq 0x9ca4
movq 0x228(%rbx), %rsi
movq %r12, %rdi
callq 0x9ca4
movq 0x1d0(%rbx), %rsi
testq %rsi, %rsi
je 0x13c78
movq (%rsi), %rax
movq %rax, 0x1d0(%rbx)
jmp 0x13c45
movq 0x70(%rsi), %rax
movq %rax, 0x288(%rbx)
movq %r12, %rdi
callq 0x9975
movq 0x288(%rbx), %rsi
testq %rsi, %rsi
jne 0x13c65
testl %r14d, %r14d
jle 0x13c96
cmpl $0x0, 0x18(%rbx)
jne 0x13c96
movl $0x1, 0x18(%rbx)
movl %r14d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x48(%rbp), %r12
jmp 0x13a48