// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: whereScanInit
static WhereTerm *whereScanInit(
  WhereScan *pScan,       /* The WhereScan object being initialized */
  WhereClause *pWC,       /* The WHERE clause to be scanned */
  int iCur,               /* Cursor to scan for */
  int iColumn,            /* Column to scan for */
  u32 opMask,             /* Operator(s) to scan for */
  Index *pIdx             /* Must be compatible with this index */
){
  pScan->pOrigWC = pWC;
  pScan->pWC = pWC;
  pScan->pIdxExpr = 0;
  pScan->idxaff = 0;
  pScan->zCollName = 0;
  pScan->opMask = opMask;
  pScan->k = 0;
  pScan->aiCur[0] = iCur;
  pScan->nEquiv = 1;
  pScan->iEquiv = 1;
  if( pIdx ){
    int j = iColumn;
    iColumn = pIdx->aiColumn[j];
    if( iColumn==XN_EXPR ){
      pScan->pIdxExpr = pIdx->aColExpr->a[j].pExpr;
      pScan->zCollName = pIdx->azColl[j];
      pScan->aiColumn[0] = XN_EXPR;
      return whereScanInitIndexExpr(pScan);
    }else if( iColumn==pIdx->pTable->iPKey ){
      iColumn = XN_ROWID;
    }else if( iColumn>=0 ){
      pScan->idxaff = pIdx->pTable->aCol[iColumn].affinity;
      pScan->zCollName = pIdx->azColl[j];
    }
  }else if( iColumn==XN_EXPR ){
    return 0;
  }
  pScan->aiColumn[0] = iColumn;
  return whereScanNext(pScan);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq %r9, -0x30(%rbp)
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x10(%rbp), %rax
movb $0x0, 0x20(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x10(%rax)
movl -0x24(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x28(%rax)
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x2c(%rax)
movq -0x10(%rbp), %rax
movb $0x1, 0x21(%rax)
movq -0x10(%rbp), %rax
movb $0x1, 0x22(%rax)
cmpq $0x0, -0x30(%rbp)
je 0x4508f5
movl -0x20(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x34(%rbp), %rcx
movswl (%rax,%rcx,2), %eax
movl %eax, -0x20(%rbp)
cmpl $-0x2, -0x20(%rbp)
jne 0x450894
movq -0x30(%rbp), %rax
movq 0x50(%rax), %rax
addq $0x8, %rax
movslq -0x34(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movw $0xfffe, 0x58(%rax)     # imm = 0xFFFE
movq -0x10(%rbp), %rdi
callq 0x450cb0
movq %rax, -0x8(%rbp)
jmp 0x450922
movl -0x20(%rbp), %eax
movq -0x30(%rbp), %rcx
movq 0x18(%rcx), %rcx
movswl 0x44(%rcx), %ecx
cmpl %ecx, %eax
jne 0x4508b0
movl $0xffffffff, -0x20(%rbp) # imm = 0xFFFFFFFF
jmp 0x4508f1
cmpl $0x0, -0x20(%rbp)
jl 0x4508ef
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movslq -0x20(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movb 0x19(%rax), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x20(%rax)
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x4508f1
jmp 0x4508f3
jmp 0x450907
cmpl $-0x2, -0x20(%rbp)
jne 0x450905
movq $0x0, -0x8(%rbp)
jmp 0x450922
jmp 0x450907
movl -0x20(%rbp), %eax
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x58(%rax)
movq -0x10(%rbp), %rdi
callq 0x450930
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)