I am trying to generate multiple programs from a given C/C++ program with loops unrolled. For example, I would like to convert something like this:
i = 0;
while (i < 5) {
printf("Hello");
i++;
}
to this:
i = 0;
printf("Hello");
i++;
while (i < 5) {
printf("Hello");
i++;
}
In the above example, I'd like to generate 5 programs each with a different number of loops unrolled. The compiler flags that I have looked at so far don't seem to generate a program but just optimize it. Is there any straightforward automated way of doing this?
Edit: I don't understand why this is being downvoted. The question linked as being a duplicate isn't relevant.