// File: /workspace/github_c_makefile_star2_O3/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, %r14
movq %rdi, 0x10(%rsp)
callq 0x48791
movq %rax, %rbx
movq 0x10(%r14), %r12
testq %r12, %r12
je 0x63bc6
cmpl $0x0, 0x60(%rsp)
setne %al
shlb $0x4, %al
incb %al
movzbl %al, %r15d
movl (%r13), %ecx
testl %ecx, %ecx
je 0x63bb2
cmpq $0x0, 0x48(%r12)
je 0x63b53
movl 0x34(%rbx), %eax
addl $0x2, %eax
movq %rbx, %rdi
movl $0x4a, %esi
movl %ecx, %edx
movl %eax, %ecx
xorl %r8d, %r8d
callq 0x487d8
movl (%r13), %ecx
movq %rbx, %rdi
movl $0x69, %esi
movl %ebp, %edx
xorl %r8d, %r8d
callq 0x487d8
movb 0x63(%r12), %al
andb $0x3, %al
cmpb $0x2, %al
jne 0x63b94
cmpl $0x0, 0x60(%rsp)
setne %cl
movb 0x48(%r14), %al
andb $0x20, %al
shrb $0x5, %al
orb %al, %cl
testb %al, %al
movl $0x10, %eax
cmovnel %r15d, %eax
testb %cl, %cl
jne 0x63b9d
jmp 0x63bb2
movb $0x10, %al
cmpl $0x0, 0x60(%rsp)
je 0x63bb2
movq 0x8(%rbx), %rcx
testq %rcx, %rcx
je 0x63bb2
movslq 0x34(%rbx), %rdx
leaq (%rdx,%rdx,2), %rdx
movb %al, -0x15(%rcx,%rdx,8)
movq 0x28(%r12), %r12
incl %ebp
addq $0x4, %r13
testq %r12, %r12
jne 0x63b21
testb $0x20, 0x48(%r14)
jne 0x63cbc
movl 0x50(%rsp), %r15d
movq 0x8(%rsp), %rax
leal 0x1(%rax), %r13d
movq 0x10(%rsp), %r12
movb 0x1f(%r12), %al
testb %al, %al
je 0x63bfe
decb %al
movb %al, 0x1f(%r12)
movzbl %al, %eax
movl 0x28(%r12,%rax,4), %ebp
jmp 0x63c0a
movl 0x58(%r12), %ebp
incl %ebp
movl %ebp, 0x58(%r12)
movswl 0x42(%r14), %ecx
movq %rbx, %rdi
movl $0x2d, %esi
movl %r13d, %edx
movl %ebp, %r8d
callq 0x487d8
movq %rbx, %rdi
movq %r14, %rsi
callq 0x62cc1
movswl 0x42(%r14), %edx
movq %r12, %rdi
movl %r13d, %esi
callq 0x4a54e
testl %r15d, %r15d
setne %al
addb %al, %al
addb $0x3, %al
xorl %ecx, %ecx
cmpb $0x0, 0x1e(%r12)
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, %r15d
cmovel %ecx, %r15d
movq %rbx, %rdi
movl $0x44, %esi
movl 0x4(%rsp), %edx
movl %ebp, %ecx
movq 0x8(%rsp), %r8
callq 0x487d8
cmpb $0x0, 0x1e(%r12)
jne 0x63ca6
movq (%r14), %rdx
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
callq 0x12044
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x63cbc
movslq 0x34(%rbx), %rcx
leaq (%rcx,%rcx,2), %rcx
movb %r15b, -0x15(%rax,%rcx,8)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq