// File: /workspace/github_c_makefile_star2_O0/ukontainer[P]sqlite-bench/sqlite3.c
// Function: windowAggFinal
static void windowAggFinal(Parse *pParse, Window *pMWin, int bFinal){
  Vdbe *v = sqlite3GetVdbe(pParse);
  Window *pWin;

  for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
    if( (pWin->pFunc->funcFlags & SQLITE_FUNC_MINMAX) 
     && pWin->eStart!=TK_UNBOUNDED 
    ){
      sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regResult);
      sqlite3VdbeAddOp1(v, OP_Last, pWin->csrApp);
      VdbeCoverage(v);
      sqlite3VdbeAddOp3(v, OP_Column, pWin->csrApp, 0, pWin->regResult);
      sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2);
      if( bFinal ){
        sqlite3VdbeAddOp1(v, OP_ResetSorter, pWin->csrApp);
      }
    }else if( pWin->regApp ){
    }else{
      if( bFinal ){
        sqlite3VdbeAddOp2(v, OP_AggFinal, pWin->regAccum, windowArgCount(pWin));
        sqlite3VdbeAppendP4(v, pWin->pFunc, P4_FUNCDEF);
        sqlite3VdbeAddOp2(v, OP_Copy, pWin->regAccum, pWin->regResult);
        sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regAccum);
      }else{
        sqlite3VdbeAddOp3(v, OP_AggValue, pWin->regAccum, windowArgCount(pWin),
                             pWin->regResult);
        sqlite3VdbeAppendP4(v, pWin->pFunc, P4_FUNCDEF);
      }
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rdi
callq 0x46bb00
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x495c78
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
movl 0x4(%rax), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x495b87
movq -0x28(%rbp), %rax
movzbl 0x19(%rax), %eax
cmpl $0x57, %eax
je 0x495b87
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x50(%rax), %ecx
movl $0x49, %esi
xorl %edx, %edx
callq 0x453790
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x54(%rax), %edx
movl $0x20, %esi
callq 0x46e2d0
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x54(%rax), %edx
movq -0x28(%rbp), %rax
movl 0x50(%rax), %r8d
movl $0x5a, %esi
xorl %ecx, %ecx
callq 0x4537c0
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rdi
callq 0x473080
movq -0x30(%rbp), %rdi
movl %eax, %esi
subl $0x2, %esi
callq 0x46bba0
cmpl $0x0, -0x14(%rbp)
je 0x495b82
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x54(%rax), %edx
movl $0x8b, %esi
callq 0x46e2d0
jmp 0x495c65
movq -0x28(%rbp), %rax
cmpl $0x0, 0x58(%rax)
je 0x495b96
jmp 0x495c63
cmpl $0x0, -0x14(%rbp)
je 0x495c15
movq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movl 0x4c(%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x28(%rbp), %rdi
callq 0x496000
movq -0x40(%rbp), %rdi
movl -0x34(%rbp), %edx
movl %eax, %ecx
movl $0x9e, %esi
callq 0x453790
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rsi
movl $0xfffffff8, %edx       # imm = 0xFFFFFFF8
callq 0x46c440
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x4c(%rax), %edx
movq -0x28(%rbp), %rax
movl 0x50(%rax), %ecx
movl $0x4e, %esi
callq 0x453790
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x4c(%rax), %ecx
movl $0x49, %esi
xorl %edx, %edx
callq 0x453790
jmp 0x495c61
movq -0x20(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x28(%rbp), %rax
movl 0x4c(%rax), %eax
movl %eax, -0x44(%rbp)
movq -0x28(%rbp), %rdi
callq 0x496000
movq -0x50(%rbp), %rdi
movl -0x44(%rbp), %edx
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl 0x50(%rax), %r8d
movl $0x9d, %esi
callq 0x4537c0
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rsi
movl $0xfffffff8, %edx       # imm = 0xFFFFFFF8
callq 0x46c440
jmp 0x495c63
jmp 0x495c65
jmp 0x495c67
movq -0x28(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x495ac8
addq $0x50, %rsp
popq %rbp
retq
nop