// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3WindowAlloc
SQLITE_PRIVATE Window *sqlite3WindowAlloc(
  Parse *pParse,    /* Parsing context */
  int eType,        /* Frame type. TK_RANGE, TK_ROWS, TK_GROUPS, or 0 */
  int eStart,       /* Start type: CURRENT, PRECEDING, FOLLOWING, UNBOUNDED */
  Expr *pStart,     /* Start window size if TK_PRECEDING or FOLLOWING */
  int eEnd,         /* End type: CURRENT, FOLLOWING, TK_UNBOUNDED, PRECEDING */
  Expr *pEnd,       /* End window size if TK_FOLLOWING or PRECEDING */
  u8 eExclude       /* EXCLUDE clause */
){
  Window *pWin = 0;
  int bImplicitFrame = 0;

  /* Parser assures the following: */
  assert( eType==0 || eType==TK_RANGE || eType==TK_ROWS || eType==TK_GROUPS );
  assert( eStart==TK_CURRENT || eStart==TK_PRECEDING
           || eStart==TK_UNBOUNDED || eStart==TK_FOLLOWING );
  assert( eEnd==TK_CURRENT || eEnd==TK_FOLLOWING
           || eEnd==TK_UNBOUNDED || eEnd==TK_PRECEDING );
  assert( (eStart==TK_PRECEDING || eStart==TK_FOLLOWING)==(pStart!=0) );
  assert( (eEnd==TK_FOLLOWING || eEnd==TK_PRECEDING)==(pEnd!=0) );

  if( eType==0 ){
    bImplicitFrame = 1;
    eType = TK_RANGE;
  }

  /* Additionally, the
  ** starting boundary type may not occur earlier in the following list than
  ** the ending boundary type:
  **
  **   UNBOUNDED PRECEDING
  **   <expr> PRECEDING
  **   CURRENT ROW
  **   <expr> FOLLOWING
  **   UNBOUNDED FOLLOWING
  **
  ** The parser ensures that "UNBOUNDED PRECEDING" cannot be used as an ending
  ** boundary, and than "UNBOUNDED FOLLOWING" cannot be used as a starting
  ** frame boundary.
  */
  if( (eStart==TK_CURRENT && eEnd==TK_PRECEDING)
   || (eStart==TK_FOLLOWING && (eEnd==TK_PRECEDING || eEnd==TK_CURRENT))
  ){
    sqlite3ErrorMsg(pParse, "unsupported frame specification");
    goto windowAllocErr;
  }

  pWin = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
  if( pWin==0 ) goto windowAllocErr;
  pWin->eFrmType = eType;
  pWin->eStart = eStart;
  pWin->eEnd = eEnd;
  if( eExclude==0 && OptimizationDisabled(pParse->db, SQLITE_WindowFunc) ){
    eExclude = TK_NO;
  }
  pWin->eExclude = eExclude;
  pWin->bImplicitFrame = bImplicitFrame;
  pWin->pEnd = sqlite3WindowOffsetExpr(pParse, pEnd);
  pWin->pStart = sqlite3WindowOffsetExpr(pParse, pStart);
  return pWin;

windowAllocErr:
  sqlite3ExprDelete(pParse->db, pEnd);
  sqlite3ExprDelete(pParse->db, pStart);
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movb 0x10(%rbp), %al
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq %r9, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x429814
movl $0x1, -0x3c(%rbp)
movl $0x59, -0x14(%rbp)
cmpl $0x55, -0x18(%rbp)
jne 0x429820
cmpl $0x58, -0x24(%rbp)
je 0x429832
cmpl $0x56, -0x18(%rbp)
jne 0x429849
cmpl $0x58, -0x24(%rbp)
je 0x429832
cmpl $0x55, -0x24(%rbp)
jne 0x429849
movq -0x10(%rbp), %rdi
leaq 0x185b86(%rip), %rsi    # 0x5af3c3
movb $0x0, %al
callq 0x3cb660
jmp 0x4298fe
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl $0x90, %esi
callq 0x3c9520
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x42986a
jmp 0x4298fe
movl -0x14(%rbp), %eax
movb %al, %cl
movq -0x38(%rbp), %rax
movb %cl, 0x20(%rax)
movl -0x18(%rbp), %eax
movb %al, %cl
movq -0x38(%rbp), %rax
movb %cl, 0x21(%rax)
movl -0x24(%rbp), %eax
movb %al, %cl
movq -0x38(%rbp), %rax
movb %cl, 0x22(%rax)
movzbl 0x10(%rbp), %eax
cmpl $0x0, %eax
jne 0x4298ae
movq -0x10(%rbp), %rax
movq (%rax), %rax
movzwl 0x5c(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x4298ae
movb $0x42, 0x10(%rbp)
movb 0x10(%rbp), %cl
movq -0x38(%rbp), %rax
movb %cl, 0x24(%rax)
movl -0x3c(%rbp), %eax
movb %al, %cl
movq -0x38(%rbp), %rax
movb %cl, 0x23(%rax)
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x465b00
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x465b00
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x429926
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x30(%rbp), %rsi
callq 0x40c670
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x40c670
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq