// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: pageFreeArray
static int pageFreeArray(
  MemPage *pPg,                   /* Page to edit */
  int iFirst,                     /* First cell to delete */
  int nCell,                      /* Cells to delete */
  CellArray *pCArray              /* Array of cells */
){
  u8 * const aData = pPg->aData;
  u8 * const pEnd = &aData[pPg->pBt->usableSize];
  u8 * const pStart = &aData[pPg->hdrOffset + 8 + pPg->childPtrSize];
  int nRet = 0;
  int i;
  int iEnd = iFirst + nCell;
  u8 *pFree = 0;
  int szFree = 0;

  for(i=iFirst; i<iEnd; i++){
    u8 *pCell = pCArray->apCell[i];
    if( SQLITE_WITHIN(pCell, pStart, pEnd) ){
      int sz;
      /* No need to use cachedCellSize() here.  The sizes of all cells that
      ** are to be freed have already been computing while deciding which
      ** cells need freeing */
      sz = pCArray->szCell[i];  assert( sz>0 );
      if( pFree!=(pCell + sz) ){
        if( pFree ){
          assert( pFree>aData && (pFree - aData)<65536 );
          freeSpace(pPg, (u16)(pFree - aData), szFree);
        }
        pFree = pCell;
        szFree = sz;
        if( pFree+sz>pEnd ) return 0;
      }else{
        pFree = pCell;
        szFree += sz;
      }
      nRet++;
    }
  }
  if( pFree ){
    assert( pFree>aData && (pFree - aData)<65536 );
    freeSpace(pPg, (u16)(pFree - aData), szFree);
  }
  return nRet;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x48(%rcx), %rcx
movl 0x38(%rcx), %ecx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
movzbl 0x9(%rcx), %ecx
addl $0x8, %ecx
movq -0x10(%rbp), %rdx
movzbl 0xa(%rdx), %edx
addl %edx, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x14(%rbp), %eax
addl -0x18(%rbp), %eax
movl %eax, -0x44(%rbp)
movq $0x0, -0x50(%rbp)
movl $0x0, -0x54(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x44(%rbp), %eax
jge 0x408064
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq -0x38(%rbp), %rcx
cmpq %rcx, %rax
jb 0x408054
movq -0x60(%rbp), %rax
movq -0x30(%rbp), %rcx
cmpq %rcx, %rax
jae 0x408054
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x40(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
movl %eax, -0x64(%rbp)
movq -0x50(%rbp), %rax
movq -0x60(%rbp), %rcx
movslq -0x64(%rbp), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
je 0x40803a
cmpq $0x0, -0x50(%rbp)
je 0x408010
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
movw %ax, %cx
movl -0x54(%rbp), %eax
movzwl %cx, %esi
movzwl %ax, %edx
callq 0x404650
movq -0x60(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0x64(%rbp), %eax
movl %eax, -0x54(%rbp)
movq -0x50(%rbp), %rax
movslq -0x64(%rbp), %rcx
addq %rcx, %rax
cmpq -0x30(%rbp), %rax
jbe 0x408038
movl $0x0, -0x4(%rbp)
jmp 0x408091
jmp 0x40804b
movq -0x60(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0x64(%rbp), %eax
addl -0x54(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x408056
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x407f80
cmpq $0x0, -0x50(%rbp)
je 0x40808b
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
movw %ax, %cx
movl -0x54(%rbp), %eax
movzwl %cx, %esi
movzwl %ax, %edx
callq 0x404650
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)