News for hackers. Stuff that matters.
Re:Stuxnet is now on GitHub by tedunangst on Sunday February 13, 2011 @12:31PM (#2213232)
What do you suppose a decompiled chunk of optimized Haskell would look like?
Re:Stuxnet is now on GitHub by jerf on Monday February 14, 2011 @12:15AM (#2215397)
Heck, you don't even need that. Put this in a file named "Hello.hs":

    module Hello where

    main = print "Hello world!"
and run "ghc -fvia-C -keep-hc-files Hello.hs". Compilation may fail with linker errors, but today we don't care about that. We just want to look at the resulting Hello.hc file, which is the C representation of the Haskell, and generally looks like:

    II_(rhG_closure);
    II_(si4_closure);
    FN_(Hello_main_entry) {
    FB_
    if ((W_)(((W_)Sp - 0x10UL) < (W_)SpLim)) goto _cip;
    Hp=Hp+2;
    if ((W_)((W_)Hp > (W_)HpLim)) goto _cip;
    Hp[-1] = (W_)&stg_CAF_BLACKHOLE_info;
    ;EF_(newCAF);
    {void (*ghcFunPtr)(void *);
and so on for quite a while longer. Passing this through a compile and decompile step might actually clean it up a bit....
Re:Stuxnet is now on GitHub by eru on Sunday February 13, 2011 @09:07PM (#2214939)
Without a very clever decompiler, I'd say `ugly'.
Re:Stuxnet is now on GitHub by gloob on Sunday February 13, 2011 @11:37PM (#2215279)
I admit to basing this on nothing more than a gut feeling, but a "sufficiently smart decompiler" seems even less plausible than a "sufficiently smart compiler".
Re:Stuxnet is now on GitHub by eru on Monday February 14, 2011 @10:26AM (#2217037)
My first version was just `ugly'. But I guarded it.