\datethis @*Intro. This program computes the $2\times n$ whirlpool permutation that corresponds to a given up-up-or-down-down permutation of $\{1,2,\ldots,2n-1\}$, which appears on the command line. So it's essentially the inverse of the program {\mc WHIRLPOOL2N-ENCODE}, and its output is a suitable input to that program. By up-up-or-down-down permutation'' of length $2n-1$, I mean a permutation $p_1\ldots p_{2n-1}$ such that \$p_{2k-1} #include int a[2*maxn]; /* where we build the answer */ int g[2*maxn]; /* the given permutation */ int w[2*maxn]; /* workspace */ int used[2*maxn]; main(int argc,char*argv[]) { register int i,j,k,n,nn,t,x,y,saven; @; @; for (n=1;n; @; } @ @= if (argc&1) { fprintf(stderr,"Usage: %s a1 a2 ... a(2n-1)\n", argv[0]); exit(-1); } nn=argc, n=saven=nn/2; if (n>maxn) { fprintf(stderr,"Recompile me: This program has maxn=%d!\n", maxn); exit(-99); } for (k=1;k=nn) { fprintf(stderr,"Perm element %d' out of range!\n", g[k]); exit(-3); } if (used[g[k]]) { fprintf(stderr,"Duplicate perm entry %d'!\n", g[k]); exit(-4); } used[g[k]]=1; } @; @ @= for (k=2;k; exit(-6); } } @ Here I compress the uncompressed'' numbers in the given permutation. @= a[0]=1; for (k=1;k= { x=g[nn-n-n-1],y=g[nn-n-n]; t=y-(x=0;k--) a[k+1]=(a[k]+t)%(n+n), a[k+saven+1]=(a[k+saven]+t)%(n+n); for (k=1;k<=n;k++) a[k]+=(a[k]= for (k=0;k