#include #include static void OutputChar(int c) { putchar(c); } static void OutputString(const char *s) { for(; *s; s++) OutputChar(*s); } int main() { int i, p = 0, q, steps, parity = 0; char op, oq; /* Decoder header */ OutputString("#include\n" "typedef int O;\n" "void o(O _) { putchar(_); }\n" "O main()\n" "{\n" "O *_[512], **p = _, **d, b, q;\n" "for(b = 0; b++ < 512; p = _ + q)\n" "_[q = (p - _ + 1) * 9 % 512] = (O*)p;\n"); /* Encode bytes */ while( (i = getchar()) != EOF ) { q = p; for(steps = 0; abs(p - q) != i; steps++) q = (q + 1) * 9 % 512; steps = 512 - steps; op = parity ? 'd' : 'p'; oq = parity ? 'p' : 'd'; OutputString("o("); if( p > q ) { OutputChar(op); OutputString("-("); OutputChar(oq); OutputChar('='); for(i = 0; i < steps; i++) OutputChar('*'); OutputString("(O**"); for(i = 0; i < steps; i++) OutputChar('*'); OutputChar(')'); OutputChar(op); OutputChar(')'); } else { OutputChar('('); OutputChar(oq); OutputChar('='); for(i = 0; i < steps; i++) OutputChar('*'); OutputString("(O**"); for(i = 0; i < steps; i++) OutputChar('*'); OutputChar(')'); OutputChar(op); OutputString(")-"); OutputChar(op); } OutputString(");"); parity ^= 1; p = q; } /* Decoder footer */ OutputString("return 0;}\n"); return 0; }