// File: /workspace/github_c_makefile_star2_O1/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 0x309cb
retq
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, -0x48(%rbp)
movq 0x50(%rdi), %r15
movq 0x60(%rdi), %r13
movslq %esi, %r12
movzbl (%r13,%r12,2), %r8d
movl %r8d, %ebx
shll $0x8, %ebx
movzbl 0x1(%r13,%r12,2), %r14d
orq %r14, %rbx
movzbl 0x5(%rdi), %eax
movq %rax, -0x50(%rbp)
movzwl 0x5(%r15,%rax), %eax
rolw $0x8, %ax
movzwl %ax, %eax
cmpl %eax, %ebx
jb 0x30a25
leal (%rbx,%rdx), %ecx
movq 0x48(%rdi), %rax
cmpl 0x34(%rax), %ecx
jbe 0x30a5d
leaq 0x48de8(%rip), %rsi     # 0x79814
leaq 0x48b06(%rip), %rcx     # 0x79539
movl $0xb, %edi
movl $0xd7d6, %edx           # imm = 0xD7D6
xorl %eax, %eax
callq 0xb8cc
movq -0x48(%rbp), %rax
movl $0xb, (%rax)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdx, -0x40(%rbp)
testb $0x4, 0x26(%rax)
movq %rdi, -0x38(%rbp)
je 0x30a87
movl %ebx, %edi
addq %r15, %rdi
movslq -0x40(%rbp), %rdx
xorl %esi, %esi
movl %r8d, -0x30(%rbp)
callq 0x8200
movl -0x30(%rbp), %r8d
movq -0x38(%rbp), %rdi
leaq (%r13,%r12,2), %r13
movzbl 0x5(%rdi), %r12d
leaq 0x1(%r12), %rdx
movq 0x48(%rdi), %rax
movl 0x34(%rax), %eax
addl $-0x4, %eax
movq %rdx, -0x30(%rbp)
movl %edx, %ecx
movzbl (%r15,%rcx), %esi
movl %esi, %edx
shll $0x8, %edx
movzbl 0x1(%r15,%rcx), %edi
orl %edi, %edx
cmpl %ebx, %edx
jae 0x30ae9
testl %edx, %edx
je 0x30ae9
addl $0x4, %ecx
cmpl %ecx, %edx
jge 0x30aa4
leaq 0x48d46(%rip), %rsi     # 0x79814
leaq 0x48a64(%rip), %rcx     # 0x79539
xorl %r14d, %r14d
movl $0xb, %ebx
movl $0xb, %edi
movl $0xc6d3, %edx           # imm = 0xC6D3
jmp 0x30b11
cmpl %eax, %edx
jle 0x30b80
leaq 0x48d1c(%rip), %rsi     # 0x79814
leaq 0x48a3a(%rip), %rcx     # 0x79539
xorl %r14d, %r14d
movl $0xb, %ebx
movl $0xb, %edi
movl $0xc6d8, %edx           # imm = 0xC6D8
xorl %eax, %eax
callq 0xb8cc
movq %r15, %rdi
testb %r14b, %r14b
je 0x30b75
movq -0x38(%rbp), %rcx
movq 0x60(%rcx), %rax
movzwl 0x10(%rcx), %ecx
leaq (%rax,%rcx,2), %rax
addq $-0x2, %rax
cmpq %rax, %r13
jae 0x30b4f
movzwl 0x2(%r13), %ecx
movw %cx, (%r13)
leaq 0x2(%r13), %rcx
movq %rcx, %r13
cmpq %rax, %rcx
jb 0x30b39
movq -0x38(%rbp), %rcx
movl 0x10(%rcx), %eax
decl %eax
movw %ax, 0x10(%rcx)
movq -0x50(%rbp), %rdx
movb %ah, 0x3(%rdi,%rdx)
movb 0x10(%rcx), %al
movb %al, 0x4(%rdi,%rdx)
addw $0x2, 0xe(%rcx)
jmp 0x30a4e
movq -0x48(%rbp), %rax
movl %ebx, (%rax)
jmp 0x30a4e
movb %r8b, (%r15,%rcx)
movb %r14b, 0x1(%r15,%rcx)
movb %sil, (%r15,%rbx)
movb %dil, 0x1(%r15,%rbx)
movq %r15, %rdi
movq -0x40(%rbp), %rcx
movb %ch, 0x2(%rdi,%rbx)
movb %cl, 0x3(%r15,%rbx)
movq -0x38(%rbp), %rax
addw %cx, 0xe(%rax)
movq -0x30(%rbp), %rax
movl %eax, %ebx
movl %ebx, %eax
movzwl (%rdi,%rax), %eax
rolw $0x8, %ax
testw %ax, %ax
je 0x30c68
movzwl %ax, %eax
movzwl (%rdi,%rax), %ecx
movzwl 0x2(%rdi,%rax), %edx
rolw $0x8, %cx
movzwl %cx, %ecx
rolw $0x8, %dx
movzwl %dx, %esi
leal (%rsi,%rax), %edx
addl $0x3, %edx
leal -0x1(%rcx), %edi
movb $0x1, %r14b
cmpl %edx, %edi
jae 0x30c23
addl %eax, %esi
movl %ecx, %edx
subl %esi, %edx
js 0x30bff
movzbl 0x7(%r15,%r12), %esi
cmpl %esi, %edx
jle 0x30c32
xorl %r14d, %r14d
movl $0xb, %edi
leaq 0x48c06(%rip), %rsi     # 0x79814
movl $0xc6eb, %edx           # imm = 0xC6EB
leaq 0x4891f(%rip), %rcx     # 0x79539
xorl %eax, %eax
callq 0xb8cc
jmp 0x30c25
movl %eax, %ebx
movq %r15, %rdi
testb %r14b, %r14b
jne 0x30bb0
jmp 0x30cd2
subb %dl, %sil
movq %r15, %rdi
movb %sil, 0x7(%r15,%r12)
movzwl (%r15,%rcx), %edx
movw %dx, (%r15,%rax)
movzbl 0x2(%r15,%rcx), %edx
shll $0x8, %edx
movzbl 0x3(%r15,%rcx), %esi
orl %edx, %esi
subl %eax, %ecx
addl %esi, %ecx
rolw $0x8, %cx
movw %cx, 0x2(%r15,%rax)
jmp 0x30c28
movq -0x30(%rbp), %rax
movzbl (%rdi,%rax), %ecx
movzbl 0x5(%rdi,%r12), %eax
xorl %ebx, %ebx
movb $0x1, %r14b
cmpb %al, %cl
jne 0x30b1b
movzbl 0x6(%rdi,%r12), %edx
cmpb %dl, 0x2(%rdi,%r12)
jne 0x30b1b
shll $0x8, %ecx
movq -0x30(%rbp), %r8
movzbl 0x1(%rdi,%r8), %esi
orq %rcx, %rsi
movzwl (%rdi,%rsi), %ecx
movw %cx, (%rdi,%r8)
shll $0x8, %eax
orl %edx, %eax
movzbl 0x2(%rdi,%rsi), %ecx
shll $0x8, %ecx
movzbl 0x3(%rdi,%rsi), %edx
orl %ecx, %edx
addl %eax, %edx
rolw $0x8, %dx
movw %dx, 0x5(%rdi,%r12)
jmp 0x30b1b
movl $0xb, %ebx
xorl %r14d, %r14d
jmp 0x30b1b