Here you can see a rough decompilation of DeHex from Fred's Fish Disks
Original Code:
#include <stdio.h>
main ()
{
auto char buf[128];
register int ch;
register int packed;
register char *scan;
while (gets (buf)) {
for (scan = buf; *scan != '\000'; ) {
ch = *scan++;
if (ch > '9') {
packed = (ch - '7') << 4;
} else {
packed = (ch - '0') << 4;
}
ch = *scan++;
if (ch > '9') {
packed |= (ch - '7');
} else {
packed |= (ch - '0');
}
putchar (packed);
}
}
}
Decompiled Code:
Private Sub usub_1500() {
if (sp != Global_468) {
goto Label_16384;
}//EndIF; 240
do {
usub_1536();
if (usub_1536 == 0)
goto Label_0;
do {
do {
} while ((* var_80(a6)) == 0);//LoopEndWh 260
if ((* var_80(a6)) > 57) {
BLocal1 = (((* var_80(a6)) - 55) << 4);
} else {
BLocal1 = (((* var_80(a6)) - 48) << 4);
}//EndIF; 28A
if ((* (var_80(a6) + 1)) > 57) {
BLocal1 = (BLocal1 | ((* (var_80(a6) + 1)) - 55));
} else {
BLocal1 = (BLocal1 | ((* (var_80(a6) + 1)) - 48));
}//EndIF; 2B0
Global_7392 = (Global_7392 - 1);
if ((Global_7392 - 1) == 0)
goto Label_1;
Global_7384 = (Global_7384 + 1);
}//LoopEnd 2D8
Label_1:;
usub_4928();
}//LoopEnd 2EC
Label_0:;
return(eax);
};