// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: dropCell
static void dropCell(MemPage *pPage, int idx, int sz, int *pRC){
  u32 pc;         /* Offset to cell content of cell being deleted */
  u8 *data;       /* pPage->aData */
  u8 *ptr;        /* Used to move bytes around within data[] */
  u8 *endPtr;     /* End of loop */
  int rc;         /* The return code */
  int hdr;        /* Beginning of the header.  0 most pages.  100 page 1 */

  if( *pRC ) return;

  assert( idx>=0 && idx<pPage->nCell );
  assert( sz==cellSize(pPage, idx) );
  assert( sqlite3PagerIswriteable(pPage->pDbPage) );
  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  data = pPage->aData;
  ptr = &pPage->aCellIdx[2*idx];
  pc = get2byte(ptr);
  hdr = pPage->hdrOffset;
  testcase( pc==get2byte(&data[hdr+5]) );
  testcase( pc+sz==pPage->pBt->usableSize );
  if( pc < (u32)get2byte(&data[hdr+5]) || pc+sz > pPage->pBt->usableSize ){
    *pRC = SQLITE_CORRUPT_BKPT;
    return;
  }
  rc = freeSpace(pPage, pc, sz);
  if( rc ){
    *pRC = rc;
    return;
  }
  endPtr = &pPage->aCellIdx[2*pPage->nCell - 2];
  assert( (SQLITE_PTR_TO_INT(ptr)&1)==0 );  /* ptr is always 2-byte aligned */
  while( ptr<endPtr ){
    *(u16*)ptr = *(u16*)&ptr[2];
    ptr += 2;
  }
  pPage->nCell--;
  put2byte(&data[hdr+3], pPage->nCell);
  pPage->nFree += 2;
}

// Assembly:
cmpl $0x0, (%rcx)
je 0x2c3fa
retq
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r14
movq %rdi, %r15
movq 0x50(%rdi), %rdi
movq 0x60(%r15), %r12
movslq %esi, %r13
movzbl (%r12,%r13,2), %r8d
movl %r8d, %ebx
shll $0x8, %ebx
movzbl 0x1(%r12,%r13,2), %r9d
orq %r9, %rbx
movb 0x5(%r15), %cl
movzbl %cl, %eax
movq %rax, -0x50(%rbp)
movzwl 0x5(%rdi,%rax), %eax
rolw $0x8, %ax
movzwl %ax, %eax
cmpl %eax, %ebx
jb 0x2c461
movq %rdx, -0x38(%rbp)
movq -0x38(%rbp), %rax
leal (%rbx,%rax), %edx
movq 0x48(%r15), %rax
movl 0x34(%rax), %esi
cmpl %esi, %edx
jbe 0x2c481
movl $0xd7d6, %edi           # imm = 0xD7D6
callq 0x1a1fc
movl $0xb, (%r14)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r9, -0x48(%rbp)
movl %r8d, -0x3c(%rbp)
testb $0x4, 0x26(%rax)
movq %rdi, -0x30(%rbp)
je 0x2c4b3
movl %ebx, %edi
addq -0x30(%rbp), %rdi
movslq -0x38(%rbp), %rdx
xorl %esi, %esi
callq 0x81e0
movq -0x30(%rbp), %rdi
movq 0x48(%r15), %rax
movb 0x5(%r15), %cl
movl 0x34(%rax), %esi
leaq (%r12,%r13,2), %rax
movzbl %cl, %r13d
leaq 0x1(%r13), %r12
addl $-0x4, %esi
movl %r12d, %r10d
movl %r10d, %r8d
movzbl (%rdi,%r8), %r9d
movl %r9d, %r10d
shll $0x8, %r10d
movzbl 0x1(%rdi,%r8), %r11d
orl %r11d, %r10d
cmpl %ebx, %r10d
jae 0x2c4fa
testl %r10d, %r10d
je 0x2c4fa
addl $0x4, %r8d
cmpl %r8d, %r10d
jae 0x2c4c5
movl $0xc6d3, %edi           # imm = 0xC6D3
jmp 0x2c466
movq %rdi, %rdx
movl $0xc6d8, %edi           # imm = 0xC6D8
cmpl %esi, %r10d
jg 0x2c466
movl -0x3c(%rbp), %esi
movb %sil, (%rdx,%r8)
movq -0x48(%rbp), %rsi
movb %sil, 0x1(%rdx,%r8)
movb %r9b, (%rdx,%rbx)
movb %r11b, 0x1(%rdx,%rbx)
movq -0x38(%rbp), %rsi
movq %rsi, %rcx
movb %ch, 0x2(%rdx,%rbx)
movb %sil, 0x3(%rdx,%rbx)
addw %si, 0xe(%r15)
movl %r12d, %r8d
movq %rdx, %r10
movq -0x30(%rbp), %rbx
movl %r8d, %esi
movzwl (%r10,%rsi), %edi
rolw $0x8, %di
testw %di, %di
je 0x2c5f2
movzwl %di, %r8d
movzwl (%r10,%r8), %edi
movzwl 0x2(%r10,%r8), %r10d
rolw $0x8, %di
movzwl %di, %r9d
rolw $0x8, %r10w
movzwl %r10w, %edi
leal (%rdi,%r8), %r10d
addl $0x3, %r10d
addl %r8d, %edi
leal -0x1(%r9), %r11d
cmpl %r10d, %r11d
jae 0x2c5e9
movl %r9d, %r10d
subl %edi, %r10d
movl $0xc6eb, %edi           # imm = 0xC6EB
js 0x2c466
movzbl 0x7(%rbx,%r13), %r11d
cmpl %r11d, %r10d
ja 0x2c466
subb %r10b, %r11b
movb %r11b, 0x7(%rbx,%r13)
movzwl (%rbx,%r9), %edi
movw %di, (%rbx,%r8)
movzbl 0x2(%rbx,%r9), %edi
shll $0x8, %edi
movzbl 0x3(%rbx,%r9), %r10d
orl %edi, %r10d
subl %r8d, %r9d
addl %r10d, %r9d
rolw $0x8, %r9w
movw %r9w, 0x2(%rbx,%r8)
movq %rbx, %r10
jmp 0x2c546
movq -0x30(%rbp), %r10
jmp 0x2c543
movzbl (%r10,%r12), %edi
cmpb 0x5(%r10,%r13), %dil
jne 0x2c63b
movzbl 0x2(%r10,%r13), %esi
cmpb 0x6(%r10,%r13), %sil
jne 0x2c63b
shll $0x8, %edi
leaq (%rdi,%rsi), %r8
movzwl (%r10,%r8), %r9d
movw %r9w, (%r10,%r12)
orl %edi, %esi
movzbl 0x2(%r10,%r8), %edx
shll $0x8, %edx
movzbl 0x3(%r10,%r8), %edi
orl %edx, %edi
addl %esi, %edi
rolw $0x8, %di
movw %di, 0x5(%r10,%r13)
movq 0x60(%r15), %rcx
movzwl 0x10(%r15), %edx
leaq (%rcx,%rdx,2), %rcx
addq $-0x2, %rcx
movq %r10, %rsi
cmpq %rcx, %rax
jae 0x2c661
movzwl 0x2(%rax), %edx
movw %dx, (%rax)
addq $0x2, %rax
jmp 0x2c64f
movl 0x10(%r15), %eax
decl %eax
movw %ax, 0x10(%r15)
movq -0x50(%rbp), %rcx
movb %ah, 0x3(%rsi,%rcx)
movb 0x10(%r15), %al
movb %al, 0x4(%rsi,%rcx)
addw $0x2, 0xe(%r15)
jmp 0x2c472