// File: /workspace/github_c_makefile_star2_O3/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, %r15
movq (%rdi), %rdi
movq 0x8(%r15), %r14
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
cmpl $0x0, 0x84(%r14)
movq %rdi, 0x20(%rsp)
movq %r15, 0x38(%rsp)
movq %r14, 0x30(%rsp)
je 0x2de77e
movq 0x18(%r14), %rax
testq %rax, %rax
je 0x2deae0
movl (%rax), %esi
jmp 0x2deae2
movq %r14, %r12
movq 0x10(%rsp), %r15
movq 0x50(%r12), %r14
movq 0x38(%r14), %rax
leaq 0xf6ae5(%rip), %rcx     # 0x3d527b
cmpq %rcx, %rax
setne %cl
leaq 0xf6ae2(%rip), %rdx     # 0x3d5285
cmpq %rdx, %rax
setne %dl
testb %dl, %cl
jne 0x2de7d2
movl 0x64(%r12), %r13d
movl 0x44(%rdi), %ebx
decl %ebx
movl %ebx, 0x44(%rdi)
movb 0x1f(%rdi), %al
testb %al, %al
je 0x2de833
decb %al
movb %al, 0x1f(%rdi)
movzbl %al, %eax
movl 0xd4(%rdi,%rax,4), %ebp
jmp 0x2de83b
leaq 0xf6a99(%rip), %rcx     # 0x3d5272
cmpq %rcx, %rax
setne %cl
leaq 0xf6a91(%rip), %rdx     # 0x3d5277
cmpq %rdx, %rax
setne %al
testb %al, %cl
jne 0x2deacd
movq 0x70(%r12), %rax
movq 0x20(%rax), %rax
movl (%rax), %ebx
movl 0x64(%r12), %eax
movl %eax, 0xc(%rsp)
movl 0x44(%rdi), %eax
decl %eax
movl %eax, 0x8(%rsp)
movl %eax, 0x44(%rdi)
movb 0x1f(%rdi), %al
testb %al, %al
je 0x2de92e
decb %al
movb %al, 0x1f(%rdi)
movzbl %al, %eax
movl 0xd4(%rdi,%rax,4), %ebp
jmp 0x2de936
movl 0x38(%rdi), %ebp
incl %ebp
movl %ebp, 0x38(%rdi)
movl 0x60(%r12), %ecx
movq %r15, %rdi
movl $0x48, %esi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x2a83e1
leaq 0xf6a22(%rip), %rax     # 0x3d527b
cmpq %rax, 0x38(%r14)
je 0x2de878
movq %r15, %rdi
movl $0x45, %esi
movl $0x1, %edx
movl %ebp, %ecx
xorl %r8d, %r8d
callq 0x2a83e1
jmp 0x2de8a8
movq 0x30(%rsp), %rax
movl 0x58(%rax), %edx
movl 0x7c(%r12), %ecx
incl %ecx
movq %r15, %rdi
movl $0x59, %esi
movl %ebp, %r8d
callq 0x2a83e1
movq 0x20(%rsp), %rdi
movl %ebp, %esi
movl $0x2, %edx
callq 0x2de3af
movl 0x68(%r12), %ecx
movq %r15, %rdi
movl $0x69, %esi
movl %ebp, %edx
movl %ebp, %r8d
callq 0x2a83e1
movl 0x68(%r12), %edx
incl %edx
movq %r15, %rdi
movl $0x36, %esi
movl %ebx, %ecx
movl %ebp, %r8d
callq 0x2a83e1
movq %r15, %rdi
movl $0x1f, %esi
movl %r13d, %edx
xorl %ecx, %ecx
movl %ebp, %r8d
callq 0x2a83e1
movl 0x60(%r12), %r8d
movl 0x7c(%r12), %ecx
movq %r15, %rdi
movl $0x59, %esi
movl %r13d, %edx
callq 0x2a83e1
movq %r15, %rdi
movl %ebx, %esi
callq 0x2bfa39
testl %ebp, %ebp
movq 0x20(%rsp), %rdi
je 0x2deacd
movb 0x1f(%rdi), %al
cmpb $0x8, %al
jb 0x2deabd
jmp 0x2deacd
movl 0x38(%rdi), %ebp
incl %ebp
movl %ebp, 0x38(%rdi)
movq 0x30(%rsp), %rax
movl 0x58(%rax), %r13d
cmpl $0x3, %ebx
jge 0x2de9a3
movl 0x60(%r12), %ecx
movq %r15, %rdi
movl $0x48, %esi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x2a83e1
movq %r15, %rdi
movl $0x7f, %esi
movl %r13d, %edx
movl %ebp, %ecx
xorl %r8d, %r8d
callq 0x2a83e1
cmpl $0x2, %ebx
je 0x2de9d5
xorl %eax, %eax
leaq 0xf68f4(%rip), %rcx     # 0x3d5272
cmpq %rcx, 0x38(%r14)
sete %al
leal -0x1(,%rax,2), %ecx
movq %r15, %rdi
movl $0x52, %esi
movl %ebp, %edx
xorl %r8d, %r8d
callq 0x2a83e1
jmp 0x2dea6b
movl 0x60(%r12), %r8d
movl 0x7c(%r12), %ecx
addl $0x2, %ecx
movq %r15, %rdi
movl $0x59, %esi
movl %r13d, %edx
callq 0x2a83e1
movq %r15, %rdi
movl $0x7f, %esi
movl %r13d, %edx
movl %ebp, %ecx
xorl %r8d, %r8d
callq 0x2a83e1
xorl %r15d, %r15d
leaq 0xf6893(%rip), %rax     # 0x3d5272
cmpq %rax, 0x38(%r14)
setne %al
movq 0x20(%rsp), %rdx
movb 0x1f(%rdx), %cl
testb %cl, %cl
je 0x2dea03
decb %cl
movb %cl, 0x1f(%rdx)
movzbl %cl, %ecx
movl 0xd4(%rdx,%rcx,4), %ebx
jmp 0x2dea0b
movl 0x38(%rdx), %ebx
incl %ebx
movl %ebx, 0x38(%rdx)
movb %al, %r15b
addl $0x69, %r15d
movl 0x7c(%r12), %ecx
incl %ecx
movq 0x10(%rsp), %r14
movq %r14, %rdi
movl $0x59, %esi
movl %r13d, %edx
movl %ebx, %r8d
callq 0x2a83e1
movq %r14, %rdi
movl %r15d, %esi
movq %r14, %r15
movl %ebx, %edx
movl %ebp, %ecx
movl %ebp, %r8d
callq 0x2a83e1
testl %ebx, %ebx
je 0x2dea6b
movq 0x20(%rsp), %rax
movzbl 0x1f(%rax), %eax
cmpq $0x7, %rax
ja 0x2dea6b
leal 0x1(%rax), %ecx
movq 0x20(%rsp), %rdx
movb %cl, 0x1f(%rdx)
movl %ebx, 0xd4(%rdx,%rax,4)
movq %r15, %rdi
movl $0x1f, %esi
movl 0xc(%rsp), %r14d
movl %r14d, %edx
movl 0x8(%rsp), %ebx
movl %ebx, %ecx
movl %ebp, %r8d
callq 0x2a83e1
movl 0x60(%r12), %r8d
movl 0x7c(%r12), %ecx
movq %r15, %rdi
movl $0x59, %esi
movl %r14d, %edx
callq 0x2a83e1
movq %r15, %rdi
movl %ebx, %esi
callq 0x2bfa39
testl %ebp, %ebp
movq 0x20(%rsp), %rdi
je 0x2deacd
movb 0x1f(%rdi), %al
cmpb $0x7, %al
ja 0x2deacd
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%rdi)
movzbl %al, %eax
movl %ebp, 0xd4(%rdi,%rax,4)
movq 0x40(%r12), %r12
testq %r12, %r12
jne 0x2de786
jmp 0x2deef3
xorl %esi, %esi
movl 0x64(%r14), %eax
movl %eax, 0x2c(%rsp)
movl 0x44(%rdi), %r13d
leal -0x2(%r13), %ebx
movl %ebx, 0x44(%rdi)
movb 0x1f(%rdi), %al
testb %al, %al
je 0x2deb25
leal -0x1(%rax), %ecx
movb %cl, 0x1f(%rdi)
movzbl %cl, %ecx
movl 0xd4(%rdi,%rcx,4), %edx
movl %edx, 0x8(%rsp)
testb %cl, %cl
je 0x2deb30
addb $-0x2, %al
movb %al, 0x1f(%rdi)
movzbl %al, %eax
movl 0xd4(%rdi,%rax,4), %eax
jmp 0x2deb38
movl 0x38(%rdi), %eax
incl %eax
movl %eax, 0x8(%rsp)
jmp 0x2deb33
movl 0x38(%rdi), %eax
incl %eax
movl %eax, 0x38(%rdi)
movl %eax, 0xc(%rsp)
testl %esi, %esi
movl %esi, 0x28(%rsp)
je 0x2deb68
movq %r14, %r12
movq %rdi, %r14
movl %esi, %ebp
callq 0x2beb15
movl %eax, 0x1c(%rsp)
movq %r14, %rdi
movq %r12, %r14
movl %ebp, %esi
callq 0x2beb15
movl %eax, 0x18(%rsp)
jmp 0x2deb78
movl $0x0, 0x18(%rsp)
movl $0x0, 0x1c(%rsp)
decl %r13d
movl 0x58(%r14), %edx
movq 0x10(%rsp), %r12
movq %r12, %rdi
movl $0x7f, %esi
movl 0x8(%rsp), %ecx
xorl %r8d, %r8d
callq 0x2a83e1
movl 0x58(%r14), %esi
movq %r15, %rdi
movl 0x1c(%rsp), %edx
callq 0x2df754
movl 0x5c(%r14), %ecx
movq %r12, %rdi
movl $0x48, %esi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x2a83e1
movq 0x40(%r14), %r14
testq %r14, %r14
jne 0x2deba8
movq 0x30(%rsp), %r14
movl 0x84(%r14), %r8d
movq %r12, %rdi
movl $0x18, %esi
movl 0x2c(%rsp), %ebp
movl %ebp, %edx
movl %ebx, %ecx
callq 0x2a83e1
movl 0x90(%r12), %eax
movq %rax, 0x40(%rsp)
movq %r12, %rdi
movl $0x7f, %esi
movl %ebp, %edx
movl 0xc(%rsp), %ebp
movl %ebp, %ecx
xorl %r8d, %r8d
callq 0x2a83e1
movl 0x88(%r14), %edx
movq %r12, %rdi
movl $0x36, %esi
movl %ebx, %ecx
movl %ebp, %r8d
callq 0x2a83e1
movzbl 0x24(%r14), %eax
cmpl $0x42, %eax
je 0x2deda5
cmpl $0x55, %eax
jne 0x2dec5c
movq 0x10(%rsp), %r12
movq %r12, %rdi
movl $0x35, %esi
movl 0x8(%rsp), %edx
movl %r13d, %ecx
movl 0xc(%rsp), %r8d
callq 0x2a83e1
jmp 0x2deda5
movq 0x18(%r14), %rsi
xorl %ebx, %ebx
testq %rsi, %rsi
je 0x2dec7e
movq 0x20(%rsp), %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x2cde19
movq %rax, %r12
movb 0x24(%r14), %al
jmp 0x2dec81
xorl %r12d, %r12d
cmpb $0x5e, %al
jne 0x2deca1
movq 0x10(%rsp), %rdi
movl $0x35, %esi
movl 0x8(%rsp), %edx
xorl %ecx, %ecx
movl 0xc(%rsp), %r8d
callq 0x2a83e1
movl %eax, %ebx
testq %r12, %r12
je 0x2ded07
movq 0x38(%rsp), %rdi
movl 0x2c(%rsp), %esi
movl 0x18(%rsp), %r15d
movl %r15d, %edx
callq 0x2df754
movq 0x10(%rsp), %r14
movq %r14, %rdi
movl $0x56, %esi
movl %r15d, %edx
movl 0x1c(%rsp), %ecx
movl 0x28(%rsp), %r8d
callq 0x2a83e1
movq (%r14), %rax
cmpb $0x0, 0x61(%rax)
je 0x2ded1b
cmpq $0x0, 0x2d0(%rax)
movq 0x30(%rsp), %r14
jne 0x2ded3c
decl (%r12)
jne 0x2ded3c
movq 0x10(%r12), %rdi
movq %r12, %rsi
callq 0x282904
jmp 0x2ded3c
movq 0x10(%rsp), %rdi
movl $0xb, %esi
xorl %edx, %edx
movl %r13d, %ecx
xorl %r8d, %r8d
jmp 0x2ded54
movq 0x88(%r14), %rax
movslq 0x90(%r14), %rcx
leaq (%rcx,%rcx,2), %rcx
movb $-0x9, -0x17(%rax,%rcx,8)
movq %r12, -0x8(%rax,%rcx,8)
movq 0x30(%rsp), %r14
movq 0x10(%rsp), %rdi
movl 0x90(%rdi), %edx
incl %edx
movl $0x10, %esi
movl %r13d, %ecx
movl %edx, %r8d
callq 0x2a83e1
testl %ebx, %ebx
movq 0x38(%rsp), %r15
movq 0x10(%rsp), %r12
je 0x2deda5
movl 0x90(%r12), %eax
movq (%r12), %rcx
cmpb $0x0, 0x61(%rcx)
je 0x2ded82
leaq 0x1e0108(%rip), %rcx    # 0x4bee88
jmp 0x2ded9d
leal -0x1(%rax), %ecx
testl %ebx, %ebx
cmovnsl %ebx, %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x3, %rcx
addq 0x88(%r12), %rcx
movl %eax, 0x8(%rcx)
movq 0x10(%rsp), %r12
movl 0x20(%r15), %r8d
movq %r15, %rdi
movq %r14, %rsi
movl 0x2c(%rsp), %ebx
movl %ebx, %edx
xorl %ecx, %ecx
callq 0x2df7c7
movq %r12, %rdi
movl %r13d, %esi
callq 0x2bfa39
movq %r12, %rdi
movl $0x5, %esi
movl %ebx, %edx
movq 0x40(%rsp), %rbx
movl %ebx, %ecx
xorl %r8d, %r8d
callq 0x2a83e1
movl 0x90(%r12), %eax
movq (%r12), %rcx
cmpb $0x0, 0x61(%rcx)
je 0x2dee01
movl %eax, 0x1e0098(%rip)    # 0x4bee90
leaq 0x1e0089(%rip), %rcx    # 0x4bee88
jmp 0x2dee32
testl %ebx, %ebx
movl %ebx, %ecx
cmovlel %eax, %ecx
movq 0x88(%r12), %rdx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
leal 0x1(%rbx), %esi
cmpl $-0x1, %ebx
leal -0x1(%rax), %edi
cmovgel %esi, %edi
movl %eax, -0x10(%rdx,%rcx,8)
movslq %edi, %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rdx,%rcx,8), %rcx
movl 0x28(%rsp), %esi
movl 0xc(%rsp), %edi
movl %eax, 0x8(%rcx)
testl %edi, %edi
movq 0x20(%rsp), %rdx
je 0x2dee5d
movzbl 0x1f(%rdx), %eax
cmpq $0x7, %rax
ja 0x2dee5d
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%rdx)
movl %edi, 0xd4(%rdx,%rax,4)
cmpl $0x0, 0x8(%rsp)
je 0x2dee7f
movzbl 0x1f(%rdx), %eax
cmpq $0x7, %rax
ja 0x2dee7f
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%rdx)
movl 0x8(%rsp), %ecx
movl %ecx, 0xd4(%rdx,%rax,4)
testl %esi, %esi
je 0x2deedd
cmpl $0x1, %esi
jne 0x2deece
cmpl $0x0, 0x18(%rsp)
je 0x2deeaa
movzbl 0x1f(%rdx), %eax
cmpq $0x7, %rax
ja 0x2deeaa
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%rdx)
movl 0x18(%rsp), %ecx
movl %ecx, 0xd4(%rdx,%rax,4)
cmpl $0x0, 0x1c(%rsp)
je 0x2deedd
movzbl 0x1f(%rdx), %eax
cmpq $0x7, %rax
ja 0x2deedd
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%rdx)
movl 0x1c(%rsp), %ecx
movl %ecx, 0xd4(%rdx,%rax,4)
jmp 0x2deedd
cmpl %esi, 0x28(%rdx)
jge 0x2deedd
movl %esi, 0x28(%rdx)
movl 0x18(%rsp), %eax
movl %eax, 0x2c(%rdx)
movq (%r15), %rdi
movq 0x8(%r15), %rsi
movl $0x1, %edx
callq 0x2de55c
movq 0x10(%rsp), %r15
movq 0x38(%rsp), %rax
movl 0x18(%rax), %ecx
movl 0x1c(%rax), %edx
movq %r15, %rdi
movl $0xc, %esi
xorl %r8d, %r8d
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2a83e1