#include #include typedef short int L; typedef struct{L hi; L lo;} rp; rp cook(L x, L y, L z){return (rp){(x&y|x&z|y&z), x^y^z};} L vals[] = {0, -1, 0x4000, 0x4001, 0x3fff, 0x7fff, 0x8000, 0xcfff, 0xffff}; int main(){assert(sizeof(L) == 2); L a, b, c; {int j=9; while(j--) {a = vals[j]; {int j=9; while(j--) {b = vals[j]; {int j=9; while(j--) {c = vals[j]; {rp x = cook(a, b, c); assert(a+b+c == (x.hi<<1) + x.lo);}}}}}}} return 0;}