// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
movl 0x20(%rbp), %eax
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movq %r9, -0x28(%rbp)
movq -0x8(%rbp), %rdi
callq 0x638c0
movq %rax, -0x30(%rbp)
movl $0x0, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x8834c
movq -0x28(%rbp), %rax
movslq -0x48(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x88285
jmp 0x88332
movq -0x38(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x882c5
movq -0x30(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rax
movslq -0x48(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x4c(%rbp)
movq -0x30(%rbp), %rdi
callq 0x63ea0
movq -0x58(%rbp), %rdi
movl -0x4c(%rbp), %edx
movl %eax, %ecx
addl $0x2, %ecx
movl $0x4a, %esi
callq 0x63980
movq -0x30(%rbp), %rdi
movl -0x18(%rbp), %edx
addl -0x48(%rbp), %edx
movq -0x28(%rbp), %rax
movslq -0x48(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
movl $0x69, %esi
callq 0x63980
movb $0x0, -0x39(%rbp)
cmpl $0x0, 0x20(%rbp)
je 0x882f2
movb $0x10, -0x39(%rbp)
movq -0x38(%rbp), %rax
movb 0x63(%rax), %al
andb $0x3, %al
movzbl %al, %eax
cmpl $0x2, %eax
jne 0x8831d
movq -0x10(%rbp), %rax
movzbl 0x48(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x8831d
movzbl -0x39(%rbp), %eax
orl $0x1, %eax
movb %al, -0x39(%rbp)
cmpb $0x0, -0x39(%rbp)
je 0x88330
movq -0x30(%rbp), %rdi
movzbl -0x39(%rbp), %esi
callq 0x63ec0
jmp 0x88332
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x38(%rbp)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x88267
movq -0x10(%rbp), %rax
movzbl 0x48(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x88361
jmp 0x8844a
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
callq 0x67350
movl %eax, -0x44(%rbp)
movq -0x30(%rbp), %rdi
movl -0x40(%rbp), %edx
movq -0x10(%rbp), %rax
movswl 0x42(%rax), %ecx
movl -0x44(%rbp), %r8d
movl $0x2d, %esi
callq 0x639b0
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x874e0
movq -0x8(%rbp), %rdi
movl -0x40(%rbp), %esi
movq -0x10(%rbp), %rax
movswl 0x42(%rax), %edx
callq 0x66050
movq -0x8(%rbp), %rax
cmpb $0x0, 0x1e(%rax)
je 0x883c4
movb $0x0, -0x39(%rbp)
jmp 0x883e4
movb $0x1, -0x39(%rbp)
movl 0x10(%rbp), %edx
movl $0x2, %ecx
movl $0x4, %eax
cmpl $0x0, %edx
cmovnel %eax, %ecx
movzbl -0x39(%rbp), %eax
orl %ecx, %eax
movb %al, -0x39(%rbp)
cmpl $0x0, 0x18(%rbp)
je 0x883f4
movzbl -0x39(%rbp), %eax
orl $0x8, %eax
movb %al, -0x39(%rbp)
cmpl $0x0, 0x20(%rbp)
je 0x88404
movzbl -0x39(%rbp), %eax
orl $0x10, %eax
movb %al, -0x39(%rbp)
movq -0x30(%rbp), %rdi
movl -0x14(%rbp), %edx
movl -0x44(%rbp), %ecx
movl -0x1c(%rbp), %r8d
movl $0x44, %esi
callq 0x639b0
movq -0x8(%rbp), %rax
cmpb $0x0, 0x1e(%rax)
jne 0x8843d
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
callq 0x16e40
movq -0x30(%rbp), %rdi
movzbl -0x39(%rbp), %esi
callq 0x63ec0
addq $0x60, %rsp
popq %rbp
retq