void select_into_reference(word_t *cond, word_t *when1, word_t *when0, word_t *target) {
    for (word_iter_t i = 0; i < WORDS; ++i) {
        target[i] = when0[i] ^ (cond[i] & (when0[i] ^ when1[i]));
    }
}

#if __AVX512F__
/// @note Under GCC -O3 the references implementation compiles into the same instruction
void select_into_ternary_avx512(word_t *cond, word_t *when1, word_t *when0, word_t *target) {
    __m512i *cond_vec = (__m512i *)cond;
    __m512i *when1_vec = (__m512i *)when1;
    __m512i *when0_vec = (__m512i *)when0;
    __m512i *target_vec = (__m512i *)target;

    for (word_iter_t i = 0; i < BITS/512; ++i) {
        _mm512_storeu_si512(target_vec + i,
                            _mm512_ternarylogic_epi64(_mm512_loadu_si512(cond_vec + i),
                                                      _mm512_loadu_si512(when1_vec + i),
                                                      _mm512_loadu_si512(when0_vec + i), 0xca));
    }
}
#endif

#if __AVX512F__
#define select_into select_into_ternary_avx512
#else
#define select_into select_into_reference
#endif

#if __AVX512F__
template <uint8_t op>
void ternary_into_avx512(word_t *x, word_t *y, word_t *z, word_t *target) {
    __m512i *x_vec = (__m512i *)x;
    __m512i *y_vec = (__m512i *)y;
    __m512i *z_vec = (__m512i *)z;
    __m512i *target_vec = (__m512i *)target;

    for (word_iter_t i = 0; i < BITS/512; ++i) {
        _mm512_storeu_si512(target_vec + i,
                            _mm512_ternarylogic_epi64(_mm512_loadu_si512(x_vec + i),
                                                      _mm512_loadu_si512(y_vec + i),
                                                      _mm512_loadu_si512(z_vec + i), op));
    }
}

