// File: /workspace/github_c_makefile_star2_O1/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 0x44e8aa
testq %r14, %r14
je 0x46d347
movq %rax, %r15
leaq 0x137c68(%rip), %r12    # 0x5a4e08
movq 0x40(%r14), %rax
testb $0x10, 0x5(%rax)
je 0x46d1b1
cmpb $0x57, 0x19(%r14)
jne 0x46d1e0
cmpl $0x0, 0x58(%r14)
jne 0x46d2f0
movl 0x4c(%r14), %edx
movq 0x60(%r14), %rax
movq 0x20(%rax), %rax
testl %ebx, %ebx
je 0x46d26d
testq %rax, %rax
je 0x46d27d
movl (%rax), %ecx
jmp 0x46d27f
movl 0x50(%r14), %ecx
movq %r15, %rdi
movl $0x49, %esi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x43bae0
movl 0x54(%r14), %edx
movq %r15, %rdi
movl $0x20, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x43bae0
movl 0x50(%r14), %r8d
movl 0x54(%r14), %edx
movq %r15, %rdi
movl $0x5a, %esi
xorl %ecx, %ecx
callq 0x43bae0
movl 0xb8(%r15), %eax
movq (%r15), %rcx
cmpb $0x0, 0x61(%rcx)
movq %r12, %rcx
jne 0x46d252
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 0x46d2f0
movl 0x54(%r14), %edx
movq %r15, %rdi
movl $0x8b, %esi
xorl %ecx, %ecx
jmp 0x46d2e8
testq %rax, %rax
je 0x46d2ff
movl (%rax), %ecx
jmp 0x46d301
xorl %ecx, %ecx
movq %r15, %rdi
movl $0x9e, %esi
xorl %r8d, %r8d
callq 0x43bae0
movq 0x40(%r14), %rsi
movq (%r15), %rdi
cmpb $0x0, 0x61(%rdi)
je 0x46d2a9
testb $0x10, 0x4(%rsi)
je 0x46d2c2
callq 0x415dca
jmp 0x46d2c2
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 0x43bae0
movl 0x4c(%r14), %ecx
movq %r15, %rdi
movl $0x49, %esi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x43bae0
movq 0x30(%r14), %r14
testq %r14, %r14
jne 0x46d1a0
jmp 0x46d347
xorl %ecx, %ecx
movl 0x50(%r14), %r8d
movq %r15, %rdi
movl $0x9d, %esi
callq 0x43bae0
movq 0x40(%r14), %rsi
movq (%r15), %rdi
cmpb $0x0, 0x61(%rdi)
je 0x46d32c
testb $0x10, 0x4(%rsi)
je 0x46d2f0
callq 0x415dca
jmp 0x46d2f0
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 0x46d2f0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq