#include <stdint.h>
#include <stdio.h>
#include <string.h>
typedef int(* issue_t)(const uint64_t*, const uint64_t*);
#define THE_SIZE 9
int comparator(const uint64_t *a, const uint64_t *b) {
return (memcmp(a, b, sizeof(uint64_t) * THE_SIZE) == 0);
}
int issue(const uint64_t *a, const uint64_t *b) {
int ret = 0;
for (int i = 2;i < 3;i += 2) {
ret |= comparator(a,b);
}
return ret;
}
int main(int argc, char *argv[]){
uint64_t a[THE_SIZE] = {0}, b[THE_SIZE] = {0}, c[THE_SIZE] = {0};
// c is our secret value containing array, we read its content from the
// environment so the compiler cannot play tricks on us by inlining
if (argc >= 2) {
memset(c, (uint64_t) argv[1][0], THE_SIZE*sizeof(uint64_t));
}
else {
fprintf(stderr, "USAGE: %s hex_value\n", argv[0]);
return 1;
}
// declarations and markup here
volatile issue_t func = issue;
printf("%d\n", func(a, b));
printf("%d\n", func(a, c));
return 0;
}
See the compilation results with different optimization levels on GodBolt.