// ["case " + str(i) + ": ternary_into_avx512<0x" + hex(i)[2:].rjust(2, "0") + ">(x, y, z, target); break;" for i in range(256)]
void dynamic_ternary_into_avx512(word_t *x, word_t *y, word_t *z, word_t *target, uint8_t op) {
    switch (op) {
        case 0: ternary_into_avx512<0x00>(x, y, z, target); break;
        case 1: ternary_into_avx512<0x01>(x, y, z, target); break;
        case 2: ternary_into_avx512<0x02>(x, y, z, target); break;
        case 3: ternary_into_avx512<0x03>(x, y, z, target); break;
        case 4: ternary_into_avx512<0x04>(x, y, z, target); break;
        case 5: ternary_into_avx512<0x05>(x, y, z, target); break;
        case 6: ternary_into_avx512<0x06>(x, y, z, target); break;
        case 7: ternary_into_avx512<0x07>(x, y, z, target); break;
        case 8: ternary_into_avx512<0x08>(x, y, z, target); break;
        case 9: ternary_into_avx512<0x09>(x, y, z, target); break;
        case 10: ternary_into_avx512<0x0a>(x, y, z, target); break;
        case 11: ternary_into_avx512<0x0b>(x, y, z, target); break;
        case 12: ternary_into_avx512<0x0c>(x, y, z, target); break;
        case 13: ternary_into_avx512<0x0d>(x, y, z, target); break;
        case 14: ternary_into_avx512<0x0e>(x, y, z, target); break;
        case 15: ternary_into_avx512<0x0f>(x, y, z, target); break;
        case 16: ternary_into_avx512<0x10>(x, y, z, target); break;
        case 17: ternary_into_avx512<0x11>(x, y, z, target); break;
        case 18: ternary_into_avx512<0x12>(x, y, z, target); break;
        case 19: ternary_into_avx512<0x13>(x, y, z, target); break;
        case 20: ternary_into_avx512<0x14>(x, y, z, target); break;
        case 21: ternary_into_avx512<0x15>(x, y, z, target); break;
        case 22: ternary_into_avx512<0x16>(x, y, z, target); break;
        case 23: ternary_into_avx512<0x17>(x, y, z, target); break;
        case 24: ternary_into_avx512<0x18>(x, y, z, target); break;
        case 25: ternary_into_avx512<0x19>(x, y, z, target); break;
        case 26: ternary_into_avx512<0x1a>(x, y, z, target); break;
        case 27: ternary_into_avx512<0x1b>(x, y, z, target); break;
        case 28: ternary_into_avx512<0x1c>(x, y, z, target); break;
        case 29: ternary_into_avx512<0x1d>(x, y, z, target); break;
        case 30: ternary_into_avx512<0x1e>(x, y, z, target); break;
        case 31: ternary_into_avx512<0x1f>(x, y, z, target); break;
        case 32: ternary_into_avx512<0x20>(x, y, z, target); break;
        case 33: ternary_into_avx512<0x21>(x, y, z, target); break;
        case 34: ternary_into_avx512<0x22>(x, y, z, target); break;
        case 35: ternary_into_avx512<0x23>(x, y, z, target); break;
        case 36: ternary_into_avx512<0x24>(x, y, z, target); break;
        case 37: ternary_into_avx512<0x25>(x, y, z, target); break;
        case 38: ternary_into_avx512<0x26>(x, y, z, target); break;
        case 39: ternary_into_avx512<0x27>(x, y, z, target); break;
        case 40: ternary_into_avx512<0x28>(x, y, z, target); break;
        case 41: ternary_into_avx512<0x29>(x, y, z, target); break;
        case 42: ternary_into_avx512<0x2a>(x, y, z, target); break;
        case 43: ternary_into_avx512<0x2b>(x, y, z, target); break;
        case 44: ternary_into_avx512<0x2c>(x, y, z, target); break;
        case 45: ternary_into_avx512<0x2d>(x, y, z, target); break;
        case 46: ternary_into_avx512<0x2e>(x, y, z, target); break;
        case 47: ternary_into_avx512<0x2f>(x, y, z, target); break;
        case 48: ternary_into_avx512<0x30>(x, y, z, target); break;
        case 49: ternary_into_avx512<0x31>(x, y, z, target); break;
        case 50: ternary_into_avx512<0x32>(x, y, z, target); break;
        case 51: ternary_into_avx512<0x33>(x, y, z, target); break;
        case 52: ternary_into_avx512<0x34>(x, y, z, target); break;
        case 53: ternary_into_avx512<0x35>(x, y, z, target); break;
        case 54: ternary_into_avx512<0x36>(x, y, z, target); break;
        case 55: ternary_into_avx512<0x37>(x, y, z, target); break;
        case 56: ternary_into_avx512<0x38>(x, y, z, target); break;
        case 57: ternary_into_avx512<0x39>(x, y, z, target); break;
        case 58: ternary_into_avx512<0x3a>(x, y, z, target); break;
        case 59: ternary_into_avx512<0x3b>(x, y, z, target); break;
        case 60: ternary_into_avx512<0x3c>(x, y, z, target); break;
        case 61: ternary_into_avx512<0x3d>(x, y, z, target); break;
        case 62: ternary_into_avx512<0x3e>(x, y, z, target); break;
        case 63: ternary_into_avx512<0x3f>(x, y, z, target); break;
        case 64: ternary_into_avx512<0x40>(x, y, z, target); break;
        case 65: ternary_into_avx512<0x41>(x, y, z, target); break;
        case 66: ternary_into_avx512<0x42>(x, y, z, target); break;
        case 67: ternary_into_avx512<0x43>(x, y, z, target); break;
        case 68: ternary_into_avx512<0x44>(x, y, z, target); break;
        case 69: ternary_into_avx512<0x45>(x, y, z, target); break;
        case 70: ternary_into_avx512<0x46>(x, y, z, target); break;
        case 71: ternary_into_avx512<0x47>(x, y, z, target); break;
        case 72: ternary_into_avx512<0x48>(x, y, z, target); break;
        case 73: ternary_into_avx512<0x49>(x, y, z, target); break;
        case 74: ternary_into_avx512<0x4a>(x, y, z, target); break;
        case 75: ternary_into_avx512<0x4b>(x, y, z, target); break;
        case 76: ternary_into_avx512<0x4c>(x, y, z, target); break;
        case 77: ternary_into_avx512<0x4d>(x, y, z, target); break;
        case 78: ternary_into_avx512<0x4e>(x, y, z, target); break;
        case 79: ternary_into_avx512<0x4f>(x, y, z, target); break;
        case 80: ternary_into_avx512<0x50>(x, y, z, target); break;
        case 81: ternary_into_avx512<0x51>(x, y, z, target); break;
        case 82: ternary_into_avx512<0x52>(x, y, z, target); break;
        case 83: ternary_into_avx512<0x53>(x, y, z, target); break;
        case 84: ternary_into_avx512<0x54>(x, y, z, target); break;
        case 85: ternary_into_avx512<0x55>(x, y, z, target); break;
        case 86: ternary_into_avx512<0x56>(x, y, z, target); break;
        case 87: ternary_into_avx512<0x57>(x, y, z, target); break;
        case 88: ternary_into_avx512<0x58>(x, y, z, target); break;
        case 89: ternary_into_avx512<0x59>(x, y, z, target); break;
        case 90: ternary_into_avx512<0x5a>(x, y, z, target); break;
        case 91: ternary_into_avx512<0x5b>(x, y, z, target); break;
        case 92: ternary_into_avx512<0x5c>(x, y, z, target); break;
        case 93: ternary_into_avx512<0x5d>(x, y, z, target); break;
        case 94: ternary_into_avx512<0x5e>(x, y, z, target); break;
        case 95: ternary_into_avx512<0x5f>(x, y, z, target); break;
        case 96: ternary_into_avx512<0x60>(x, y, z, target); break;
        case 97: ternary_into_avx512<0x61>(x, y, z, target); break;
        case 98: ternary_into_avx512<0x62>(x, y, z, target); break;
        case 99: ternary_into_avx512<0x63>(x, y, z, target); break;
        case 100: ternary_into_avx512<0x64>(x, y, z, target); break;
        case 101: ternary_into_avx512<0x65>(x, y, z, target); break;
        case 102: ternary_into_avx512<0x66>(x, y, z, target); break;
        case 103: ternary_into_avx512<0x67>(x, y, z, target); break;
        case 104: ternary_into_avx512<0x68>(x, y, z, target); break;
        case 105: ternary_into_avx512<0x69>(x, y, z, target); break;
        case 106: ternary_into_avx512<0x6a>(x, y, z, target); break;
        case 107: ternary_into_avx512<0x6b>(x, y, z, target); break;
        case 108: ternary_into_avx512<0x6c>(x, y, z, target); break;
        case 109: ternary_into_avx512<0x6d>(x, y, z, target); break;
        case 110: ternary_into_avx512<0x6e>(x, y, z, target); break;
        case 111: ternary_into_avx512<0x6f>(x, y, z, target); break;
        case 112: ternary_into_avx512<0x70>(x, y, z, target); break;
        case 113: ternary_into_avx512<0x71>(x, y, z, target); break;
        case 114: ternary_into_avx512<0x72>(x, y, z, target); break;
        case 115: ternary_into_avx512<0x73>(x, y, z, target); break;
        case 116: ternary_into_avx512<0x74>(x, y, z, target); break;
        case 117: ternary_into_avx512<0x75>(x, y, z, target); break;
        case 118: ternary_into_avx512<0x76>(x, y, z, target); break;
        case 119: ternary_into_avx512<0x77>(x, y, z, target); break;
        case 120: ternary_into_avx512<0x78>(x, y, z, target); break;
        case 121: ternary_into_avx512<0x79>(x, y, z, target); break;
        case 122: ternary_into_avx512<0x7a>(x, y, z, target); break;
        case 123: ternary_into_avx512<0x7b>(x, y, z, target); break;
        case 124: ternary_into_avx512<0x7c>(x, y, z, target); break;
        case 125: ternary_into_avx512<0x7d>(x, y, z, target); break;
        case 126: ternary_into_avx512<0x7e>(x, y, z, target); break;
        case 127: ternary_into_avx512<0x7f>(x, y, z, target); break;
        case 128: ternary_into_avx512<0x80>(x, y, z, target); break;
        case 129: ternary_into_avx512<0x81>(x, y, z, target); break;
        case 130: ternary_into_avx512<0x82>(x, y, z, target); break;
        case 131: ternary_into_avx512<0x83>(x, y, z, target); break;
        case 132: ternary_into_avx512<0x84>(x, y, z, target); break;
        case 133: ternary_into_avx512<0x85>(x, y, z, target); break;
        case 134: ternary_into_avx512<0x86>(x, y, z, target); break;
        case 135: ternary_into_avx512<0x87>(x, y, z, target); break;
        case 136: ternary_into_avx512<0x88>(x, y, z, target); break;
        case 137: ternary_into_avx512<0x89>(x, y, z, target); break;
        case 138: ternary_into_avx512<0x8a>(x, y, z, target); break;
        case 139: ternary_into_avx512<0x8b>(x, y, z, target); break;
        case 140: ternary_into_avx512<0x8c>(x, y, z, target); break;
        case 141: ternary_into_avx512<0x8d>(x, y, z, target); break;
        case 142: ternary_into_avx512<0x8e>(x, y, z, target); break;
        case 143: ternary_into_avx512<0x8f>(x, y, z, target); break;
        case 144: ternary_into_avx512<0x90>(x, y, z, target); break;
        case 145: ternary_into_avx512<0x91>(x, y, z, target); break;
        case 146: ternary_into_avx512<0x92>(x, y, z, target); break;
        case 147: ternary_into_avx512<0x93>(x, y, z, target); break;
        case 148: ternary_into_avx512<0x94>(x, y, z, target); break;
        case 149: ternary_into_avx512<0x95>(x, y, z, target); break;
        case 150: ternary_into_avx512<0x96>(x, y, z, target); break;
        case 151: ternary_into_avx512<0x97>(x, y, z, target); break;
        case 152: ternary_into_avx512<0x98>(x, y, z, target); break;
        case 153: ternary_into_avx512<0x99>(x, y, z, target); break;
        case 154: ternary_into_avx512<0x9a>(x, y, z, target); break;
        case 155: ternary_into_avx512<0x9b>(x, y, z, target); break;
        case 156: ternary_into_avx512<0x9c>(x, y, z, target); break;
        case 157: ternary_into_avx512<0x9d>(x, y, z, target); break;
        case 158: ternary_into_avx512<0x9e>(x, y, z, target); break;
        case 159: ternary_into_avx512<0x9f>(x, y, z, target); break;
        case 160: ternary_into_avx512<0xa0>(x, y, z, target); break;
        case 161: ternary_into_avx512<0xa1>(x, y, z, target); break;
        case 162: ternary_into_avx512<0xa2>(x, y, z, target); break;
        case 163: ternary_into_avx512<0xa3>(x, y, z, target); break;
        case 164: ternary_into_avx512<0xa4>(x, y, z, target); break;
        case 165: ternary_into_avx512<0xa5>(x, y, z, target); break;
        case 166: ternary_into_avx512<0xa6>(x, y, z, target); break;
        case 167: ternary_into_avx512<0xa7>(x, y, z, target); break;
        case 168: ternary_into_avx512<0xa8>(x, y, z, target); break;
        case 169: ternary_into_avx512<0xa9>(x, y, z, target); break;
        case 170: ternary_into_avx512<0xaa>(x, y, z, target); break;
        case 171: ternary_into_avx512<0xab>(x, y, z, target); break;
        case 172: ternary_into_avx512<0xac>(x, y, z, target); break;
        case 173: ternary_into_avx512<0xad>(x, y, z, target); break;
        case 174: ternary_into_avx512<0xae>(x, y, z, target); break;
        case 175: ternary_into_avx512<0xaf>(x, y, z, target); break;
        case 176: ternary_into_avx512<0xb0>(x, y, z, target); break;
        case 177: ternary_into_avx512<0xb1>(x, y, z, target); break;
        case 178: ternary_into_avx512<0xb2>(x, y, z, target); break;
        case 179: ternary_into_avx512<0xb3>(x, y, z, target); break;
        case 180: ternary_into_avx512<0xb4>(x, y, z, target); break;
        case 181: ternary_into_avx512<0xb5>(x, y, z, target); break;
        case 182: ternary_into_avx512<0xb6>(x, y, z, target); break;
        case 183: ternary_into_avx512<0xb7>(x, y, z, target); break;
        case 184: ternary_into_avx512<0xb8>(x, y, z, target); break;
        case 185: ternary_into_avx512<0xb9>(x, y, z, target); break;
        case 186: ternary_into_avx512<0xba>(x, y, z, target); break;
        case 187: ternary_into_avx512<0xbb>(x, y, z, target); break;
        case 188: ternary_into_avx512<0xbc>(x, y, z, target); break;
        case 189: ternary_into_avx512<0xbd>(x, y, z, target); break;
        case 190: ternary_into_avx512<0xbe>(x, y, z, target); break;
        case 191: ternary_into_avx512<0xbf>(x, y, z, target); break;
        case 192: ternary_into_avx512<0xc0>(x, y, z, target); break;
        case 193: ternary_into_avx512<0xc1>(x, y, z, target); break;
        case 194: ternary_into_avx512<0xc2>(x, y, z, target); break;
        case 195: ternary_into_avx512<0xc3>(x, y, z, target); break;
        case 196: ternary_into_avx512<0xc4>(x, y, z, target); break;
        case 197: ternary_into_avx512<0xc5>(x, y, z, target); break;
        case 198: ternary_into_avx512<0xc6>(x, y, z, target); break;
        case 199: ternary_into_avx512<0xc7>(x, y, z, target); break;
        case 200: ternary_into_avx512<0xc8>(x, y, z, target); break;
        case 201: ternary_into_avx512<0xc9>(x, y, z, target); break;
        case 202: ternary_into_avx512<0xca>(x, y, z, target); break;
        case 203: ternary_into_avx512<0xcb>(x, y, z, target); break;
        case 204: ternary_into_avx512<0xcc>(x, y, z, target); break;
        case 205: ternary_into_avx512<0xcd>(x, y, z, target); break;
        case 206: ternary_into_avx512<0xce>(x, y, z, target); break;
        case 207: ternary_into_avx512<0xcf>(x, y, z, target); break;
        case 208: ternary_into_avx512<0xd0>(x, y, z, target); break;
        case 209: ternary_into_avx512<0xd1>(x, y, z, target); break;
        case 210: ternary_into_avx512<0xd2>(x, y, z, target); break;
        case 211: ternary_into_avx512<0xd3>(x, y, z, target); break;
        case 212: ternary_into_avx512<0xd4>(x, y, z, target); break;
        case 213: ternary_into_avx512<0xd5>(x, y, z, target); break;
        case 214: ternary_into_avx512<0xd6>(x, y, z, target); break;
        case 215: ternary_into_avx512<0xd7>(x, y, z, target); break;
        case 216: ternary_into_avx512<0xd8>(x, y, z, target); break;
        case 217: ternary_into_avx512<0xd9>(x, y, z, target); break;
        case 218: ternary_into_avx512<0xda>(x, y, z, target); break;
        case 219: ternary_into_avx512<0xdb>(x, y, z, target); break;
        case 220: ternary_into_avx512<0xdc>(x, y, z, target); break;
        case 221: ternary_into_avx512<0xdd>(x, y, z, target); break;
        case 222: ternary_into_avx512<0xde>(x, y, z, target); break;
        case 223: ternary_into_avx512<0xdf>(x, y, z, target); break;
        case 224: ternary_into_avx512<0xe0>(x, y, z, target); break;
        case 225: ternary_into_avx512<0xe1>(x, y, z, target); break;
        case 226: ternary_into_avx512<0xe2>(x, y, z, target); break;
        case 227: ternary_into_avx512<0xe3>(x, y, z, target); break;
        case 228: ternary_into_avx512<0xe4>(x, y, z, target); break;
        case 229: ternary_into_avx512<0xe5>(x, y, z, target); break;
        case 230: ternary_into_avx512<0xe6>(x, y, z, target); break;
        case 231: ternary_into_avx512<0xe7>(x, y, z, target); break;
        case 232: ternary_into_avx512<0xe8>(x, y, z, target); break;
        case 233: ternary_into_avx512<0xe9>(x, y, z, target); break;
        case 234: ternary_into_avx512<0xea>(x, y, z, target); break;
        case 235: ternary_into_avx512<0xeb>(x, y, z, target); break;
        case 236: ternary_into_avx512<0xec>(x, y, z, target); break;
        case 237: ternary_into_avx512<0xed>(x, y, z, target); break;
        case 238: ternary_into_avx512<0xee>(x, y, z, target); break;
        case 239: ternary_into_avx512<0xef>(x, y, z, target); break;
        case 240: ternary_into_avx512<0xf0>(x, y, z, target); break;
        case 241: ternary_into_avx512<0xf1>(x, y, z, target); break;
        case 242: ternary_into_avx512<0xf2>(x, y, z, target); break;
        case 243: ternary_into_avx512<0xf3>(x, y, z, target); break;
        case 244: ternary_into_avx512<0xf4>(x, y, z, target); break;
        case 245: ternary_into_avx512<0xf5>(x, y, z, target); break;
        case 246: ternary_into_avx512<0xf6>(x, y, z, target); break;
        case 247: ternary_into_avx512<0xf7>(x, y, z, target); break;
        case 248: ternary_into_avx512<0xf8>(x, y, z, target); break;
        case 249: ternary_into_avx512<0xf9>(x, y, z, target); break;
        case 250: ternary_into_avx512<0xfa>(x, y, z, target); break;
        case 251: ternary_into_avx512<0xfb>(x, y, z, target); break;
        case 252: ternary_into_avx512<0xfc>(x, y, z, target); break;
        case 253: ternary_into_avx512<0xfd>(x, y, z, target); break;
        case 254: ternary_into_avx512<0xfe>(x, y, z, target); break;
        case 255: ternary_into_avx512<0xff>(x, y, z, target); break;
    }
}
#endif

