// File: /workspace/github_c_makefile_star2_O3/ukontainer[P]sqlite-bench/sqlite3.c
// Function: sqlite3WindowAlloc
SQLITE_PRIVATE Window *sqlite3WindowAlloc(
  Parse *pParse,    /* Parsing context */
  int eType,        /* Frame type. TK_RANGE or TK_ROWS */
  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 */
){
  Window *pWin = 0;

  /* Parser assures the following: */
  assert( eType==TK_RANGE || eType==TK_ROWS );
  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 a frame is declared "RANGE" (not "ROWS"), then it may not use
  ** either "<expr> PRECEDING" or "<expr> FOLLOWING".
  */
  if( eType==TK_RANGE && (pStart!=0 || pEnd!=0) ){
    sqlite3ErrorMsg(pParse, "RANGE must use only UNBOUNDED or CURRENT ROW");
    goto windowAllocErr;
  }

  /* 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 delimiter for ROWS");
    goto windowAllocErr;
  }

  pWin = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
  if( pWin==0 ) goto windowAllocErr;
  pWin->eType = eType;
  pWin->eStart = eStart;
  pWin->eEnd = eEnd;
  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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r15
movl %r8d, %ebp
movl %edx, %r12d
movl %esi, %r13d
movq %rdi, %r14
cmpl $0x56, %esi
movq %rcx, (%rsp)
jne 0x44db3e
movq %rcx, %rax
orq %r15, %rax
je 0x44db3e
leaq 0x106c25(%rip), %rsi    # 0x554761
jmp 0x44db54
movl %r12d, %eax
xorl $0x52, %eax
movl %ebp, %ecx
xorl $0x55, %ecx
leaq 0x106c3e(%rip), %rsi    # 0x55478e
orl %eax, %ecx
jne 0x44db93
movq %r14, %rdi
xorl %eax, %eax
callq 0x40e48a
testq %r15, %r15
je 0x44db6e
movq (%r14), %rdi
movq %r15, %rsi
callq 0x4381eb
movq (%rsp), %rsi
testq %rsi, %rsi
je 0x44db7f
movq (%r14), %rdi
callq 0x4381eb
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x53, %r12d
jne 0x44dba3
cmpl $0x52, %ebp
je 0x44db54
cmpl $0x55, %ebp
je 0x44db54
movq (%r14), %rdi
movl $0x70, %esi
callq 0x40c786
testq %rax, %rax
je 0x44db5e
movq %rax, %rbx
movb %r13b, 0x18(%rax)
movb %r12b, 0x19(%rax)
movb %bpl, 0x1a(%rax)
movq %r14, %rdi
movq %r15, %rsi
callq 0x4763e4
movq %rax, 0x28(%rbx)
movq %r14, %rdi
movq (%rsp), %rsi
callq 0x4763e4
movq %rax, 0x20(%rbx)
jmp 0x44db81