/*% c99 -O3 -Wall -o # % */ #include #include #include #include #include char *tok[] = { "add", "sub", "neg", "div", "rem", "udiv", "urem", "mul", "and", "or", "xor", "sar", "shr", "shl", "stored", "stores", "storel", "storew", "storeh", "storeb", "load", "loadsw", "loaduw", "loadsh", "loaduh", "loadsb", "loadub", "extsw", "extuw", "extsh", "extuh", "extsb", "extub", "exts", "truncd", "stosi", "dtosi", "stoui", "dtoui", "uwtof", "ultof", "swtof", "sltof", "cast", "copy", "alloc4", "alloc8", "alloc16", "culew", "cultw", "cslew", "csltw", "csgtw", "csgew", "cugtw", "cugew", "ceqw", "cnew", "culel", "cultl", "cslel", "csltl", "csgtl", "csgel", "cugtl", "cugel", "ceql", "cnel", "cles", "clts", "cgts", "cges", "cnes", "ceqs", "cos", "cuos", "cled", "cltd", "cgtd", "cged", "cned", "ceqd", "cod", "cuod", "vaarg", "vastart", "...", "env", "loc", "call", "phi", "jmp", "jnz", "ret", "hlt", "export", "function", "type", "data", "section", "align", "file", "blit", "l", "w", "sh", "uh", "h", "sb", "ub", "b", "d", "s", "z", "loadw", "loadl", "loads", "loadd", "alloc1", "alloc2", }; enum { Ntok = sizeof tok / sizeof tok[0] }; uint32_t th[Ntok]; uint32_t hash(char *s) { uint32_t h; h = 0; for (; *s; ++s) h = *s + 17*h; return h; } int main() { char *bmap; uint32_t h, M, K; int i, j; bmap = malloc(1u << 31); for (i=0; i> M; if (bmap[h]) break; bmap[h] = 1; } if (i==Ntok) { printf("found K=%d for M=%d\n", K, M); exit(0); } K += 2; } while (K != 1); } }