void dynamic_ternary_into_reference(word_t *x, word_t *y, word_t *z, word_t *target, uint8_t op) {
    switch (op) {
        case 0: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = 0; break;
        case 1: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] | y[i]) | z[i])); break;
        case 2: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (z[i] & (~(x[i] | y[i]))); break;
        case 3: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(x[i] | y[i])); break;
        case 4: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (y[i] & (~(x[i] | z[i]))); break;
        case 5: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(x[i] | z[i])); break;
        case 6: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((~x[i]) & (y[i] ^ z[i])); break;
        case 7: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(x[i] | (y[i] & z[i]))); break;
        case 8: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((y[i] & z[i]) & (~x[i])); break;
        case 9: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(x[i] | (y[i] ^ z[i]))); break;
        case 10: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (z[i] & (~x[i])); break;
        case 11: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((~x[i]) & (z[i] | (~y[i]))); break;
        case 12: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (y[i] & (~x[i])); break;
        case 13: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((~x[i]) & (y[i] | (~z[i]))); break;
        case 14: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((~x[i]) & (y[i] | z[i])); break;
        case 15: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~x[i]); break;
        case 16: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (x[i] & (~(y[i] | z[i]))); break;
        case 17: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(y[i] | z[i])); break;
        case 18: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((~y[i]) & (x[i] ^ z[i])); break;
        case 19: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(y[i] | (x[i] & z[i]))); break;
        case 20: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((~z[i]) & (x[i] ^ y[i])); break;
        case 21: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(z[i] | (x[i] & y[i]))); break;
        case 22: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (((((x[i] & y[i]) & z[i]) ^ x[i]) ^ y[i]) ^ z[i]); break;
        case 23: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] | y[i]) & (z[i] | (x[i] & y[i])))); break;
        case 24: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] ^ y[i]) & (x[i] ^ z[i])); break;
        case 25: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] & y[i]) | (y[i] ^ z[i]))); break;
        case 26: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((z[i] | (x[i] & y[i])) ^ x[i]); break;
        case 27: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((z[i] & (x[i] ^ y[i])) ^ y[i])); break;
        case 28: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((y[i] | (x[i] & z[i])) ^ x[i]); break;
        case 29: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((y[i] & (x[i] ^ z[i])) ^ z[i])); break;
        case 30: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((y[i] | z[i]) ^ x[i]); break;
        case 31: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(x[i] & (y[i] | z[i]))); break;
        case 32: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] & z[i]) & (~y[i])); break;
        case 33: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(y[i] | (x[i] ^ z[i]))); break;
        case 34: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (z[i] & (~y[i])); break;
        case 35: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((~y[i]) & (z[i] | (~x[i]))); break;
        case 36: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] ^ y[i]) & (y[i] ^ z[i])); break;
        case 37: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] & y[i]) | (x[i] ^ z[i]))); break;
        case 38: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((z[i] | (x[i] & y[i])) ^ y[i]); break;
        case 39: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((z[i] & (x[i] ^ y[i])) ^ x[i])); break;
        case 40: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (z[i] & (x[i] ^ y[i])); break;
        case 41: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] & y[i]) | ((x[i] ^ y[i]) ^ z[i]))); break;
        case 42: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (z[i] & (~(x[i] & y[i]))); break;
        case 43: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(((x[i] ^ y[i]) & (y[i] ^ z[i])) ^ x[i])); break;
        case 44: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((y[i] | z[i]) & (x[i] ^ y[i])); break;
        case 45: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((y[i] | (~z[i])) ^ x[i]); break;
        case 46: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((y[i] | (x[i] ^ z[i])) ^ x[i]); break;
        case 47: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(x[i] & (y[i] | (~z[i])))); break;
        case 48: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (x[i] & (~y[i])); break;
        case 49: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((~y[i]) & (x[i] | (~z[i]))); break;
        case 50: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((~y[i]) & (x[i] | z[i])); break;
        case 51: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~y[i]); break;
        case 52: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] | (y[i] & z[i])) ^ y[i]); break;
        case 53: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] & (y[i] ^ z[i])) ^ z[i])); break;
        case 54: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] | z[i]) ^ y[i]); break;
        case 55: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(y[i] & (x[i] | z[i]))); break;
        case 56: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] | z[i]) & (x[i] ^ y[i])); break;
        case 57: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] | (~z[i])) ^ y[i]); break;
        case 58: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] | (y[i] ^ z[i])) ^ y[i]); break;
        case 59: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(y[i] & (x[i] | (~z[i])))); break;
        case 60: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (x[i] ^ y[i]); break;
        case 61: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((~(x[i] | z[i])) | (x[i] ^ y[i])); break;
        case 62: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((z[i] & (~x[i])) | (x[i] ^ y[i])); break;
        case 63: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(x[i] & y[i])); break;
        case 64: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] & y[i]) & (~z[i])); break;
        case 65: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(z[i] | (x[i] ^ y[i]))); break;
        case 66: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] ^ z[i]) & (y[i] ^ z[i])); break;
        case 67: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] & z[i]) | (x[i] ^ y[i]))); break;
        case 68: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (y[i] & (~z[i])); break;
        case 69: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((~z[i]) & (y[i] | (~x[i]))); break;
        case 70: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((y[i] | (x[i] & z[i])) ^ z[i]); break;
        case 71: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((y[i] & (x[i] ^ z[i])) ^ x[i])); break;
        case 72: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (y[i] & (x[i] ^ z[i])); break;
        case 73: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] & z[i]) | ((x[i] ^ y[i]) ^ z[i]))); break;
        case 74: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((y[i] | z[i]) & (x[i] ^ z[i])); break;
        case 75: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((z[i] | (~y[i])) ^ x[i]); break;
        case 76: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (y[i] & (~(x[i] & z[i]))); break;
        case 77: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(((x[i] ^ z[i]) & (y[i] ^ z[i])) ^ x[i])); break;
        case 78: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((z[i] | (x[i] ^ y[i])) ^ x[i]); break;
        case 79: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(x[i] & (z[i] | (~y[i])))); break;
        case 80: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (x[i] & (~z[i])); break;
        case 81: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((~z[i]) & (x[i] | (~y[i]))); break;
        case 82: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] | (y[i] & z[i])) ^ z[i]); break;
        case 83: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] & (y[i] ^ z[i])) ^ y[i])); break;
        case 84: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((~z[i]) & (x[i] | y[i])); break;
        case 85: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~z[i]); break;
        case 86: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] | y[i]) ^ z[i]); break;
        case 87: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(z[i] & (x[i] | y[i]))); break;
        case 88: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] | y[i]) & (x[i] ^ z[i])); break;
        case 89: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] | (~y[i])) ^ z[i]); break;
        case 90: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (x[i] ^ z[i]); break;
        case 91: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((~(x[i] | y[i])) | (x[i] ^ z[i])); break;
        case 92: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] | (y[i] ^ z[i])) ^ z[i]); break;
        case 93: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(z[i] & (x[i] | (~y[i])))); break;
        case 94: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((y[i] & (~x[i])) | (x[i] ^ z[i])); break;
        case 95: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(x[i] & z[i])); break;
        case 96: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (x[i] & (y[i] ^ z[i])); break;
        case 97: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((y[i] & z[i]) | ((x[i] ^ y[i]) ^ z[i]))); break;
        case 98: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] | z[i]) & (y[i] ^ z[i])); break;
        case 99: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((z[i] | (~x[i])) ^ y[i]); break;
        case 100: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] | y[i]) & (y[i] ^ z[i])); break;
        case 101: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((y[i] | (~x[i])) ^ z[i]); break;
        case 102: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (y[i] ^ z[i]); break;
        case 103: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((~(x[i] | y[i])) | (y[i] ^ z[i])); break;
        case 104: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (((((x[i] | y[i]) | z[i]) ^ x[i]) ^ y[i]) ^ z[i]); break;
        case 105: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] ^ y[i]) ^ z[i])); break;
        case 106: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] & y[i]) ^ z[i]); break;
        case 107: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] | y[i]) & ((x[i] ^ y[i]) ^ z[i]))); break;
        case 108: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] & z[i]) ^ y[i]); break;
        case 109: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] | z[i]) & ((x[i] ^ y[i]) ^ z[i]))); break;
        case 110: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((y[i] & (~x[i])) | (y[i] ^ z[i])); break;
        case 111: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((~x[i]) | (y[i] ^ z[i])); break;
        case 112: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (x[i] & (~(y[i] & z[i]))); break;
        case 113: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(((x[i] ^ y[i]) | (x[i] ^ z[i])) ^ x[i])); break;
        case 114: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((z[i] | (x[i] ^ y[i])) ^ y[i]); break;
        case 115: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(y[i] & (z[i] | (~x[i])))); break;
        case 116: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((y[i] | (x[i] ^ z[i])) ^ z[i]); break;
        case 117: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(z[i] & (y[i] | (~x[i])))); break;
        case 118: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] & (~y[i])) | (y[i] ^ z[i])); break;
        case 119: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(y[i] & z[i])); break;
        case 120: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((y[i] & z[i]) ^ x[i]); break;
        case 121: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((y[i] | z[i]) & ((x[i] ^ y[i]) ^ z[i]))); break;
        case 122: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] & (~y[i])) | (x[i] ^ z[i])); break;
        case 123: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((~y[i]) | (x[i] ^ z[i])); break;
        case 124: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] & (~z[i])) | (x[i] ^ y[i])); break;
        case 125: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((~z[i]) | (x[i] ^ y[i])); break;
        case 126: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] ^ y[i]) | (x[i] ^ z[i])); break;
        case 127: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] & y[i]) & z[i])); break;
        case 128: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] & y[i]) & z[i]); break;
        case 129: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] ^ y[i]) | (x[i] ^ z[i]))); break;
        case 130: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (z[i] & (~(x[i] ^ y[i]))); break;
        case 131: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((~(x[i] ^ y[i])) & (z[i] | (~x[i]))); break;
        case 132: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (y[i] & (~(x[i] ^ z[i]))); break;
        case 133: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((~(x[i] ^ z[i])) & (y[i] | (~x[i]))); break;
        case 134: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((y[i] | z[i]) & ((x[i] ^ y[i]) ^ z[i])); break;
        case 135: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((y[i] & z[i]) ^ x[i])); break;
        case 136: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (y[i] & z[i]); break;
        case 137: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((((y[i] | z[i]) | (~x[i])) ^ y[i]) ^ z[i]); break;
        case 138: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (z[i] & (y[i] | (~x[i]))); break;
        case 139: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((y[i] | (x[i] ^ z[i])) ^ z[i])); break;
        case 140: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (y[i] & (z[i] | (~x[i]))); break;
        case 141: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((z[i] | (x[i] ^ y[i])) ^ y[i])); break;
        case 142: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (((x[i] ^ y[i]) | (x[i] ^ z[i])) ^ x[i]); break;
        case 143: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((y[i] & z[i]) | (~x[i])); break;
        case 144: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (x[i] & (~(y[i] ^ z[i]))); break;
        case 145: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((~(y[i] ^ z[i])) & (x[i] | (~y[i]))); break;
        case 146: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] | z[i]) & ((x[i] ^ y[i]) ^ z[i])); break;
        case 147: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] & z[i]) ^ y[i])); break;
        case 148: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] | y[i]) & ((x[i] ^ y[i]) ^ z[i])); break;
        case 149: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] & y[i]) ^ z[i])); break;
        case 150: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] ^ y[i]) ^ z[i]); break;
        case 151: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((~(x[i] | y[i])) | ((x[i] ^ y[i]) ^ z[i])); break;
        case 152: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((((x[i] | y[i]) | z[i]) ^ y[i]) ^ z[i]); break;
        case 153: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(y[i] ^ z[i])); break;
        case 154: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] & (~y[i])) ^ z[i]); break;
        case 155: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] | y[i]) & (y[i] ^ z[i]))); break;
        case 156: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] & (~z[i])) ^ y[i]); break;
        case 157: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] | z[i]) & (y[i] ^ z[i]))); break;
        case 158: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((y[i] & z[i]) | ((x[i] ^ y[i]) ^ z[i])); break;
        case 159: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(x[i] & (y[i] ^ z[i]))); break;
        case 160: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (x[i] & z[i]); break;
        case 161: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((((x[i] | z[i]) | (~y[i])) ^ x[i]) ^ z[i]); break;
        case 162: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (z[i] & (x[i] | (~y[i]))); break;
        case 163: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] | (y[i] ^ z[i])) ^ z[i])); break;
        case 164: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((((x[i] | y[i]) | z[i]) ^ x[i]) ^ z[i]); break;
        case 165: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(x[i] ^ z[i])); break;
        case 166: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((y[i] & (~x[i])) ^ z[i]); break;
        case 167: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] | y[i]) & (x[i] ^ z[i]))); break;
        case 168: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (z[i] & (x[i] | y[i])); break;
        case 169: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] | y[i]) ^ z[i])); break;
        case 170: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = z[i]; break;
        case 171: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (z[i] | (~(x[i] | y[i]))); break;
        case 172: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] & (y[i] ^ z[i])) ^ y[i]); break;
        case 173: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] | (y[i] & z[i])) ^ z[i])); break;
        case 174: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (z[i] | (y[i] & (~x[i]))); break;
        case 175: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (z[i] | (~x[i])); break;
        case 176: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (x[i] & (z[i] | (~y[i]))); break;
        case 177: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((z[i] | (x[i] ^ y[i])) ^ x[i])); break;
        case 178: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (((x[i] ^ z[i]) & (y[i] ^ z[i])) ^ x[i]); break;
        case 179: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] & z[i]) | (~y[i])); break;
        case 180: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((y[i] & (~z[i])) ^ x[i]); break;
        case 181: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((y[i] | z[i]) & (x[i] ^ z[i]))); break;
        case 182: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] & z[i]) | ((x[i] ^ y[i]) ^ z[i])); break;
        case 183: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(y[i] & (x[i] ^ z[i]))); break;
        case 184: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((y[i] & (x[i] ^ z[i])) ^ x[i]); break;
        case 185: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((y[i] | (x[i] & z[i])) ^ z[i])); break;
        case 186: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (z[i] | (x[i] & (~y[i]))); break;
        case 187: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (z[i] | (~y[i])); break;
        case 188: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] & z[i]) | (x[i] ^ y[i])); break;
        case 189: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] ^ z[i]) & (y[i] ^ z[i]))); break;
        case 190: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (z[i] | (x[i] ^ y[i])); break;
        case 191: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] & y[i]) & (~z[i]))); break;
        case 192: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (x[i] & y[i]); break;
        case 193: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((((x[i] | y[i]) | (~z[i])) ^ x[i]) ^ y[i]); break;
        case 194: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((((x[i] | y[i]) | z[i]) ^ x[i]) ^ y[i]); break;
        case 195: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(x[i] ^ y[i])); break;
        case 196: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (y[i] & (x[i] | (~z[i]))); break;
        case 197: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] | (y[i] ^ z[i])) ^ y[i])); break;
        case 198: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((z[i] & (~x[i])) ^ y[i]); break;
        case 199: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] | z[i]) & (x[i] ^ y[i]))); break;
        case 200: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (y[i] & (x[i] | z[i])); break;
        case 201: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] | z[i]) ^ y[i])); break;
        case 202: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] & (y[i] ^ z[i])) ^ z[i]); break;
        case 203: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] | (y[i] & z[i])) ^ y[i])); break;
        case 204: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = y[i]; break;
        case 205: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (y[i] | (~(x[i] | z[i]))); break;
        case 206: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (y[i] | (z[i] & (~x[i]))); break;
        case 207: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (y[i] | (~x[i])); break;
        case 208: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (x[i] & (y[i] | (~z[i]))); break;
        case 209: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((y[i] | (x[i] ^ z[i])) ^ x[i])); break;
        case 210: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((z[i] & (~y[i])) ^ x[i]); break;
        case 211: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((y[i] | z[i]) & (x[i] ^ y[i]))); break;
        case 212: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (((x[i] ^ y[i]) & (y[i] ^ z[i])) ^ x[i]); break;
        case 213: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] & y[i]) | (~z[i])); break;
        case 214: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] & y[i]) | ((x[i] ^ y[i]) ^ z[i])); break;
        case 215: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~(z[i] & (x[i] ^ y[i]))); break;
        case 216: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((z[i] & (x[i] ^ y[i])) ^ x[i]); break;
        case 217: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((z[i] | (x[i] & y[i])) ^ y[i])); break;
        case 218: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] & y[i]) | (x[i] ^ z[i])); break;
        case 219: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] ^ y[i]) & (y[i] ^ z[i]))); break;
        case 220: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (y[i] | (x[i] & (~z[i]))); break;
        case 221: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (y[i] | (~z[i])); break;
        case 222: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (y[i] | (x[i] ^ z[i])); break;
        case 223: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] & z[i]) & (~y[i]))); break;
        case 224: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (x[i] & (y[i] | z[i])); break;
        case 225: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((y[i] | z[i]) ^ x[i])); break;
        case 226: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((y[i] & (x[i] ^ z[i])) ^ z[i]); break;
        case 227: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((y[i] | (x[i] & z[i])) ^ x[i])); break;
        case 228: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((z[i] & (x[i] ^ y[i])) ^ y[i]); break;
        case 229: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((z[i] | (x[i] & y[i])) ^ x[i])); break;
        case 230: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] & y[i]) | (y[i] ^ z[i])); break;
        case 231: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((x[i] ^ y[i]) & (x[i] ^ z[i]))); break;
        case 232: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] | y[i]) & (z[i] | (x[i] & y[i]))); break;
        case 233: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] & y[i]) | (((~z[i]) ^ x[i]) ^ y[i])); break;
        case 234: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (z[i] | (x[i] & y[i])); break;
        case 235: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (z[i] | (~(x[i] ^ y[i]))); break;
        case 236: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (y[i] | (x[i] & z[i])); break;
        case 237: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (y[i] | (~(x[i] ^ z[i]))); break;
        case 238: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (y[i] | z[i]); break;
        case 239: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((y[i] | z[i]) | (~x[i])); break;
        case 240: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = x[i]; break;
        case 241: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (x[i] | (~(y[i] | z[i]))); break;
        case 242: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (x[i] | (z[i] & (~y[i]))); break;
        case 243: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (x[i] | (~y[i])); break;
        case 244: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (x[i] | (y[i] & (~z[i]))); break;
        case 245: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (x[i] | (~z[i])); break;
        case 246: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (x[i] | (y[i] ^ z[i])); break;
        case 247: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (~((y[i] & z[i]) & (~x[i]))); break;
        case 248: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (x[i] | (y[i] & z[i])); break;
        case 249: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (x[i] | (~(y[i] ^ z[i]))); break;
        case 250: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (x[i] | z[i]); break;
        case 251: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] | z[i]) | (~y[i])); break;
        case 252: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = (x[i] | y[i]); break;
        case 253: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] | y[i]) | (~z[i])); break;
        case 254: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ((x[i] | y[i]) | z[i]); break;
        case 255: for (word_iter_t i = 0; i < WORDS; ++i) target[i] = ONE_WORD; break;
    }
}

#if __AVX512F__
#define dynamic_ternary_into dynamic_ternary_into_avx512
#else
#define dynamic_ternary_into dynamic_ternary_into_reference
#endif
