// File: /workspace/github_c_makefile_star2_O1/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 0x473082
movl %r8d, %r13d
movq 0x10(%r12), %rax
movq %rax, 0x8(%rsp)
testb $0x20, 0x40(%rdx)
movl %esi, 0x4(%rsp)
jne 0x472ecd
movb 0x1f(%r12), %al
testb %al, %al
je 0x473005
decb %al
movb %al, 0x1f(%r12)
movzbl %al, %eax
movl 0xc4(%r12,%rax,4), %ebp
jmp 0x473011
movq %r14, 0x18(%rsp)
movq 0x10(%rdx), %r14
testq %r14, %r14
je 0x472eef
movzwl 0x63(%r14), %eax
andl $0x3, %eax
cmpw $0x2, %ax
je 0x472eef
movq 0x28(%r14), %r14
jmp 0x472ed6
movq %rbx, 0x20(%rsp)
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 0x472f75
movl (%rsp), %ebx
xorl %r12d, %r12d
movzwl 0x60(%r15), %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x472f57
movq 0x8(%r14), %rdx
movzwl (%rdx,%r12,2), %edx
movq 0x8(%r15), %rsi
shll $0x10, %eax
xorl %edi, %edi
cmpw %dx, (%rsi)
je 0x472f52
addq $0x10000, %rdi          # imm = 0x10000
addq $0x2, %rsi
cmpq %rdi, %rax
jne 0x472f3b
jmp 0x472f57
sarl $0x10, %edi
movl %edi, %ecx
leal (%r12,%rbp), %r8d
movq 0x8(%rsp), %rdi
movl $0x5a, %esi
movl %r13d, %edx
callq 0x43bae0
incq %r12
cmpq %rbx, %r12
jne 0x472f1a
movq 0x8(%rsp), %r15
movq %r15, %rdi
movl $0x1d, %esi
movl 0x4(%rsp), %edx
xorl %ecx, %ecx
movl %ebp, %r8d
callq 0x43bae0
movl %eax, %ebp
movq (%r15), %rax
cmpb $0x0, 0x61(%rax)
jne 0x472fb2
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 0x43bae0
leaq 0xdf431(%rip), %rdx     # 0x552404
movq %r15, %rdi
movl %eax, %esi
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x40e507
movl 0xb8(%r15), %eax
movq (%r15), %rcx
cmpb $0x0, 0x61(%rcx)
movq 0x20(%rsp), %rbx
movq 0x18(%rsp), %r14
je 0x473063
leaq 0x131e05(%rip), %rcx    # 0x5a4e08
jmp 0x47307a
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 0x43bae0
movq %r15, %rdi
movl $0x1e, %esi
movl 0x4(%rsp), %edx
xorl %ecx, %ecx
movl %ebp, %r8d
callq 0x43bae0
testl %ebp, %ebp
je 0x473082
movzbl 0x1f(%r12), %eax
cmpq $0x7, %rax
ja 0x473082
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%r12)
movl %ebp, 0xc4(%r12,%rax,4)
jmp 0x473082
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 0x45390d
movq 0x10(%rbx), %rdx
movq 0x18(%rbx), %rcx
movq %r12, %rdi
movq %rax, %rsi
movl $0x2, %r8d
movq %rbx, %r9
callq 0x446174
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq