// File: /workspace/github_c_makefile_star2_O0/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
subq $0x50, %rsp
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5e000
movq %rax, -0x30(%rbp)
movl $0x0, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x80a81
movq -0x20(%rbp), %rax
movslq -0x28(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x809ef
jmp 0x80a67
movq -0x38(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x80a2f
movq -0x30(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rax
movslq -0x28(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x48(%rbp)
movq -0x30(%rbp), %rdi
callq 0x5e520
movq -0x50(%rbp), %rdi
movl -0x48(%rbp), %edx
movl %eax, %ecx
addl $0x2, %ecx
movl $0x49, %esi
callq 0x5e0c0
movq -0x30(%rbp), %rdi
movl -0x14(%rbp), %edx
addl -0x28(%rbp), %edx
addl $0x1, %edx
movq -0x20(%rbp), %rax
movslq -0x28(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
movl $0x67, %esi
callq 0x5e0c0
cmpl $0x0, 0x18(%rbp)
je 0x80a65
movq -0x30(%rbp), %rdi
movl $0x10, %esi
callq 0x5e540
jmp 0x80a67
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x38(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x809d4
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
callq 0x66a70
movl %eax, -0x44(%rbp)
movq -0x30(%rbp), %rdi
movl -0x40(%rbp), %edx
movq -0x10(%rbp), %rax
movswl 0x42(%rax), %ecx
movl -0x44(%rbp), %r8d
movl $0x2b, %esi
callq 0x5e0f0
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x7fe30
movq -0x8(%rbp), %rdi
movl -0x40(%rbp), %esi
movq -0x10(%rbp), %rax
movswl 0x42(%rax), %edx
callq 0x69c40
movq -0x8(%rbp), %rax
cmpb $0x0, 0x1e(%rax)
je 0x80ae4
movb $0x0, -0x39(%rbp)
jmp 0x80b04
movb $0x1, -0x39(%rbp)
movl -0x24(%rbp), %edx
movl $0x2, %ecx
movl $0x4, %eax
cmpl $0x0, %edx
cmovnel %eax, %ecx
movzbl -0x39(%rbp), %eax
orl %ecx, %eax
movb %al, -0x39(%rbp)
cmpl $0x0, 0x10(%rbp)
je 0x80b14
movzbl -0x39(%rbp), %eax
orl $0x8, %eax
movb %al, -0x39(%rbp)
cmpl $0x0, 0x18(%rbp)
je 0x80b24
movzbl -0x39(%rbp), %eax
orl $0x10, %eax
movb %al, -0x39(%rbp)
movq -0x30(%rbp), %rdi
movl -0x14(%rbp), %edx
movl -0x44(%rbp), %ecx
movl -0x18(%rbp), %r8d
movl $0x42, %esi
callq 0x5e0f0
movq -0x8(%rbp), %rax
cmpb $0x0, 0x1e(%rax)
jne 0x80b5d
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
callq 0x13c20
movq -0x30(%rbp), %rdi
movzbl -0x39(%rbp), %esi
callq 0x5e540
addq $0x50, %rsp
popq %rbp
retq