// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3ExprCacheStore
SQLITE_PRIVATE void sqlite3ExprCacheStore(Parse *pParse, int iTab, int iCol, int iReg){
  int i;
  int minLru;
  int idxLru;
  struct yColCache *p;

  assert( iReg>0 );  /* Register numbers are always positive */
  assert( iCol>=-1 && iCol<32768 );  /* Finite column numbers */

  /* The SQLITE_ColumnCache flag disables the column cache.  This is used
  ** for testing only - to verify that SQLite always gets the same answer
  ** with and without the column cache.
  */
  if( OptimizationDisabled(pParse->db, SQLITE_ColumnCache) ) return;

  /* First replace any existing entry.
  **
  ** Actually, the way the column cache is currently used, we are guaranteed
  ** that the object will never already be in cache.  Verify this guarantee.
  */
#ifndef NDEBUG
  for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
    assert( p->iReg==0 || p->iTable!=iTab || p->iColumn!=iCol );
  }
#endif

  /* Find an empty slot and replace it */
  for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
    if( p->iReg==0 ){
      p->iLevel = pParse->iCacheLevel;
      p->iTable = iTab;
      p->iColumn = iCol;
      p->iReg = iReg;
      p->tempReg = 0;
      p->lru = pParse->iCacheCnt++;
      return;
    }
  }

  /* Replace the last recently used */
  minLru = 0x7fffffff;
  idxLru = -1;
  for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
    if( p->lru<minLru ){
      idxLru = i;
      minLru = p->lru;
    }
  }
  if( ALWAYS(idxLru>=0) ){
    p = &pParse->aColCache[idxLru];
    p->iLevel = pParse->iCacheLevel;
    p->iTable = iTab;
    p->iColumn = iCol;
    p->iReg = iReg;
    p->tempReg = 0;
    p->lru = pParse->iCacheCnt++;
    return;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movzwl 0x4c(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x6a869
jmp 0x6a9b5
movl $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rax
addq $0x74, %rax
movq %rax, -0x28(%rbp)
cmpl $0xa, -0x18(%rbp)
jge 0x6a8f3
movq -0x28(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jne 0x6a8da
movq -0x8(%rbp), %rax
movl 0x6c(%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0xc(%rax)
movl -0xc(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl -0x10(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0x14(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0x8(%rax)
movq -0x8(%rbp), %rax
movl 0x70(%rax), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, 0x70(%rax)
movq -0x28(%rbp), %rax
movl %ecx, 0x14(%rax)
jmp 0x6a9b5
jmp 0x6a8dc
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
movq -0x28(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x28(%rbp)
jmp 0x6a87c
movl $0x7fffffff, -0x1c(%rbp) # imm = 0x7FFFFFFF
movl $0xffffffff, -0x20(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rax
addq $0x74, %rax
movq %rax, -0x28(%rbp)
cmpl $0xa, -0x18(%rbp)
jge 0x6a94f
movq -0x28(%rbp), %rax
movl 0x14(%rax), %eax
cmpl -0x1c(%rbp), %eax
jge 0x6a936
movl -0x18(%rbp), %eax
movl %eax, -0x20(%rbp)
movq -0x28(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x1c(%rbp)
jmp 0x6a938
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
movq -0x28(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x28(%rbp)
jmp 0x6a914
cmpl $0x0, -0x20(%rbp)
jl 0x6a9b5
movq -0x8(%rbp), %rax
addq $0x74, %rax
movslq -0x20(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movl 0x6c(%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0xc(%rax)
movl -0xc(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl -0x10(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0x14(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0x8(%rax)
movq -0x8(%rbp), %rax
movl 0x70(%rax), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, 0x70(%rax)
movq -0x28(%rbp), %rax
movl %ecx, 0x14(%rax)
popq %rbp
retq
nopw (%rax,%rax)