// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %rbp
movq %rdx, %r15
movq (%rdi), %r14
movq 0x10(%rdi), %r12
movq %rsi, 0x30(%rsp)
movl 0x34(%rsi), %r13d
testq %rcx, %rcx
sete %al
movl %r8d, 0x10(%rsp)
cmpl %r8d, %r13d
sete %cl
orb %al, %cl
movq %rdi, 0x18(%rsp)
jne 0x2ef4b2
movq %rdi, %rbx
testb $-0x80, 0x40(%r15)
jne 0x2ef2f5
movb 0x1f(%rbx), %al
testb %al, %al
je 0x2ef444
decb %al
movb %al, 0x1f(%rbx)
movzbl %al, %eax
movl 0xd4(%rbx,%rax,4), %ebp
jmp 0x2ef44c
movl %r13d, 0x14(%rsp)
movq 0x10(%r15), %r13
testq %r13, %r13
je 0x2ef317
movzwl 0x63(%r13), %eax
andl $0x3, %eax
cmpw $0x2, %ax
je 0x2ef317
movq 0x28(%r13), %r13
jmp 0x2ef2fe
movq %r14, 0x28(%rsp)
movzwl 0x5e(%r13), %ecx
movl 0x38(%rbx), %eax
leal 0x1(%rax), %edx
movq %rdx, 0x20(%rsp)
addl %ecx, %eax
movl %eax, 0x38(%rbx)
movl %ecx, 0xc(%rsp)
testl %ecx, %ecx
je 0x2ef39d
movl 0xc(%rsp), %r14d
xorl %ebx, %ebx
movzwl 0x60(%rbp), %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x2ef37b
movq 0x8(%r13), %rdx
movzwl (%rdx,%rbx,2), %edx
movq 0x8(%rbp), %rsi
shll $0x10, %eax
xorl %edi, %edi
cmpw %dx, (%rsi)
je 0x2ef376
addq $0x10000, %rdi          # imm = 0x10000
addq $0x2, %rsi
cmpq %rdi, %rax
jne 0x2ef35f
jmp 0x2ef37b
sarl $0x10, %edi
movl %edi, %ecx
movq 0x20(%rsp), %rax
leal (%rax,%rbx), %r8d
movq %r12, %rdi
movl $0x59, %esi
movl 0x10(%rsp), %edx
callq 0x2b200c
incq %rbx
cmpq %r14, %rbx
jne 0x2ef340
movq %r12, %rdi
movl $0x1e, %esi
movl 0x14(%rsp), %edx
xorl %ecx, %ecx
movq 0x20(%rsp), %r8
callq 0x2b200c
movl %eax, %ebp
movq (%r12), %rax
cmpb $0x0, 0x61(%rax)
jne 0x2ef3dd
movq 0x88(%r12), %rax
movslq %ebp, %rcx
leaq (%rcx,%rcx,2), %rcx
movb $-0x3, 0x1(%rax,%rcx,8)
movl 0xc(%rsp), %edx
movl %edx, 0x10(%rax,%rcx,8)
movq %r12, %rdi
movl $0x44, %esi
movl $0xb, %edx
movl $0x2, %ecx
xorl %r8d, %r8d
callq 0x2b200c
leaq 0xf1b05(%rip), %rdx     # 0x3e0f03
movq %r12, %rdi
movl %eax, %esi
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x285198
movq 0x18(%rsp), %rcx
movq 0xa0(%rcx), %rax
testq %rax, %rax
cmoveq %rcx, %rax
movb $0x1, 0x21(%rax)
movl 0x90(%r12), %eax
movq (%r12), %rcx
cmpb $0x0, 0x61(%rcx)
movq 0x28(%rsp), %r14
je 0x2ef494
leaq 0x1daa46(%rip), %rcx    # 0x4c9e88
jmp 0x2ef4af
movl 0x38(%rbx), %ebp
incl %ebp
movl %ebp, 0x38(%rbx)
movq %r12, %rdi
movl $0x86, %esi
movl 0x10(%rsp), %edx
movl %ebp, %ecx
xorl %r8d, %r8d
callq 0x2b200c
movq %r12, %rdi
movl $0x1f, %esi
movl %r13d, %edx
xorl %ecx, %ecx
movl %ebp, %r8d
callq 0x2b200c
testl %ebp, %ebp
je 0x2ef4b2
movzbl 0x1f(%rbx), %eax
cmpq $0x7, %rax
ja 0x2ef4b2
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%rbx)
movl %ebp, 0xd4(%rbx,%rax,4)
jmp 0x2ef4b2
leal -0x1(%rax), %ecx
testl %ebp, %ebp
cmovnsl %ebp, %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x3, %rcx
addq 0x88(%r12), %rcx
movl %eax, 0x8(%rcx)
movq 0x30(%rsp), %rbp
movq 0x28(%rbp), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x2cc81d
movq %rax, %r14
cmpw $0x0, 0x46(%r15)
jle 0x2ef50b
movl $0x19, %ebx
xorl %r13d, %r13d
movq 0x8(%r15), %rax
cmpb $0x45, (%rax,%rbx)
jne 0x2ef4fa
movl 0x30(%rbp), %edx
addl %r13d, %edx
movq %r12, %rdi
movl $0x53, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x2b200c
incq %r13
movswq 0x46(%r15), %rax
addq $0x20, %rbx
cmpq %rax, %r13
jl 0x2ef4d8
movq 0x10(%rbp), %rdx
movq 0x18(%rbp), %rcx
movq 0x18(%rsp), %rdi
movq %r14, %rsi
movl $0x2, %r8d
movq %rbp, %r9
callq 0x2bc4f2
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbp)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq