Just a short post to show you the current state of the x64 decompiler. In fact, it already mostly works but we still have to solve some minor problems. Let us consider this source code:

struct color_t { short red; short green; short blue; short alpha; }; extern color_t lighten(color_t c); color_t func(int red, int green, int blue, int alpha) { color_t c; c.red = red; c.green = green; c.blue = blue; c.alpha = alpha; return lighten(c); }

After compilation we get the following binary code:

Please note that the c, which is a structure, is passed by value in 2 registers: rcx and rdx. We had to rework quite many things in the decompiler to support such variables (we call them scattered variables). However, the output was worth it:



color_t __fastcall func(__int16 cx0, __int16 dx0, __int16 r8_0, __int16 r9_0) { color_t c; c .red = cx0 ; c .green = dx0 ; c .blue = r8_0 ; c .alpha = r9_0 ; return lighten ( c ); }

There is still some work to be done, but it seems we solved most problematic issues. Stay tuned, there will be more decompiler news soon!