// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: windowReturnOneRow
static void windowReturnOneRow(WindowCodeArg *p){
  Window *pMWin = p->pMWin;
  Vdbe *v = p->pVdbe;

  if( pMWin->regStartRowid ){
    windowFullScan(p);
  }else{
    Parse *pParse = p->pParse;
    Window *pWin;

    for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
      FuncDef *pFunc = pWin->pFunc;
      if( pFunc->zName==nth_valueName
       || pFunc->zName==first_valueName
      ){
        int csr = pWin->csrApp;
        int lbl = sqlite3VdbeMakeLabel(pParse);
        int tmpReg = sqlite3GetTempReg(pParse);
        sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regResult);

        if( pFunc->zName==nth_valueName ){
          sqlite3VdbeAddOp3(v, OP_Column,pMWin->iEphCsr,pWin->iArgCol+1,tmpReg);
          windowCheckValue(pParse, tmpReg, 2);
        }else{
          sqlite3VdbeAddOp2(v, OP_Integer, 1, tmpReg);
        }
        sqlite3VdbeAddOp3(v, OP_Add, tmpReg, pWin->regApp, tmpReg);
        sqlite3VdbeAddOp3(v, OP_Gt, pWin->regApp+1, lbl, tmpReg);
        VdbeCoverageNeverNull(v);
        sqlite3VdbeAddOp3(v, OP_SeekRowid, csr, 0, tmpReg);
        VdbeCoverageNeverTaken(v);
        sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol, pWin->regResult);
        sqlite3VdbeResolveLabel(v, lbl);
        sqlite3ReleaseTempReg(pParse, tmpReg);
      }
      else if( pFunc->zName==leadName || pFunc->zName==lagName ){
        int nArg = pWin->pOwner->x.pList->nExpr;
        int csr = pWin->csrApp;
        int lbl = sqlite3VdbeMakeLabel(pParse);
        int tmpReg = sqlite3GetTempReg(pParse);
        int iEph = pMWin->iEphCsr;

        if( nArg<3 ){
          sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regResult);
        }else{
          sqlite3VdbeAddOp3(v, OP_Column, iEph,pWin->iArgCol+2,pWin->regResult);
        }
        sqlite3VdbeAddOp2(v, OP_Rowid, iEph, tmpReg);
        if( nArg<2 ){
          int val = (pFunc->zName==leadName ? 1 : -1);
          sqlite3VdbeAddOp2(v, OP_AddImm, tmpReg, val);
        }else{
          int op = (pFunc->zName==leadName ? OP_Add : OP_Subtract);
          int tmpReg2 = sqlite3GetTempReg(pParse);
          sqlite3VdbeAddOp3(v, OP_Column, iEph, pWin->iArgCol+1, tmpReg2);
          sqlite3VdbeAddOp3(v, op, tmpReg2, tmpReg, tmpReg);
          sqlite3ReleaseTempReg(pParse, tmpReg2);
        }

        sqlite3VdbeAddOp3(v, OP_SeekRowid, csr, lbl, tmpReg);
        VdbeCoverage(v);
        sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol, pWin->regResult);
        sqlite3VdbeResolveLabel(v, lbl);
        sqlite3ReleaseTempReg(pParse, tmpReg);
      }
    }
  }
  sqlite3VdbeAddOp2(v, OP_Gosub, p->regGosub, p->addrGosub);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq (%rdi), %r14
