// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/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;
  int i;

  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;
      pParse->nMem += nPk;
      for(i=0; i<nPk; i++){
        int k;
        assert( pPk->aiColumn[i]>=0 );
        k = sqlite3TableColumnToIndex(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);
      sqlite3MayAbort(pParse);
      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);
  /* excluded.* columns of type REAL need to be converted to a hard real */
  for(i=0; i<pTab->nCol; i++){
    if( pTab->aCol[i].affinity==SQLITE_AFF_REAL ){
      sqlite3VdbeAddOp1(v, OP_RealAffinity, pUpsert->regData+i);
    }
  }
  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 $0x80, %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 0x4608b3
movl -0x24(%rbp), %eax
cmpl -0x44(%rbp), %eax
je 0x4608b3
movq -0x18(%rbp), %rax
movl 0x40(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
jne 0x4607d0
movq -0x8(%rbp), %rdi
callq 0x42f190
movl %eax, -0x4c(%rbp)
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %edx
movl -0x4c(%rbp), %ecx
movl $0x86, %esi
callq 0x410100
movq -0x30(%rbp), %rdi
movl -0x44(%rbp), %edx
movl -0x4c(%rbp), %r8d
movl $0x1f, %esi
xorl %ecx, %ecx
callq 0x410130
movq -0x8(%rbp), %rdi
movl -0x4c(%rbp), %esi
callq 0x42e560
jmp 0x4608b1
movq -0x18(%rbp), %rdi
callq 0x3cef20
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movzwl 0x5e(%rax), %eax
movl %eax, -0x5c(%rbp)
movq -0x8(%rbp), %rax
movl 0x38(%rax), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
movl -0x5c(%rbp), %ecx
movq -0x8(%rbp), %rax
addl 0x38(%rax), %ecx
movl %ecx, 0x38(%rax)
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x5c(%rbp), %eax
jge 0x460855
movq -0x20(%rbp), %rdi
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x48(%rbp), %rcx
movswl (%rax,%rcx,2), %esi
callq 0x42e800
cwtl
movl %eax, -0x64(%rbp)
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %edx
movl -0x64(%rbp), %ecx
movl -0x60(%rbp), %r8d
addl -0x48(%rbp), %r8d
movl $0x59, %esi
callq 0x410130
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x460809
movq -0x30(%rbp), %rdi
movl -0x44(%rbp), %edx
movl -0x60(%rbp), %r8d
movl -0x5c(%rbp), %r9d
movl $0x1e, %esi
xorl %ecx, %ecx
callq 0x3cb970
movl %eax, -0x48(%rbp)
movq -0x30(%rbp), %rdi
movl $0x44, %esi
movl $0xb, %edx
movl $0x2, %ecx
xorl %r8d, %r8d
leaq 0x14c3b8(%rip), %r9     # 0x5acc48
movl $0xffffffff, (%rsp)     # imm = 0xFFFFFFFF
callq 0x429aa0
movq -0x8(%rbp), %rdi
callq 0x42e470
movq -0x30(%rbp), %rdi
movl -0x48(%rbp), %esi
callq 0x429a70
jmp 0x4608b3
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
xorl %edx, %edx
callq 0x432c70
movq %rax, -0x40(%rbp)
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
movq -0x18(%rbp), %rcx
movswl 0x46(%rcx), %ecx
cmpl %ecx, %eax
jge 0x460921
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x48(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movsbl 0x19(%rax), %eax
cmpl $0x45, %eax
jne 0x460914
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x30(%rax), %edx
addl -0x48(%rbp), %edx
movl $0x53, %esi
callq 0x42ba70
jmp 0x460916
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x4608d1
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 0x41eba0
movq -0x10(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x18(%rax)
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)