// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/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 */
  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( sqlite3IsToplevel(pParse) );

  assert( v );   /* We failed long ago if this is not so */
  for(p = pParse->pAinc; p; p = p->pNext){
    static const int iLn = VDBE_OFFSET_LINENO(2);
    static const VdbeOpList autoInc[] = {
      /* 0  */ {OP_Null,    0,  0, 0},
      /* 1  */ {OP_Rewind,  0, 10, 0},
      /* 2  */ {OP_Column,  0,  0, 0},
      /* 3  */ {OP_Ne,      0,  9, 0},
      /* 4  */ {OP_Rowid,   0,  0, 0},
      /* 5  */ {OP_Column,  0,  1, 0},
      /* 6  */ {OP_AddImm,  0,  0, 0},
      /* 7  */ {OP_Copy,    0,  0, 0},
      /* 8  */ {OP_Goto,    0, 11, 0},
      /* 9  */ {OP_Next,    0,  2, 0},
      /* 10 */ {OP_Integer, 0,  0, 0},
      /* 11 */ {OP_Close,   0,  0, 0}
    };
    VdbeOp *aOp;
    pDb = &db->aDb[p->iDb];
    memId = p->regCtr;
    assert( sqlite3SchemaMutexHeld(db, 0, pDb->pSchema) );
    sqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenRead);
    sqlite3VdbeLoadString(v, memId-1, p->pTab->zName);
    aOp = sqlite3VdbeAddOpList(v, ArraySize(autoInc), autoInc, iLn);
    if( aOp==0 ) break;
    aOp[0].p2 = memId;
    aOp[0].p3 = memId+2;
    aOp[2].p3 = memId;
    aOp[3].p1 = memId-1;
    aOp[3].p3 = memId;
    aOp[3].p5 = SQLITE_JUMPIFNULL;
    aOp[4].p2 = memId+1;
    aOp[5].p3 = memId;
    aOp[6].p1 = memId;
    aOp[7].p2 = memId+2;
    aOp[7].p1 = memId;
    aOp[10].p2 = memId;
    if( pParse->nTab==0 ) pParse->nTab = 1;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rax
movq %rax, (%rsp)
movq 0x10(%rdi), %r14
leaq 0x98(%rdi), %r15
movq (%r15), %r15
testq %r15, %r15
je 0x2c5f88
movq (%rsp), %rax
movq 0x20(%rax), %rax
movslq 0x10(%r15), %rdx
movl 0x14(%r15), %r13d
movq %rdx, %rcx
shlq $0x5, %rcx
movq 0x18(%rax,%rcx), %rax
movq 0x68(%rax), %rcx
movq %rbx, %rdi
xorl %esi, %esi
movl $0x60, %r8d
callq 0x2c5fdd
leal -0x1(%r13), %ebp
movq 0x8(%r15), %rax
movq (%rax), %r12
movq %r14, %rdi
movl $0x73, %esi
xorl %edx, %edx
movl %ebp, %ecx
xorl %r8d, %r8d
callq 0x2b200c
movq %r14, %rdi
movl %eax, %esi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x285198
movq %r14, %rdi
movl $0xc, %esi
leaq 0x118a4d(%rip), %rdx    # 0x3de970
callq 0x2850a2
testq %rax, %rax
je 0x2c5f88
movl %r13d, 0x8(%rax)
leal 0x2(%r13), %ecx
movl %ecx, 0xc(%rax)
movl %r13d, 0x3c(%rax)
movl %ebp, 0x4c(%rax)
movl %r13d, 0x54(%rax)
movw $0x10, 0x4a(%rax)
leal 0x1(%r13), %edx
movl %edx, 0x68(%rax)
movl %r13d, 0x84(%rax)
movl %r13d, 0x94(%rax)
movl %ecx, 0xb0(%rax)
movl %r13d, 0xac(%rax)
movl %r13d, 0xf8(%rax)
cmpl $0x0, 0x34(%rbx)
jne 0x2c5f7f
movl $0x1, 0x34(%rbx)
testq %rax, %rax
jne 0x2c5eaa
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq