// File: /workspace/github_c_makefile_star2_O0/ukontainer[P]sqlite-bench/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 update_flags,   /* 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 assembled record for the table */
  int i;              /* Loop counter */
  u8 bAffinityDone = 0; /* True if OP_Affinity has been run already */

  assert( update_flags==0
       || update_flags==OPFLAG_ISUPDATE
       || update_flags==(OPFLAG_ISUPDATE|OPFLAG_SAVEPOSITION)
  );

  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;
    bAffinityDone = 1;
    if( pIdx->pPartIdxWhere ){
      sqlite3VdbeAddOp2(v, OP_IsNull, aRegIdx[i], sqlite3VdbeCurrentAddr(v)+2);
      VdbeCoverage(v);
    }
    pik_flags = (useSeekResult ? OPFLAG_USESEEKRESULT : 0);
    if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){
      assert( pParse->nested==0 );
      pik_flags |= OPFLAG_NCHANGE;
      pik_flags |= (update_flags & OPFLAG_SAVEPOSITION);
#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
      if( update_flags==0 ){
        sqlite3VdbeAddOp4(v, OP_InsertInt, 
            iIdxCur+i, aRegIdx[i], 0, (char*)pTab, P4_TABLE
        );
        sqlite3VdbeChangeP5(v, OPFLAG_ISNOOP);
      }
#endif
    }
    sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i],
                         aRegIdx[i]+1,
                         pIdx->uniqNotNull ? pIdx->nKeyCol: pIdx->nColumn);
    sqlite3VdbeChangeP5(v, pik_flags);
  }
  if( !HasRowid(pTab) ) return;
  regData = regNewData + 1;
  regRec = sqlite3GetTempReg(pParse);
  sqlite3VdbeAddOp3(v, OP_MakeRecord, regData, pTab->nCol, regRec);
  sqlite3SetMakeRecordP5(v, pTab);
  if( !bAffinityDone ){
    sqlite3TableAffinity(v, pTab, 0);
  }
  if( pParse->nested ){
    pik_flags = 0;
  }else{
    pik_flags = OPFLAG_NCHANGE;
    pik_flags |= (update_flags?update_flags:OPFLAG_LASTROWID);
  }
  if( appendBias ){
    pik_flags |= OPFLAG_APPEND;
  }
  if( useSeekResult ){
    pik_flags |= OPFLAG_USESEEKRESULT;
  }
  sqlite3VdbeAddOp3(v, OP_Insert, iDataCur, regRec, regNewData);
  if( !pParse->nested ){
    sqlite3VdbeAppendP4(v, pTab, P4_TABLE);
  }
  sqlite3VdbeChangeP5(v, pik_flags);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %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)
movb $0x0, -0x49(%rbp)
movq -0x8(%rbp), %rdi
callq 0x46bb00
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 0x49c235
movq -0x28(%rbp), %rax
movslq -0x48(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x49c0fc
jmp 0x49c21b
movb $0x1, -0x49(%rbp)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x49c140
movq -0x30(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rax
movslq -0x48(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x50(%rbp)
movq -0x30(%rbp), %rdi
callq 0x473080
movq -0x58(%rbp), %rdi
movl -0x50(%rbp), %edx
movl %eax, %ecx
addl $0x2, %ecx
movl $0x32, %esi
callq 0x453790
movl 0x20(%rbp), %edx
xorl %eax, %eax
movl $0x10, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movb %al, -0x39(%rbp)
movq -0x38(%rbp), %rax
movw 0x63(%rax), %ax
andw $0x3, %ax
movzwl %ax, %eax
cmpl $0x2, %eax
jne 0x49c18f
movq -0x10(%rbp), %rax
movl 0x40(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x49c18f
movzbl -0x39(%rbp), %eax
orl $0x1, %eax
movb %al, -0x39(%rbp)
movl 0x10(%rbp), %ecx
andl $0x2, %ecx
movzbl -0x39(%rbp), %eax
orl %ecx, %eax
movb %al, -0x39(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x70(%rbp)
movl -0x18(%rbp), %eax
addl -0x48(%rbp), %eax
movl %eax, -0x64(%rbp)
movq -0x28(%rbp), %rax
movslq -0x48(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x60(%rbp)
movq -0x28(%rbp), %rax
movslq -0x48(%rbp), %rcx
movl (%rax,%rcx,4), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
movq -0x38(%rbp), %rax
movw 0x63(%rax), %ax
shrw $0x3, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x49c1e4
movq -0x38(%rbp), %rax
movzwl 0x5e(%rax), %eax
movl %eax, -0x74(%rbp)
jmp 0x49c1ef
movq -0x38(%rbp), %rax
movzwl 0x60(%rax), %eax
movl %eax, -0x74(%rbp)
movl -0x5c(%rbp), %r8d
movl -0x60(%rbp), %ecx
movl -0x64(%rbp), %edx
movq -0x70(%rbp), %rdi
movl -0x74(%rbp), %r9d
movl $0x85, %esi
callq 0x4113b0
movq -0x30(%rbp), %rdi
movzbl -0x39(%rbp), %eax
movzwl %ax, %esi
callq 0x411430
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x38(%rbp)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x49c0de
movq -0x10(%rbp), %rax
movl 0x40(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x49c249
jmp 0x49c32c
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
callq 0x470ad0
movl %eax, -0x44(%rbp)
movq -0x30(%rbp), %rdi
movl -0x40(%rbp), %edx
movq -0x10(%rbp), %rax
movswl 0x46(%rax), %ecx
movl -0x44(%rbp), %r8d
movl $0x66, %esi
callq 0x4537c0
cmpb $0x0, -0x49(%rbp)
jne 0x49c290
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %edx, %edx
callq 0x474e40
movq -0x8(%rbp), %rax
cmpb $0x0, 0x1e(%rax)
je 0x49c2a0
movb $0x0, -0x39(%rbp)
jmp 0x49c2c8
movb $0x1, -0x39(%rbp)
cmpl $0x0, 0x10(%rbp)
je 0x49c2b2
movl 0x10(%rbp), %eax
movl %eax, -0x78(%rbp)
jmp 0x49c2bc
movl $0x20, %eax
movl %eax, -0x78(%rbp)
jmp 0x49c2bc
movl -0x78(%rbp), %ecx
movzbl -0x39(%rbp), %eax
orl %ecx, %eax
movb %al, -0x39(%rbp)
cmpl $0x0, 0x18(%rbp)
je 0x49c2d8
movzbl -0x39(%rbp), %eax
orl $0x8, %eax
movb %al, -0x39(%rbp)
cmpl $0x0, 0x20(%rbp)
je 0x49c2e8
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 $0x7a, %esi
callq 0x4537c0
movq -0x8(%rbp), %rax
cmpb $0x0, 0x1e(%rax)
jne 0x49c31c
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0xfffffffa, %edx       # imm = 0xFFFFFFFA
callq 0x46c440
movq -0x30(%rbp), %rdi
movzbl -0x39(%rbp), %eax
movzwl %ax, %esi
callq 0x411430
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)