// File: /workspace/github_c_makefile_star2_O0/jkbenaim[P]psfrag/sqlite3.c
// Function: updateAccumulator
static void updateAccumulator(Parse *pParse, int regAcc, AggInfo *pAggInfo){
  Vdbe *v = pParse->pVdbe;
  int i;
  int regHit = 0;
  int addrHitTest = 0;
  struct AggInfo_func *pF;
  struct AggInfo_col *pC;

  pAggInfo->directMode = 1;
  for(i=0, pF=pAggInfo->aFunc; i<pAggInfo->nFunc; i++, pF++){
    int nArg;
    int addrNext = 0;
    int regAgg;
    ExprList *pList = pF->pExpr->x.pList;
    assert( !ExprHasProperty(pF->pExpr, EP_xIsSelect) );
    assert( !IsWindowFunc(pF->pExpr) );
    if( ExprHasProperty(pF->pExpr, EP_WinFunc) ){
      Expr *pFilter = pF->pExpr->y.pWin->pFilter;
      if( pAggInfo->nAccumulator 
       && (pF->pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL) 
      ){
        if( regHit==0 ) regHit = ++pParse->nMem;
        /* If this is the first row of the group (regAcc==0), clear the
        ** "magnet" register regHit so that the accumulator registers
        ** are populated if the FILTER clause jumps over the the 
        ** invocation of min() or max() altogether. Or, if this is not
        ** the first row (regAcc==1), set the magnet register so that the
        ** accumulators are not populated unless the min()/max() is invoked and
        ** indicates that they should be.  */
        sqlite3VdbeAddOp2(v, OP_Copy, regAcc, regHit);
      }
      addrNext = sqlite3VdbeMakeLabel(pParse);
      sqlite3ExprIfFalse(pParse, pFilter, addrNext, SQLITE_JUMPIFNULL);
    }
    if( pList ){
      nArg = pList->nExpr;
      regAgg = sqlite3GetTempRange(pParse, nArg);
      sqlite3ExprCodeExprList(pParse, pList, regAgg, 0, SQLITE_ECEL_DUP);
    }else{
      nArg = 0;
      regAgg = 0;
    }
    if( pF->iDistinct>=0 ){
      if( addrNext==0 ){ 
        addrNext = sqlite3VdbeMakeLabel(pParse);
      }
      testcase( nArg==0 );  /* Error condition */
      testcase( nArg>1 );   /* Also an error */
      codeDistinct(pParse, pF->iDistinct, addrNext, 1, regAgg);
    }
    if( pF->pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL ){
      CollSeq *pColl = 0;
      struct ExprList_item *pItem;
      int j;
      assert( pList!=0 );  /* pList!=0 if pF->pFunc has NEEDCOLL */
      for(j=0, pItem=pList->a; !pColl && j<nArg; j++, pItem++){
        pColl = sqlite3ExprCollSeq(pParse, pItem->pExpr);
      }
      if( !pColl ){
        pColl = pParse->db->pDfltColl;
      }
      if( regHit==0 && pAggInfo->nAccumulator ) regHit = ++pParse->nMem;
      sqlite3VdbeAddOp4(v, OP_CollSeq, regHit, 0, 0, (char *)pColl, P4_COLLSEQ);
    }
    sqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, pF->iMem);
    sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF);
    sqlite3VdbeChangeP5(v, (u8)nArg);
    sqlite3ReleaseTempRange(pParse, regAgg, nArg);
    if( addrNext ){
      sqlite3VdbeResolveLabel(v, addrNext);
    }
  }
  if( regHit==0 && pAggInfo->nAccumulator ){
    regHit = regAcc;
  }
  if( regHit ){
    addrHitTest = sqlite3VdbeAddOp1(v, OP_If, regHit); VdbeCoverage(v);
  }
  for(i=0, pC=pAggInfo->aCol; i<pAggInfo->nAccumulator; i++, pC++){
    sqlite3ExprCode(pParse, pC->pExpr, pC->iMem);
  }

  pAggInfo->directMode = 0;
  if( addrHitTest ){
    sqlite3VdbeJumpHere(v, addrHitTest);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movb $0x1, (%rax)
movl $0x0, -0x24(%rbp)
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x38(%rbp)
movl -0x24(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x38(%rcx), %eax
jge 0x8d174
movl $0x0, -0x48(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movl 0x4(%rax), %eax
andl $0x1000000, %eax        # imm = 0x1000000
cmpl $0x0, %eax
je 0x8cf9f
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq 0x40(%rax), %rax
movq 0x48(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x2c(%rax)
je 0x8cf7e
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x4(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x8cf7e
cmpl $0x0, -0x28(%rbp)
jne 0x8cf6a
movq -0x8(%rbp), %rcx
movl 0x38(%rcx), %eax
addl $0x1, %eax
movl %eax, 0x38(%rcx)
movl %eax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
movl -0xc(%rbp), %edx
movl -0x28(%rbp), %ecx
movl $0x4e, %esi
callq 0x5ad50
movq -0x8(%rbp), %rdi
callq 0x76770
movl %eax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl -0x48(%rbp), %edx
movl $0x10, %ecx
callq 0x77bc0
cmpq $0x0, -0x58(%rbp)
je 0x8cfd8
movq -0x58(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x44(%rbp)
movq -0x8(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x76830
movl %eax, -0x4c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rsi
movl -0x4c(%rbp), %edx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x768c0
jmp 0x8cfe6
movl $0x0, -0x44(%rbp)
movl $0x0, -0x4c(%rbp)
movq -0x38(%rbp), %rax
cmpl $0x0, 0x14(%rax)
jl 0x8d01e
cmpl $0x0, -0x48(%rbp)
jne 0x8d002
movq -0x8(%rbp), %rdi
callq 0x76770
movl %eax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movl 0x14(%rax), %esi
movl -0x48(%rbp), %edx
movl -0x4c(%rbp), %r8d
movl $0x1, %ecx
callq 0xa0ec0
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x4(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x8d0f4
movq $0x0, -0x68(%rbp)
movl $0x0, -0x74(%rbp)
movq -0x58(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x70(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x68(%rbp)
movb %al, -0x75(%rbp)
jne 0x8d068
movl -0x74(%rbp), %eax
cmpl -0x44(%rbp), %eax
setl %al
movb %al, -0x75(%rbp)
movb -0x75(%rbp), %al
testb $0x1, %al
jne 0x8d071
jmp 0x8d09c
movq -0x8(%rbp), %rdi
movq -0x70(%rbp), %rax
movq (%rax), %rsi
callq 0x5d7b0
movq %rax, -0x68(%rbp)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
movq -0x70(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x70(%rbp)
jmp 0x8d050
cmpq $0x0, -0x68(%rbp)
jne 0x8d0b2
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x68(%rbp)
cmpl $0x0, -0x28(%rbp)
jne 0x8d0d2
movq -0x18(%rbp), %rax
cmpl $0x0, 0x2c(%rax)
je 0x8d0d2
movq -0x8(%rbp), %rcx
movl 0x38(%rcx), %eax
addl $0x1, %eax
movl %eax, 0x38(%rcx)
movl %eax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
movl -0x28(%rbp), %edx
movq -0x68(%rbp), %r9
movl $0x52, %esi
xorl %r8d, %r8d
movl %r8d, %ecx
movl $0xfffffffe, (%rsp)     # imm = 0xFFFFFFFE
callq 0x73d90
movq -0x20(%rbp), %rdi
movl -0x4c(%rbp), %ecx
movq -0x38(%rbp), %rax
movl 0x10(%rax), %r8d
movl $0x9a, %esi
xorl %edx, %edx
callq 0x5ad80
movq -0x20(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rsi
movl $0xfffffff8, %edx       # imm = 0xFFFFFFF8
callq 0x74620
movq -0x20(%rbp), %rdi
movl -0x44(%rbp), %eax
movzbl %al, %eax
movzwl %ax, %esi
callq 0x16f50
movq -0x8(%rbp), %rdi
movl -0x4c(%rbp), %esi
movl -0x44(%rbp), %edx
callq 0x76c90
cmpl $0x0, -0x48(%rbp)
je 0x8d158
movq -0x20(%rbp), %rdi
movl -0x48(%rbp), %esi
callq 0x76790
jmp 0x8d15a
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movq -0x38(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x38(%rbp)
jmp 0x8ceea
cmpl $0x0, -0x28(%rbp)
jne 0x8d18a
movq -0x18(%rbp), %rax
cmpl $0x0, 0x2c(%rax)
je 0x8d18a
movl -0xc(%rbp), %eax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
je 0x8d1a4
movq -0x20(%rbp), %rdi
movl -0x28(%rbp), %edx
movl $0x12, %esi
callq 0x75c50
movl %eax, -0x2c(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x40(%rbp)
movl -0x24(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x2c(%rcx), %eax
jge 0x8d1f2
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x40(%rbp), %rax
movl 0x14(%rax), %edx
callq 0x74020
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movq -0x40(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x40(%rbp)
jmp 0x8d1b7
movq -0x18(%rbp), %rax
movb $0x0, (%rax)
cmpl $0x0, -0x2c(%rbp)
je 0x8d20b
movq -0x20(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0x73d60
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)