// File: /workspace/github_c_makefile_star2_O1/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 $0x28, %rsp
movq %r9, %r13
movq %r8, -0x38(%rbp)
movl %ecx, %r15d
movl %edx, -0x2c(%rbp)
movq %rsi, %r14
movq %rdi, -0x40(%rbp)
callq 0x507bf
movq %rax, %rbx
movq 0x10(%r14), %r12
testq %r12, %r12
je 0x6f128
movq %r14, -0x48(%rbp)
cmpl $0x0, 0x20(%rbp)
setne %r14b
shlb $0x4, %r14b
xorl %eax, %eax
movl (%r13), %edx
testl %edx, %edx
je 0x6f107
cmpq $0x0, 0x48(%r12)
je 0x6f0a5
movl 0x3c(%rbx), %ecx
addl $0x2, %ecx
movq %rbx, %rdi
movl $0x4c, %esi
xorl %r8d, %r8d
callq 0x3fa9e
movl (%r13), %ecx
movq %rbx, %rdi
movl $0x70, %esi
movl %r15d, %edx
xorl %r8d, %r8d
callq 0x3fa9e
movb 0x63(%r12), %al
andb $0x3, %al
movl %r14d, %ecx
cmpb $0x2, %al
jne 0x6f0da
movq -0x48(%rbp), %rax
movb 0x46(%rax), %cl
shrb $0x5, %cl
andb $0x1, %cl
orb %r14b, %cl
movb $0x1, %al
testb %cl, %cl
je 0x6f107
movq (%rbx), %rdx
cmpb $0x0, 0x51(%rdx)
leaq 0x263fa(%rip), %rdx     # 0x954e8
jne 0x6f104
movslq 0x3c(%rbx), %rdx
movq 0x8(%rbx), %rsi
leaq (%rdx,%rdx,2), %rdx
leaq (%rsi,%rdx,8), %rdx
addq $-0x18, %rdx
movb %cl, 0x3(%rdx)
movq 0x28(%r12), %r12
incl %r15d
addq $0x4, %r13
testq %r12, %r12
jne 0x6f07b
testb %al, %al
sete %r12b
movq -0x48(%rbp), %r14
jmp 0x6f12b
movb $0x1, %r12b
testb $0x20, 0x46(%r14)
movq -0x40(%rbp), %rcx
jne 0x6f235
movq -0x38(%rbp), %rax
leal 0x1(%rax), %edx
movb 0x1f(%rcx), %al
testb %al, %al
je 0x6f157
decb %al
movb %al, 0x1f(%rcx)
movzbl %al, %eax
movl 0x24(%rcx,%rax,4), %r15d
jmp 0x6f162
movl 0x54(%rcx), %r15d
incl %r15d
movl %r15d, 0x54(%rcx)
movq %r14, %r13
movswl 0x3e(%r14), %ecx
movq %rbx, %rdi
movl $0x32, %esi
movl %edx, %r14d
movl %r15d, %r8d
callq 0x3fa9e
testb %r12b, %r12b
je 0x6f18f
movq %rbx, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x56560
movswl 0x3e(%r13), %edx
movq -0x40(%rbp), %r12
movq %r12, %rdi
movl %r14d, %esi
callq 0x5291f
cmpl $0x0, 0x10(%rbp)
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, 0x18(%rbp)
movzbl %cl, %ecx
cmovel %eax, %ecx
movl %ecx, %eax
orb $0x10, %al
cmpl $0x0, 0x20(%rbp)
movzbl %al, %r14d
cmovel %ecx, %r14d
movq %rbx, %rdi
movl $0x5f, %esi
movl -0x2c(%rbp), %edx
movl %r15d, %ecx
movq -0x38(%rbp), %r8
callq 0x3fa9e
cmpb $0x0, 0x1e(%r12)
jne 0x6f20b
movq (%r13), %rdx
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
callq 0x14ab9
movq (%rbx), %rax
cmpb $0x0, 0x51(%rax)
je 0x6f21d
leaq 0x262cd(%rip), %rax     # 0x954e8
jmp 0x6f231
movslq 0x3c(%rbx), %rax
movq 0x8(%rbx), %rcx
leaq (%rax,%rax,2), %rax
leaq (%rcx,%rax,8), %rax
addq $-0x18, %rax
movb %r14b, 0x3(%rax)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq