// File: /workspace/github_c_makefile_star2_O0/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
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0xffffffff, -0x38(%rbp) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movl 0x6c(%rax), %eax
movl %eax, -0x4c(%rbp)
movq -0x48(%rbp), %rax
cmpl $0x0, 0x9c(%rax)
jne 0x163b5
movq -0x48(%rbp), %rax
movl $0x0, 0x148(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x18(%rax)
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x230(%rax)
movl $0x0, -0x28(%rbp)
leaq -0xc01d(%rip), %rdi     # 0xa3c0
callq 0x4c370
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x16401
movq -0x48(%rbp), %rax
movb $0x1, 0x50(%rax)
movl $0x7, -0x4(%rbp)
jmp 0x168c6
movq -0x48(%rbp), %rax
movb 0x152(%rax), %al
movb %al, -0x39(%rbp)
movq -0x48(%rbp), %rax
cmpq $0x0, 0x170(%rax)
je 0x16427
movq -0x48(%rbp), %rax
movb $0x1, 0x152(%rax)
jmp 0x16429
movq -0x48(%rbp), %rcx
xorl %eax, %eax
cmpb $0x0, 0x50(%rcx)
movb %al, -0x61(%rbp)
jne 0x1644d
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x61(%rbp)
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0x16459
jmp 0x165ac
movq -0x18(%rbp), %rcx
movslq -0x28(%rbp), %rax
addq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x260(%rax)
movq -0x18(%rbp), %rdi
movslq -0x28(%rbp), %rax
addq %rax, %rdi
leaq -0x34(%rbp), %rsi
callq 0x49ae0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x268(%rax)
movq -0x10(%rbp), %rax
movl 0x268(%rax), %eax
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jle 0x164b7
movq -0x10(%rbp), %rax
movl $0x12, 0x18(%rax)
jmp 0x165ac
movl -0x34(%rbp), %eax
movl %eax, -0x68(%rbp)
subl $0x1, %eax
je 0x1655c
jmp 0x164c8
movl -0x68(%rbp), %eax
subl $0x94, %eax
je 0x1651a
jmp 0x164d4
movl -0x68(%rbp), %eax
subl $0x95, %eax
jne 0x16572
jmp 0x164e4
movq -0x48(%rbp), %rax
movl 0x148(%rax), %eax
cmpl $0x0, %eax
je 0x16515
movq -0x10(%rbp), %rdi
leaq 0x99192(%rip), %rsi     # 0xaf690
movb $0x0, %al
callq 0x136f0
movq -0x10(%rbp), %rax
movl $0x9, 0x18(%rax)
jmp 0x165ae
jmp 0x165a7
movq -0x48(%rbp), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rsi
callq 0x9cd0
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x260, %rdx            # imm = 0x260
leaq 0x9915a(%rip), %rsi     # 0xaf69a
movb $0x0, %al
callq 0x137f0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x165ae
movq -0x18(%rbp), %rcx
movslq -0x28(%rbp), %rax
addq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x230(%rax)
movq -0x30(%rbp), %rdi
movl -0x34(%rbp), %esi
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %r8
movq 0x260(%rax), %rdx
movl 0x268(%rax), %ecx
callq 0x4c3b0
movl -0x34(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0x165a5
jmp 0x165ae
jmp 0x165a7
jmp 0x16429
jmp 0x165ae
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x1662e
cmpl $0x0, -0x24(%rbp)
jne 0x1662e
movq -0x10(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jne 0x1662e
cmpl $0x1, -0x38(%rbp)
je 0x1660e
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %r8
movq 0x260(%rax), %rdx
movl 0x268(%rax), %ecx
movl $0x1, %esi
callq 0x4c3b0
movq -0x18(%rbp), %rcx
movslq -0x28(%rbp), %rax
addq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x230(%rax)
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %r8
movq 0x260(%rax), %rdx
movl 0x268(%rax), %ecx
xorl %esi, %esi
callq 0x4c3b0
movq -0x30(%rbp), %rdi
leaq -0xc219(%rip), %rsi     # 0xa420
callq 0x4c500
movb -0x39(%rbp), %cl
movq -0x48(%rbp), %rax
movb %cl, 0x152(%rax)
movq -0x48(%rbp), %rax
cmpb $0x0, 0x50(%rax)
je 0x16660
movq -0x10(%rbp), %rax
movl $0x7, 0x18(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0x166b8
movq -0x10(%rbp), %rax
cmpl $0x65, 0x18(%rax)
je 0x166b8
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x166b8
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x78(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rax
movl 0x18(%rax), %edi
callq 0x11060
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq %rax, %rcx
leaq 0x97b1f(%rip), %rdx     # 0xae1d0
movb $0x0, %al
callq 0x30360
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x16703
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movl 0x18(%rax), %edi
movq -0x20(%rbp), %rax
movq (%rax), %rdx
leaq 0x97ae9(%rip), %rsi     # 0xae1d0
movb $0x0, %al
callq 0xc5f0
movq -0x10(%rbp), %rax
movq $0x0, 0x8(%rax)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x1673e
movq -0x10(%rbp), %rax
cmpl $0x0, 0x50(%rax)
jle 0x1673e
movq -0x10(%rbp), %rax
movzbl 0x1e(%rax), %eax
cmpl $0x0, %eax
jne 0x1673e
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x2e770
movq -0x10(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x10(%rbp), %rax
movzbl 0x1e(%rax), %eax
cmpl $0x0, %eax
jne 0x1677c
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x1c8(%rax), %rsi
callq 0x9cd0
movq -0x10(%rbp), %rax
movq $0x0, 0x1c8(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x1c0(%rax)
movq -0x10(%rbp), %rax
movq 0x280(%rax), %rdi
callq 0xa420
movq -0x10(%rbp), %rax
cmpb $0x0, 0x201(%rax)
jne 0x167ad
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x238(%rax), %rsi
callq 0x9a30
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x240(%rax), %rsi
callq 0x99b0
movq -0x10(%rbp), %rax
movl 0x1fc(%rax), %eax
subl $0x1, %eax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jl 0x167fe
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x218(%rax), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x9cd0
movl -0x28(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x167d1
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x218(%rax), %rsi
callq 0x9cd0
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x228(%rax), %rsi
callq 0x9cd0
movq -0x10(%rbp), %rax
cmpq $0x0, 0x1d0(%rax)
je 0x16864
movq -0x10(%rbp), %rax
movq 0x1d0(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x1d0(%rax)
movq -0x48(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x9cd0
jmp 0x16826
jmp 0x16866
movq -0x10(%rbp), %rax
cmpq $0x0, 0x288(%rax)
je 0x168a5
movq -0x10(%rbp), %rax
movq 0x288(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq 0x70(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x288(%rax)
movq -0x48(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x9a30
jmp 0x16866
cmpl $0x0, -0x24(%rbp)
jle 0x168c0
movq -0x10(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jne 0x168c0
movq -0x10(%rbp), %rax
movl $0x1, 0x18(%rax)
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)