// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/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->pFExpr->x.pList;
    assert( !ExprHasProperty(pF->pFExpr, EP_xIsSelect) );
    assert( !IsWindowFunc(pF->pFExpr) );
    if( ExprHasProperty(pF->pFExpr, EP_WinFunc) ){
      Expr *pFilter = pF->pFExpr->y.pWin->pFilter;
      if( pAggInfo->nAccumulator
       && (pF->pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL)
       && regAcc
      ){
        /* If regAcc==0, there there exists some min() or max() function
        ** without a FILTER clause that will ensure the magnet registers
        ** are populated. */
        if( regHit==0 ) regHit = ++pParse->nMem;
        /* If this is the first row of the group (regAcc contains 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 contains 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->pCExpr, pC->iMem);
  }

  pAggInfo->directMode = 0;
  if( addrHitTest ){
    sqlite3VdbeJumpHereOrPopInst(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 0x444f7e
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 0x444da9
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 0x444d88
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x4(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x444d88
cmpl $0x0, -0xc(%rbp)
je 0x444d88
cmpl $0x0, -0x28(%rbp)
jne 0x444d74
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 $0x4d, %esi
callq 0x410100
movq -0x8(%rbp), %rdi
callq 0x42d540
movl %eax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl -0x48(%rbp), %edx
movl $0x10, %ecx
callq 0x42e060
cmpq $0x0, -0x58(%rbp)
je 0x444de2
movq -0x58(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x44(%rbp)
movq -0x8(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x42cb30
movl %eax, -0x4c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rsi
movl -0x4c(%rbp), %edx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x42cbc0
jmp 0x444df0
movl $0x0, -0x44(%rbp)
movl $0x0, -0x4c(%rbp)
movq -0x38(%rbp), %rax
cmpl $0x0, 0x14(%rax)
jl 0x444e28
cmpl $0x0, -0x48(%rbp)
jne 0x444e0c
movq -0x8(%rbp), %rdi
callq 0x42d540
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 0x4592b0
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x4(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x444efe
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 0x444e72
movl -0x74(%rbp), %eax
cmpl -0x44(%rbp), %eax
setl %al
movb %al, -0x75(%rbp)
movb -0x75(%rbp), %al
testb $0x1, %al
jne 0x444e7b
jmp 0x444ea6
movq -0x8(%rbp), %rdi
movq -0x70(%rbp), %rax
movq (%rax), %rsi
callq 0x4124c0
movq %rax, -0x68(%rbp)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
movq -0x70(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x70(%rbp)
jmp 0x444e5a
cmpq $0x0, -0x68(%rbp)
jne 0x444ebc
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x68(%rbp)
cmpl $0x0, -0x28(%rbp)
jne 0x444edc
movq -0x18(%rbp), %rax
cmpl $0x0, 0x2c(%rax)
je 0x444edc
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 $0x51, %esi
xorl %r8d, %r8d
movl %r8d, %ecx
movl $0xfffffffe, (%rsp)     # imm = 0xFFFFFFFE
callq 0x429aa0
movq -0x20(%rbp), %rdi
movl -0x4c(%rbp), %ecx
movq -0x38(%rbp), %rax
movl 0x10(%rax), %r8d
movl $0x9a, %esi
xorl %edx, %edx
callq 0x410130
movq -0x20(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rsi
movl $0xfffffff8, %edx       # imm = 0xFFFFFFF8
callq 0x42a320
movq -0x20(%rbp), %rdi
movl -0x44(%rbp), %eax
movzbl %al, %eax
movzwl %ax, %esi
callq 0x3cb9f0
movq -0x8(%rbp), %rdi
movl -0x4c(%rbp), %esi
movl -0x44(%rbp), %edx
callq 0x42d0c0
cmpl $0x0, -0x48(%rbp)
je 0x444f62
movq -0x20(%rbp), %rdi
movl -0x48(%rbp), %esi
callq 0x42dc90
jmp 0x444f64
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movq -0x38(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x38(%rbp)
jmp 0x444cea
cmpl $0x0, -0x28(%rbp)
jne 0x444f94
movq -0x18(%rbp), %rax
cmpl $0x0, 0x2c(%rax)
je 0x444f94
movl -0xc(%rbp), %eax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
je 0x444fae
movq -0x20(%rbp), %rdi
movl -0x28(%rbp), %edx
movl $0x12, %esi
callq 0x42ba70
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 0x444ffc
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x40(%rbp), %rax
movl 0x14(%rax), %edx
callq 0x429d30
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movq -0x40(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x40(%rbp)
jmp 0x444fc1
movq -0x18(%rbp), %rax
movb $0x0, (%rax)
cmpl $0x0, -0x2c(%rbp)
je 0x445015
movq -0x20(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0x45a1e0
addq $0x80, %rsp
popq %rbp
retq
nop