// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3ExprCollSeq
SQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, const Expr *pExpr){
  sqlite3 *db = pParse->db;
  CollSeq *pColl = 0;
  const Expr *p = pExpr;
  while( p ){
    int op = p->op;
    if( op==TK_REGISTER ) op = p->op2;
    if( (op==TK_AGG_COLUMN || op==TK_COLUMN || op==TK_TRIGGER)
     && p->y.pTab!=0
    ){
      /* op==TK_REGISTER && p->y.pTab!=0 happens when pExpr was originally
      ** a TK_COLUMN but was previously evaluated and cached in a register */
      int j = p->iColumn;
      if( j>=0 ){
        const char *zColl = p->y.pTab->aCol[j].zColl;
        pColl = sqlite3FindCollSeq(db, ENC(db), zColl, 0);
      }
      break;
    }
    if( op==TK_CAST || op==TK_UPLUS ){
      p = p->pLeft;
      continue;
    }
    if( op==TK_VECTOR ){
      p = p->x.pList->a[0].pExpr;
      continue;
    }
    if( op==TK_COLLATE ){
      pColl = sqlite3GetCollSeq(pParse, ENC(db), 0, p->u.zToken);
      break;
    }
    if( p->flags & EP_Collate ){
      if( p->pLeft && (p->pLeft->flags & EP_Collate)!=0 ){
        p = p->pLeft;
      }else{
        Expr *pNext  = p->pRight;
        /* The Expr.x union is never used at the same time as Expr.pRight */
        assert( p->x.pList==0 || p->pRight==0 );
        if( p->x.pList!=0
         && !db->mallocFailed
         && ALWAYS(!ExprHasProperty(p, EP_xIsSelect))
        ){
          int i;
          for(i=0; ALWAYS(i<p->x.pList->nExpr); i++){
            if( ExprHasProperty(p->x.pList->a[i].pExpr, EP_Collate) ){
              pNext = p->x.pList->a[i].pExpr;
              break;
            }
          }
        }
        p = pNext;
      }
    }else{
      break;
    }
  }
  if( sqlite3CheckCollSeq(pParse, pColl) ){
    pColl = 0;
  }
  return pColl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x4126ec
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x2c(%rbp)
cmpl $0xad, -0x2c(%rbp)
jne 0x412514
movq -0x28(%rbp), %rax
movzbl 0x2(%rax), %eax
movl %eax, -0x2c(%rbp)
cmpl $0xa6, -0x2c(%rbp)
je 0x41252c
cmpl $0xa4, -0x2c(%rbp)
je 0x41252c
cmpl $0x4d, -0x2c(%rbp)
jne 0x412589
movq -0x28(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x412589
movq -0x28(%rbp), %rax
movswl 0x30(%rax), %eax
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
jl 0x412584
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movslq -0x30(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rax
movb 0x5e(%rax), %al
movq -0x38(%rbp), %rdx
xorl %ecx, %ecx
movzbl %al, %esi
callq 0x40abd0
movq %rax, -0x20(%rbp)
jmp 0x4126ec
cmpl $0x24, -0x2c(%rbp)
je 0x412598
cmpl $0xab, -0x2c(%rbp)
jne 0x4125a9
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x4124eb
cmpl $0xae, -0x2c(%rbp)
jne 0x4125c7
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x4124eb
cmpl $0x6f, -0x2c(%rbp)
jne 0x4125f3
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movb 0x5e(%rax), %al
movq -0x28(%rbp), %rcx
movq 0x8(%rcx), %rcx
xorl %edx, %edx
movzbl %al, %esi
callq 0x412710
movq %rax, -0x20(%rbp)
jmp 0x4126ec
movq -0x28(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x4126e5
movq -0x28(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x412639
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x4(%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x412639
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x4126e3
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x4126db
movq -0x18(%rbp), %rax
cmpb $0x0, 0x61(%rax)
jne 0x4126db
movq -0x28(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x4126db
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x28(%rbp), %rcx
movq 0x20(%rcx), %rcx
cmpl (%rcx), %eax
jge 0x4126d9
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
addq $0x8, %rax
movslq -0x44(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl 0x4(%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x4126cc
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
addq $0x8, %rax
movslq -0x44(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x4126d9
jmp 0x4126ce
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x412676
jmp 0x4126db
movq -0x40(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x4126e7
jmp 0x4126ec
jmp 0x4124eb
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x412800
cmpl $0x0, %eax
je 0x412706
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq