Java (OpenJDK 8), 351 343 339 320 318318 247 + 56 bytes
Just a near 1:1 port of the reference to start golfing from.
void f(int[]x,int y,int z){int q=x[y];x[y]=x[z];x[z]=q;}
s->{for(int r=24,c,x,y,z;r>0;--r){for(c=0;c<4;x=s[c]<<24|s[c]>>>8,y=s[4+c]<<9|s[4+c]>>>23,z=s[8+c],s[8+c]=x^z<<1^(y&z)<<2,s[4+c]=y^x^(x|z)<<1,s[c++]=z^y^(x&y)<<3);if((r&3)<1==2){x=s[0];s[0]=s[1];s[1]=x;x=s[2];s[2]=s[3];s[3]=x;}if(f(r&3s,0,2)==2;f(s,1,3){x=s[0];s[0]=s[2];s[2]=x;x=s[1];s[1]=s[3];s[3]=x;;}if((r&3)<1)s[0]^=0x9e377900|r;{f(s,0,1);f(s,2,3);s[0]^=0x9e377900|r;}}}