// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
callq 0x44dbe5
testq %r14, %r14
je 0x46cc13
movq %rax, %r15
leaq 0x13839c(%rip), %r12    # 0x5a4e08
movq 0x40(%r14), %rax
testb $0x10, 0x5(%rax)
je 0x46ca7d
cmpb $0x57, 0x19(%r14)
jne 0x46caac
cmpl $0x0, 0x58(%r14)
jne 0x46cbbc
movl 0x4c(%r14), %edx
movq 0x60(%r14), %rax
movq 0x20(%rax), %rax
testl %ebx, %ebx
je 0x46cb39
testq %rax, %rax
je 0x46cb49
movl (%rax), %ecx
jmp 0x46cb4b
movl 0x50(%r14), %ecx
movq %r15, %rdi
movl $0x49, %esi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x43a65f
movl 0x54(%r14), %edx
movq %r15, %rdi
movl $0x20, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x43a65f
movl 0x50(%r14), %r8d
movl 0x54(%r14), %edx
movq %r15, %rdi
movl $0x5a, %esi
xorl %ecx, %ecx
callq 0x43a65f
movl 0xb8(%r15), %eax
movq (%r15), %rcx
cmpb $0x0, 0x61(%rcx)
movq %r12, %rcx
jne 0x46cb1e
xorl %ecx, %ecx
cmpl $0x2, %eax
setl %cl
orl $-0x2, %ecx
addl %eax, %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x3, %rcx
addq 0x68(%r15), %rcx
movl %eax, 0x8(%rcx)
testl %ebx, %ebx
je 0x46cbbc
movl 0x54(%r14), %edx
movq %r15, %rdi
movl $0x8b, %esi
xorl %ecx, %ecx
jmp 0x46cbb4
testq %rax, %rax
je 0x46cbcb
movl (%rax), %ecx
jmp 0x46cbcd
xorl %ecx, %ecx
movq %r15, %rdi
movl $0x9e, %esi
xorl %r8d, %r8d
callq 0x43a65f
movq 0x40(%r14), %rsi
movq (%r15), %rdi
cmpb $0x0, 0x61(%rdi)
je 0x46cb75
testb $0x10, 0x4(%rsi)
je 0x46cb8e
callq 0x415f0a
jmp 0x46cb8e
movq 0x68(%r15), %rax
movslq 0xb8(%r15), %rcx
leaq (%rcx,%rcx,2), %rcx
movb $-0x8, -0x17(%rax,%rcx,8)
movq %rsi, -0x8(%rax,%rcx,8)
movl 0x4c(%r14), %edx
movl 0x50(%r14), %ecx
movq %r15, %rdi
movl $0x4e, %esi
xorl %r8d, %r8d
callq 0x43a65f
movl 0x4c(%r14), %ecx
movq %r15, %rdi
movl $0x49, %esi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x43a65f
movq 0x30(%r14), %r14
testq %r14, %r14
jne 0x46ca6c
jmp 0x46cc13
xorl %ecx, %ecx
movl 0x50(%r14), %r8d
movq %r15, %rdi
movl $0x9d, %esi
callq 0x43a65f
movq 0x40(%r14), %rsi
movq (%r15), %rdi
cmpb $0x0, 0x61(%rdi)
je 0x46cbf8
testb $0x10, 0x4(%rsi)
je 0x46cbbc
callq 0x415f0a
jmp 0x46cbbc
movq 0x68(%r15), %rax
movslq 0xb8(%r15), %rcx
leaq (%rcx,%rcx,2), %rcx
movb $-0x8, -0x17(%rax,%rcx,8)
movq %rsi, -0x8(%rax,%rcx,8)
jmp 0x46cbbc
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq