// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x84(%rax)
je 0x457d9f
movq -0x8(%rbp), %rdi
callq 0x458990
jmp 0x4580e1
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x4580df
movq -0x28(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
leaq 0x1529bc(%rip), %rcx    # 0x5aa790
cmpq %rcx, 0x38(%rax)
je 0x457def
movq -0x30(%rbp), %rax
leaq 0x1529b5(%rip), %rcx    # 0x5aa79a
cmpq %rcx, 0x38(%rax)
jne 0x457f14
movq -0x28(%rbp), %rax
movl 0x64(%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rdi
callq 0x42d540
movl %eax, -0x38(%rbp)
movq -0x20(%rbp), %rdi
callq 0x42f190
movl %eax, -0x3c(%rbp)
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x60(%rax), %ecx
movl $0x48, %esi
xorl %edx, %edx
callq 0x410100
movq -0x30(%rbp), %rax
leaq 0x15295d(%rip), %rcx    # 0x5aa790
cmpq %rcx, 0x38(%rax)
jne 0x457e6f
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x58(%rax), %edx
movq -0x28(%rbp), %rax
movl 0x7c(%rax), %ecx
addl $0x1, %ecx
movl -0x3c(%rbp), %r8d
movl $0x59, %esi
callq 0x410130
movq -0x20(%rbp), %rdi
movl -0x3c(%rbp), %esi
movl $0x2, %edx
callq 0x457a20
jmp 0x457e85
movq -0x18(%rbp), %rdi
movl -0x3c(%rbp), %ecx
movl $0x45, %esi
movl $0x1, %edx
callq 0x410100
movq -0x18(%rbp), %rdi
movl -0x3c(%rbp), %edx
movq -0x28(%rbp), %rax
movl 0x68(%rax), %ecx
movl -0x3c(%rbp), %r8d
movl $0x69, %esi
callq 0x410130
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x68(%rax), %edx
addl $0x1, %edx
movl -0x38(%rbp), %ecx
movl -0x3c(%rbp), %r8d
movl $0x36, %esi
callq 0x410130
movq -0x18(%rbp), %rdi
movl -0x34(%rbp), %edx
movl -0x3c(%rbp), %r8d
movl $0x1f, %esi
xorl %ecx, %ecx
callq 0x410130
movq -0x18(%rbp), %rdi
movl -0x34(%rbp), %edx
movq -0x28(%rbp), %rax
movl 0x7c(%rax), %ecx
movq -0x28(%rbp), %rax
movl 0x60(%rax), %r8d
movl $0x59, %esi
callq 0x410130
movq -0x18(%rbp), %rdi
movl -0x38(%rbp), %esi
callq 0x42dc90
movq -0x20(%rbp), %rdi
movl -0x3c(%rbp), %esi
callq 0x42e560
jmp 0x4580cc
movq -0x30(%rbp), %rax
leaq 0x15283b(%rip), %rcx    # 0x5aa75a
cmpq %rcx, 0x38(%rax)
je 0x457f3a
movq -0x30(%rbp), %rax
leaq 0x15282f(%rip), %rcx    # 0x5aa75f
cmpq %rcx, 0x38(%rax)
jne 0x4580ca
movq -0x28(%rbp), %rax
movq 0x70(%rax), %rax
movq 0x20(%rax), %rax
movl (%rax), %eax
movl %eax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movl 0x64(%rax), %eax
movl %eax, -0x44(%rbp)
movq -0x20(%rbp), %rdi
callq 0x42d540
movl %eax, -0x48(%rbp)
movq -0x20(%rbp), %rdi
callq 0x42f190
movl %eax, -0x4c(%rbp)
movq -0x10(%rbp), %rax
movl 0x58(%rax), %eax
movl %eax, -0x50(%rbp)
cmpl $0x3, -0x40(%rbp)
jge 0x457f96
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x60(%rax), %ecx
movl $0x48, %esi
xorl %edx, %edx
callq 0x410100
jmp 0x457fb9
movq -0x18(%rbp), %rdi
movl -0x50(%rbp), %edx
movq -0x28(%rbp), %rax
movl 0x7c(%rax), %ecx
addl $0x2, %ecx
movq -0x28(%rbp), %rax
movl 0x60(%rax), %r8d
movl $0x59, %esi
callq 0x410130
movq -0x18(%rbp), %rdi
movl -0x50(%rbp), %edx
movl -0x4c(%rbp), %ecx
movl $0x7f, %esi
callq 0x410100
cmpl $0x2, -0x40(%rbp)
jge 0x45800b
movq -0x30(%rbp), %rax
movq 0x38(%rax), %rdx
leaq 0x152778(%rip), %rsi    # 0x5aa75a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0x1, %ecx
cmpq %rsi, %rdx
cmovel %ecx, %eax
movl %eax, -0x54(%rbp)
movq -0x18(%rbp), %rdi
movl -0x4c(%rbp), %edx
movl -0x54(%rbp), %ecx
movl $0x52, %esi
callq 0x410100
jmp 0x45807a
movq -0x30(%rbp), %rax
movq 0x38(%rax), %rdx
leaq 0x152740(%rip), %rsi    # 0x5aa75a
movl $0x6a, %eax
movl $0x69, %ecx
cmpq %rsi, %rdx
cmovel %ecx, %eax
movl %eax, -0x58(%rbp)
movq -0x20(%rbp), %rdi
callq 0x42f190
movl %eax, -0x5c(%rbp)
movq -0x18(%rbp), %rdi
movl -0x50(%rbp), %edx
movq -0x28(%rbp), %rax
movl 0x7c(%rax), %ecx
addl $0x1, %ecx
movl -0x5c(%rbp), %r8d
movl $0x59, %esi
callq 0x410130
movq -0x18(%rbp), %rdi
movl -0x58(%rbp), %esi
movl -0x5c(%rbp), %edx
movl -0x4c(%rbp), %ecx
movl -0x4c(%rbp), %r8d
callq 0x410130
movq -0x20(%rbp), %rdi
movl -0x5c(%rbp), %esi
callq 0x42e560
movq -0x18(%rbp), %rdi
movl -0x44(%rbp), %edx
movl -0x48(%rbp), %ecx
movl -0x4c(%rbp), %r8d
movl $0x1f, %esi
callq 0x410130
movq -0x18(%rbp), %rdi
movl -0x44(%rbp), %edx
movq -0x28(%rbp), %rax
movl 0x7c(%rax), %ecx
movq -0x28(%rbp), %rax
movl 0x60(%rax), %r8d
movl $0x59, %esi
callq 0x410130
movq -0x18(%rbp), %rdi
movl -0x48(%rbp), %esi
callq 0x42dc90
movq -0x20(%rbp), %rdi
movl -0x4c(%rbp), %esi
callq 0x42e560
jmp 0x4580cc
jmp 0x4580ce
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x457db2
jmp 0x4580e1
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x1c(%rax), %edx
movq -0x8(%rbp), %rax
movl 0x18(%rax), %ecx
movl $0xc, %esi
callq 0x410100
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)