Extremely verbose code for calculation syndrome and encoding