// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/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 assembled record for the table */
  int i;              /* Loop counter */
  u8 bAffinityDone = 0; /* True if OP_Affinity has been run already */

  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);
    }
    sqlite3VdbeAddOp2(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i]);
    pik_flags = 0;
    if( useSeekResult ) pik_flags = OPFLAG_USESEEKRESULT;
    if( IsPrimaryKeyIndex(pIdx) && !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);
  if( !bAffinityDone ) sqlite3TableAffinity(v, pTab, 0);
  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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, %r13
movq %r8, -0x48(%rbp)
movl %ecx, %r15d
movl %edx, -0x3c(%rbp)
movq %rsi, %r12
movl 0x20(%rbp), %r14d
movl 0x18(%rbp), %eax
movl %eax, -0x38(%rbp)
movl 0x10(%rbp), %eax
movl %eax, -0x34(%rbp)
movq %rdi, -0x58(%rbp)
callq 0x49f90
movq %rax, %rbx
movq %r12, -0x50(%rbp)
addq $0x10, %r12
movl %r14d, -0x30(%rbp)
testl %r14d, %r14d
setne %al
shlb $0x4, %al
incb %al
xorl %r14d, %r14d
movzbl %al, %eax
movl %eax, -0x2c(%rbp)
movq (%r12), %r12
testq %r12, %r12
je 0x60d89
movl (%r13), %ecx
testl %ecx, %ecx
je 0x60d79
cmpq $0x0, 0x48(%r12)
je 0x60d23
movl 0x3c(%rbx), %eax
addl $0x2, %eax
movq %rbx, %rdi
pushq $0x4c
popq %rsi
movl %ecx, %edx
movl %eax, %ecx
callq 0x4a1ab
movl (%r13), %ecx
movq %rbx, %rdi
pushq $0x70
popq %rsi
movl %r15d, %edx
callq 0x4a1ab
movb 0x63(%r12), %al
andb $0x3, %al
cmpb $0x2, %al
jne 0x60d63
cmpl $0x0, -0x30(%rbp)
setne %cl
movq -0x50(%rbp), %rax
movb 0x46(%rax), %al
andb $0x20, %al
shrb $0x5, %al
orb %al, %cl
testb %al, %al
pushq $0x10
popq %rax
cmovnel -0x2c(%rbp), %eax
movb $0x1, %r14b
testb %cl, %cl
jne 0x60d6b
jmp 0x60d79
movb $0x10, %al
cmpl $0x0, -0x30(%rbp)
je 0x60d76
movzbl %al, %esi
movq %rbx, %rdi
callq 0x13770
movb $0x1, %r14b
addq $0x28, %r12
incl %r15d
addq $0x4, %r13
jmp 0x60ced
movq -0x50(%rbp), %r13
testb $0x20, 0x46(%r13)
movq -0x48(%rbp), %rax
movq -0x58(%rbp), %r15
jne 0x60e63
leal 0x1(%rax), %r12d
movq %r15, %rdi
callq 0x4c550
movswl 0x3e(%r13), %ecx
pushq $0x32
popq %rsi
movq %rbx, %rdi
movl %r12d, %edx
movl %eax, -0x2c(%rbp)
movl %eax, %r8d
callq 0x385b6
testb %r14b, %r14b
jne 0x60dd7
movq %rbx, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x4eb90
movswl 0x3e(%r13), %edx
movq %r15, %rdi
movl %r12d, %esi
callq 0x4ba18
cmpl $0x0, -0x34(%rbp)
setne %al
addb %al, %al
addb $0x3, %al
xorl %ecx, %ecx
cmpb $0x0, 0x1e(%r15)
movzbl %al, %eax
cmovnel %ecx, %eax
leal 0x8(%rax), %ecx
cmpl $0x0, -0x38(%rbp)
movzbl %cl, %ecx
cmovel %eax, %ecx
movl %ecx, %eax
orb $0x10, %al
cmpl $0x0, -0x30(%rbp)
movzbl %al, %r14d
cmovel %ecx, %r14d
pushq $0x5f
popq %rsi
movq %rbx, %rdi
movl -0x3c(%rbp), %edx
movl -0x2c(%rbp), %ecx
movq -0x48(%rbp), %r8
callq 0x385b6
cmpb $0x0, 0x1e(%r15)
jne 0x60e49
movq (%r13), %rdx
pushq $-0x1
popq %rsi
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x1385d
movzbl %r14b, %esi
movq %rbx, %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x13770
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq