// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3CompleteInsertion
SQLITE_PRIVATE void sqlite3CompleteInsertion(
  Parse *pParse,      /* The parser context */
  Table *pTab,        /* the table into which we are inserting */
  int baseCur,        /* Index of a read/write cursor pointing at pTab */
  int regRowid,       /* 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 */
){
  int i;
  Vdbe *v;
  Index *pIdx;
  u8 pik_flags;
  int regData;
  int regRec;

  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, baseCur+i+1, aRegIdx[i]);
    if( useSeekResult ){
      sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
    }
  }
  regData = regRowid + 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, baseCur, regRec, regRowid);
  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
movl %r9d, -0x2c(%rbp)
movq %r8, %r12
movq %rcx, -0x38(%rbp)
movl %edx, %r13d
movq %rsi, %r14
movq %rdi, -0x48(%rbp)
callq 0x41ef4
movq %rax, %rbx
movq %r14, -0x50(%rbp)
leaq 0x10(%r14), %r15
movq %r13, -0x40(%rbp)
incl %r13d
pushq $0x67
popq %r14
movq (%r15), %r15
testq %r15, %r15
je 0x55ced
movl (%r12), %ecx
testl %ecx, %ecx
je 0x55ce0
cmpq $0x0, 0x48(%r15)
je 0x55cb6
movl 0x34(%rbx), %eax
addl $0x2, %eax
movq %rbx, %rdi
pushq $0x49
popq %rsi
movl %ecx, %edx
movl %eax, %ecx
callq 0x41f42
movl (%r12), %ecx
movq %rbx, %rdi
movl %r14d, %esi
movl %r13d, %edx
callq 0x41f42
cmpl $0x0, 0x18(%rbp)
je 0x55ce0
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x55ce0
movslq 0x34(%rbx), %rcx
imulq $0x18, %rcx, %rcx
movb $0x10, -0x15(%rax,%rcx)
addq $0x28, %r15
incl %r13d
addq $0x4, %r12
jmp 0x55c86
movq -0x38(%rbp), %rax
leal 0x1(%rax), %r15d
movq -0x48(%rbp), %r13
movq %r13, %rdi
callq 0x46ff9
movl %eax, %r14d
movq -0x50(%rbp), %r12
movswl 0x42(%r12), %ecx
pushq $0x2b
popq %rsi
movq %rbx, %rdi
movl %r15d, %edx
movl %eax, %r8d
callq 0x41f4c
movq %rbx, %rdi
movq %r12, %rsi
callq 0x552a2
movswl 0x42(%r12), %edx
movq %r13, %rdi
movl %r15d, %esi
callq 0x49537
cmpl $0x0, -0x2c(%rbp)
setne %al
addb %al, %al
addb $0x3, %al
xorl %ecx, %ecx
cmpb $0x0, 0x1e(%r13)
movzbl %al, %eax
cmovnel %ecx, %eax
leal 0x8(%rax), %ecx
cmpl $0x0, 0x10(%rbp)
movzbl %cl, %ecx
cmovel %eax, %ecx
movl %ecx, %eax
orb $0x10, %al
cmpl $0x0, 0x18(%rbp)
movzbl %al, %r15d
cmovel %ecx, %r15d
pushq $0x42
popq %rsi
movq %rbx, %rdi
movq -0x40(%rbp), %rdx
movl %r14d, %ecx
movq -0x38(%rbp), %r8
callq 0x41f4c
cmpb $0x0, 0x1e(%r13)
jne 0x55d9e
movq (%r12), %rdx
pushq $-0x1
popq %rsi
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x1074b
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x55db4
movslq 0x34(%rbx), %rcx
imulq $0x18, %rcx, %rcx
movb %r15b, -0x15(%rax,%rcx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq