Expression Simplification

Listing: Expression Simplification, Before Optimization

#define MY_OFFSET 4

void func(int* result1, int* result2, int* result3, int* result4, int x)
{

 *result1 = x + 0;
 *result2 = x * 2;
  *result3 = x - x;
  *result4 = 1 + x + MY_OFFSET;
}
Listing: Expression Simplification, After Optimization

#define MY_OFFSET 4

void func_optimized(int* result1, int* result2, int* result3, int* result4, int x)
{
 *result1 = x;
 *result2 = x << 2;
 *result3 = 0;
 *result4 = 5 + x;
}