movq 0x8(%rdi), %rbp
movq 0x10(%rdi), %rax
movq %rax, 0x30(%rsp)
cmpl $0x0, 0x84(%rbp)
movq %r14, 0x10(%rsp)
movq %rbp, 0x28(%rsp)
movq %rdi, 0x40(%rsp)
je 0x27d07b
movq %rdi, %r12
movq 0x18(%rbp), %rax
movl $0x0, 0x20(%rsp)
movl $0x0, %r15d
testq %rax, %rax
je 0x27cf3f
movl (%rax), %r15d
movl 0x64(%rbp), %eax
movl %eax, 0x24(%rsp)
movl 0x44(%r14), %eax
movq %rax, 0x8(%rsp)
leal -0x2(%rax), %r13d
movl %r13d, 0x44(%r14)
movq %r14, %rdi
callq 0x267d61
movl %eax, 0x4(%rsp)
movq %r14, %rdi
callq 0x267d61
movl %eax, (%rsp)
movl $0x0, %ebx
testl %r15d, %r15d
je 0x27cf94
movq %r14, %rdi
movl %r15d, %esi
callq 0x266492
movl %eax, %ebx
movq %r14, %rdi
movl %r15d, %esi
callq 0x266492
movl %eax, 0x20(%rsp)
movl %r15d, 0x1c(%rsp)
movq 0x8(%rsp), %rax
decl %eax
movq %rax, 0x8(%rsp)
movl 0x58(%rbp), %edx
pushq $0x7f
popq %rsi
movq 0x30(%rsp), %r14
movq %r14, %rdi
movl 0x4(%rsp), %ecx
callq 0x24d51a
movl 0x58(%rbp), %esi
movq %r12, %rdi
movl %ebx, 0x3c(%rsp)
movl %ebx, %edx
callq 0x27dbe4
movq %rbp, %r15
pushq $0x48
popq %rbp
testq %r15, %r15
je 0x27cfee
movl 0x5c(%r15), %ecx
movq %r14, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x24d51a
movq 0x40(%r15), %r15
jmp 0x27cfd3
movq 0x28(%rsp), %r15
movl 0x84(%r15), %r8d
pushq $0x18
popq %rsi
movq %r14, %rdi
movl 0x24(%rsp), %ebx
movl %ebx, %edx
movl %r13d, %ecx
callq 0x24d51f
movl 0x90(%r14), %ebp
pushq $0x7f
popq %rsi
movq %r14, %rdi
movl %ebx, %edx
movl (%rsp), %ebx
movl %ebx, %ecx
callq 0x24d51a
movl 0x88(%r15), %edx
pushq $0x36
popq %rsi
movq %r14, %rdi
movl %r13d, %ecx
movl %ebx, %r8d
callq 0x24d51f
movzbl 0x24(%r15), %eax
cmpl $0x42, %eax
movl 0x1c(%rsp), %r15d
movq 0x8(%rsp), %r13
je 0x27d46d
cmpl $0x55, %eax
jne 0x27d3a1
pushq $0x35
popq %rsi
movq %r14, %rdi
movl 0x4(%rsp), %edx
movl %r13d, %ecx
movl (%rsp), %r8d
callq 0x24d51f
jmp 0x27d46d
leaq 0xf8609(%rip), %rsi     # 0x37568b
leaq 0xf860c(%rip), %rbx     # 0x375695
movq %rbp, %r12
testq %r12, %r12
je 0x27d52f
movq 0x50(%r12), %r13
movq 0x38(%r13), %rax
cmpq %rsi, %rax
setne %cl
cmpq %rbx, %rax
setne %dl
testb %dl, %cl
jne 0x27d109
movl 0x64(%r12), %eax
movl %eax, 0x8(%rsp)
movl 0x44(%r14), %ebp
decl %ebp
movl %ebp, 0x44(%r14)
movq %r14, %rdi
movq %rsi, %rbx
callq 0x267d61
movl %eax, %r15d
movl 0x60(%r12), %ecx
movq 0x30(%rsp), %r14
movq %r14, %rdi
pushq $0x48
popq %rsi
xorl %edx, %edx
callq 0x24d51a
cmpq %rbx, 0x38(%r13)
je 0x27d180
movq %r14, %rdi
pushq $0x45
popq %rsi
pushq $0x1
popq %rdx
movl %r15d, %ecx
callq 0x24d51a
pushq $0x59
popq %rbx
jmp 0x27d1af
leaq 0xf8572(%rip), %rcx     # 0x375682
cmpq %rcx, %rax
setne %cl
leaq 0xf856a(%rip), %rdx     # 0x375687
cmpq %rdx, %rax
setne %al
testb %al, %cl
jne 0x27d397
movq 0x70(%r12), %rax
movq 0x20(%rax), %rax
movl (%rax), %ebx
movl 0x64(%r12), %eax
movl %eax, 0x4(%rsp)
movl 0x44(%r14), %eax
decl %eax
movl %eax, 0x8(%rsp)
movl %eax, 0x44(%r14)
movq %r14, %rdi
callq 0x267d61
movl %eax, %r15d
movl 0x58(%rbp), %ebp
cmpl $0x2, %ebx
jg 0x27d247
movl 0x60(%r12), %ecx
movq 0x30(%rsp), %r14
movq %r14, %rdi
pushq $0x48
popq %rsi
xorl %edx, %edx
callq 0x24d51a
jmp 0x27d266
movq 0x28(%rsp), %rax
movl 0x58(%rax), %edx
movl 0x7c(%r12), %ecx
incl %ecx
movq %r14, %rdi
pushq $0x59
popq %rbx
movl %ebx, %esi
movl %r15d, %r8d
callq 0x24d51f
movq 0x10(%rsp), %rdi
movl %r15d, %esi
pushq $0x2
popq %rdx
callq 0x27cc5f
movl 0x68(%r12), %ecx
movq %r14, %rdi
pushq $0x69
popq %rsi
movl %r15d, %edx
movl %r15d, %r8d
callq 0x24d51f
movl 0x68(%r12), %edx
incl %edx
movq %r14, %rdi
pushq $0x36
popq %rsi
movl %ebp, %ecx
movl %r15d, %r8d
callq 0x24d51f
movq %r14, %rdi
pushq $0x1f
popq %rsi
movl 0x8(%rsp), %r13d
movl %r13d, %edx
xorl %ecx, %ecx
movl %r15d, %r8d
callq 0x24d51f
movl 0x60(%r12), %r8d
movl 0x7c(%r12), %ecx
movq %r14, %rdi
movl %ebx, %esi
movl %r13d, %edx
callq 0x24d51f
movq %r14, %rdi
movl %ebp, %esi
callq 0x266fe1
testl %r15d, %r15d
movq 0x10(%rsp), %r14
movq 0x28(%rsp), %rbp
leaq 0xf8462(%rip), %rsi     # 0x37568b
leaq 0xf8465(%rip), %rbx     # 0x375695
je 0x27d397
movb 0x1f(%r14), %al
cmpb $0x8, %al
jb 0x27d385
jmp 0x27d397
movl 0x60(%r12), %r8d
movl 0x7c(%r12), %ecx
addl $0x2, %ecx
movq 0x30(%rsp), %r14
movq %r14, %rdi
pushq $0x59
popq %rsi
movl %ebp, %edx
callq 0x24d51f
movl %ebp, (%rsp)
movq %r14, %rdi
pushq $0x7f
popq %rsi
movl %ebp, %edx
movl %r15d, %ebp
movl %r15d, %ecx
callq 0x24d51a
movq 0x38(%r13), %rax
cmpl $0x1, %ebx
jg 0x27d2ae
xorl %ecx, %ecx
leaq 0xf83f4(%rip), %rdx     # 0x375682
cmpq %rdx, %rax
sete %cl
leal -0x1(%rcx,%rcx), %ecx
movq %r14, %rdi
pushq $0x52
popq %rsi
movl %ebp, %edx
callq 0x24d51a
movl %ebp, %r15d
pushq $0x59
popq %r13
jmp 0x27d325
xorl %r15d, %r15d
leaq 0xf83ca(%rip), %rcx     # 0x375682
cmpq %rcx, %rax
setne %r15b
addl $0x69, %r15d
movq 0x10(%rsp), %rdi
callq 0x267d61
movl %eax, %ebx
movl 0x7c(%r12), %ecx
incl %ecx
movq %r14, %rdi
pushq $0x59
popq %r13
movl %r13d, %esi
movl (%rsp), %edx
movl %eax, %r8d
callq 0x24d51f
movq %r14, %rdi
movl %r15d, %esi
movl %ebx, %edx
movl %ebp, %ecx
movl %ebp, %r8d
callq 0x24d51f
testl %ebx, %ebx
movl %ebp, %r15d
je 0x27d325
movq 0x10(%rsp), %rax
movzbl 0x1f(%rax), %eax
cmpq $0x7, %rax
ja 0x27d325
leal 0x1(%rax), %ecx
movq 0x10(%rsp), %rdx
movb %cl, 0x1f(%rdx)
movl %ebx, 0xd4(%rdx,%rax,4)
movq %r14, %rdi
pushq $0x1f
popq %rsi
movl 0x4(%rsp), %ebp
movl %ebp, %edx
movl 0x8(%rsp), %ebx
movl %ebx, %ecx
movl %r15d, %r8d
callq 0x24d51f
movl 0x60(%r12), %r8d
movl 0x7c(%r12), %ecx
movq %r14, %rdi
movl %r13d, %esi
movl %ebp, %edx
callq 0x24d51f
movq %r14, %rdi
movl %ebx, %esi
callq 0x266fe1
testl %r15d, %r15d
movq 0x10(%rsp), %r14
movq 0x28(%rsp), %rbp
leaq 0xf8317(%rip), %rsi     # 0x37568b
leaq 0xf831a(%rip), %rbx     # 0x375695
je 0x27d397
movb 0x1f(%r14), %al
cmpb $0x7, %al
ja 0x27d397
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%r14)
movzbl %al, %eax
movl %r15d, 0xd4(%r14,%rax,4)
movq 0x40(%r12), %r12
jmp 0x27d08c
movq 0x28(%rsp), %r15
movq 0x18(%r15), %rsi
xorl %ebx, %ebx
testq %rsi, %rsi
je 0x27d3c8
movq 0x10(%rsp), %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x270980
movq %rax, %r12
movb 0x24(%r15), %al
jmp 0x27d3cb
xorl %r12d, %r12d
movl 0x1c(%rsp), %r15d
cmpb $0x5e, %al
jne 0x27d3eb
pushq $0x35
popq %rsi
movq %r14, %rdi
movl 0x4(%rsp), %edx
xorl %ecx, %ecx
movl (%rsp), %r8d
callq 0x24d51f
movl %eax, %ebx
testq %r12, %r12
je 0x27d44a
movq 0x40(%rsp), %rdi
movl 0x24(%rsp), %esi
movl 0x20(%rsp), %r13d
movl %r13d, %edx
callq 0x27dbe4
pushq $0x56
popq %rsi
movq %r14, %rdi
movl %r13d, %edx
movq 0x8(%rsp), %r13
movl 0x3c(%rsp), %ecx
movl %r15d, %r8d
callq 0x24d51f
pushq $-0x9
popq %rdx
movq %r14, %rdi
movq %r12, %rsi
callq 0x26495f
movl 0x90(%r14), %edx
incl %edx
pushq $0x10
popq %rsi
movq %r14, %rdi
movl %r13d, %ecx
movl %edx, %r8d
callq 0x24d51f
jmp 0x27d45a
pushq $0xb
popq %rsi
movq %r14, %rdi
xorl %edx, %edx
movl %r13d, %ecx
callq 0x24d51a
testl %ebx, %ebx
movq 0x40(%rsp), %r12
je 0x27d46d
movq %r14, %rdi
movl %ebx, %esi
callq 0x2645f8
movl 0x20(%r12), %r8d
movq %r12, %rdi
movq 0x28(%rsp), %rsi
movl 0x24(%rsp), %ebx
movl %ebx, %edx
xorl %ecx, %ecx
callq 0x27dc56
movq %r14, %rdi
movl %r13d, %esi
callq 0x266fe1
pushq $0x5
popq %rsi
movq %r14, %rdi
movl %ebx, %edx
movl %ebp, %ecx
callq 0x24d51a
leal -0x1(%rbp), %esi
movq %r14, %rdi
callq 0x2645f8
incl %ebp
movq %r14, %rdi
movl %ebp, %esi
callq 0x2645f8
cmpl $0x0, (%rsp)
movq 0x10(%rsp), %rbx
je 0x27d4dd
movzbl 0x1f(%rbx), %eax
cmpq $0x7, %rax
ja 0x27d4dd
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%rbx)
movl (%rsp), %ecx
movl %ecx, 0xd4(%rbx,%rax,4)
cmpl $0x0, 0x4(%rsp)
movl 0x3c(%rsp), %ebp
je 0x27d503
movzbl 0x1f(%rbx), %eax
cmpq $0x7, %rax
ja 0x27d503
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%rbx)
movl 0x4(%rsp), %ecx
movl %ecx, 0xd4(%rbx,%rax,4)
testl %r15d, %r15d
je 0x27d524
movq %rbx, %rdi
movl 0x20(%rsp), %esi
movl %r15d, %edx
callq 0x2666df
movq %rbx, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x2666df
pushq $0x1
popq %rsi
movq %r12, %rdi
callq 0x27cda0
movq 0x40(%rsp), %rax
movl 0x18(%rax), %ecx
movl 0x1c(%rax), %edx
pushq $0xc
popq %rsi
movq 0x30(%rsp), %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x24d51a