You simply have to compute the inverse permutation for each step and apply them in reverse order.
If you have a forward permutation P defined as
moveP[0] = n0
moveP[1] = n1
moveP[2] = n2
moveP[3] = n3
then you compute the corresponding inverse permutation P-1 such as
movePinv[n0] = 0
movePinv[n1] = 1
movePinv[n2] = 2
movePinv[n3] = 3
That way you have P-1(Y) = X if P(X) = Y.
In your example, if you start from array A0 and apply 2 permutations P and Q, giving the steps A1 = P(A0) and A2 = Q(A1) = Q(P(A0)), then to get back the initial array A0, you have to apply the inverse permutations in reverse order to the final array. That is A1 = Q-1(A2) then A0 = P-1(A1) = P-1(Q-1(A2)).
Note that for an improved memory usage you can definitely do this incrementally, accumulating all the inverse permutations in a single one (assuming you are only interested in retrieving the initial order but not the intermediate steps of course).
Edit : following your code, here is what the backward step could look like to. It's clearly not great if you plan to do it several times (since the inverse permutations would be computed and applied to the source array each time), but for a one-shot, it's the simplest way.
int backFrom = x - 1, backTo = 0; // for example
char state[4] = arr[backFrom];
int swapInvAux[4];
for (z = backFrom; z >= backTo; --z)
{
swapInvAux = InversePermutation(swap[z]);
state = Swappit(state, swapInvAux);
}
For better performance, parallel to the swap array you should store a chain of accumulated inverse permutations obtained by applying your Swappit function to the swap array itself. Doing so you would be able to reverse the final state to any intermediate state in a single step.