Universal Disassemblers vs. Universal MIILs

David Keppel pardo at june.cs.washington.edu
Fri Oct 21 07:52:29 AEST 1988


bcase at cup.portal.com (Brian bcase Case) writes:
>knudsen at ihlpl.ATT.COM (Knudsen) writes:
>>And distributing a uMIIL isn't going to make automatic disassembly *easier*?
>This, I think, is the one real hurdle is getting a the MIIL concept accepted.

I think the nub of the matter is that it makes disassembly more
*useful*, not any easier.

I claim that I can distribute C code to my programs and it is
completely useless.  I gave an example of this quite a while back.
I need to do things such as:

* Rename all variables.
* Hoist (inline) functions.
* Do loop transformations (e.g. for() loop to a goto loop).
* Strip out all comments.
* Run the preprocessor to remove #ifdefs  (Is this the same
  value "4" that appeared in the line before, or are they
  unrelated?)
* Avoid standard libraries.
* Do code motion.
* Delcare wasted variables, dead code, unoptimize code that
  an optimizer can put back together again later, ...

Essentially, preform all the optimizations that I can on the C source,
and  steal liberally from the Obfusacted C Code Contest.  Consider the
following (well-formated) program.  What does it do?

extern	struct	_a7F9a1Xs3 {
	int	_a7F6a1Xs3;
	char	*_a7G9a1xs3;
	char	*_a7G6a1xs3;
	int	_a7G6a1xs7;
	short	_a7F9a1xs7;
	char	_a7F9a1xf7;
} _iob[3];

main(_a7F9a1xf3, _a7F61axf3)
    int _a7F9a1xf3;
    char *_a7F61axf3[];
{
    int _a7G61asf3, _a7G61faf3;

    goto _a7G61afx3;
  _a7G61afs3:
    exit(0), _a7G61asf3&=(0x10)+1;
  _a7G61afx3:
    ((_a7G61asf3=(--((&_iob[0]))->_a7F6a1Xs3>=0
	? *((&_iob[0]))->_a7G9a1xs3++&0377
	:_filbuf((&_iob[0]))))
    !=(-1));
    if (_a7G61asf3*(3-1)==(0-2))  goto _a7G61afs3;
    (--((&_iob[1]))->_a7F6a1Xs3>=0
	? ((int)(*((&_iob[1]))->_a7G9a1xs3++=(unsigned)(_a7G61asf3)))
	:_flsbuf((unsigned)(_a7G61asf3),(&_iob[1])));
    goto _a7G61afx3;
  _a7G71afs3:
    (--((&_iob[1]))->_a7F6a1Xs3>=0
	? ((int)(*((&_iob[1]))->_a7G9a1xs3++=(unsigned)(_a7G61asf3)))
	:_flsbuf((unsigned)(_a7G61asf3),(&_iob[1])));
    exit(1);
}

Did you guess:

#include <stdio.h>

main(argc, argv)
    int argc;
    char *argv[];
{
    int c;

    while ((c=getchar())!=EOF)
	putchar(c);
}

Enough.

	;-D on  ( Throw a monkey in the wrench )  Pardo
-- 
		    pardo at cs.washington.edu
    {rutgers,cornell,ucsd,ubc-cs,tektronix}!uw-beaver!june!pardo



More information about the Comp.lang.c mailing list