// File: /workspace/github_c_makefile_star2_O3/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 0x3126d
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 %rdx, -0x40(%rbp)
movq 0x50(%rdi), %rdx
movq 0x60(%rdi), %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(%rdi), %cl
movzbl %cl, %esi
movzwl 0x5(%rdx,%rsi), %eax
rolw $0x8, %ax
movzwl %ax, %eax
cmpl %eax, %ebx
jb 0x312d7
movq %rdx, -0x30(%rbp)
movq -0x40(%rbp), %rax
leal (%rbx,%rax), %edx
movq 0x48(%r15), %rax
movl 0x34(%rax), %edi
cmpl %edi, %edx
movq -0x30(%rbp), %rdx
jbe 0x312f4
leaq 0x48536(%rip), %rsi     # 0x79814
leaq 0x48254(%rip), %rcx     # 0x79539
movl $0xb, %edi
movl $0xd7d6, %edx           # imm = 0xD7D6
jmp 0x31388
movq %r9, -0x50(%rbp)
movl %r8d, -0x44(%rbp)
testb $0x4, 0x26(%rax)
movq %rsi, -0x38(%rbp)
je 0x31325
movl %ebx, %edi
addq %rdx, %rdi
movslq -0x40(%rbp), %rdx
xorl %esi, %esi
callq 0x8200
movq -0x30(%rbp), %rdx
movq 0x48(%r15), %rax
movb 0x5(%r15), %cl
movl 0x34(%rax), %edi
leaq (%r12,%r13,2), %rax
movzbl %cl, %ecx
leaq 0x1(%rcx), %r13
addl $-0x4, %edi
movl %r13d, %r10d
movl %r10d, %r8d
movzbl (%rdx,%r8), %r9d
movl %r9d, %r10d
shll $0x8, %r10d
movzbl 0x1(%rdx,%r8), %r11d
orl %r11d, %r10d
cmpl %ebx, %r10d
jae 0x31368
testl %r10d, %r10d
je 0x31368
addl $0x4, %r8d
cmpl %r8d, %r10d
jae 0x31336
movl $0xc6d3, %edx           # imm = 0xC6D3
jmp 0x31375
movq %rdx, %rsi
movl $0xc6d8, %edx           # imm = 0xC6D8
cmpl %edi, %r10d
jle 0x313a5
leaq 0x48498(%rip), %rsi     # 0x79814
leaq 0x481b6(%rip), %rcx     # 0x79539
movl $0xb, %edi
xorl %eax, %eax
callq 0xb9c7
movl $0xb, (%r14)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl -0x44(%rbp), %edx
movb %dl, (%rsi,%r8)
movq -0x50(%rbp), %rdx
movb %dl, 0x1(%rsi,%r8)
movb %r9b, (%rsi,%rbx)
movb %r11b, 0x1(%rsi,%rbx)
movq -0x40(%rbp), %rdx
movb %dh, 0x2(%rsi,%rbx)
movb %dl, 0x3(%rsi,%rbx)
addw %dx, 0xe(%r15)
movzbl (%rsi,%r13), %edx
movl %edx, %edi
shll $0x8, %edi
movzbl 0x1(%rsi,%r13), %r9d
orl %edi, %r9d
je 0x314af
movl %r13d, %edi
movq -0x30(%rbp), %rsi
movl %r9d, %r10d
movzbl (%rsi,%r10), %r8d
shll $0x8, %r8d
movzbl 0x1(%rsi,%r10), %edx
movzwl 0x2(%rsi,%r10), %r11d
rolw $0x8, %r11w
movzwl %r11w, %ebx
leal (%rbx,%r9), %r11d
addl $0x3, %r11d
leal (%r8,%rdx), %r12d
decl %r12d
cmpl %r11d, %r12d
jae 0x31496
orl %edx, %r8d
addl %r9d, %ebx
movl %r8d, %r11d
subl %ebx, %r11d
movl $0xc6eb, %edx           # imm = 0xC6EB
js 0x31375
movq -0x30(%rbp), %r12
movzbl 0x7(%r12,%rcx), %ebx
cmpl %ebx, %r11d
ja 0x31375
subb %r11b, %bl
movb %bl, 0x7(%r12,%rcx)
movzwl (%r12,%r8), %edx
movw %dx, (%r12,%r10)
movzbl 0x2(%r12,%r8), %edx
shll $0x8, %edx
movzbl 0x3(%r12,%r8), %r11d
orl %edx, %r11d
subl %r9d, %r8d
addl %r11d, %r8d
rolw $0x8, %r8w
movw %r8w, 0x2(%r12,%r10)
movl %edi, %edx
movzbl (%r12,%rdx), %r8d
movzbl 0x1(%r12,%rdx), %edx
shll $0x8, %r8d
jmp 0x31499
movl %r9d, %edi
orl %r8d, %edx
movl %edx, %r9d
jne 0x313ef
movq -0x30(%rbp), %r10
movb (%r10,%r13), %dl
jmp 0x314b3
movq -0x30(%rbp), %r10
movq -0x38(%rbp), %rsi
cmpb 0x5(%r10,%rcx), %dl
jne 0x31502
movzbl 0x2(%r10,%rcx), %edi
cmpb 0x6(%r10,%rcx), %dil
jne 0x31502
movzbl %dl, %edx
shll $0x8, %edx
leaq (%rdx,%rdi), %r8
movzwl (%r10,%r8), %r9d
movw %r9w, (%r10,%r13)
orl %edx, %edi
movzbl 0x2(%r10,%r8), %edx
shll $0x8, %edx
movzbl 0x3(%r10,%r8), %esi
orl %edx, %esi
addl %edi, %esi
rolw $0x8, %si
movw %si, 0x5(%r10,%rcx)
movq -0x38(%rbp), %rsi
movq 0x60(%r15), %rcx
movzwl 0x10(%r15), %edx
leaq (%rcx,%rdx,2), %rcx
addq $-0x2, %rcx
cmpq %rcx, %rax
jae 0x31530
movzwl 0x2(%rax), %edx
movw %dx, (%rax)
leaq 0x2(%rax), %rdx
movq %rdx, %rax
cmpq %rcx, %rdx
jb 0x31518
movzwl 0x10(%r15), %edx
decl %edx
movw %dx, 0x10(%r15)
movq -0x30(%rbp), %rcx
movb %dh, 0x3(%rcx,%rsi)
movb 0x10(%r15), %al
movb %al, 0x4(%rcx,%rsi)
addw $0x2, 0xe(%r15)
jmp 0x31396