Duplicated function call which has side effects
rfalke opened this issue · comments
Exe: https://github.com/rfalke/decompiler-subjects/blob/master/from_holdec/dmi/cfg/ia32_elf/subject.exe
Snowman: d7dee56
Input:
int intermediate_12_loop_with_break_and_block(int arg)
{
while (1) {
puts("head");
if (time(0) == arg) {
puts("will break");
break;
}
puts("barrier");
if (rand() == arg) {
break;
}
puts("tail");
}
return 0;
}
Output:
int32_t intermediate_12_loop_with_break_and_block(int32_t ecx, uint32_t a2, uint32_t a3) {
uint32_t ebx4;
uint32_t eax5;
uint32_t eax6;
ebx4 = a2;
while (fun_8048350("head"), eax5 = fun_8048340(0), eax5 != ebx4) {
fun_8048350("barrier");
eax6 = fun_8048380("barrier");
if (ebx4 == eax6)
goto addr_8048899_4;
fun_8048350("tail");
}
fun_8048350("will break");
addr_8048899_4:
return 0;
}
-
The call 'fun_8048350("barrier")' is duplicated changing the semantics.
-
Also there is goto where it is possible to do without.