// File: /workspace/github_c_makefile_star2_O3/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, %rbx
movq %rdi, -0x40(%rbp)
callq 0x4f63b
movq %rax, %r14
movq 0x10(%rbx), %r12
testq %r12, %r12
je 0x6db8c
movq %rbx, -0x48(%rbp)
movl 0x20(%rbp), %ebx
testl %ebx, %ebx
setne %cl
shlb $0x4, %cl
incb %cl
xorl %eax, %eax
movzbl %cl, %ecx
movl %ecx, -0x30(%rbp)
movl (%r13), %ecx
testl %ecx, %ecx
je 0x6db6b
cmpq $0x0, 0x48(%r12)
je 0x6daf8
movl 0x3c(%r14), %eax
addl $0x2, %eax
movq %r14, %rdi
movl $0x4c, %esi
movl %ecx, %edx
movl %eax, %ecx
xorl %r8d, %r8d
callq 0x3ea9f
movl (%r13), %ecx
movq %r14, %rdi
movl $0x70, %esi
movl %r15d, %edx
xorl %r8d, %r8d
callq 0x3ea9f
movb 0x63(%r12), %al
andb $0x3, %al
cmpb $0x2, %al
jne 0x6db3c
testl %ebx, %ebx
setne %dl
movq -0x48(%rbp), %rax
movb 0x46(%rax), %al
andb $0x20, %al
shrb $0x5, %al
orb %al, %dl
testb %al, %al
movl $0x10, %ecx
cmovnel -0x30(%rbp), %ecx
movb $0x1, %al
testb %dl, %dl
jne 0x6db42
jmp 0x6db6b
movb $0x10, %cl
testl %ebx, %ebx
je 0x6db69
movq (%r14), %rax
cmpb $0x0, 0x51(%rax)
leaq 0x259a8(%rip), %rax     # 0x934f8
jne 0x6db66
movslq 0x3c(%r14), %rax
movq 0x8(%r14), %rdx
leaq (%rax,%rax,2), %rax
leaq (%rdx,%rax,8), %rax
addq $-0x18, %rax
movb %cl, 0x3(%rax)
movb $0x1, %al
movq 0x28(%r12), %r12
incl %r15d
addq $0x4, %r13
testq %r12, %r12
jne 0x6dac5
testb %al, %al
sete %r12b
movq -0x48(%rbp), %rbx
jmp 0x6db8f
movb $0x1, %r12b
testb $0x20, 0x46(%rbx)
movq -0x40(%rbp), %rcx
jne 0x6dc92
movq -0x38(%rbp), %rax
leal 0x1(%rax), %edx
movb 0x1f(%rcx), %al
testb %al, %al
je 0x6dbba
decb %al
movb %al, 0x1f(%rcx)
movzbl %al, %eax
movl 0x24(%rcx,%rax,4), %r15d
jmp 0x6dbc5
movl 0x54(%rcx), %r15d
incl %r15d
movl %r15d, 0x54(%rcx)
movq %rbx, %r13
movswl 0x3e(%rbx), %ecx
movq %r14, %rdi
movl $0x32, %esi
movl %edx, %ebx
movl %r15d, %r8d
callq 0x3ea9f
testb %r12b, %r12b
je 0x6dbf0
movq %r14, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x55309
movswl 0x3e(%r13), %edx
movq -0x40(%rbp), %r12
movq %r12, %rdi
movl %ebx, %esi
callq 0x51780
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, %ebx
cmovel %ecx, %ebx
movq %r14, %rdi
movl $0x5f, %esi
movl -0x2c(%rbp), %edx
movl %r15d, %ecx
movq -0x38(%rbp), %r8
callq 0x3ea9f
cmpb $0x0, 0x1e(%r12)
jne 0x6dc69
movq (%r13), %rdx
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
callq 0x14b4f
movq (%r14), %rax
cmpb $0x0, 0x51(%rax)
je 0x6dc7b
leaq 0x2587f(%rip), %rax     # 0x934f8
jmp 0x6dc8f
movslq 0x3c(%r14), %rax
movq 0x8(%r14), %rcx
leaq (%rax,%rax,2), %rax
leaq (%rcx,%rax,8), %rax
addq $-0x18, %rax
movb %bl, 0x3(%rax)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq