// File: /workspace/github_c_makefile_star2_O1/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, %r12
movq (%rdi), %rdi
movq 0x8(%r12), %r15
movq 0x10(%r12), %r14
cmpl $0x0, 0x84(%r15)
movq %rdi, 0x18(%rsp)
movq %r12, 0x38(%rsp)
movq %r15, 0x20(%rsp)
je 0x2e7a34
movq 0x18(%r15), %rax
testq %rax, %rax
je 0x2e7d78
movl (%rax), %esi
jmp 0x2e7d7a
testq %r15, %r15
je 0x2e81a6
movq 0x20(%rsp), %r15
movq 0x50(%r15), %r12
movq 0x38(%r12), %rax
leaq 0xf6fa9(%rip), %rcx     # 0x3de9fb
cmpq %rcx, %rax
setne %cl
leaq 0xf6fa6(%rip), %rdx     # 0x3dea05
cmpq %rdx, %rax
setne %dl
testb %dl, %cl
jne 0x2e7a8d
movl 0x64(%r15), %r13d
movl 0x44(%rdi), %ebx
decl %ebx
movl %ebx, 0x44(%rdi)
movb 0x1f(%rdi), %al
testb %al, %al
je 0x2e7aec
decb %al
movb %al, 0x1f(%rdi)
movzbl %al, %eax
movl 0xd4(%rdi,%rax,4), %ebp
jmp 0x2e7af4
leaq 0xf6f5e(%rip), %rcx     # 0x3de9f2
cmpq %rcx, %rax
setne %cl
leaq 0xf6f56(%rip), %rdx     # 0x3de9f7
cmpq %rdx, %rax
setne %al
testb %al, %cl
jne 0x2e7d66
movq 0x70(%r15), %rax
movq 0x20(%rax), %rax
movl (%rax), %ebx
movl 0x64(%r15), %eax
movl %eax, 0x8(%rsp)
movl 0x44(%rdi), %ecx
decl %ecx
movl %ecx, 0x44(%rdi)
movb 0x1f(%rdi), %al
testb %al, %al
movl %ecx, 0x10(%rsp)
je 0x2e7be2
decb %al
movb %al, 0x1f(%rdi)
movzbl %al, %eax
movl 0xd4(%rdi,%rax,4), %ebp
jmp 0x2e7bea
movl 0x38(%rdi), %ebp
incl %ebp
movl %ebp, 0x38(%rdi)
movl 0x60(%r15), %ecx
movq %r14, %rdi
movl $0x48, %esi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x2b200c
leaq 0xf6eea(%rip), %rax     # 0x3de9fb
cmpq %rax, 0x38(%r12)
je 0x2e7b31
movq %r14, %rdi
movl $0x45, %esi
movl $0x1, %edx
movl %ebp, %ecx
xorl %r8d, %r8d
callq 0x2b200c
jmp 0x2e7b60
movq 0x20(%rsp), %rax
movl 0x58(%rax), %edx
movl 0x7c(%r15), %ecx
incl %ecx
movq %r14, %rdi
movl $0x59, %esi
movl %ebp, %r8d
callq 0x2b200c
movq 0x18(%rsp), %rdi
movl %ebp, %esi
movl $0x2, %edx
callq 0x2e7661
movl 0x68(%r15), %ecx
movq %r14, %rdi
movl $0x69, %esi
movl %ebp, %edx
movl %ebp, %r8d
callq 0x2b200c
movl 0x68(%r15), %edx
incl %edx
movq %r14, %rdi
movl $0x36, %esi
movl %ebx, %ecx
movl %ebp, %r8d
callq 0x2b200c
movq %r14, %rdi
movl $0x1f, %esi
movl %r13d, %edx
xorl %ecx, %ecx
movl %ebp, %r8d
callq 0x2b200c
movl 0x60(%r15), %r8d
movl 0x7c(%r15), %ecx
movq %r14, %rdi
movl $0x59, %esi
movl %r13d, %edx
callq 0x2b200c
movq %r14, %rdi
movl %ebx, %esi
callq 0x2c91a7
testl %ebp, %ebp
movq 0x18(%rsp), %rdi
je 0x2e7d66
movb 0x1f(%rdi), %al
cmpb $0x8, %al
jb 0x2e7d56
jmp 0x2e7d66
movl 0x38(%rdi), %ebp
incl %ebp
movl %ebp, 0x38(%rdi)
movq 0x20(%rsp), %rax
movl 0x58(%rax), %r13d
cmpl $0x2, %ebx
jg 0x2e7c0b
movl 0x60(%r15), %ecx
movq %r14, %rdi
movl $0x48, %esi
xorl %edx, %edx
xorl %r8d, %r8d
jmp 0x2e7c21
movl 0x60(%r15), %r8d
movl 0x7c(%r15), %ecx
addl $0x2, %ecx
movq %r14, %rdi
movl $0x59, %esi
movl %r13d, %edx
callq 0x2b200c
movq %r14, %rdi
movl $0x7f, %esi
movl %r13d, 0xc(%rsp)
movl %r13d, %edx
movl %ebp, %ecx
xorl %r8d, %r8d
callq 0x2b200c
movq 0x38(%r12), %rax
cmpl $0x1, %ebx
jg 0x2e7c79
xorl %ecx, %ecx
leaq 0xf6d9f(%rip), %rdx     # 0x3de9f2
cmpq %rdx, %rax
sete %cl
leal -0x1(%rcx,%rcx), %ecx
movq %r14, %rdi
movl $0x52, %esi
movl %ebp, %edx
xorl %r8d, %r8d
callq 0x2b200c
movl 0x10(%rsp), %r13d
jmp 0x2e7d0b
xorl %r12d, %r12d
leaq 0xf6d6f(%rip), %rcx     # 0x3de9f2
cmpq %rcx, %rax
setne %al
movq 0x18(%rsp), %rdx
movb 0x1f(%rdx), %cl
testb %cl, %cl
movl 0x10(%rsp), %r13d
je 0x2e7cab
decb %cl
movb %cl, 0x1f(%rdx)
movzbl %cl, %ecx
movl 0xd4(%rdx,%rcx,4), %ebx
jmp 0x2e7cb3
movl 0x38(%rdx), %ebx
incl %ebx
movl %ebx, 0x38(%rdx)
movb %al, %r12b
addl $0x69, %r12d
movl 0x7c(%r15), %ecx
incl %ecx
movq %r14, %rdi
movl $0x59, %esi
movl 0xc(%rsp), %edx
movl %ebx, %r8d
callq 0x2b200c
movq %r14, %rdi
movl %r12d, %esi
movl %ebx, %edx
movl %ebp, %ecx
movl %ebp, %r8d
callq 0x2b200c
testl %ebx, %ebx
je 0x2e7d0b
movq 0x18(%rsp), %rax
movzbl 0x1f(%rax), %eax
cmpq $0x7, %rax
ja 0x2e7d0b
leal 0x1(%rax), %ecx
movq 0x18(%rsp), %rdx
movb %cl, 0x1f(%rdx)
movl %ebx, 0xd4(%rdx,%rax,4)
movq %r14, %rdi
movl $0x1f, %esi
movl 0x8(%rsp), %ebx
movl %ebx, %edx
movl %r13d, %ecx
movl %ebp, %r8d
callq 0x2b200c
movl 0x60(%r15), %r8d
movl 0x7c(%r15), %ecx
movq %r14, %rdi
movl $0x59, %esi
movl %ebx, %edx
callq 0x2b200c
movq %r14, %rdi
movl %r13d, %esi
callq 0x2c91a7
testl %ebp, %ebp
movq 0x18(%rsp), %rdi
je 0x2e7d66
movb 0x1f(%rdi), %al
cmpb $0x7, %al
ja 0x2e7d66
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%rdi)
movzbl %al, %eax
movl %ebp, 0xd4(%rdi,%rax,4)
movq 0x40(%r15), %r15
testq %r15, %r15
jne 0x2e7a42
jmp 0x2e81a6
xorl %esi, %esi
movl 0x64(%r15), %eax
movl %eax, 0x10(%rsp)
movl 0x44(%rdi), %ebx
leal -0x2(%rbx), %eax
movl %eax, 0x28(%rsp)
movl %eax, 0x44(%rdi)
movb 0x1f(%rdi), %al
testb %al, %al
je 0x2e7dab
decb %al
movb %al, 0x1f(%rdi)
movzbl %al, %eax
movl 0xd4(%rdi,%rax,4), %eax
movl %eax, 0x8(%rsp)
jmp 0x2e7db7
movl 0x38(%rdi), %eax
incl %eax
movl %eax, 0x8(%rsp)
movl %eax, 0x38(%rdi)
movb 0x1f(%rdi), %al
testb %al, %al
je 0x2e7dcf
decb %al
movb %al, 0x1f(%rdi)
movzbl %al, %eax
movl 0xd4(%rdi,%rax,4), %ebp
jmp 0x2e7dd7
movl 0x38(%rdi), %ebp
incl %ebp
movl %ebp, 0x38(%rdi)
testl %esi, %esi
movl %esi, 0x2c(%rsp)
je 0x2e7e12
movq %r15, %r13
movq %rdi, %r15
movq %rbx, %r12
movl %ebp, %ebx
movl %esi, %ebp
callq 0x2c8275
movl %eax, 0xc(%rsp)
movq %r15, %rdi
movq %r13, %r15
movl %ebp, %esi
movl %ebx, %ebp
movq %r12, %rbx
movq 0x38(%rsp), %r12
callq 0x2c8275
movl %eax, 0x14(%rsp)
jmp 0x2e7e22
movl $0x0, 0x14(%rsp)
movl $0x0, 0xc(%rsp)
movl 0x58(%r15), %edx
movq %r14, %rdi
movl $0x7f, %esi
movl 0x8(%rsp), %ecx
xorl %r8d, %r8d
callq 0x2b200c
movl 0x58(%r15), %esi
movq %r12, %rdi
movl 0xc(%rsp), %edx
callq 0x2e89fc
testq %r15, %r15
je 0x2e7e73
movq 0x20(%rsp), %r15
movl 0x5c(%r15), %ecx
movq %r14, %rdi
movl $0x48, %esi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x2b200c
movq 0x40(%r15), %r15
testq %r15, %r15
jne 0x2e7e54
decl %ebx
movq %rbx, 0x30(%rsp)
movq 0x20(%rsp), %r15
movl 0x84(%r15), %r8d
movq %r14, %rdi
movl $0x18, %esi
movl 0x10(%rsp), %ebx
movl %ebx, %edx
movl 0x28(%rsp), %r13d
movl %r13d, %ecx
callq 0x2b200c
movl 0x90(%r14), %eax
movq %rax, 0x40(%rsp)
movq %r14, %rdi
movl $0x7f, %esi
movl %ebx, %edx
movl %ebp, %ecx
xorl %r8d, %r8d
callq 0x2b200c
movl 0x88(%r15), %edx
movq %r14, %rdi
movl $0x36, %esi
movl %r13d, %ecx
movl %ebp, %r8d
callq 0x2b200c
movzbl 0x24(%r15), %eax
cmpl $0x42, %eax
je 0x2e804a
cmpl $0x55, %eax
jne 0x2e7f0c
movq %r14, %rdi
movl $0x35, %esi
movl 0x8(%rsp), %edx
movq 0x30(%rsp), %rcx
movl %ebp, %r8d
callq 0x2b200c
jmp 0x2e804a
movq %r15, %rax
movq %r12, %r15
movq 0x18(%rax), %rsi
xorl %ebx, %ebx
testq %rsi, %rsi
je 0x2e7f30
movq 0x18(%rsp), %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x2d7619
movq %rax, %r12
jmp 0x2e7f33
xorl %r12d, %r12d
movq 0x20(%rsp), %rax
cmpb $0x5e, 0x24(%rax)
jne 0x2e7f56
movq %r14, %rdi
movl $0x35, %esi
movl 0x8(%rsp), %edx
xorl %ecx, %ecx
movl %ebp, %r8d
callq 0x2b200c
movl %eax, %ebx
testq %r12, %r12
je 0x2e7fb1
movl %ebp, 0x28(%rsp)
movq %r15, %rdi
movl 0x10(%rsp), %esi
movl 0x14(%rsp), %ebp
movl %ebp, %edx
callq 0x2e89fc
movq %r14, %rdi
movl $0x56, %esi
movl %ebp, %edx
movl 0xc(%rsp), %ecx
movl 0x2c(%rsp), %r8d
callq 0x2b200c
movq (%r14), %rax
cmpb $0x0, 0x61(%rax)
je 0x2e7fca
cmpq $0x0, 0x2d0(%rax)
jne 0x2e7fe6
decl (%r12)
jne 0x2e7fe6
movq 0x10(%r12), %rdi
movq %r12, %rsi
callq 0x28c3e7
jmp 0x2e7fe6
movq %r14, %rdi
movl $0xb, %esi
xorl %edx, %edx
movq 0x30(%rsp), %rcx
xorl %r8d, %r8d
callq 0x2b200c
jmp 0x2e8008
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)
movl 0x90(%r14), %edx
incl %edx
movq %r14, %rdi
movl $0x10, %esi
movq 0x30(%rsp), %rcx
movl %edx, %r8d
callq 0x2b200c
movl 0x28(%rsp), %ebp
testl %ebx, %ebx
movq %r15, %r12
movq 0x20(%rsp), %r15
je 0x2e804a
movl 0x90(%r14), %eax
movq (%r14), %rcx
cmpb $0x0, 0x61(%rcx)
je 0x2e802d
leaq 0x1e1e5d(%rip), %rcx    # 0x4c9e88
jmp 0x2e8047
leal -0x1(%rax), %ecx
testl %ebx, %ebx
cmovnsl %ebx, %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x3, %rcx
addq 0x88(%r14), %rcx
movl %eax, 0x8(%rcx)
movl 0x20(%r12), %r8d
movq %r12, %rdi
movq %r15, %rsi
movl 0x10(%rsp), %ebx
movl %ebx, %edx
xorl %ecx, %ecx
callq 0x2e8a6f
movq %r14, %rdi
movq 0x30(%rsp), %rsi
callq 0x2c91a7
movq %r14, %rdi
movl $0x5, %esi
movl %ebx, %edx
movq 0x40(%rsp), %rbx
movl %ebx, %ecx
xorl %r8d, %r8d
callq 0x2b200c
movl 0x90(%r14), %eax
movq (%r14), %rcx
cmpb $0x0, 0x61(%rcx)
je 0x2e80a7
movl %eax, 0x1e1df2(%rip)    # 0x4c9e90
leaq 0x1e1de3(%rip), %rcx    # 0x4c9e88
jmp 0x2e80d7
testl %ebx, %ebx
movl %ebx, %ecx
cmovlel %eax, %ecx
movq 0x88(%r14), %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 0x2c(%rsp), %esi
movl %eax, 0x8(%rcx)
testl %ebp, %ebp
movq 0x18(%rsp), %rdx
je 0x2e80fe
movzbl 0x1f(%rdx), %eax
cmpq $0x7, %rax
ja 0x2e80fe
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%rdx)
movl %ebp, 0xd4(%rdx,%rax,4)
cmpl $0x0, 0x8(%rsp)
je 0x2e8120
movzbl 0x1f(%rdx), %eax
cmpq $0x7, %rax
ja 0x2e8120
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%rdx)
movl 0x8(%rsp), %ecx
movl %ecx, 0xd4(%rdx,%rax,4)
testl %esi, %esi
je 0x2e8199
cmpl $0x1, %esi
jne 0x2e814c
cmpl $0x0, 0x14(%rsp)
je 0x2e815e
movzbl 0x1f(%rdx), %eax
cmpq $0x7, %rax
ja 0x2e815e
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%rdx)
leaq (%rdx,%rax,4), %rax
addq $0xd4, %rax
jmp 0x2e8158
cmpl %esi, 0x28(%rdx)
jge 0x2e815e
movl %esi, 0x28(%rdx)
leaq 0x2c(%rdx), %rax
movl 0x14(%rsp), %ecx
movl %ecx, (%rax)
cmpl $0x1, %esi
jne 0x2e8187
cmpl $0x0, 0xc(%rsp)
je 0x2e8199
movzbl 0x1f(%rdx), %eax
cmpq $0x7, %rax
ja 0x2e8199
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%rdx)
leaq (%rdx,%rax,4), %rdx
addq $0xd4, %rdx
jmp 0x2e8193
cmpl %esi, 0x28(%rdx)
jge 0x2e8199
movl %esi, 0x28(%rdx)
addq $0x2c, %rdx
movl 0xc(%rsp), %eax
movl %eax, (%rdx)
movq %r12, %rdi
movl $0x1, %esi
callq 0x2e780e
movq 0x38(%rsp), %rax
movl 0x18(%rax), %ecx
movl 0x1c(%rax), %edx
movq %r14, %rdi
movl $0xc, %esi
xorl %r8d, %r8d
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2b200c