GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
/****************************************************************************1**2*A compact.c ANUPQ source Eamonn O'Brien3**4*Y Copyright 1995-2001, Lehrstuhl D fuer Mathematik, RWTH Aachen, Germany5*Y Copyright 1995-2001, School of Mathematical Sciences, ANU, Australia6**7*/89#include "pq_defs.h"10#include "pcp_vars.h"1112/* compact the group tables from pcp->gspace onwards */1314void compact(struct pcp_vars *pcp)15{16register int *y = y_address;1718register int i;19register int j;20register int p1;21register int new_address;22register int bound;2324new_address = pcp->gspace - 1;25i = pcp->gspace;2627#ifndef DEBUG28if (pcp->fullop || pcp->diagn)29#endif30text(2, pcp->lused, pcp->structure, 0, 0);3132while (i < pcp->lused) {3334/* the next block is currently allocated */35if (y[i] > 0) {36p1 = y[i];37++new_address;38y[p1] = -new_address;39y[new_address] = y[i];40bound = y[i + 1] + 1;41for (j = 1; j <= bound; ++j)42y[++new_address] = y[++i];43++i;44} else if (y[i] == 0)45/* this block is currently deallocated */46i += y[i + 1] + 2;47else48/* this block consists only of the header block of length 1 */49++i;50}5152pcp->lused = new_address;5354#ifndef DEBUG55if (pcp->fullop || pcp->diagn)56#endif57PRINT("After compaction Lused = %d\n", pcp->lused);5859return;60}616263