// File: /workspace/github_c_makefile_star2_O2/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, -0x44(%rbp)
cmpl $0x0, 0x9c(%r12)
jne 0x12157
movl $0x0, 0x148(%r12)
andl $0x0, 0x18(%rbx)
movq %rsi, -0x38(%rbp)
movq %rsi, 0x230(%rbx)
movl $0xc90, %edi            # imm = 0xC90
callq 0x9c40
testq %rax, %rax
je 0x12286
movq %r14, -0x50(%rbp)
movq %rax, -0x40(%rbp)
orl $-0x1, (%rax)
movb 0x152(%r12), %al
movb %al, -0x29(%rbp)
cmpq $0x0, 0x170(%r12)
je 0x121a3
movb $0x1, 0x152(%r12)
leaq 0x260(%rbx), %rax
movq %rax, -0x58(%rbp)
xorl %r14d, %r14d
pushq $-0x1
popq %r15
movq -0x38(%rbp), %rcx
movl %r15d, -0x30(%rbp)
movb 0x50(%r12), %al
movb %al, -0x2a(%rbp)
xorl %r13d, %r13d
movb $0x1, %al
cmpb $0x0, -0x2a(%rbp)
jne 0x12295
movslq %r14d, %r15
cmpb $0x0, (%rcx,%r15)
je 0x12295
movq %r12, %r13
leaq (%rcx,%r15), %r12
movq %r12, 0x260(%rbx)
movq %r12, %rdi
leaq -0x48(%rbp), %rsi
callq 0x30a47
movl %eax, 0x268(%rbx)
movl %r15d, %r14d
addl %eax, %r14d
cmpl -0x44(%rbp), %r14d
jg 0x1229b
movl -0x48(%rbp), %r15d
cmpl $0x95, %r15d
jne 0x12235
movq %r13, %r12
cmpl $0x0, 0x148(%r13)
movq -0x38(%rbp), %rcx
je 0x121c5
jmp 0x122ee
cmpl $0x1, %r15d
je 0x12246
cmpl $0x94, %r15d
je 0x122b2
jmp 0x12254
movslq %r14d, %rcx
addq -0x38(%rbp), %rcx
movq %rcx, 0x230(%rbx)
movq -0x40(%rbp), %rdi
movl %r15d, %esi
movq %r12, %rdx
movl %eax, %ecx
movq %rbx, %r8
callq 0x31edf
cmpl $0x0, 0x18(%rbx)
movq %r13, %r12
movl $0x0, %r13d
movq -0x38(%rbp), %rcx
movb $0x1, %al
je 0x121b9
jmp 0x12313
movb $0x1, 0x50(%r12)
pushq $0x7
popq %r13
jmp 0x12512
movl -0x30(%rbp), %r15d
jmp 0x12313
movl $0x12, 0x18(%rbx)
movl -0x30(%rbp), %r15d
movq %r13, %r12
xorl %r13d, %r13d
movq -0x38(%rbp), %rcx
jmp 0x12311
pushq $0x1
popq %rax
movq -0x50(%rbp), %r15
movq (%r15), %rsi
movq %r13, %r12
movl %eax, %r13d
movq %r12, %rdi
callq 0x968b
leaq 0x5a8ed(%rip), %rsi     # 0x6cbbe
movq %r12, %rdi
movq -0x58(%rbp), %rdx
xorl %eax, %eax
callq 0x10594
movq %rax, (%r15)
xorl %eax, %eax
movl -0x30(%rbp), %r15d
movq -0x38(%rbp), %rcx
jmp 0x12313
leaq 0x5a8bf(%rip), %rsi     # 0x6cbb4
xorl %r13d, %r13d
movq %rbx, %rdi
xorl %eax, %eax
callq 0x104d6
movq -0x38(%rbp), %rcx
movl $0x9, 0x18(%rbx)
movl -0x30(%rbp), %r15d
movb $0x1, %al
testb %al, %al
je 0x12379
movslq %r14d, %rax
cmpb $0x0, (%rcx,%rax)
jne 0x12379
cmpl $0x0, 0x18(%rbx)
jne 0x12379
movq 0x260(%rbx), %rdx
movl 0x268(%rbx), %ecx
cmpl $0x1, %r15d
jne 0x1233f
movq -0x40(%rbp), %r14
jmp 0x1236c
movq -0x38(%rbp), %r15
addq %rax, %r15
pushq $0x1
popq %rsi
movq -0x40(%rbp), %r14
movq %r14, %rdi
movq %rbx, %r8
callq 0x31edf
movq %r15, 0x230(%rbx)
movq 0x260(%rbx), %rdx
movl 0x268(%rbx), %ecx
movq %r14, %rdi
xorl %esi, %esi
movq %rbx, %r8
callq 0x31edf
movq -0x40(%rbp), %r14
cmpl $0x0, (%r14)
js 0x1238d
movq %r14, %rdi
callq 0x35f3b
jmp 0x1237d
movq %r14, %rdi
callq 0x9c7b
movb -0x29(%rbp), %al
movb %al, 0x152(%r12)
cmpb $0x0, 0x50(%r12)
je 0x123db
movl $0x7, 0x18(%rbx)
pushq $0x7
popq %rdi
cmpq $0x0, 0x8(%rbx)
jne 0x123e7
leaq 0x8(%rbx), %r15
callq 0xe5c3
leaq 0x59330(%rip), %rdx     # 0x6b6f9
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rcx
xorl %eax, %eax
callq 0x20d5f
jmp 0x123e7
movl 0x18(%rbx), %edi
testl %edi, %edi
je 0x123e7
cmpl $0x65, %edi
jne 0x123b2
movq 0x8(%rbx), %rdx
testq %rdx, %rdx
je 0x12410
movq -0x50(%rbp), %rax
movq %rdx, (%rax)
movl 0x18(%rbx), %edi
leaq 0x592f8(%rip), %rsi     # 0x6b6f9
xorl %eax, %eax
callq 0xaf99
andq $0x0, 0x8(%rbx)
incl %r13d
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x1242f
cmpl $0x0, 0x50(%rbx)
jle 0x1242f
cmpb $0x0, 0x1e(%rbx)
jne 0x1242f
callq 0x1fcce
andq $0x0, 0x10(%rbx)
cmpb $0x0, 0x1e(%rbx)
jne 0x12453
movq 0x1c8(%rbx), %rsi
movq %r12, %rdi
callq 0x968b
andq $0x0, 0x1c8(%rbx)
andl $0x0, 0x1c0(%rbx)
movq 0x280(%rbx), %rdi
callq 0x9c7b
cmpb $0x0, 0x201(%rbx)
jne 0x12477
movq 0x238(%rbx), %rsi
movq %r12, %rdi
callq 0x93dc
movq 0x240(%rbx), %rsi
movq %r12, %rdi
callq 0x9382
movl 0x1fc(%rbx), %r14d
testl %r14d, %r14d
jle 0x124ab
movq 0x218(%rbx), %rax
movq -0x8(%rax,%r14,8), %rsi
decq %r14
movq %r12, %rdi
callq 0x968b
jmp 0x1248d
movq 0x218(%rbx), %rsi
movq %r12, %rdi
callq 0x968b
movq 0x228(%rbx), %rsi
movq %r12, %rdi
callq 0x968b
movq 0x1d0(%rbx), %rsi
testq %rsi, %rsi
je 0x124f4
movq (%rsi), %rax
movq %rax, 0x1d0(%rbx)
jmp 0x124c1
movq 0x70(%rsi), %rax
movq %rax, 0x288(%rbx)
movq %r12, %rdi
callq 0x93dc
movq 0x288(%rbx), %rsi
testq %rsi, %rsi
jne 0x124e1
testl %r13d, %r13d
jle 0x12512
cmpl $0x0, 0x18(%rbx)
jne 0x12512
movl $0x1, 0x18(%rbx)
movl %r13d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq