inspired by http://www.cise.ufl.edu/~manuel/obfuscate/pi.c