a2t.c: Convert some code from Pascal