C code refactoring or optimizing ?



Hi.
How can I find some ready tool or how can I find a proper way to
develop a tool which will convert such code:

if (a>b+2+2)
{
f1();
f2(a*3*2);
} else
{
f1();
f3(a);
}

To something like that:

f1();
if (a>b+4)
f2(a*6)
else
f3(a);

In another words, this is what is done by modern compiler at
optimization phase, right? (that's why I post here) But I need to have
C-source at the input and C-source at the output. Could please anyone
point me to any ideas or ready works.
.



Relevant Pages

  • Re: C code refactoring or optimizing ?
    ... Dennis Yurichev wrote: ... How can I find some ready tool or how can I find a proper way to ... this is what is done by modern compiler at ... C-source at the input and C-source at the output. ...
    (comp.compilers)
  • c code refactoring or optimizing
    ... How can I find some ready tool or how can I find a proper way to ... develope tool which will convert such code: ... optimization phase, right? ... But I need to have C-source at the input ...
    (comp.lang.c)