A C-to-C transformation to copy a function.
This transformation introduces a new function which is the duplicate of another.
For instance, consider the following C code:
int fibonacci(int x) {
if (x <= 1) {
return x;
}
return fibonacci(x - 1) + fibonacci(x - 2);
}Copying
int fibonacci(int x) {
if (x <= 1) {
return x;
}
return fibonacci(x - 1) + fibonacci(x - 2);
}
int fib(int x) {
if (x <= 1) {
return x;
}
return fib(x - 1) + fib(x - 2);
}This transformation is not likely to be useful in isolation. Most often it is an initial step before applying different transformations to the two duplicates.