// File: /workspace/github_c_makefile_star2_O1/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, -0x50(%rbp)
cmpl $0x0, 0x9c(%r12)
jne 0x13775
movl $0x0, 0x148(%r12)
movl $0x0, 0x18(%rbx)
movq %rsi, -0x38(%rbp)
movq %rsi, 0x230(%rbx)
movl $0xc90, %edi            # imm = 0xC90
callq 0xa2a2
testq %rax, %rax
je 0x137e5
movq %rax, %r13
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movb 0x152(%r12), %al
movb %al, -0x29(%rbp)
cmpq $0x0, 0x170(%r12)
je 0x137be
movb $0x1, 0x152(%r12)
movq %r14, -0x60(%rbp)
movb $0x1, %al
movl %eax, -0x3c(%rbp)
cmpb $0x0, 0x50(%r12)
movq -0x38(%rbp), %rcx
je 0x137f6
xorl %r14d, %r14d
movl $0xffffffff, -0x30(%rbp) # imm = 0xFFFFFFFF
xorl %r15d, %r15d
jmp 0x138d5
movb $0x1, 0x50(%r12)
movl $0x7, %r15d
jmp 0x13b06
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %r14d, %r14d
movq %r12, -0x48(%rbp)
movl %eax, -0x30(%rbp)
movslq %r14d, %r15
cmpb $0x0, (%rcx,%r15)
je 0x137dd
leaq (%rcx,%r15), %r12
movq %r12, 0x260(%rbx)
movq %r12, %rdi
leaq -0x54(%rbp), %rsi
callq 0x3590c
movl %eax, 0x268(%rbx)
movl %r15d, %r14d
addl %eax, %r14d
cmpl -0x50(%rbp), %r14d
jg 0x138bd
movl -0x54(%rbp), %r15d
cmpl $0x1, %r15d
je 0x13876
cmpl $0x95, %r15d
je 0x1385d
cmpl $0x94, %r15d
jne 0x13884
jmp 0x13b18
movq -0x48(%rbp), %r12
cmpl $0x0, 0x148(%r12)
jne 0x13b60
movl -0x30(%rbp), %r15d
jmp 0x138a1
movslq %r14d, %rcx
addq -0x38(%rbp), %rcx
movq %rcx, 0x230(%rbx)
movq %r13, %rdi
movl %r15d, %esi
movq %r12, %rdx
movl %eax, %ecx
movq %rbx, %r8
callq 0x36fb5
cmpl $0x0, 0x18(%rbx)
movq -0x48(%rbp), %r12
jne 0x138ca
cmpb $0x0, 0x50(%r12)
movl %r15d, %eax
movq -0x38(%rbp), %rcx
je 0x13802
movl %r15d, -0x30(%rbp)
jmp 0x137dd
movl $0x12, 0x18(%rbx)
movq -0x48(%rbp), %r12
jmp 0x138ce
movl %r15d, -0x30(%rbp)
xorl %r15d, %r15d
movq -0x38(%rbp), %rcx
cmpb $0x0, -0x3c(%rbp)
je 0x1393e
movslq %r14d, %rax
cmpb $0x0, (%rcx,%rax)
jne 0x1393e
cmpl $0x0, 0x18(%rbx)
jne 0x1393e
cmpl $0x1, -0x30(%rbp)
je 0x1391a
addq %rax, %rcx
movq 0x260(%rbx), %rdx
movq %rcx, %r14
movl 0x268(%rbx), %ecx
movq %r13, %rdi
movl $0x1, %esi
movq %rbx, %r8
callq 0x36fb5
movq %r14, 0x230(%rbx)
movq 0x260(%rbx), %rdx
movl 0x268(%rbx), %ecx
movq %r13, %rdi
xorl %esi, %esi
movq %rbx, %r8
callq 0x36fb5
jmp 0x1393e
movq %r13, %rdi
callq 0x38d62
cmpl $0x0, (%r13)
jns 0x13936
movq %r13, %rdi
callq 0xa2e8
movb -0x29(%rbp), %al
movb %al, 0x152(%r12)
cmpb $0x0, 0x50(%r12)
je 0x13967
movl $0x7, 0x18(%rbx)
movl 0x18(%rbx), %eax
testq %rax, %rax
je 0x139c8
cmpl $0x65, %eax
je 0x139c8
cmpq $0x0, 0x8(%rbx)
jne 0x139c8
leaq 0x8(%rbx), %rdi
cmpl $0x204, %eax            # imm = 0x204
jne 0x1398f
leaq 0x6994b(%rip), %rcx     # 0x7d2d8
jmp 0x139b7
movzbl %al, %eax
cmpl $0x1b, %eax
setae %cl
cmpq $0x2, %rax
sete %dl
orb %cl, %dl
je 0x139ac
leaq 0x69920(%rip), %rcx     # 0x7d2ca
jmp 0x139b7
leaq 0x7fe4d(%rip), %rcx     # 0x93800
movq (%rcx,%rax,8), %rcx
leaq 0x65d1b(%rip), %rdx     # 0x796d9
movq %r12, %rsi
xorl %eax, %eax
callq 0x24616
movq 0x8(%rbx), %rdx
testq %rdx, %rdx
je 0x139f4
movq -0x60(%rbp), %rax
movq %rdx, (%rax)
movl 0x18(%rbx), %edi
leaq 0x65cf7(%rip), %rsi     # 0x796d9
xorl %eax, %eax
callq 0xb8cc
movq $0x0, 0x8(%rbx)
incl %r15d
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x13a16
cmpl $0x0, 0x50(%rbx)
jle 0x13a16
cmpb $0x0, 0x1e(%rbx)
jne 0x13a16
callq 0x2325e
movq $0x0, 0x10(%rbx)
cmpb $0x0, 0x1e(%rbx)
jne 0x13a40
movq 0x1c8(%rbx), %rsi
movq %r12, %rdi
callq 0x9c3a
movq $0x0, 0x1c8(%rbx)
movl $0x0, 0x1c0(%rbx)
movq 0x280(%rbx), %rdi
callq 0xa2e8
cmpb $0x0, 0x201(%rbx)
jne 0x13a64
movq 0x238(%rbx), %rsi
movq %r12, %rdi
callq 0x9939
movq 0x240(%rbx), %rsi
movq %r12, %rdi
callq 0x98df
movslq 0x1fc(%rbx), %r14
testq %r14, %r14
jle 0x13a9f
incq %r14
movq 0x218(%rbx), %rax
movq -0x10(%rax,%r14,8), %rsi
movq %r12, %rdi
callq 0x9c3a
decq %r14
cmpq $0x1, %r14
jg 0x13a82
movq 0x218(%rbx), %rsi
movq %r12, %rdi
callq 0x9c3a
movq 0x228(%rbx), %rsi
movq %r12, %rdi
callq 0x9c3a
movq 0x1d0(%rbx), %rsi
testq %rsi, %rsi
je 0x13ae8
movq (%rsi), %rax
movq %rax, 0x1d0(%rbx)
jmp 0x13ab5
movq 0x70(%rsi), %rax
movq %rax, 0x288(%rbx)
movq %r12, %rdi
callq 0x9939
movq 0x288(%rbx), %rsi
testq %rsi, %rsi
jne 0x13ad5
testl %r15d, %r15d
jle 0x13b06
cmpl $0x0, 0x18(%rbx)
jne 0x13b06
movl $0x1, 0x18(%rbx)
movl %r15d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x260(%rbx), %rax
movq %rax, -0x50(%rbp)
movq -0x60(%rbp), %r15
movq (%r15), %rsi
movq -0x48(%rbp), %r12
movq %r12, %rdi
callq 0x9c3a
leaq 0x67061(%rip), %rsi     # 0x7ab9e
movl $0x0, -0x3c(%rbp)
movq %r12, %rdi
movq -0x50(%rbp), %rdx
xorl %eax, %eax
callq 0x117e2
movq %rax, (%r15)
movl $0x1, %r15d
jmp 0x138d1
leaq 0x6702d(%rip), %rsi     # 0x7ab94
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %eax, %eax
callq 0x11724
movl $0x9, 0x18(%rbx)
jmp 0x138d1