请看以下由IDA生成的伪代码:
请看以下由IDA生成的伪代码: _BYTE *result; // eax result = a4; //此处省略 *((_DWORD *)a6 + 17) = a5[14]; *((_DWORD *)a6 + 18) = a5[15]; *((_DWORD *)a6 + 19) = a5[16]; *((_DWORD *)a6 + 20) = a5[17]; *((_DWORD *)a6 + 21) = a5[18]; *((_DWORD *)a6 + 22) = a5[19]; *((_DWORD *)a6 + 23) = a5[20]; result = (_BYTE *)a5[21]; *((_DWORD *)a6 + 24) = result; } return result;以上伪代码中,a4是函数的第4个输入参数,变量result与a4的类型相同。
从result的注释可知,它对应寄存器eax。但是,汇编代码中没有把a4赋予eax的指令。
与上述伪代码对应的汇编是:
mov eax, [edi+38h] mov [esi+44h], eax mov eax, [edi+3Ch] mov [esi+48h], eax mov eax, [edi+40h] mov [esi+4Ch], eax mov eax, [edi+44h] mov [esi+50h], eax mov eax, [edi+48h] mov [esi+54h], eax mov eax, [edi+4Ch] mov [esi+58h], eax mov eax, [edi+50h] mov [esi+5Ch], eax mov eax, [edi+54h] mov [esi+60h], eax以上每2行汇编被IDA翻译为1行伪代码赋值语句,但最后2行汇编却被翻译为:
result = (_BYTE *)a5[21];
*((_DWORD *)a6 + 24) = result;
按照前面7行伪代码的生成方式,这2行汇编也应该被翻译为:
*((_DWORD *)a6 + 24) = a5[21];
即无需把此时的eax翻译为result。
还有,这个函数的调用者没有使用返回值result。
因此,可以删除变量result及其操作,并把该函数定义为void函数。