// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3AutoincrementBegin
SQLITE_PRIVATE void sqlite3AutoincrementBegin(Parse *pParse){
  AutoincInfo *p;            /* Information about an AUTOINCREMENT */
  sqlite3 *db = pParse->db;  /* The database connection */
  Db *pDb;                   /* Database only autoinc table */
  int memId;                 /* Register holding max rowid */
  int addr;                  /* A VDBE address */
  Vdbe *v = pParse->pVdbe;   /* VDBE under construction */

  /* This routine is never called during trigger-generation.  It is
  ** only called from the top-level */
  assert( pParse->pTriggerTab==0 );
  assert( pParse==sqlite3ParseToplevel(pParse) );

  assert( v );   /* We failed long ago if this is not so */
  for(p = pParse->pAinc; p; p = p->pNext){
    pDb = &db->aDb[p->iDb];
    memId = p->regCtr;
    assert( sqlite3SchemaMutexHeld(db, 0, pDb->pSchema) );
    sqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenRead);
    sqlite3VdbeAddOp3(v, OP_Null, 0, memId, memId+1);
    addr = sqlite3VdbeCurrentAddr(v);
    sqlite3VdbeAddOp4(v, OP_String8, 0, memId-1, 0, p->pTab->zName, 0);
    sqlite3VdbeAddOp2(v, OP_Rewind, 0, addr+9);
    sqlite3VdbeAddOp3(v, OP_Column, 0, 0, memId);
    sqlite3VdbeAddOp3(v, OP_Ne, memId-1, addr+7, memId);
    sqlite3VdbeChangeP5(v, SQLITE_JUMPIFNULL);
    sqlite3VdbeAddOp2(v, OP_Rowid, 0, memId+1);
    sqlite3VdbeAddOp3(v, OP_Column, 0, 1, memId);
    sqlite3VdbeAddOp2(v, OP_Goto, 0, addr+9);
    sqlite3VdbeAddOp2(v, OP_Next, 0, addr+2);
    sqlite3VdbeAddOp2(v, OP_Integer, 0, memId);
    sqlite3VdbeAddOp0(v, OP_Close);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x1d0(%rax), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x5e46d
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x10(%rcx), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x10(%rax), %edx
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x68(%rax), %rcx
xorl %esi, %esi
movl $0x30, %r8d
callq 0x5e480
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %ecx
movl -0x24(%rbp), %r8d
addl $0x1, %r8d
movl $0x18, %esi
xorl %edx, %edx
callq 0x5e0f0
movq -0x30(%rbp), %rdi
callq 0x5e520
movl %eax, -0x28(%rbp)
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %r9
movl $0x5e, %esi
xorl %r8d, %r8d
movl %r8d, %edx
movl $0x0, (%rsp)
callq 0x5e1b0
movq -0x30(%rbp), %rdi
movl -0x28(%rbp), %ecx
addl $0x9, %ecx
movl $0x65, %esi
xorl %edx, %edx
callq 0x5e0c0
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %r8d
movl $0x29, %esi
xorl %ecx, %ecx
movl %ecx, %edx
callq 0x5e0f0
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %edx
subl $0x1, %edx
movl -0x28(%rbp), %ecx
addl $0x7, %ecx
movl -0x24(%rbp), %r8d
movl $0x4b, %esi
callq 0x5e0f0
movq -0x30(%rbp), %rdi
movl $0x8, %esi
callq 0x5e540
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movl $0x60, %esi
xorl %edx, %edx
callq 0x5e0c0
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %r8d
movl $0x29, %esi
xorl %edx, %edx
movl $0x1, %ecx
callq 0x5e0f0
movq -0x30(%rbp), %rdi
movl -0x28(%rbp), %ecx
addl $0x9, %ecx
movl $0xe, %esi
xorl %edx, %edx
callq 0x5e0c0
movq -0x30(%rbp), %rdi
movl -0x28(%rbp), %ecx
addl $0x2, %ecx
movl $0x7, %esi
xorl %edx, %edx
callq 0x5e0c0
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %ecx
movl $0x15, %esi
xorl %edx, %edx
callq 0x5e0c0
movq -0x30(%rbp), %rdi
movl $0x36, %esi
callq 0x5e060
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x5e2e2
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)