1 #include <inttypes.h>
2 #include <stdio.h>
3 #define LONGx1 "8192"
4 #define LONGx2 "16384"
main(void)5 void main(void) {
6    const char *n = "abcdefghijklmnopqrstuvwxyz0123456789";
7    uint64_t c0 = 0, c1 = 1, c2 = 2;
8    uint64_t s;
9    uint32_t eax = 1, ecx;
10    __asm__("cpuid"
11            : "=c"(ecx)
12            : "a"(eax)
13            : "%ebx", "%edx");
14    __asm__("crc32b\t" "(%1), %0"
15            : "=r"(c0)
16            : "r"(n), "0"(c0));
17    __asm__("crc32q\t" "(%3), %0\n\t"
18            "crc32q\t" LONGx1 "(%3), %1\n\t"
19            "crc32q\t" LONGx2 "(%3), %2"
20            : "=r"(c0), "=r"(c1), "=r"(c2)
21            : "r"(n), "0"(c0), "1"(c1), "2"(c2));
22   s = c0 + c1 + c2;
23   printf("avoiding unused code removal by printing %d, %d, %d\n", (int)s, (int)eax, (int)ecx);
24 }
25