// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x41fa4
jmp 0x42105
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rax
movl -0xc(%rbp), %ecx
shll %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
shll $0x8, %eax
movq -0x30(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
orl %ecx, %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movzbl 0x5(%rax), %eax
movl %eax, -0x40(%rbp)
movl -0x1c(%rbp), %eax
movq -0x28(%rbp), %rcx
movl -0x40(%rbp), %edx
addl $0x5, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
shll $0x8, %ecx
movq -0x28(%rbp), %rdx
movl -0x40(%rbp), %esi
addl $0x5, %esi
movslq %esi, %rsi
movzbl 0x1(%rdx,%rsi), %edx
orl %edx, %ecx
cmpl %ecx, %eax
jb 0x4202b
movl -0x1c(%rbp), %eax
addl -0x10(%rbp), %eax
movq -0x8(%rbp), %rcx
movq 0x48(%rcx), %rcx
cmpl 0x34(%rcx), %eax
jbe 0x42042
movl $0xd7d6, %edi           # imm = 0xD7D6
callq 0x24410
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
jmp 0x42105
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl -0x10(%rbp), %edx
callq 0x42a40
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x42068
movl -0x3c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
jmp 0x42105
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x8(%rbp), %rcx
movzwl 0x10(%rcx), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x420ae
movq -0x30(%rbp), %rax
movw 0x2(%rax), %cx
movq -0x30(%rbp), %rax
movw %cx, (%rax)
movq -0x30(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x30(%rbp)
jmp 0x42087
movq -0x8(%rbp), %rax
movw 0x10(%rax), %cx
addw $-0x1, %cx
movw %cx, 0x10(%rax)
movq -0x8(%rbp), %rax
movzwl 0x10(%rax), %eax
sarl $0x8, %eax
movb %al, %dl
movq -0x28(%rbp), %rax
movl -0x40(%rbp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x8(%rbp), %rax
movw 0x10(%rax), %ax
movb %al, %dl
movq -0x28(%rbp), %rax
movl -0x40(%rbp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movb %dl, 0x1(%rax,%rcx)
movq -0x8(%rbp), %rax
movzwl 0xe(%rax), %ecx
addl $0x2, %ecx
movw %cx, 0xe(%rax)
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)