// File: /workspace/github_c_makefile_star2_O1/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:
movq 0x1d0(%rdi), %rcx
testq %rcx, %rcx
je 0x5ca33
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq 0x10(%rdi), %r14
movq (%rdi), %rax
movq %rax, -0x38(%rbp)
movq %rdi, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movslq 0x10(%rcx), %rdx
movq %rcx, -0x50(%rbp)
movl 0x14(%rcx), %r13d
movb 0x1f(%rdi), %cl
testb %cl, %cl
je 0x5c826
decb %cl
movb %cl, 0x1f(%rdi)
movzbl %cl, %ecx
movl 0x28(%rdi,%rcx,4), %r15d
jmp 0x5c831
movl 0x58(%rdi), %r15d
incl %r15d
movl %r15d, 0x58(%rdi)
movq %rdx, %rcx
shlq $0x5, %rcx
movq 0x18(%rax,%rcx), %rax
movq 0x68(%rax), %rcx
xorl %esi, %esi
movl $0x31, %r8d
callq 0x45c23
leal 0x1(%r13), %edx
movq %r14, %rdi
movl $0x4a, %esi
movl %edx, -0x30(%rbp)
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x45b9e
movl %eax, -0x2c(%rbp)
movq %r14, %rdi
movl $0x65, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x45b9e
movl %eax, %r12d
movq %r14, %rdi
movl $0x29, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movl %r15d, %r8d
callq 0x45b9e
movl %eax, %ebx
decl %r13d
movq %r14, %rdi
movl $0x4c, %esi
movq %r13, -0x48(%rbp)
movl %r13d, %edx
xorl %ecx, %ecx
movl %r15d, %r8d
callq 0x45b9e
movl %eax, %r13d
movq %r14, %rdi
movl $0x7, %esi
xorl %edx, %edx
movl %ebx, %ecx
xorl %r8d, %r8d
callq 0x45b9e
testl %r12d, %r12d
js 0x5c8e7
movl 0x34(%r14), %eax
cmpl %r12d, %eax
jbe 0x5c8e7
movq 0x8(%r14), %rcx
movl %r12d, %edx
leaq (%rdx,%rdx,2), %rdx
movl %eax, 0x8(%rcx,%rdx,8)
movq %r14, %rdi
movl $0x41, %esi
xorl %edx, %edx
movl -0x30(%rbp), %ebx
movl %ebx, %ecx
xorl %r8d, %r8d
callq 0x45b9e
movq %r14, %rdi
movl $0xe, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x45b9e
movl %eax, %r12d
testl %r13d, %r13d
js 0x5c932
movl 0x34(%r14), %eax
cmpl %r13d, %eax
jbe 0x5c932
movq 0x8(%r14), %rcx
movl %r13d, %edx
leaq (%rdx,%rdx,2), %rdx
movl %eax, 0x8(%rcx,%rdx,8)
movq %r14, %rdi
movl $0x60, %esi
xorl %edx, %edx
movl %ebx, %ecx
xorl %r8d, %r8d
callq 0x45b9e
movl -0x2c(%rbp), %edx
testl %edx, %edx
js 0x5c963
movl 0x34(%r14), %eax
cmpl %edx, %eax
jbe 0x5c963
movq 0x8(%r14), %rcx
movl %edx, %edx
leaq (%rdx,%rdx,2), %rdx
movl %eax, 0x8(%rcx,%rdx,8)
testl %r12d, %r12d
movq -0x48(%rbp), %rdx
js 0x5c984
movl 0x34(%r14), %eax
cmpl %r12d, %eax
jbe 0x5c984
movq 0x8(%r14), %rcx
movl %r12d, %esi
leaq (%rsi,%rsi,2), %rsi
movl %eax, 0x8(%rcx,%rsi,8)
movq %r14, %rdi
movl $0x2b, %esi
movl $0x2, %ecx
movl %r15d, %r8d
callq 0x45b9e
movq %r14, %rdi
movl $0x42, %esi
xorl %edx, %edx
movl %r15d, %ecx
movl %ebx, %r8d
callq 0x45b9e
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x5c9c4
movslq 0x34(%r14), %rcx
leaq (%rcx,%rcx,2), %rcx
movb $0x8, -0x15(%rax,%rcx,8)
movq %r14, %rdi
movl $0x36, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x45b9e
testl %r15d, %r15d
movq -0x40(%rbp), %rdi
je 0x5ca15
movzbl 0x1f(%rdi), %eax
cmpq $0x7, %rax
ja 0x5ca15
xorl %ecx, %ecx
cmpl %r15d, 0x84(%rdi,%rcx)
je 0x5ca10
addq $0x18, %rcx
cmpl $0xf0, %ecx
jne 0x5c9ed
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%rdi)
movl %r15d, 0x28(%rdi,%rax,4)
jmp 0x5ca15
movb $0x1, 0x7c(%rdi,%rcx)
movq -0x50(%rbp), %rcx
movq (%rcx), %rcx
testq %rcx, %rcx
jne 0x5c7fc
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq