Reverse Engineering challenge #87.

Tags: X86 L3 .

This is one of the hardest ever exercises at this website. What does this code do?

Hint: the function has been copypasted from the guts of GCC, but in fact, it is present almost in all modern compilers, though, in different forms, but calculating the same value(s). Its function is highly important.

Second hint: f(f(x))=x.

Optimizing GCC 5.4 x86

        mov     edx, 31
        mov     eax, 1
        imul    eax, edi
        imul    edi, edi
        sub     edx, 1
        jne     .L2

More challenges:; about solutions: