// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movl 0x34(%rax), %eax
movl %eax, -0x44(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x49c5e5
movl -0x24(%rbp), %eax
cmpl -0x44(%rbp), %eax
je 0x49c5e5
movq -0x18(%rbp), %rax
movl 0x40(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
jne 0x49c50b
movq -0x8(%rbp), %rdi
callq 0x470ad0
movl %eax, -0x48(%rbp)
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %edx
movl -0x48(%rbp), %ecx
movl $0x88, %esi
callq 0x453790
movq -0x30(%rbp), %rdi
movl -0x44(%rbp), %edx
movl -0x48(%rbp), %r8d
movl $0x1e, %esi
xorl %ecx, %ecx
callq 0x4537c0
movq -0x8(%rbp), %rdi
movl -0x48(%rbp), %esi
callq 0x470060
jmp 0x49c5e3
movq -0x18(%rbp), %rdi
callq 0x414850
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movzwl 0x5e(%rax), %eax
movl %eax, -0x54(%rbp)
movq -0x8(%rbp), %rax
movl 0x38(%rax), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
movl -0x54(%rbp), %ecx
movq -0x8(%rbp), %rax
addl 0x38(%rax), %ecx
movl %ecx, 0x38(%rax)
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x54(%rbp), %eax
jge 0x49c590
movq -0x20(%rbp), %rdi
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x5c(%rbp), %rcx
movswl (%rax,%rcx,2), %esi
callq 0x4701b0
cwtl
movl %eax, -0x60(%rbp)
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %edx
movl -0x60(%rbp), %ecx
movl -0x58(%rbp), %r8d
addl -0x5c(%rbp), %r8d
movl $0x5a, %esi
callq 0x4537c0
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x49c544
movq -0x30(%rbp), %rdi
movl -0x44(%rbp), %edx
movl -0x58(%rbp), %r8d
movl -0x54(%rbp), %r9d
movl $0x1d, %esi
xorl %ecx, %ecx
callq 0x4113b0
movl %eax, -0x5c(%rbp)
movq -0x30(%rbp), %rdi
movl $0x45, %esi
movl $0xb, %edx
movl $0x2, %ecx
xorl %r8d, %r8d
leaq 0xe3b34(%rip), %r9      # 0x5800ff
movl $0xffffffff, (%rsp)     # imm = 0xFFFFFFFF
callq 0x46bbd0
movq -0x30(%rbp), %rdi
movl -0x5c(%rbp), %esi
callq 0x46bba0
jmp 0x49c5e5
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
xorl %edx, %edx
callq 0x472710
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x10(%rbp), %rax
movl $0x2, %r8d
xorl %r9d, %r9d
movq $0x0, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x461f00
movq -0x10(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x18(%rax)
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)