// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/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[] */
  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( CORRUPT_DB || sz==cellSize(pPage, idx) );
  assert( sqlite3PagerIswriteable(pPage->pDbPage) );
  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  assert( pPage->nFree>=0 );
  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+sz > pPage->pBt->usableSize ){
    *pRC = SQLITE_CORRUPT_BKPT;
    return;
  }
  rc = freeSpace(pPage, pc, sz);
  if( rc ){
    *pRC = rc;
    return;
  }
  pPage->nCell--;
  if( pPage->nCell==0 ){
    memset(&data[hdr+1], 0, 4);
    data[hdr+7] = 0;
    put2byte(&data[hdr+5], pPage->pBt->usableSize);
    pPage->nFree = pPage->pBt->usableSize - pPage->hdrOffset
                       - pPage->childPtrSize - 8;
  }else{
    memmove(ptr, ptr+2, 2*(pPage->nCell - idx));
    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 0x403e24
jmp 0x403fde
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 0x9(%rax), %eax
movl %eax, -0x38(%rbp)
movl -0x1c(%rbp), %eax
addl -0x10(%rbp), %eax
movq -0x8(%rbp), %rcx
movq 0x48(%rcx), %rcx
cmpl 0x38(%rcx), %eax
jbe 0x403e93
movl $0x115f2, %edi          # imm = 0x115F2
callq 0x3dff80
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
jmp 0x403fde
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %eax
movw %ax, %cx
movl -0x10(%rbp), %eax
movzwl %cx, %esi
movzwl %ax, %edx
callq 0x404650
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x403ec2
movl -0x34(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
jmp 0x403fde
movq -0x8(%rbp), %rax
movw 0x18(%rax), %cx
addw $-0x1, %cx
movw %cx, 0x18(%rax)
movq -0x8(%rbp), %rax
movzwl 0x18(%rax), %eax
cmpl $0x0, %eax
jne 0x403f78
movq -0x28(%rbp), %rdi
movl -0x38(%rbp), %eax
addl $0x1, %eax
cltq
addq %rax, %rdi
xorl %esi, %esi
movl $0x4, %edx
callq 0x19360
movq -0x28(%rbp), %rax
movl -0x38(%rbp), %ecx
addl $0x7, %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movl 0x38(%rax), %eax
shrl $0x8, %eax
movb %al, %dl
movq -0x28(%rbp), %rax
movl -0x38(%rbp), %ecx
addl $0x5, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movl 0x38(%rax), %eax
movb %al, %dl
movq -0x28(%rbp), %rax
movl -0x38(%rbp), %ecx
addl $0x5, %ecx
movslq %ecx, %rcx
movb %dl, 0x1(%rax,%rcx)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movl 0x38(%rax), %ecx
movq -0x8(%rbp), %rax
movzbl 0x9(%rax), %eax
subl %eax, %ecx
movq -0x8(%rbp), %rax
movzbl 0xa(%rax), %eax
subl %eax, %ecx
subl $0x8, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x14(%rax)
jmp 0x403fde
movq -0x30(%rbp), %rdi
movq -0x30(%rbp), %rsi
addq $0x2, %rsi
movq -0x8(%rbp), %rax
movzwl 0x18(%rax), %eax
subl -0xc(%rbp), %eax
shll %eax
movslq %eax, %rdx
callq 0x19bf0
movq -0x8(%rbp), %rax
movzwl 0x18(%rax), %eax
sarl $0x8, %eax
movb %al, %dl
movq -0x28(%rbp), %rax
movl -0x38(%rbp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x8(%rbp), %rax
movw 0x18(%rax), %ax
movb %al, %dl
movq -0x28(%rbp), %rax
movl -0x38(%rbp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movb %dl, 0x1(%rax,%rcx)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %ecx
addl $0x2, %ecx
movl %ecx, 0x14(%rax)
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)