// File: /workspace/github_c_makefile_star2_O3/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: updateVirtualTable
static void updateVirtualTable(
  Parse *pParse,       /* The parsing context */
  SrcList *pSrc,       /* The virtual table to be modified */
  Table *pTab,         /* The virtual table */
  ExprList *pChanges,  /* The columns to change in the UPDATE statement */
  Expr *pRowid,        /* Expression used to recompute the rowid */
  int *aXRef,          /* Mapping from columns of pTab to entries in pChanges */
  Expr *pWhere,        /* WHERE clause of the UPDATE statement */
  int onError          /* ON CONFLICT strategy */
){
  Vdbe *v = pParse->pVdbe;  /* Virtual machine under construction */
  int ephemTab;             /* Table holding the result of the SELECT */
  int i;                    /* Loop counter */
  sqlite3 *db = pParse->db; /* Database connection */
  const char *pVTab = (const char*)sqlite3GetVTable(db, pTab);
  WhereInfo *pWInfo;
  int nArg = 2 + pTab->nCol;      /* Number of arguments to VUpdate */
  int regArg;                     /* First register in VUpdate arg array */
  int regRec;                     /* Register in which to assemble record */
  int regRowid;                   /* Register for ephem table rowid */
  int iCsr = pSrc->a[0].iCursor;  /* Cursor used for virtual table scan */
  int aDummy[2];                  /* Unused arg for sqlite3WhereOkOnePass() */
  int bOnePass;                   /* True to use onepass strategy */
  int addr;                       /* Address of OP_OpenEphemeral */

  /* Allocate nArg registers to martial the arguments to VUpdate. Then
  ** create and open the ephemeral table in which the records created from
  ** these arguments will be temporarily stored. */
  assert( v );
  ephemTab = pParse->nTab++;
  addr= sqlite3VdbeAddOp2(v, OP_OpenEphemeral, ephemTab, nArg);
  regArg = pParse->nMem + 1;
  pParse->nMem += nArg;
  regRec = ++pParse->nMem;
  regRowid = ++pParse->nMem;

  /* Start scanning the virtual table */
  pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0,0,WHERE_ONEPASS_DESIRED,0);
  if( pWInfo==0 ) return;

  /* Populate the argument registers. */
  sqlite3VdbeAddOp2(v, OP_Rowid, iCsr, regArg);
  if( pRowid ){
    sqlite3ExprCode(pParse, pRowid, regArg+1);
  }else{
    sqlite3VdbeAddOp2(v, OP_Rowid, iCsr, regArg+1);
  }
  for(i=0; i<pTab->nCol; i++){
    if( aXRef[i]>=0 ){
      sqlite3ExprCode(pParse, pChanges->a[aXRef[i]].pExpr, regArg+2+i);
    }else{
      sqlite3VdbeAddOp3(v, OP_VColumn, iCsr, i, regArg+2+i);
    }
  }

  bOnePass = sqlite3WhereOkOnePass(pWInfo, aDummy);

  if( bOnePass ){
    /* If using the onepass strategy, no-op out the OP_OpenEphemeral coded
    ** above. Also, if this is a top-level parse (not a trigger), clear the
    ** multi-write flag so that the VM does not open a statement journal */
    sqlite3VdbeChangeToNoop(v, addr);
    if( sqlite3IsToplevel(pParse) ){
      pParse->isMultiWrite = 0;
    }
  }else{
    /* Create a record from the argument register contents and insert it into
    ** the ephemeral table. */
    sqlite3VdbeAddOp3(v, OP_MakeRecord, regArg, nArg, regRec);
    sqlite3VdbeAddOp2(v, OP_NewRowid, ephemTab, regRowid);
    sqlite3VdbeAddOp3(v, OP_Insert, ephemTab, regRec, regRowid);
  }


  if( bOnePass==0 ){
    /* End the virtual table scan */
    sqlite3WhereEnd(pWInfo);

    /* Begin scannning through the ephemeral table. */
    addr = sqlite3VdbeAddOp1(v, OP_Rewind, ephemTab); VdbeCoverage(v);

    /* Extract arguments from the current row of the ephemeral table and 
    ** invoke the VUpdate method.  */
    for(i=0; i<nArg; i++){
      sqlite3VdbeAddOp3(v, OP_Column, ephemTab, i, regArg+i);
    }
  }
  sqlite3VtabMakeWritable(pParse, pTab);
  sqlite3VdbeAddOp4(v, OP_VUpdate, 0, nArg, regArg, pVTab, P4_VTAB);
  sqlite3VdbeChangeP5(v, onError==OE_Default ? OE_Abort : onError);
  sqlite3MayAbort(pParse);

  /* End of the ephemeral table scan. Or, if using the onepass strategy,
  ** jump to here if the scan visited zero rows. */
  if( bOnePass==0 ){
    sqlite3VdbeAddOp2(v, OP_Next, ephemTab, addr+1); VdbeCoverage(v);
    sqlite3VdbeJumpHere(v, addr);
    sqlite3VdbeAddOp2(v, OP_Close, ephemTab, 0);
  }else{
    sqlite3WhereEnd(pWInfo);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %r9, %r14
movq %rcx, -0x78(%rbp)
movq %rsi, %r9
movq %rdi, %r15
movq 0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movq 0x10(%rdi), %rsi
movq %rdx, -0x60(%rbp)
movq 0x58(%rdx), %r12
testq %r12, %r12
movq %r8, -0x98(%rbp)
je 0x6c865
movq (%r15), %rax
cmpq %rax, (%r12)
je 0x6c868
movq 0x28(%r12), %r12
testq %r12, %r12
jne 0x6c855
xorl %r12d, %r12d
movl 0x18(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x60(%rbp), %rax
movswl 0x3e(%rax), %ebx
leal 0x2(%rbx), %ecx
movl 0x4c(%r9), %eax
movl %eax, -0x54(%rbp)
movl 0x50(%r15), %edx
leal 0x1(%rdx), %eax
movl %eax, 0x50(%r15)
movq %rsi, %rdi
movq %rsi, -0x38(%rbp)
movl $0x3a, %esi
movq %rdx, -0x68(%rbp)
movl %ecx, -0x30(%rbp)
xorl %r8d, %r8d
movq %r9, -0x48(%rbp)
callq 0x3ea9f
movq %rax, -0x40(%rbp)
movl 0x54(%r15), %r13d
movq %rbx, -0x90(%rbp)
leal 0x4(%r13,%rbx), %ebx
movl %ebx, 0x54(%r15)
movl $0x0, (%rsp)
movq %r15, %rdi
movq -0x48(%rbp), %rsi
movq -0x50(%rbp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
movl $0x4, %r9d
callq 0x5d034
testq %rax, %rax
je 0x6c938
movl %ebx, -0x7c(%rbp)
movq %rax, -0x70(%rbp)
leal 0x1(%r13), %ecx
movq -0x38(%rbp), %rdi
movl $0x69, %esi
movl -0x54(%rbp), %ebx
movl %ebx, %edx
movq %rcx, -0x50(%rbp)
xorl %r8d, %r8d
callq 0x3ea9f
movq %r13, -0x88(%rbp)
leal 0x2(%r13), %ecx
movq -0x98(%rbp), %rsi
testq %rsi, %rsi
movq %r15, -0x48(%rbp)
movl %ebx, %r13d
je 0x6c947
movq %r15, %rdi
movl %ecx, %edx
callq 0x4f909
jmp 0x6c95b
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x38(%rbp), %rdi
movl $0x69, %esi
movl -0x54(%rbp), %edx
xorl %r8d, %r8d
callq 0x3ea9f
movq -0x60(%rbp), %rax
cmpw $0x0, 0x3e(%rax)
movl -0x30(%rbp), %ecx
movq -0x50(%rbp), %rdx
jle 0x6c9d7
movl %r13d, %r9d
movq -0x88(%rbp), %r15
addl $0x3, %r15d
xorl %ebx, %ebx
movslq (%r14,%rbx,4), %rax
testq %rax, %rax
js 0x6c9a5
movq -0x78(%rbp), %rcx
movq 0x8(%rcx), %rcx
shlq $0x5, %rax
movq (%rcx,%rax), %rsi
leal (%r15,%rbx), %edx
movq -0x48(%rbp), %rdi
callq 0x4f909
jmp 0x6c9bc
leal (%r15,%rbx), %r8d
movq -0x38(%rbp), %rdi
movl $0x9a, %esi
movl %r9d, %edx
movl %ebx, %ecx
callq 0x3ea9f
incq %rbx
movq -0x60(%rbp), %rax
movswq 0x3e(%rax), %rax
cmpq %rax, %rbx
movl -0x30(%rbp), %ecx
movq -0x50(%rbp), %rdx
movl %r13d, %r9d
jl 0x6c97d
movq -0x70(%rbp), %rsi
movb 0x36(%rsi), %al
movb %al, -0x78(%rbp)
testb %al, %al
je 0x6ca10
movq -0x38(%rbp), %r15
movq %r15, %rdi
movq -0x40(%rbp), %rsi
callq 0x14c6f
movq -0x48(%rbp), %rax
cmpq $0x0, 0x1c0(%rax)
jne 0x6ca07
movb $0x0, 0x20(%rax)
movq -0x68(%rbp), %r14
jmp 0x6cad2
movq -0x88(%rbp), %rax
movq -0x90(%rbp), %rdi
leal (%rax,%rdi), %r8d
addl $0x3, %r8d
movl %r8d, -0x40(%rbp)
movq -0x38(%rbp), %r15
movq %r15, %rdi
movl $0x32, %esi
callq 0x3ea9f
xorl %ebx, %ebx
movq %r15, %rdi
movl $0x54, %esi
movq -0x68(%rbp), %r14
movl %r14d, %edx
movl -0x7c(%rbp), %r13d
movl %r13d, %ecx
xorl %r8d, %r8d
callq 0x3ea9f
movq %r15, %rdi
movl $0x5f, %esi
movl %r14d, %edx
movl -0x40(%rbp), %ecx
movl %r13d, %r8d
callq 0x3ea9f
movq -0x70(%rbp), %rdi
callq 0x5ec9b
movq %r15, %rdi
movl $0x6e, %esi
movl %r14d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x3ea9f
movq %rax, -0x40(%rbp)
cmpw $-0x1, -0x90(%rbp)
jl 0x6cad2
movl -0x30(%rbp), %r13d
movq %r14, %r15
movq -0x50(%rbp), %r14
leal (%r14,%rbx), %r8d
movq -0x38(%rbp), %rdi
movl $0x30, %esi
movl %r15d, %edx
movl %ebx, %ecx
callq 0x3ea9f
incl %ebx
cmpl %ebx, %r13d
jne 0x6caa8
movl -0x2c(%rbp), %ebx
movq %r15, %r14
movq -0x38(%rbp), %r15
jmp 0x6cad5
movl -0x2c(%rbp), %ebx
movq -0x48(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x69c46
movq %r15, %rdi
movl $0xd, %esi
xorl %edx, %edx
movl -0x30(%rbp), %ecx
movq -0x50(%rbp), %r8
callq 0x3ea9f
movq %r15, %rdi
movl %eax, %esi
movq %r12, %rdx
movl $0xfffffff6, %ecx       # imm = 0xFFFFFFF6
callq 0x14b4f
cmpl $0xa, %ebx
movl $0x2, %eax
cmovnel %ebx, %eax
movq (%r15), %rcx
cmpb $0x0, 0x51(%rcx)
je 0x6cb27
leaq 0x269d3(%rip), %rcx     # 0x934f8
jmp 0x6cb3b
movslq 0x3c(%r15), %rcx
movq 0x8(%r15), %rdx
leaq (%rcx,%rcx,2), %rcx
leaq (%rdx,%rcx,8), %rcx
addq $-0x18, %rcx
movq -0x40(%rbp), %rbx
movb %al, 0x3(%rcx)
movq -0x48(%rbp), %rcx
movq 0x1c0(%rcx), %rax
testq %rax, %rax
cmoveq %rcx, %rax
movb $0x1, 0x21(%rax)
cmpb $0x0, -0x78(%rbp)
je 0x6cb75
movq -0x70(%rbp), %rdi
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5ec9b
leal 0x1(%rbx), %ecx
movq %r15, %rdi
movl $0x8, %esi
movl %r14d, %edx
xorl %r8d, %r8d
callq 0x3ea9f
movl 0x3c(%r15), %eax
leal -0x1(%rax), %ecx
movq 0x30(%r15), %rdx
movl %ecx, 0x68(%rdx)
movq (%r15), %rdx
cmpb $0x0, 0x51(%rdx)
je 0x6cbab
leaq 0x2694f(%rip), %rcx     # 0x934f8
jmp 0x6cbbf
testl %ebx, %ebx
cmovnsl %ebx, %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x3, %rcx
addq 0x8(%r15), %rcx
movl %eax, 0x8(%rcx)
movq %r15, %rdi
movl $0x3e, %esi
movl %r14d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3ea9f