The Andromeda Decompiler is not available to the public at present, so the only example of its use is usually limited to the very impressive demo program. I asked the author to compile the switch test program; here is the result:
void sub_401080(DWORD arg_4)
{
DWORD var_c;
sub_401440();
__main();
switch (arg_4)
{
case 7:
var_c = "Seven!";
goto loc_4010D0;
case 6:
var_c = "Six!";
goto loc_4010D0;
case 5:
var_c = "Five!";
goto loc_4010D0;
case 4:
var_c = "Four!";
goto loc_4010D0;
case 3:
var_c = "Three!";
goto loc_4010D0;
case 2:
var_c = "Two!";
loc_4010D0:
puts((void *)var_c);
return;
}
var_c = "Other!";
goto loc_4010D0;
}//sub_401080(:[1])
This will compile with little effort, and looks like it will run correctly. Obviously, the goto statements are unfortunate. However, this is possibly because the author has not tested before on gcc-compiled input programs.
I'm not sure where the binary for this program came from; it is in a file called
switch_gcc.dc
. To give some idea of the original binary, this is the assembler view:
sub_401080 proc near
mov [eax], ebp
mov eax, 0
mov ebp, esp
sub esp, 8
and esp, 0FFFFFFF0h
mov [eax-4], ebx
mov ebx, [eax+8]
call sub_401440
call __main
cmp ebx, 7
ja loc_4010E0
T32 = ebx * 4, T32 = &off_4010A8 + T32, (*T32)
loc_40110D:
mov dword ptr [eax], offset aSeven
jmp loc_4010D0
loc_40110D4:
mov dword ptr [eax], offset aSix
jmp loc_4010D0
...
loc_4010C8:
mov fdword ptr [eax], offset aTwo
loc_4010D0:
call puts
mov ebx, [eax-4]
mov eax, 0
mov esp, ebp
mov ebp, [eax]
ret
loc_4010E0:
mov dword ptr [eax], offset aOther
jmp loc_4010D0
sub_401080 endp
This assembler code is like nothing I've seen; I suspect that esp is being displayed as eax and possibly some instructions are displayed out of sequence. This was from version 0.62; unfortunately the
.dc
file won't read in later versions of the GUI.
It's a real shame that this decompiler doesn't seem to have progressed since May 2005.
--
MikeVanEmmerik - 24 Mar 2007