#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
typedef uint32_t (* issue_t)(const uint32_t, const uint32_t);
uint32_t func(const uint32_t a) {
return 5;
}
uint32_t issue(const uint32_t a, const uint32_t b) {
uint32_t c = 0;
const uint32_t d = func(b);
if(d > 255) {
c = a;
}
else {
c = a + 1;
}
return c;
}
int main(int argc, char * argv[]) {
uint32_t a = 0, b = 0;
// b is our secret value, we read its content from the environment so the
// compiler cannot play tricks on us by inlining
if (argc >= 2) {
b = (uint32_t) strtol(argv[1], NULL, 16);
}
else {
fprintf(stderr, "USAGE: %s hex_value\n", argv[0]);
return 1;
}
// declarations and markup here
volatile issue_t func = issue;
printf("%u\n", func(a, b));
return 0;
}
See the compilation results with different optimization levels on GodBolt.