Hex-Rays v1.3 Comparison Page

Welcome to the Hex-Rays Decompiler v1.3 comparison page! Below you will find side-by-side
comparisons of Hex-Rays v1.2 and v1.3 outputs. Please maximize the window
too see both columns simultaneously. The previous comparison can be found here.

It seems that 64-bit support is a never ending story.
The previous version of the decompiler could not recognize the 64-bit addition
because it was interleaved with other operations and the value of an operand
changed midway. The new version can handle it, and the output is much simpler.

Complex references like pointers to arrays to pointers to (the list may go on) were
not always recognized and represented nicely. Only one level of indirection was handled nicely, deeper references might look ugly.
Now the decompiler does a much better job.
(the type of a3g is char (**a3g)[5], so the expression on the left is correct too)

Assignments and comma operators

if ( !ptr || (v3 = *ptr, !*ptr) )
do_something...;

if ( !ptr || (v3 = *ptr) == 0 )
do_something...;

Nobody likes comma operators but the decompiler has to revert to them to get rid of gotos.
In some cases they can still be eliminated and that's what the new version does.

Note that the decompiler replaced the result variable with its known value, zero.
Knowing a variable value enables many other optimizations and can simplify the output
very much. It also removes false dependencies: for example, the previous version had
to introduce a cast to LPCSTR.

It is difficult to say what exactly improvement of the decompiler led to this result,
but we like it anyway. The decompiler could get rid of intermediate variables and simplify the code
to the maximum.

Improved optimizer - 2

return (char)(a1 - -107 * (unsigned __int16)(a1 / 661));

return (char)(a1 % 661);

Yet another example of improved output. There are many other improved things, like inlined
strcpy, strlen and other functions, we are just getting too many examples anyway...

We tweaked the structural analysis: now it is faster (especially on big functions) and produces more concise output.
Note that there is only one if operator now. Since not everyone likes dense
code, this is configurable.

Floating point constants

LODWORD(v63) = 1065353216;
LODWORD(v62) = 1065353216;

v63 = 1.0;
v62 = 1.0;

Floating point constants are detected even if they are moved around using integer
manipulation commands (a simple mov instruction).

It seems that the fast structural analysis combined with the improved loop recognition made it possible to
shorten the output. Whatever the reason is, we like the output on the right.

NOTE: these are just some selected examples that can be illustrated as a side-by-side difference.
Hex-Rays Decompiler v1.3 includes are many other improvements and new features that are not mentioned on this page -
simply because there was nothing to compare them with.
Also, some improvements have already been illustrated in the previous comparisons.
Please refer to the news page for more details.