0

I want to make this decompiled function look nicer but don't know how ? Can you please help me by telling steps to do the structure in ida?

This is a dot product function. I want to change type of __int64 a2@<rsi>, __int64 a3@<rdx> to look more familiar.

void 
__usercall dot_prod(signed int a1@<edi>, __int64 a2@<rsi>, __int64 a3@<rdx>,
                    __int128 _XMM0@<xmm0>, __int128 _XMM1@<xmm1>) 
{   
  __int64 v5; // rax@2   double v6; // xmm0_8@2

  if ( a1 > 0 )   
    {
      v5 = 0LL;
      v6 = 0.0;

      do
      {
        v6 = v6 + *(double *)(a2 + 8 * v5) * *(double *)(a3 + 8 * v5);
        ++v5;
      } while ( a1 > (signed int)v5 );   
   } 
}

1 Answer 1

0

Place cursor on a name of variable (in decompiled code window, you arrive there by using TAB in assembly window), press N. This will allow you to rename the entity your cursor stays on, including functions, variables, etc. Place cursor on a name of variable, press Y. This will allow you to change its type.

Regarding a2 and a3 in your specific example they look like arrays of doubles, so their type should be double*.

I expect that the result of the line will be something like

v6 = v6 + a2[v5]*a3[v5];
3
  • I know this...I mean what do you suggest as type here instead of __int64 a2@<rsi> Commented Jul 23, 2015 at 7:08
  • try double* as a types for a2 and a3
    – w s
    Commented Jul 23, 2015 at 7:20
  • @schrodinger, if you're asking what the argument names should be, I'd recommend (in Hungarian Notation): a1 = nVectorLength, a2 = pVector1, a3 = pVector2. Commented Jul 23, 2015 at 13:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.