Description

I've always wanted to write an obfuscated program by hand just for fun, and now I have! Can you guess what the C program below does?

^ TOP

Code

#include <stdlib.h>
#include <stdio.h>

#define string int
#define while(a) s = (a);
#define nibble char
#define goto(a) /* a */

string main() {
	string s;
	void*(*void_pointer)(size_t) = malloc;
	nibble *n;
	int i = 20;
	first:
	while (i < 100) {
		n = void_pointer(i*sizeof(nibble));
		i++;
		if (i < 50) goto(first);
	}
	n[0] = 'T'; n[1] = 'y'; n[2] = 8; n += 3;
	n[0] |= (n[0] = 8) << 3;
	n[i%20] = (n[0] | (n[0] >> 1) + 1) ^ 8;
	n[2] = n['\n'-1] = n[3] = n[2] = n[1] + 7;
	*(&n[4]+3) = n[4] = n[3]+3*((++n[2]) - (--n[2]));
	n['\n' + 3] = '\n';
	n['\n' + 4] = ((n[0]&n[1])-'B')%2;
	if ((int)void_pointer % 2 == 0) {
		goto (terminate); 
	}
	n[0xA/2] = (2^20)-2;
	n[0xA] = ('d' + 'e')/2;
	n[6] = ((~n[0])|64) + '`';
	n[8] = (~((nibble)(string)void_pointer | 0x8D))|0x72;
	n[11] = '%'; n[12] = 'c';
	goto(last);
	n[((!!'!')<<4)-!'!'-1] = !(!('!'))*'!'<<!'!';
	last:
	while (2 > 1) {
		n -= 2;	printf(n, n[17]);
	}
	terminate:
	;
}