// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3AutoincrementEnd
SQLITE_PRIVATE void sqlite3AutoincrementEnd(Parse *pParse){
  AutoincInfo *p;
  Vdbe *v = pParse->pVdbe;
  sqlite3 *db = pParse->db;

  assert( v );
  for(p = pParse->pAinc; p; p = p->pNext){
    Db *pDb = &db->aDb[p->iDb];
    int j1, j2, j3, j4, j5;
    int iRec;
    int memId = p->regCtr;

    iRec = sqlite3GetTempReg(pParse);
    assert( sqlite3SchemaMutexHeld(db, 0, pDb->pSchema) );
    sqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenWrite);
    j1 = sqlite3VdbeAddOp1(v, OP_NotNull, memId+1);
    j2 = sqlite3VdbeAddOp0(v, OP_Rewind);
    j3 = sqlite3VdbeAddOp3(v, OP_Column, 0, 0, iRec);
    j4 = sqlite3VdbeAddOp3(v, OP_Eq, memId-1, 0, iRec);
    sqlite3VdbeAddOp2(v, OP_Next, 0, j3);
    sqlite3VdbeJumpHere(v, j2);
    sqlite3VdbeAddOp2(v, OP_NewRowid, 0, memId+1);
    j5 = sqlite3VdbeAddOp0(v, OP_Goto);
    sqlite3VdbeJumpHere(v, j4);
    sqlite3VdbeAddOp2(v, OP_Rowid, 0, memId+1);
    sqlite3VdbeJumpHere(v, j1);
    sqlite3VdbeJumpHere(v, j5);
    sqlite3VdbeAddOp3(v, OP_MakeRecord, memId-1, 2, iRec);
    sqlite3VdbeAddOp3(v, OP_Insert, 0, iRec, memId+1);
    sqlite3VdbeChangeP5(v, OPFLAG_APPEND);
    sqlite3VdbeAddOp0(v, OP_Close);
    sqlite3ReleaseTempReg(pParse, iRec);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x1d0(%rax), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x7d0f0
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x10(%rcx), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x44(%rbp)
movq -0x8(%rbp), %rdi
callq 0x66a70
movl %eax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x10(%rax), %edx
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x68(%rax), %rcx
xorl %esi, %esi
movl $0x31, %r8d
callq 0x5e480
movq -0x18(%rbp), %rdi
movl -0x44(%rbp), %edx
addl $0x1, %edx
movl $0x4a, %esi
callq 0x5ecf0
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rdi
movl $0x65, %esi
callq 0x5e060
movl %eax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
movl -0x40(%rbp), %r8d
movl $0x29, %esi
xorl %ecx, %ecx
movl %ecx, %edx
callq 0x5e0f0
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rdi
movl -0x44(%rbp), %edx
subl $0x1, %edx
movl -0x40(%rbp), %r8d
movl $0x4c, %esi
xorl %ecx, %ecx
callq 0x5e0f0
movl %eax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
movl -0x34(%rbp), %ecx
movl $0x7, %esi
xorl %edx, %edx
callq 0x5e0c0
movq -0x18(%rbp), %rdi
movl -0x30(%rbp), %esi
callq 0x5e090
movq -0x18(%rbp), %rdi
movl -0x44(%rbp), %ecx
addl $0x1, %ecx
movl $0x41, %esi
xorl %edx, %edx
callq 0x5e0c0
movq -0x18(%rbp), %rdi
movl $0xe, %esi
callq 0x5e060
movl %eax, -0x3c(%rbp)
movq -0x18(%rbp), %rdi
movl -0x38(%rbp), %esi
callq 0x5e090
movq -0x18(%rbp), %rdi
movl -0x44(%rbp), %ecx
addl $0x1, %ecx
movl $0x60, %esi
xorl %edx, %edx
callq 0x5e0c0
movq -0x18(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0x5e090
movq -0x18(%rbp), %rdi
movl -0x3c(%rbp), %esi
callq 0x5e090
movq -0x18(%rbp), %rdi
movl -0x44(%rbp), %edx
subl $0x1, %edx
movl -0x40(%rbp), %r8d
movl $0x2b, %esi
movl $0x2, %ecx
callq 0x5e0f0
movq -0x18(%rbp), %rdi
movl -0x40(%rbp), %ecx
movl -0x44(%rbp), %r8d
addl $0x1, %r8d
movl $0x42, %esi
xorl %edx, %edx
callq 0x5e0f0
movq -0x18(%rbp), %rdi
movl $0x8, %esi
callq 0x5e540
movq -0x18(%rbp), %rdi
movl $0x36, %esi
callq 0x5e060
movq -0x8(%rbp), %rdi
movl -0x40(%rbp), %esi
callq 0x66ac0
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x7cf42
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)