Hex-Rays v7.2 vs. v7.1 Decompiler Comparison Page

Below you will find side-by-side comparisons of v7.1 and v7.2 decompilations. Please maximize the window too see both columns simultaneously.

The following examples are displayed on this page:

NOTE: these are just some selected examples that can be illustrated as side-by-side differences. There are many other improvements and new features that are not mentioned on this page.


Magic divisions in 64-bit code

In the past the Decompiler was able to recognize magic divisions in 32-bit code. We now support magic divisions in 64-bit code too.

return 21600 * (t / 21600);

More aggressive 'if' to 'boolean' folding

More aggressive folding of if_one_else_zero constructs; the output is much shorter and easier to grasp.

return a1 << 28 != 0 && (a1 & (unsigned __int8)(a1 - 1)) == 0;

Better type of 'this' argument

The decompiler tries to guess the type of the first argument of a constructor. This leads to improved listing.

XImage *__fastcall XImage::setHotSpot(XImage *this, int a2, int a3)
{
  LOWORD(this->height) = a2;
  HIWORD(this->height) = a3;
  return this;
}

Improved union field selection

The decompiler has a better algorithm to find the correct union field. This reduces the number of casts in the output.

float __fastcall ret4f(__n128 a1)
{
  return a1.n128_f32[2];
}

Improved recognition of 'for' loops

We improved recognition of 'for' loops, they are shorter and much easier to understand.

  for ( i = 0; i < 16; ++i )
  {
    printf("%x", *(unsigned __int8 *)(i + v2) >> 4);
    printf("%x", *(_BYTE *)(i + v2) & 0xF);
  }

Added support for shifted pointers

Please note that the code on the left is completely illegible; the assembler code is probably easier to work with in this case. However, the code on the right is very neat. JFYI, below is the class hierarchy for this example:

struct __cppobj B1
{
  B1_vtbl *__vftable /*VFT*/;
  char d1[4];
};
struct __cppobj B2
{
  B2_vtbl *__vftable /*VFT*/;
  char d2[4];
};