// File: /workspace/github_c_makefile_star2_O2/skeeto[P]flappy/sqlite3.c
// Function: sqlite3CompleteInsertion
SQLITE_PRIVATE void sqlite3CompleteInsertion(
  Parse *pParse,      /* The parser context */
  Table *pTab,        /* the table into which we are inserting */
  int iDataCur,       /* Cursor of the canonical data source */
  int iIdxCur,        /* First index cursor */
  int regNewData,     /* Range of content */
  int *aRegIdx,       /* Register used by each index.  0 for unused indices */
  int isUpdate,       /* True for UPDATE, False for INSERT */
  int appendBias,     /* True if this is likely to be an append */
  int useSeekResult   /* True to set the USESEEKRESULT flag on OP_[Idx]Insert */
){
  Vdbe *v;            /* Prepared statements under construction */
  Index *pIdx;        /* An index being inserted or updated */
  u8 pik_flags;       /* flag values passed to the btree insert */
  int regData;        /* Content registers (after the rowid) */
  int regRec;         /* Register holding assemblied record for the table */
  int i;              /* Loop counter */

  v = sqlite3GetVdbe(pParse);
  assert( v!=0 );
  assert( pTab->pSelect==0 );  /* This table is not a VIEW */
  for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
    if( aRegIdx[i]==0 ) continue;
    if( pIdx->pPartIdxWhere ){
      sqlite3VdbeAddOp2(v, OP_IsNull, aRegIdx[i], sqlite3VdbeCurrentAddr(v)+2);
    }
    sqlite3VdbeAddOp2(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i]);
    pik_flags = 0;
    if( useSeekResult ) pik_flags = OPFLAG_USESEEKRESULT;
    if( pIdx->autoIndex==2 && !HasRowid(pTab) ){
      assert( pParse->nested==0 );
      pik_flags |= OPFLAG_NCHANGE;
    }
    if( pik_flags )  sqlite3VdbeChangeP5(v, pik_flags);
  }
  if( !HasRowid(pTab) ) return;
  regData = regNewData + 1;
  regRec = sqlite3GetTempReg(pParse);
  sqlite3VdbeAddOp3(v, OP_MakeRecord, regData, pTab->nCol, regRec);
  sqlite3TableAffinityStr(v, pTab);
  sqlite3ExprCacheAffinityChange(pParse, regData, pTab->nCol);
  if( pParse->nested ){
    pik_flags = 0;
  }else{
    pik_flags = OPFLAG_NCHANGE;
    pik_flags |= (isUpdate?OPFLAG_ISUPDATE:OPFLAG_LASTROWID);
  }
  if( appendBias ){
    pik_flags |= OPFLAG_APPEND;
  }
  if( useSeekResult ){
    pik_flags |= OPFLAG_USESEEKRESULT;
  }
  sqlite3VdbeAddOp3(v, OP_Insert, iDataCur, regRec, regNewData);
  if( !pParse->nested ){
    sqlite3VdbeChangeP4(v, -1, pTab->zName, P4_TRANSIENT);
  }
  sqlite3VdbeChangeP5(v, pik_flags);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %r13
movq %r8, 0x8(%rsp)
movl %ecx, %ebp
movl %edx, 0x4(%rsp)
movq %rsi, %r15
movq %rdi, 0x10(%rsp)
callq 0x43f1b
movq %rax, %rbx
movq %r15, %r14
leaq 0x10(%r15), %r12
cmpl $0x0, 0x60(%rsp)
setne %al
shlb $0x4, %al
incb %al
movzbl %al, %r15d
movq (%r12), %r12
testq %r12, %r12
je 0x589e2
movl (%r13), %ecx
testl %ecx, %ecx
je 0x589d3
cmpq $0x0, 0x48(%r12)
je 0x5897b
movl 0x34(%rbx), %eax
addl $0x2, %eax
movq %rbx, %rdi
pushq $0x4a
popq %rsi
movl %ecx, %edx
movl %eax, %ecx
callq 0x43f64
movl (%r13), %ecx
movq %rbx, %rdi
pushq $0x69
popq %rsi
movl %ebp, %edx
callq 0x43f64
movb 0x63(%r12), %al
andb $0x3, %al
cmpb $0x2, %al
jne 0x589b5
cmpl $0x0, 0x60(%rsp)
setne %cl
movb 0x48(%r14), %al
andb $0x20, %al
shrb $0x5, %al
orb %al, %cl
testb %al, %al
pushq $0x10
popq %rax
cmovnel %r15d, %eax
testb %cl, %cl
jne 0x589be
jmp 0x589d3
movb $0x10, %al
cmpl $0x0, 0x60(%rsp)
je 0x589d3
movq 0x8(%rbx), %rcx
testq %rcx, %rcx
je 0x589d3
movslq 0x34(%rbx), %rdx
imulq $0x18, %rdx, %rdx
movb %al, -0x15(%rcx,%rdx)
addq $0x28, %r12
incl %ebp
addq $0x4, %r13
jmp 0x58945
testb $0x20, 0x48(%r14)
jne 0x58ab5
movq %r14, %r12
movq 0x8(%rsp), %rax
leal 0x1(%rax), %r15d
movq 0x10(%rsp), %r13
movq %r13, %rdi
callq 0x46316
movl %eax, %ebp
movswl 0x42(%r14), %ecx
pushq $0x2d
popq %rsi
movq %rbx, %rdi
movl %r15d, %edx
movl %eax, %r8d
callq 0x43f69
movq %rbx, %rdi
movq %r14, %rsi
callq 0x57d5e
movswl 0x42(%r14), %edx
movq %r13, %rdi
movl %r15d, %esi
callq 0x459a9
cmpl $0x0, 0x50(%rsp)
setne %al
addb %al, %al
addb $0x3, %al
xorl %ecx, %ecx
cmpb $0x0, 0x1e(%r13)
movzbl %al, %eax
cmovnel %ecx, %eax
leal 0x8(%rax), %ecx
cmpl $0x0, 0x58(%rsp)
movzbl %cl, %ecx
cmovel %eax, %ecx
movl %ecx, %eax
orb $0x10, %al
cmpl $0x0, 0x60(%rsp)
movzbl %al, %r14d
cmovel %ecx, %r14d
pushq $0x44
popq %rsi
movq %rbx, %rdi
movl 0x4(%rsp), %edx
movl %ebp, %ecx
movq 0x8(%rsp), %r8
callq 0x43f69
cmpb $0x0, 0x1e(%r13)
jne 0x58a9f
movq (%r12), %rdx
pushq $-0x1
popq %rsi
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x10de3
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x58ab5
movslq 0x34(%rbx), %rcx
imulq $0x18, %rcx, %rcx
movb %r14b, -0x15(%rax,%rcx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq