source 1987 Montgomery "Speeding the Pollard and elliptic curve methods of factorization", page 261, fifth and sixth displays, plus common-subexpression elimination
parameter a24
assume 4 a24 = a+2
compute A = X2+Z2
compute AA = A^2
compute B = X2-Z2
compute BB = B^2
compute E = AA-BB
compute C = X3+Z3
compute D = X3-Z3
compute DA = D A
compute CB = C B
compute X5 = Z1(DA+CB)^2
compute Z5 = X1(DA-CB)^2
compute X4 = AA BB
compute Z4 = E(BB + a24 E)