0

Logically, 1046 Bytes
@A:3i:o,c:4t;XOR(3i)(t3)AND(i0,i1)(t0)AND(i1,i2)(t1)AND(i0,i2)(t2)COPY(t3)(o)OR(3t)(c)
@B:8a,8b:8o,d:7c;A(a0,b0,0)(o0,c0)A(a1,b1,c0)(o1,c1)A(a2,b2,c1)(o2,c2)A(a3,b3,c2)(o3,c3)A(a4,b4,c3)(o4,c4)A(a5,b5,c4)(o5,c5)A(a6,b6,c5)(o6,c6)A(a7,b7,c6)(o7,d)
@C:i,a,b:d:x,y,z;NOT(i)(x)AN...