// File: /workspace/github_c_makefile_star2_O2/ukontainer[P]sqlite-bench/sqlite3.c
// Function: sqlite3UpsertDoUpdate
SQLITE_PRIVATE void sqlite3UpsertDoUpdate(
  Parse *pParse,        /* The parsing and code-generating context */
  Upsert *pUpsert,      /* The ON CONFLICT clause for the upsert */
  Table *pTab,          /* The table being updated */
  Index *pIdx,          /* The UNIQUE constraint that failed */
  int iCur              /* Cursor for pIdx (or pTab if pIdx==NULL) */
){
  Vdbe *v = pParse->pVdbe;
  sqlite3 *db = pParse->db;
  SrcList *pSrc;            /* FROM clause for the UPDATE */
  int iDataCur;

  assert( v!=0 );
  assert( pUpsert!=0 );
  VdbeNoopComment((v, "Begin DO UPDATE of UPSERT"));
  iDataCur = pUpsert->iDataCur;
  if( pIdx && iCur!=iDataCur ){
    if( HasRowid(pTab) ){
      int regRowid = sqlite3GetTempReg(pParse);
      sqlite3VdbeAddOp2(v, OP_IdxRowid, iCur, regRowid);
      sqlite3VdbeAddOp3(v, OP_SeekRowid, iDataCur, 0, regRowid);
      VdbeCoverage(v);
      sqlite3ReleaseTempReg(pParse, regRowid);
    }else{
      Index *pPk = sqlite3PrimaryKeyIndex(pTab);
      int nPk = pPk->nKeyCol;
      int iPk = pParse->nMem+1;
      int i;
      pParse->nMem += nPk;
      for(i=0; i<nPk; i++){
        int k;
        assert( pPk->aiColumn[i]>=0 );
        k = sqlite3ColumnOfIndex(pIdx, pPk->aiColumn[i]);
        sqlite3VdbeAddOp3(v, OP_Column, iCur, k, iPk+i);
        VdbeComment((v, "%s.%s", pIdx->zName,
                    pTab->aCol[pPk->aiColumn[i]].zName));
      }
      sqlite3VdbeVerifyAbortable(v, OE_Abort);
      i = sqlite3VdbeAddOp4Int(v, OP_Found, iDataCur, 0, iPk, nPk);
      VdbeCoverage(v);
      sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_CORRUPT, OE_Abort, 0, 
            "corrupt database", P4_STATIC);
      sqlite3VdbeJumpHere(v, i);
    }
  }
  /* pUpsert does not own pUpsertSrc - the outer INSERT statement does.  So
  ** we have to make a copy before passing it down into sqlite3Update() */
  pSrc = sqlite3SrcListDup(db, pUpsert->pUpsertSrc, 0);
  sqlite3Update(pParse, pSrc, pUpsert->pUpsertSet,
      pUpsert->pUpsertWhere, OE_Abort, 0, 0, pUpsert);
  pUpsert->pUpsertSet = 0;    /* Will have been deleted by sqlite3Update() */
  pUpsert->pUpsertWhere = 0;  /* Will have been deleted by sqlite3Update() */
  VdbeNoopComment((v, "End DO UPDATE of UPSERT"));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r15
movq %rsi, %r14
movq %rdi, %r12
movq (%rdi), %rbp
movl 0x34(%rsi), %esi
testq %rcx, %rcx
sete %al
movl %r8d, 0xc(%rsp)
cmpl %r8d, %esi
sete %cl
orb %al, %cl
jne 0x4638c3
movl %esi, 0x8(%rsp)
movq 0x10(%r12), %r13
testb $0x20, 0x40(%rdx)
jne 0x463810
movq %r12, %rdi
callq 0x44b9b3
movl %eax, %ebx
movq %r13, %rdi
movl $0x88, %esi
movl 0xc(%rsp), %edx
movl %eax, %ecx
callq 0x432a3f
pushq $0x1e
popq %rsi
movq %r13, %rdi
movl 0x8(%rsp), %edx
xorl %ecx, %ecx
movl %ebx, %r8d
callq 0x432a44
testl %ebx, %ebx
je 0x4638c3
movzbl 0x1f(%r12), %eax
cmpq $0x7, %rax
ja 0x4638c3
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%r12)
movl %ebx, 0xc4(%r12,%rax,4)
jmp 0x4638c3
movq %rbp, 0x10(%rsp)
movq %r14, 0x20(%rsp)
movq %rdx, %rdi
callq 0x40f0e7
movq %rax, %rbx
movzwl 0x5e(%rax), %ebp
movl 0x38(%r12), %eax
leal 0x1(%rax), %r14d
addl %ebp, %eax
movq %r12, 0x18(%rsp)
movl %eax, 0x38(%r12)
xorl %r12d, %r12d
cmpq %r12, %rbp
je 0x463872
movq 0x8(%rbx), %rax
movswl (%rax,%r12,2), %esi
movq %r15, %rdi
callq 0x44b4cd
movswl %ax, %ecx
leal (%r14,%r12), %r8d
movq %r13, %rdi
pushq $0x5a
popq %rsi
movl 0xc(%rsp), %edx
callq 0x432a44
incq %r12
jmp 0x463841
pushq $0x1d
popq %rsi
movq %r13, %rdi
movl 0x8(%rsp), %edx
xorl %ecx, %ecx
movl %r14d, %r8d
movl %ebp, %r9d
callq 0x40c85b
movl %eax, %ebx
orl $-0x1, (%rsp)
leaq 0xdcb7a(%rip), %r9      # 0x540410
pushq $0x45
popq %rsi
pushq $0xb
popq %rdx
pushq $0x2
popq %rcx
movq %r13, %rdi
xorl %r8d, %r8d
callq 0x4485b6
movq %r13, %rdi
movl %ebx, %esi
callq 0x4485a5
movq 0x20(%rsp), %r14
movq 0x18(%rsp), %r12
movq 0x10(%rsp), %rbp
movq 0x28(%r14), %rsi
movq %rbp, %rdi
xorl %edx, %edx
callq 0x44c94e
movq 0x10(%r14), %rdx
movq 0x18(%r14), %rcx
pushq $0x2
popq %r8
movq %r12, %rdi
movq %rax, %rsi
movq %r14, %r9
callq 0x441a2c
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r14)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq