// File: /workspace/github_c_makefile_star2_O3/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, %rbx
movq %rdi, %r12
movq (%rdi), %r14
movl 0x34(%rsi), %esi
testq %rcx, %rcx
sete %al
cmpl %r8d, %esi
sete %cl
orb %al, %cl
jne 0x472949
movl %r8d, %r13d
movq 0x10(%r12), %rax
movq %rax, 0x8(%rsp)
testb $0x20, 0x40(%rdx)
movl %esi, 0x4(%rsp)
jne 0x472798
movb 0x1f(%r12), %al
testb %al, %al
je 0x4728cc
decb %al
movb %al, 0x1f(%r12)
movzbl %al, %eax
movl 0xc4(%r12,%rax,4), %ebp
jmp 0x4728d8
movq %r14, 0x18(%rsp)
movq %rbx, 0x20(%rsp)
addq $0x10, %rdx
movq (%rdx), %r14
movzwl 0x63(%r14), %eax
andl $0x3, %eax
leaq 0x28(%r14), %rdx
cmpw $0x2, %ax
jne 0x4727a6
movzwl 0x5e(%r14), %ecx
movl 0x38(%r12), %eax
leal 0x1(%rax), %ebp
addl %ecx, %eax
movq %r12, 0x10(%rsp)
movl %eax, 0x38(%r12)
movl %ecx, (%rsp)
testl %ecx, %ecx
je 0x47283c
movl (%rsp), %ebx
xorl %r12d, %r12d
movzwl 0x60(%r15), %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x47281e
movq 0x8(%r14), %rdx
movzwl (%rdx,%r12,2), %edx
movq 0x8(%r15), %rsi
shll $0x10, %eax
xorl %edi, %edi
cmpw %dx, (%rsi)
je 0x472819
addq $0x10000, %rdi          # imm = 0x10000
addq $0x2, %rsi
cmpq %rdi, %rax
jne 0x472802
jmp 0x47281e
sarl $0x10, %edi
movl %edi, %ecx
leal (%r12,%rbp), %r8d
movq 0x8(%rsp), %rdi
movl $0x5a, %esi
movl %r13d, %edx
callq 0x43a65f
incq %r12
cmpq %rbx, %r12
jne 0x4727e1
movq 0x8(%rsp), %r15
movq %r15, %rdi
movl $0x1d, %esi
movl 0x4(%rsp), %edx
xorl %ecx, %ecx
movl %ebp, %r8d
callq 0x43a65f
movl %eax, %ebp
movq (%r15), %rax
cmpb $0x0, 0x61(%rax)
jne 0x472879
movq 0x68(%r15), %rax
movslq %ebp, %rcx
leaq (%rcx,%rcx,2), %rcx
movb $-0x3, 0x1(%rax,%rcx,8)
movl (%rsp), %edx
movl %edx, 0x10(%rax,%rcx,8)
movq %r15, %rdi
movl $0x45, %esi
movl $0xb, %edx
movl $0x2, %ecx
xorl %r8d, %r8d
callq 0x43a65f
leaq 0xdfbee(%rip), %rdx     # 0x552488
movq %r15, %rdi
movl %eax, %esi
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x40e765
movl 0xb8(%r15), %eax
movq (%r15), %rcx
cmpb $0x0, 0x61(%rcx)
movq 0x20(%rsp), %rbx
movq 0x18(%rsp), %r14
je 0x47292a
leaq 0x13253e(%rip), %rcx    # 0x5a4e08
jmp 0x472941
movl 0x38(%r12), %ebp
incl %ebp
movl %ebp, 0x38(%r12)
movq 0x8(%rsp), %r15
movq %r15, %rdi
movl $0x88, %esi
movl %r13d, %edx
movl %ebp, %ecx
xorl %r8d, %r8d
callq 0x43a65f
movq %r15, %rdi
movl $0x1e, %esi
movl 0x4(%rsp), %edx
xorl %ecx, %ecx
movl %ebp, %r8d
callq 0x43a65f
testl %ebp, %ebp
je 0x472949
movzbl 0x1f(%r12), %eax
cmpq $0x7, %rax
ja 0x472949
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%r12)
movl %ebp, 0xc4(%r12,%rax,4)
jmp 0x472949
leal -0x1(%rax), %ecx
testl %ebp, %ebp
cmovnsl %ebp, %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x3, %rcx
addq 0x68(%r15), %rcx
movq 0x10(%rsp), %r12
movl %eax, 0x8(%rcx)
movq 0x28(%rbx), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x452b7f
movq 0x10(%rbx), %rdx
movq 0x18(%rbx), %rcx
movq %r12, %rdi
movq %rax, %rsi
movl $0x2, %r8d
movq %rbx, %r9
callq 0x44548b
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq