source 2015 Renes--Costello--Batina "Complete addition formulas for prime order elliptic curves", Algorithm 2
assume Z2 = 1
parameter b3
assume b3 = 3 b
compute t0 = X1 * X2
compute t1 = Y1 * Y2
compute t3 = X2 + Y2
compute t4 = X1 + Y1
compute t3 = t3 * t4
compute t4 = t0 + t1
compute t3 = t3 - t4
compute t4 = X2 * Z1
compute t4 = t4 + X1
compute t5 = Y2 * Z1
compute t5 = t5 + Y1
compute Z3 = a * t4
compute X3 = b3 * Z1
compute Z3 = X3 + Z3
compute X3 = t1 - Z3
compute Z3 = t1 + Z3
compute Y3 = X3 * Z3
compute t1 = t0 + t0
compute t1 = t1 + t0
compute t2 = a * Z1
compute t4 = b3 * t4
compute t1 = t1 + t2
compute t2 = t0 - t2
compute t2 = a * t2
compute t4 = t4 + t2
compute t0 = t1 * t4
compute Y3 = Y3 + t0
compute t0 = t5 * t4
compute X3 = t3 * X3
compute X3 = X3 - t0
compute t0 = t3 * t1
compute Z3 = t5 * Z3
compute Z3 = Z3 + t0