GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
#include <stdio.h>12extern int npt,cp[],orb[],*pptr[],pno[];3extern FILE *ip,*op;45int6orbitsv (int pt, int *sv, int lo)7/* Computes orbit of pt under perms listed in pno, and writes8Schreier vector into sv9*/10{ int u,v,w,x,y,z;11if (lo==0)12{ for (u=1;u<=npt;u++) sv[u]=0;13orb[1]=pt; lo=1; sv[pt]= -1;14}15for (x=1;x<=lo;x++)16{ z=orb[x];17for (y=1;y<= *pno;y++)18{ w=pno[y]; v=pptr[w][z];19if (sv[v]==0) { lo++; orb[lo]=v; sv[v]=w+1; }20}21}22return(lo);23}2425int26addsv (int pt, int *sv)27/* The Schreier vector sv is applied to the point pt, and the resulting word28added to the end of cp. It is assumed that pt is in the orbit. If not, the29program will break down.30Externals: cp.31*/32{ int pn;33pn=sv[pt]; while (pn!= -1)34{ (*cp)++; cp[*cp]=pn; pt=pptr[pn][pt]; pn=sv[pt]; }35return(0);36}3738int39image (int pt)40/* The image of pt under cp is computed and returned.41Externals: pptr,cp.42*/43{ int i;44for (i=1;i<= *cp;i++) pt=pptr[cp[i]][pt];45return(pt);46}4748int49invert (int *ptr1, int *ptr2)50/* permutation ptr1 is inverted and put in ptr2.51Externals: npt.52*/53{ int i;54for (i=1;i<=npt;i++) ptr2[ptr1[i]]=i;55return(0);56}5758int59readperm (int *ptr)60/* The next npt numbers from input ip are read. These should form a61permutation on 1,2,3,...,npt. If not 2 is returned. If the perm is the62identity, 1 is returned, otherwise 0.63Externals: npt,orb,ip.64*/65{ int i,j,id; id=1;66for (i=1;i<=npt;i++) orb[i]=0;67for (i=1;i<=npt;i++)68{ fscanf(ip,"%d",ptr+i); j=ptr[i];69if (j<=0 || j>npt || orb[j])70{ fprintf(stderr,"perm[%d]=%d\n",i,j); return(2);}71orb[j]=1; if (id && j!=i) id=0;72}73return(id);74}7576int77printvec (int *ptr, int e)78/* Points ptr[1] to ptr[npt+e] are output to op, followed by new line. The79first npt of these will be a permutation or a Schreier vector. e=0 or 1.80Externals: npt,op.81*/82{ int i;83if (npt>=10000)84for (i=1;i<=npt;i++) fprintf(op,"%6d",ptr[i]);85else86if (npt>=1000)87for (i=1;i<=npt;i++) fprintf(op,"%5d",ptr[i]);88else for (i=1;i<=npt;i++) fprintf(op,"%4d",ptr[i]);89fprintf(op," ");90for (i=npt+1;i<=npt+e;i++) fprintf(op,"%4d",ptr[i]);91fprintf(op,"\n");92return(0);93}9495int96readvec (int *ptr, int e)97/* The next npt+e points from ip are read into array ptr.98Externals: npt,ip.99*/100{ int i; for (i=1;i<=npt+e;i++) fscanf(ip,"%d",ptr+i); return(0);}101102int103readbaselo (int nb, int *base, int *lorb)104/* The nb base points are read into base, and the nb orbit lengths into lorb,105from ip.106Externals: ip.107*/108{ int i;109for (i=1;i<=nb;i++) fscanf(ip,"%d",base+i);110for (i=1;i<=nb;i++) fscanf(ip,"%d",lorb+i);111return(0);112}113114int115printbaselo (int nb, int *base, int *lorb)116/* base and lorb are printed to op.117Externals: op.118*/119{ int i;120if (npt>=1000)121{ for (i=1;i<=nb;i++) fprintf(op,"%5d",base[i]); fprintf(op,"\n");122for (i=1;i<=nb;i++) fprintf(op,"%5d",lorb[i]); fprintf(op,"\n");123} else124{ for (i=1;i<=nb;i++) fprintf(op,"%4d",base[i]); fprintf(op,"\n");125for (i=1;i<=nb;i++) fprintf(op,"%4d",lorb[i]); fprintf(op,"\n");126}127return(0);128}129130int131printpsv (int nb, int *gno, int **svptr)132/* Permutationsnos gno[1],...,gno[*gno] are output (up to npt+1), and then133Schreier vectors svptr[1],...,svptr[nb] are output to op.134Externals: npt,pptr,orb,op.135*/136{ int i,j,k;137for (i=1;i<= *gno;i++)138{ j=gno[i]; orb[j+1]=2*i-1; printvec(pptr[j],1); }139for (i=1;i<=nb;i++)140{ for (j=1;j<=npt;j++)141{ k=svptr[i][j]; if (k>0) k=orb[k]; fprintf(op,"%4d",k); }142fprintf(op,"\n");143}144return(0);145}146147int148readpsv (int e, int nb, int nperms, int **svptr)149/* nperms permutations (up to npt+1) are read into perm nos pptr[e],pptr[e+2],.150and pptr[e+2x] is inverted into pptr[e+2x+1], for x=1,...,nperms. Then the151Screier vectors svptr[1],...,svptr[nb] are read from ip.152Externals: pptr,npt,ip.153*/154{ int i,j,*k;155for (i=1;i<=nperms;i++)156{ j=e+2*i-2; readvec(pptr[j],1); invert(pptr[j],pptr[j+1]); }157for (i=1;i<=nb;i++)158{ readvec(svptr[i],0);159for (j=1;j<=npt;j++) { k=svptr[i]+j; if (*k>0) *k +=e;}160}161return(0);162}163164int seeknln (void) { while (getc(ip)!='\n'); }165166167