// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %r12
movq (%rdi), %rax
movq %rax, -0x40(%rbp)
movq 0x10(%rdi), %r14
leaq 0x1d0(%rdi), %rbx
movq %rdi, -0x48(%rbp)
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x53633
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x30(%rbp)
movslq 0x10(%rbx), %r15
movl 0x14(%rbx), %r13d
movq %r12, %rdi
callq 0x46ff9
movq %r12, %rdi
movl %eax, %r12d
movq %rbx, -0x50(%rbp)
movl 0x10(%rbx), %edx
shlq $0x5, %r15
movq -0x30(%rbp), %rax
movq 0x18(%rax,%r15), %rax
movq 0x68(%rax), %rcx
xorl %esi, %esi
pushq $0x31
popq %r8
callq 0x4200b
leal 0x1(%r13), %edx
movq %r14, %rdi
pushq $0x4a
popq %rsi
movl %edx, -0x38(%rbp)
callq 0x42436
movl %eax, -0x34(%rbp)
movq %r14, %rdi
pushq $0x65
popq %rsi
callq 0x41f34
movl %eax, %ebx
movq %r14, %rdi
pushq $0x29
popq %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movl %r12d, %r8d
callq 0x41f4c
movl %eax, %r15d
decl %r13d
movq %r14, %rdi
pushq $0x4c
popq %rsi
movq %r13, -0x58(%rbp)
movl %r13d, %edx
xorl %ecx, %ecx
movl %r12d, -0x30(%rbp)
movl %r12d, %r8d
callq 0x41f4c
movl %eax, %r12d
movq %r14, %rdi
pushq $0x7
popq %rsi
xorl %edx, %edx
movl %r15d, %ecx
callq 0x41f42
testl %ebx, %ebx
js 0x5354c
movl 0x34(%r14), %eax
cmpl %ebx, %eax
jbe 0x5354c
movq 0x8(%r14), %rcx
movl %ebx, %edx
imulq $0x18, %rdx, %rdx
movl %eax, 0x8(%rcx,%rdx)
movq %r14, %rdi
pushq $0x41
popq %rsi
xorl %edx, %edx
movl -0x38(%rbp), %r15d
movl %r15d, %ecx
callq 0x41f42
movq %r14, %rdi
pushq $0xe
popq %rsi
callq 0x41f34
movl %eax, %ebx
testl %r12d, %r12d
js 0x5358a
movl 0x34(%r14), %eax
cmpl %r12d, %eax
jbe 0x5358a
movq 0x8(%r14), %rcx
movl %r12d, %edx
imulq $0x18, %rdx, %rdx
movl %eax, 0x8(%rcx,%rdx)
movq %r14, %rdi
pushq $0x60
popq %rsi
xorl %edx, %edx
movl %r15d, %ecx
callq 0x41f42
movl -0x34(%rbp), %edx
testl %edx, %edx
js 0x535b7
movl 0x34(%r14), %eax
cmpl %edx, %eax
jbe 0x535b7
movq 0x8(%r14), %rcx
movl %edx, %edx
imulq $0x18, %rdx, %rdx
movl %eax, 0x8(%rcx,%rdx)
testl %ebx, %ebx
movq -0x48(%rbp), %r12
js 0x535d5
movl 0x34(%r14), %eax
cmpl %ebx, %eax
jbe 0x535d5
movq 0x8(%r14), %rcx
movl %ebx, %edx
imulq $0x18, %rdx, %rdx
movl %eax, 0x8(%rcx,%rdx)
movq %r14, %rdi
pushq $0x2b
popq %rsi
movq -0x58(%rbp), %rdx
pushq $0x2
popq %rcx
movl -0x30(%rbp), %ebx
movl %ebx, %r8d
callq 0x41f4c
movq %r14, %rdi
pushq $0x42
popq %rsi
xorl %edx, %edx
movl %ebx, %ecx
movl %r15d, %r8d
callq 0x41f4c
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x53615
movslq 0x34(%r14), %rcx
imulq $0x18, %rcx, %rcx
movb $0x8, -0x15(%rax,%rcx)
movq %r14, %rdi
pushq $0x36
popq %rsi
callq 0x41f34
movq %r12, %rdi
movl %ebx, %esi
callq 0x4701c
movq -0x50(%rbp), %rbx
jmp 0x53479
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq