├── requirements.txt ├── output ├── sample4 ├── sample10 ├── sample12 ├── sample14 ├── sample15 ├── sample_multiple_paths ├── tigress-0-challenge-0 ├── tigress-0-challenge-1 ├── tigress-0-challenge-2 ├── tigress-0-challenge-3 ├── tigress-0-challenge-4 ├── tigress-1-challenge-0 ├── tigress-1-challenge-1 ├── tigress-1-challenge-2 ├── tigress-1-challenge-3 ├── tigress-1-challenge-4 ├── sample_symbolic_memory_easy ├── sample14.ll ├── sample_multiple_paths.ll ├── sample12.ll ├── sample4.ll ├── tigress-1-challenge-2.ll ├── tigress-0-challenge-3.ll ├── tigress-0-challenge-0.ll ├── tigress-1-challenge-4.ll ├── tigress-1-challenge-0.ll ├── tigress-1-challenge-1.ll ├── tigress-1-challenge-3.ll ├── sample15.ll ├── tigress-0-challenge-1.ll ├── sample10.ll ├── tigress-0-challenge-4.ll └── tigress-0-challenge-2.ll ├── .gitignore ├── samples ├── sample_multiple_paths ├── sample_symbolic_memory_easy ├── sample_symbolic_memory_hard ├── sample_multiple_paths.c ├── sample_symbolic_memory_hard.c └── sample_symbolic_memory_easy.c ├── template.c ├── LICENSE.md ├── testing_equality.py ├── tigress.py ├── README.md └── utils.py /requirements.txt: -------------------------------------------------------------------------------- 1 | angr 2 | llvmlite 3 | -------------------------------------------------------------------------------- /output/sample4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toshipiazza/Tigress_angr/HEAD/output/sample4 -------------------------------------------------------------------------------- /output/sample10: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toshipiazza/Tigress_angr/HEAD/output/sample10 -------------------------------------------------------------------------------- /output/sample12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toshipiazza/Tigress_angr/HEAD/output/sample12 -------------------------------------------------------------------------------- /output/sample14: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toshipiazza/Tigress_angr/HEAD/output/sample14 -------------------------------------------------------------------------------- /output/sample15: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toshipiazza/Tigress_angr/HEAD/output/sample15 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | env.sh 2 | llvm-6.0.0.src/ 3 | tigress-challenges/ 4 | llvmlite/ 5 | compile_all.sh 6 | run_all.sh 7 | -------------------------------------------------------------------------------- /output/sample_multiple_paths: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toshipiazza/Tigress_angr/HEAD/output/sample_multiple_paths -------------------------------------------------------------------------------- /output/tigress-0-challenge-0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toshipiazza/Tigress_angr/HEAD/output/tigress-0-challenge-0 -------------------------------------------------------------------------------- /output/tigress-0-challenge-1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toshipiazza/Tigress_angr/HEAD/output/tigress-0-challenge-1 -------------------------------------------------------------------------------- /output/tigress-0-challenge-2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toshipiazza/Tigress_angr/HEAD/output/tigress-0-challenge-2 -------------------------------------------------------------------------------- /output/tigress-0-challenge-3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toshipiazza/Tigress_angr/HEAD/output/tigress-0-challenge-3 -------------------------------------------------------------------------------- /output/tigress-0-challenge-4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toshipiazza/Tigress_angr/HEAD/output/tigress-0-challenge-4 -------------------------------------------------------------------------------- /output/tigress-1-challenge-0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toshipiazza/Tigress_angr/HEAD/output/tigress-1-challenge-0 -------------------------------------------------------------------------------- /output/tigress-1-challenge-1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toshipiazza/Tigress_angr/HEAD/output/tigress-1-challenge-1 -------------------------------------------------------------------------------- /output/tigress-1-challenge-2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toshipiazza/Tigress_angr/HEAD/output/tigress-1-challenge-2 -------------------------------------------------------------------------------- /output/tigress-1-challenge-3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toshipiazza/Tigress_angr/HEAD/output/tigress-1-challenge-3 -------------------------------------------------------------------------------- /output/tigress-1-challenge-4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toshipiazza/Tigress_angr/HEAD/output/tigress-1-challenge-4 -------------------------------------------------------------------------------- /samples/sample_multiple_paths: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toshipiazza/Tigress_angr/HEAD/samples/sample_multiple_paths -------------------------------------------------------------------------------- /output/sample_symbolic_memory_easy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toshipiazza/Tigress_angr/HEAD/output/sample_symbolic_memory_easy -------------------------------------------------------------------------------- /samples/sample_symbolic_memory_easy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toshipiazza/Tigress_angr/HEAD/samples/sample_symbolic_memory_easy -------------------------------------------------------------------------------- /samples/sample_symbolic_memory_hard: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toshipiazza/Tigress_angr/HEAD/samples/sample_symbolic_memory_hard -------------------------------------------------------------------------------- /template.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | uint64_t SECRET(uint64_t); 6 | int main(int argc, char *argv[]) 7 | { 8 | printf("%lu\n", SECRET(strtoul(argv[1], NULL, 10))); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /samples/sample_multiple_paths.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | uint64_t SECRET(uint64_t input) { 6 | int i = 0; 7 | /* Exercise support for multiple symbolic branches; 8 | * this branch can happen at most ~6 times so it's 9 | * still a tractable example. 10 | */ 11 | while (input /= 2048) 12 | i += 1; 13 | return i; 14 | } 15 | 16 | int main(int argc, char **argv) { 17 | if (argc < 2) { 18 | printf("Call this program with 1 arguments\n"); 19 | return 1; 20 | } 21 | printf("%lu\n", SECRET(strtoul(argv[1], 0, 10))); 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /output/sample14.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = '' 2 | source_filename = "" 3 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 4 | target triple = "unknown-unknown-unknown" 5 | 6 | ; Function Attrs: norecurse nounwind readnone 7 | define i64 @SECRET(i64 %.1) local_unnamed_addr #0 { 8 | .3: 9 | %const = bitcast i64 -7070675565921424023 to i64 10 | %.5 = lshr i64 %.1, 32 11 | %.24 = shl i64 %.1, 3 12 | %.25 = and i64 %.24, 34359738360 13 | %.27 = add nuw nsw i64 %.25, 8 14 | %.28 = xor i64 %.27, %.5 15 | %.29 = mul i64 %.28, %const 16 | %.30 = xor i64 %.29, %.5 17 | %.50 = lshr i64 %.29, 47 18 | %.56 = xor i64 %.30, %.50 19 | %.57 = mul i64 %.56, %const 20 | %.111 = lshr i64 %.57, 47 21 | %.117 = xor i64 %.111, %.57 22 | %.118 = mul i64 %.117, %const 23 | ret i64 %.118 24 | } 25 | 26 | attributes #0 = { norecurse nounwind readnone } 27 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright 2018 Toshi Piazza 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | software and associated documentation files (the "Software"), to deal in the Software 5 | without restriction, including without limitation the rights to use, copy, modify, merge, 6 | publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | to whom the Software is furnished to do so, subject to the following conditions: 8 | 9 | The above copyright notice and this permission notice shall be included in all copies or 10 | substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | DEALINGS IN THE SOFTWARE. 18 | -------------------------------------------------------------------------------- /samples/sample_symbolic_memory_hard.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | static unsigned int table[256]; 6 | 7 | /* http://www.hackersdelight.org/hdcodetxt/crc.c.txt */ 8 | unsigned int crc32c(unsigned char *message, int len) { 9 | unsigned int byte, crc, mask; 10 | /* this is all constant wrt input */ 11 | for (byte = 0; byte <= 255; byte++) { 12 | crc = byte; 13 | for (int j = 7; j >= 0; j--) { 14 | mask = -(crc & 1); 15 | crc = (crc >> 1) ^ (0xEDB88320 & mask); 16 | } 17 | table[byte] = crc; 18 | } 19 | crc = 0xFFFFFFFF; 20 | for (int i = 0; i < len; ++i) { 21 | byte = message[i]; 22 | /* table lookup has symbolic index, exercises symbolic 23 | * memory subsystem 24 | */ 25 | crc = (crc >> 8) ^ table[(crc ^ byte) & 0xFF]; 26 | i = i + 1; 27 | } 28 | return ~crc; 29 | } 30 | 31 | uint64_t SECRET(uint64_t input) { 32 | return (uint64_t)crc32c((unsigned char *)&input, sizeof(input)); 33 | } 34 | 35 | int main(int argc, char **argv) { 36 | if (argc < 2) { 37 | printf("Call this program with 1 arguments\n"); 38 | return 1; 39 | } 40 | printf("%lu\n", SECRET(strtoul(argv[1], 0, 10))); 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /output/sample_multiple_paths.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = '' 2 | source_filename = "" 3 | target triple = "unknown-unknown-unknown" 4 | 5 | ; Function Attrs: norecurse nounwind readnone 6 | define i64 @SECRET(i64 %.1) local_unnamed_addr #0 { 7 | .3: 8 | %.5 = icmp ult i64 %.1, 2048 9 | br i1 %.5, label %.3.if, label %.3.endif 10 | 11 | .3.if: ; preds = %.3.endif.endif.endif, %.3.endif.endif, %.3.endif, %.3 12 | %merge = phi i64 [ 0, %.3 ], [ 1, %.3.endif ], [ 2, %.3.endif.endif ], [ 3, %.3.endif.endif.endif ] 13 | ret i64 %merge 14 | 15 | .3.endif: ; preds = %.3 16 | %.17 = icmp ult i64 %.1, 4194304 17 | br i1 %.17, label %.3.if, label %.3.endif.endif 18 | 19 | .3.endif.endif: ; preds = %.3.endif 20 | %.38 = icmp ult i64 %.1, 8589934592 21 | br i1 %.38, label %.3.if, label %.3.endif.endif.endif 22 | 23 | .3.endif.endif.endif: ; preds = %.3.endif.endif 24 | %.68 = icmp ult i64 %.1, 17592186044416 25 | br i1 %.68, label %.3.if, label %.3.endif.endif.endif.endif 26 | 27 | .3.endif.endif.endif.endif: ; preds = %.3.endif.endif.endif 28 | %.107 = icmp ult i64 %.1, 36028797018963968 29 | %spec.select = select i1 %.107, i64 4, i64 5 30 | ret i64 %spec.select 31 | } 32 | 33 | attributes #0 = { norecurse nounwind readnone } 34 | -------------------------------------------------------------------------------- /output/sample12.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = '' 2 | source_filename = "" 3 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 4 | target triple = "unknown-unknown-unknown" 5 | 6 | ; Function Attrs: norecurse nounwind readnone 7 | define i64 @SECRET(i64 %.1) local_unnamed_addr #0 { 8 | .3: 9 | %.5 = lshr i64 %.1, 24 10 | %0 = trunc i64 %.5 to i32 11 | %.7 = and i32 %0, 255 12 | %.11 = lshr i64 %.1, 16 13 | %1 = trunc i64 %.11 to i32 14 | %.13 = and i32 %1, 255 15 | %.17 = lshr i64 %.1, 8 16 | %2 = trunc i64 %.17 to i32 17 | %.19 = and i32 %2, 255 18 | %.23 = lshr i64 %.1, 6 19 | %.24 = trunc i64 %.23 to i2 20 | %.25 = xor i2 %.24, -1 21 | %.26 = zext i2 %.25 to i26 22 | %.29 = or i26 %.26, -33262988 23 | %.30 = lshr i64 %.1, 3 24 | %3 = trunc i64 %.30 to i29 25 | %.32 = and i29 %3, 7 26 | %.33 = zext i26 %.29 to i29 27 | %.34 = shl nuw i29 %.33, 3 28 | %.35 = or i29 %.34, %.32 29 | %4 = lshr i64 %.1, 2 30 | %5 = trunc i64 %4 to i30 31 | %6 = and i30 %5, 1 32 | %.40 = zext i29 %.35 to i30 33 | %7 = shl nuw i30 %.40, 1 34 | %.41 = or i30 %7, %6 35 | %.42 = xor i30 %.41, 1 36 | %8 = lshr i64 %.1, 1 37 | %9 = trunc i64 %8 to i31 38 | %10 = and i31 %9, 1 39 | %.46 = zext i30 %.42 to i31 40 | %.47 = shl nuw i31 %.46, 1 41 | %.48 = or i31 %.47, %10 42 | %11 = trunc i64 %.1 to i32 43 | %12 = and i32 %11, 1 44 | %.53 = zext i31 %.48 to i32 45 | %13 = shl nuw i32 %.53, 1 46 | %.54 = or i32 %13, %12 47 | %.55 = xor i32 %.54, 1 48 | %.56 = mul i32 %.55, 16777619 49 | %.57 = xor i32 %.56, %.19 50 | %.58 = mul i32 %.57, 16777619 51 | %.59 = xor i32 %.58, %.13 52 | %.60 = mul i32 %.59, 16777619 53 | %.61 = xor i32 %.60, %.7 54 | %.62 = mul i32 %.61, 16777619 55 | %.63 = zext i32 %.62 to i64 56 | ret i64 %.63 57 | } 58 | 59 | attributes #0 = { norecurse nounwind readnone } 60 | -------------------------------------------------------------------------------- /samples/sample_symbolic_memory_easy.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | static int scramble[] = { 6 | 250, 134, 87, 117, 237, 188, 99, 58, 239, 67, 125, 78, 216, 231, 212, 167, 7 | 178, 94, 10, 230, 137, 213, 159, 152, 36, 51, 24, 151, 146, 158, 143, 42, 8 | 11, 160, 123, 208, 15, 131, 16, 247, 153, 191, 41, 17, 156, 113, 56, 254, 9 | 91, 129, 19, 95, 72, 225, 235, 45, 102, 183, 157, 180, 196, 28, 96, 194, 10 | 49, 46, 31, 201, 68, 249, 108, 106, 4, 133, 69, 30, 1, 149, 18, 166, 11 | 222, 205, 227, 97, 130, 119, 224, 104, 109, 245, 197, 187, 100, 193, 207, 110, 12 | 217, 26, 39, 37, 116, 223, 0, 8, 92, 128, 120, 57, 47, 147, 243, 229, 13 | 74, 43, 220, 190, 115, 114, 5, 63, 142, 121, 240, 59, 173, 181, 145, 195, 14 | 221, 170, 139, 186, 7, 111, 203, 66, 161, 14, 60, 192, 215, 211, 86, 98, 15 | 198, 251, 6, 206, 174, 162, 35, 71, 135, 136, 12, 83, 171, 144, 255, 165, 16 | 242, 85, 210, 202, 105, 52, 54, 154, 77, 27, 101, 204, 148, 62, 168, 89, 17 | 172, 228, 32, 185, 76, 219, 246, 44, 132, 22, 184, 64, 122, 234, 176, 126, 18 | 55, 236, 232, 214, 155, 3, 13, 75, 84, 138, 177, 226, 70, 163, 53, 124, 19 | 179, 164, 50, 103, 200, 81, 199, 79, 140, 90, 233, 112, 25, 33, 150, 218, 20 | 253, 141, 88, 244, 118, 241, 107, 175, 189, 9, 20, 21, 252, 61, 65, 80, 21 | 182, 73, 248, 93, 238, 29, 82, 34, 40, 2, 23, 38, 209, 48, 127, 169 22 | }; 23 | 24 | uint64_t SECRET(uint64_t input) { 25 | uint64_t ret; 26 | for (int i = 0; i < sizeof(input); ++i) 27 | ((char *)ret)[i] = scramble[((char *)input)[i]] 28 | return ret; 29 | } 30 | 31 | int main(int argc, char **argv) { 32 | if (argc < 2) { 33 | printf("Call this program with 1 arguments\n"); 34 | return 1; 35 | } 36 | printf("%lu\n", SECRET(strtoul(argv[1], 0, 10))); 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /testing_equality.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import claripy 4 | import angr 5 | import logging 6 | import tigress 7 | 8 | 9 | def main(obfuscated, deobfuscated, num_tests): 10 | l = logging.getLogger("tigress") 11 | 12 | # challenges all feed input to strtoul, and dump output hash via 13 | # printf; we hook them both here for ease of implementation 14 | l.info("Exploring all possible paths") 15 | p = angr.Project(obfuscated) 16 | input = claripy.BVS('input', 64) 17 | p.hook_symbol('strtoul', tigress.Strtol(input)) 18 | p.hook_symbol('printf', tigress.Printf()) 19 | s = p.factory.entry_state(args=[obfuscated, 'dummy'], 20 | add_options=angr.options.unicorn) 21 | sm = p.factory.simulation_manager(s) 22 | sm.explore() 23 | 24 | wrong = 0 25 | total = 0 26 | for i in sm.deadended: 27 | # Generates up to num_tests satisfying inputs to get 28 | # to this deadended path 29 | l.info("Generating test cases for deadended path") 30 | for test in i.solver.eval_upto(input, num_tests): 31 | if run_binary(obfuscated, test) != run_binary(deobfuscated, test): 32 | l.warn("Test case {} failed!".format(test)) 33 | wrong += 1 34 | total += 1 35 | l.warn("Success rate: {}/{} ({}%)".format(total-wrong, total, float(total-wrong)/total*100)) 36 | 37 | 38 | def run_binary(binary, arg): 39 | from subprocess import Popen, PIPE 40 | p = Popen([binary, str(arg)], stdout=PIPE) 41 | stdout, _ = p.communicate() 42 | return int(stdout) 43 | 44 | 45 | if __name__ == '__main__': 46 | import argparse 47 | import os 48 | 49 | logging.getLogger('angr').setLevel('WARNING') 50 | logging.getLogger('tigress').setLevel('INFO') 51 | 52 | parser = argparse.ArgumentParser() 53 | parser.add_argument('obfuscated') 54 | parser.add_argument('deobfuscated') 55 | parser.add_argument('--num_tests', type=int) 56 | parser.set_defaults(num_tests=100) 57 | args = parser.parse_args() 58 | main(args.obfuscated, args.deobfuscated, args.num_tests) 59 | -------------------------------------------------------------------------------- /output/sample4.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = '' 2 | source_filename = "" 3 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 4 | target triple = "unknown-unknown-unknown" 5 | 6 | ; Function Attrs: norecurse nounwind readnone 7 | define i64 @SECRET(i64 %.1) local_unnamed_addr #0 { 8 | .3: 9 | %0 = trunc i64 %.1 to i32 10 | %.7 = and i32 %0, 255 11 | %.11 = add nuw nsw i32 %.7, 1 12 | %1 = urem i32 %.11, 65521 13 | %.19 = lshr i64 %.1, 8 14 | %2 = trunc i64 %.19 to i32 15 | %.21 = and i32 %2, 255 16 | %.25 = add nuw nsw i32 %1, %.21 17 | %3 = urem i32 %.25, 65521 18 | %.33 = lshr i64 %.1, 16 19 | %4 = trunc i64 %.33 to i32 20 | %.35 = and i32 %4, 255 21 | %.39 = add nuw nsw i32 %3, %.35 22 | %5 = urem i32 %.39, 65521 23 | %.47 = lshr i64 %.1, 24 24 | %6 = trunc i64 %.47 to i32 25 | %.49 = and i32 %6, 255 26 | %.53 = add nuw nsw i32 %5, %.49 27 | %7 = urem i32 %.53, 65521 28 | %.61 = lshr i64 %.1, 32 29 | %8 = trunc i64 %.61 to i32 30 | %.63 = and i32 %8, 255 31 | %.67 = add nuw nsw i32 %7, %.63 32 | %9 = urem i32 %.67, 65521 33 | %.75 = lshr i64 %.1, 40 34 | %10 = trunc i64 %.75 to i32 35 | %.77 = and i32 %10, 255 36 | %.81 = add nuw nsw i32 %9, %.77 37 | %11 = urem i32 %.81, 65521 38 | %.89 = lshr i64 %.1, 48 39 | %12 = trunc i64 %.89 to i32 40 | %.91 = and i32 %12, 255 41 | %.95 = add nuw nsw i32 %11, %.91 42 | %13 = urem i32 %.95, 65521 43 | %.103 = lshr i64 %.1, 56 44 | %14 = trunc i64 %.103 to i32 45 | %.105 = and i32 %14, 255 46 | %.109 = add nuw nsw i32 %13, %.105 47 | %15 = urem i32 %.109, 65521 48 | %.516 = add nuw nsw i32 %3, %1 49 | %16 = urem i32 %.516, 65521 50 | %.524 = add nuw nsw i32 %5, %16 51 | %17 = urem i32 %.524, 65521 52 | %.532 = add nuw nsw i32 %7, %17 53 | %18 = urem i32 %.532, 65521 54 | %.540 = add nuw nsw i32 %9, %18 55 | %19 = urem i32 %.540, 65521 56 | %.548 = add nuw nsw i32 %11, %19 57 | %20 = urem i32 %.548, 65521 58 | %.556 = add nuw nsw i32 %13, %20 59 | %21 = urem i32 %.556, 65521 60 | %.564 = add nuw nsw i32 %15, %21 61 | %22 = urem i32 %.564, 65521 62 | %.574 = shl nuw i32 %22, 16 63 | %.688 = or i32 %.574, %15 64 | %.689 = zext i32 %.688 to i64 65 | ret i64 %.689 66 | } 67 | 68 | attributes #0 = { norecurse nounwind readnone } 69 | -------------------------------------------------------------------------------- /output/tigress-1-challenge-2.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = '' 2 | source_filename = "" 3 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 4 | target triple = "unknown-unknown-unknown" 5 | 6 | ; Function Attrs: norecurse nounwind readnone 7 | define i64 @SECRET(i64 %.1) local_unnamed_addr #0 { 8 | .3: 9 | %.197 = add i64 %.1, -902749805 10 | %0 = udiv i64 %.1, 7 11 | %1 = trunc i64 %0 to i3 12 | %.207 = shl i3 %1, 1 13 | %2 = lshr i64 %0, 1 14 | %.215 = trunc i64 %2 to i3 15 | %.216 = or i3 %.207, %.215 16 | %.222 = zext i3 %.216 to i6 17 | %.223 = shl nuw nsw i6 %.222, 1 18 | %.224 = or i6 %.223, 1 19 | %.225 = sub nsw i6 0, %.224 20 | %.226 = zext i6 %.225 to i64 21 | %.230 = lshr i64 %.197, %.226 22 | %.256 = zext i3 %.216 to i64 23 | %.257 = shl nuw nsw i64 %.256, 1 24 | %.258 = or i64 %.257, 1 25 | %.259 = shl i64 %.197, %.258 26 | %.260 = or i64 %.230, %.259 27 | %3 = lshr i64 %0, 3 28 | %.297 = and i64 %3, 14 29 | %.298 = or i64 %.297, 1 30 | %.299 = shl i64 127996265, %.298 31 | %4 = lshr i64 %.299, 4 32 | %.309 = and i64 %4, 14 33 | %.310 = or i64 %.309, 1 34 | %.311 = shl i64 %.1, %.310 35 | %5 = trunc i64 %4 to i5 36 | %6 = and i5 %5, 14 37 | %7 = or i5 %6, 1 38 | %.361 = zext i5 %7 to i6 39 | %.362 = sub nsw i6 0, %.361 40 | %.363 = zext i6 %.362 to i64 41 | %.367 = lshr i64 %.1, %.363 42 | %.368 = or i64 %.367, %.311 43 | %.369 = mul i64 %.1, 343000538 44 | %.370 = add i64 %.369, 1638886 45 | %8 = lshr i64 %.370, 18 46 | %.379 = and i64 %8, 14 47 | %.380 = or i64 %.379, 1 48 | %.381 = shl i64 %.368, %.380 49 | %9 = trunc i64 %8 to i5 50 | %10 = and i5 %9, 14 51 | %11 = or i5 %10, 1 52 | %.503 = zext i5 %11 to i6 53 | %.504 = sub nsw i6 0, %.503 54 | %.505 = zext i6 %.504 to i64 55 | %.509 = lshr i64 %.368, %.505 56 | %.38228 = or i64 %.381, %.509 57 | %12 = lshr i64 %.38228, 4 58 | %.519 = and i64 %12, 14 59 | %.520 = or i64 %.519, 1 60 | %.521 = lshr i64 %.260, %.520 61 | %13 = trunc i64 %12 to i5 62 | %14 = and i5 %13, 14 63 | %15 = or i5 %14, 1 64 | %.845 = zext i5 %15 to i6 65 | %.846 = sub nsw i6 0, %.845 66 | %.847 = zext i6 %.846 to i64 67 | %.851 = shl i64 %.260, %.847 68 | %.852 = or i64 %.851, %.521 69 | ret i64 %.852 70 | } 71 | 72 | attributes #0 = { norecurse nounwind readnone } 73 | -------------------------------------------------------------------------------- /output/tigress-0-challenge-3.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = '' 2 | source_filename = "" 3 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 4 | target triple = "unknown-unknown-unknown" 5 | 6 | ; Function Attrs: norecurse nounwind readnone 7 | define i64 @SECRET(i64 %.1) local_unnamed_addr #0 { 8 | .3: 9 | %.7 = lshr i64 %.1, 1 10 | %.11 = shl i64 %.1, 63 11 | %.12 = or i64 %.11, %.7 12 | %.21 = mul i64 %.12, %.12 13 | %0 = lshr i64 %.1, 3 14 | %.39 = and i64 %0, 6 15 | %.40 = or i64 %.39, 1 16 | %.41 = lshr i64 %.1, %.40 17 | %1 = lshr i64 %.41, 26 18 | %.46 = trunc i64 %1 to i38 19 | %.47 = or i38 %.46, 15 20 | %.68 = lshr i64 %.41, 24 21 | %2 = trunc i64 %.68 to i40 22 | %.70 = and i40 %2, 3 23 | %.71 = zext i38 %.47 to i40 24 | %.72 = shl nuw i40 %.71, 2 25 | %.73 = or i40 %.72, %.70 26 | %.75 = zext i40 %.73 to i43 27 | %.76 = shl nuw i43 %.75, 3 28 | %.77 = or i43 %.76, 7 29 | %.98 = lshr i64 %.41, 18 30 | %3 = trunc i64 %.98 to i46 31 | %.100 = and i46 %3, 7 32 | %.101 = zext i43 %.77 to i46 33 | %.102 = shl nuw i46 %.101, 3 34 | %.103 = or i46 %.102, %.100 35 | %.105 = zext i46 %.103 to i51 36 | %.106 = shl nuw i51 %.105, 5 37 | %.107 = or i51 %.106, 31 38 | %4 = lshr i64 %.41, 12 39 | %5 = trunc i64 %4 to i52 40 | %6 = and i52 %5, 1 41 | %.131 = zext i51 %.107 to i52 42 | %.132 = shl nuw i52 %.131, 1 43 | %.133 = or i52 %.132, %6 44 | %.135 = zext i52 %.133 to i54 45 | %.136 = shl nuw i54 %.135, 2 46 | %.137 = or i54 %.136, 3 47 | %.158 = lshr i64 %.41, 8 48 | %7 = trunc i64 %.158 to i56 49 | %.160 = and i56 %7, 3 50 | %.161 = zext i54 %.137 to i56 51 | %.162 = shl nuw i56 %.161, 2 52 | %.163 = or i56 %.162, %.160 53 | %.165 = zext i56 %.163 to i59 54 | %.166 = shl nuw i59 %.165, 3 55 | %.167 = or i59 %.166, 7 56 | %.188 = lshr i64 %.41, 3 57 | %8 = trunc i64 %.188 to i61 58 | %.190 = and i61 %8, 3 59 | %.191 = zext i59 %.167 to i61 60 | %.192 = shl nuw i61 %.191, 2 61 | %.193 = or i61 %.192, %.190 62 | %.195 = zext i61 %.193 to i62 63 | %.196 = shl nuw i62 %.195, 1 64 | %.197 = or i62 %.196, 1 65 | %9 = lshr i64 %.41, 1 66 | %10 = trunc i64 %9 to i63 67 | %11 = and i63 %10, 1 68 | %.221 = zext i62 %.197 to i63 69 | %.222 = shl nuw i63 %.221, 1 70 | %.223 = or i63 %.222, %11 71 | %.225 = zext i63 %.223 to i64 72 | %.226 = shl nuw i64 %.225, 1 73 | %.227 = or i64 %.226, 1 74 | %.229 = sub i64 %.21, %.227 75 | %.238 = and i64 %.1, -2 76 | %.239 = add i64 %.1, 40 77 | %12 = lshr i64 %.239, 4 78 | %.248 = and i64 %12, 6 79 | %.249 = or i64 %.248, 1 80 | %.250 = shl i64 %.238, %.249 81 | %13 = lshr exact i64 %.250, 1 82 | %.253 = trunc i64 %13 to i5 83 | %14 = and i5 %.253, 14 84 | %15 = or i5 %14, 1 85 | %.260 = zext i5 %15 to i6 86 | %.261 = sub nsw i6 0, %.260 87 | %.262 = zext i6 %.261 to i64 88 | %.266 = lshr i64 %.229, %.262 89 | %.520 = and i64 %13, 14 90 | %.522 = or i64 %.520, 1 91 | %.523 = shl i64 %.229, %.522 92 | %.524 = or i64 %.266, %.523 93 | ret i64 %.524 94 | } 95 | 96 | attributes #0 = { norecurse nounwind readnone } 97 | -------------------------------------------------------------------------------- /output/tigress-0-challenge-0.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = '' 2 | source_filename = "" 3 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 4 | target triple = "unknown-unknown-unknown" 5 | 6 | ; Function Attrs: norecurse nounwind readnone 7 | define i64 @SECRET(i64 %.1) local_unnamed_addr #0 { 8 | .3: 9 | %.5 = add i64 %.1, 886599889 10 | %.6 = or i64 %.5, %.1 11 | %.7 = or i64 %.6, -637752949 12 | %reass.add = add i64 %.7, %.1 13 | %reass.mul = mul i64 %reass.add, 746348727 14 | %.11 = add i64 %reass.mul, 661712698513491303 15 | %0 = lshr i64 %.1, 26 16 | %.16 = trunc i64 %0 to i38 17 | %.17 = or i38 %.16, 1 18 | %.18 = lshr i64 %.1, 23 19 | %1 = trunc i64 %.18 to i41 20 | %.20 = and i41 %1, 7 21 | %.21 = zext i38 %.17 to i41 22 | %.22 = shl nuw i41 %.21, 3 23 | %.23 = or i41 %.22, %.20 24 | %.25 = zext i41 %.23 to i43 25 | %.26 = shl nuw i43 %.25, 2 26 | %.27 = or i43 %.26, 3 27 | %2 = lshr i64 %.1, 20 28 | %3 = trunc i64 %2 to i44 29 | %4 = and i44 %3, 1 30 | %.31 = zext i43 %.27 to i44 31 | %.32 = shl nuw i44 %.31, 1 32 | %.33 = or i44 %.32, %4 33 | %.35 = zext i44 %.33 to i45 34 | %.36 = shl nuw i45 %.35, 1 35 | %.37 = or i45 %.36, 1 36 | %5 = lshr i64 %.1, 18 37 | %6 = trunc i64 %5 to i46 38 | %7 = and i46 %6, 1 39 | %.41 = zext i45 %.37 to i46 40 | %.42 = shl nuw i46 %.41, 1 41 | %.43 = or i46 %.42, %7 42 | %.45 = zext i46 %.43 to i50 43 | %.46 = shl nuw i50 %.45, 4 44 | %.47 = or i50 %.46, 15 45 | %.48 = lshr i64 %.1, 11 46 | %8 = trunc i64 %.48 to i53 47 | %.50 = and i53 %8, 7 48 | %.51 = zext i50 %.47 to i53 49 | %.52 = shl nuw i53 %.51, 3 50 | %.53 = or i53 %.52, %.50 51 | %.55 = zext i53 %.53 to i54 52 | %.56 = shl nuw i54 %.55, 1 53 | %.57 = or i54 %.56, 1 54 | %.58 = lshr i64 %.1, 8 55 | %9 = trunc i64 %.58 to i56 56 | %.60 = and i56 %9, 3 57 | %.61 = zext i54 %.57 to i56 58 | %.62 = shl nuw i56 %.61, 2 59 | %.63 = or i56 %.62, %.60 60 | %.65 = zext i56 %.63 to i57 61 | %.66 = shl nuw i57 %.65, 1 62 | %.67 = or i57 %.66, 1 63 | %.70 = and i64 %.1, 127 64 | %.71 = zext i57 %.67 to i64 65 | %.72 = shl nuw i64 %.71, 7 66 | %.73 = or i64 %.72, %.70 67 | %.75 = trunc i64 %.1 to i3 68 | %.76 = add i3 %.75, 1 69 | %10 = or i3 %.76, 1 70 | %.86 = zext i3 %10 to i64 71 | %.87 = shl i64 %.73, %.86 72 | %.95 = shl i64 %.87, 4 73 | %.96 = and i64 %.95, 1008 74 | %.98 = add i64 %.1, 500810693 75 | %.100 = trunc i64 %.1 to i4 76 | %.102 = lshr i4 %.100, 1 77 | %11 = trunc i4 %.102 to i3 78 | %.104 = xor i3 %11, -1 79 | %.110 = zext i3 %.104 to i6 80 | %.111 = shl nuw nsw i6 %.110, 1 81 | %.112 = or i6 %.111, 1 82 | %.113 = sub nsw i6 0, %.112 83 | %.114 = zext i6 %.113 to i64 84 | %.118 = shl i64 %.98, %.114 85 | %.132 = zext i3 %.104 to i64 86 | %.133 = shl nuw nsw i64 %.132, 1 87 | %.134 = or i64 %.133, 1 88 | %.135 = lshr i64 %.98, %.134 89 | %.119 = or i64 %.118, %.135 90 | %.136 = or i64 %.119, %.96 91 | %.137 = mul i64 %.73, %.11 92 | %.200 = mul i64 %.137, %.136 93 | ret i64 %.200 94 | } 95 | 96 | attributes #0 = { norecurse nounwind readnone } 97 | -------------------------------------------------------------------------------- /output/tigress-1-challenge-4.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = '' 2 | source_filename = "" 3 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 4 | target triple = "unknown-unknown-unknown" 5 | 6 | ; Function Attrs: norecurse nounwind readnone 7 | define i64 @SECRET(i64 %.1) local_unnamed_addr #0 { 8 | .3: 9 | %const7 = bitcast i64 281473904017537 to i64 10 | %const5 = bitcast i64 1098438934657 to i64 11 | %const = bitcast i64 3222274177 to i64 12 | %.7 = lshr i64 %.1, 3 13 | %.11 = shl i64 %.1, 61 14 | %.12 = or i64 %.11, %.7 15 | %.13 = add i64 %.12, %const 16 | %.14 = or i64 %.13, %.1 17 | %const_mat = add i64 %const, 772432873 18 | %.15 = add i64 %.14, %const_mat 19 | %.16 = lshr i64 %.15, 16 20 | %.26 = add i64 %.12, %const7 21 | %.27 = or i64 %.26, %.1 22 | %const_mat8 = add i64 %const7, 772432873 23 | %.28 = add i64 %.27, %const_mat8 24 | %.29 = lshr i64 %.28, 40 25 | %.30 = trunc i64 %.29 to i8 26 | %.32 = trunc i64 %.1 to i6 27 | %.33 = add i6 %.32, 2 28 | %.34 = lshr i6 %.33, 4 29 | %.36 = zext i6 %.34 to i8 30 | %.40 = or i8 %.30, %.36 31 | %.41 = zext i8 %.40 to i24 32 | %.431 = shl nuw nsw i64 %.16, 8 33 | %.43 = trunc i64 %.431 to i24 34 | %.44 = or i24 %.41, %.43 35 | %.46 = trunc i64 %.1 to i8 36 | %.48 = trunc i64 %.7 to i8 37 | %.49 = add i8 %.48, -127 38 | %.50 = or i8 %.49, %.46 39 | %.51 = add i8 %.50, 106 40 | %.52 = zext i8 %.51 to i32 41 | %.53 = zext i24 %.44 to i32 42 | %.54 = shl nuw i32 %.53, 8 43 | %.55 = or i32 %.54, %.52 44 | %.64 = add i64 %.12, -1072693119 45 | %.65 = or i64 %.64, %.1 46 | %.66 = add i64 %.65, -300260246 47 | %.67 = lshr i64 %.66, 48 48 | %0 = trunc i64 %.67 to i48 49 | %.69 = and i48 %0, 65535 50 | %.70 = zext i32 %.55 to i48 51 | %.71 = shl nuw i48 %.70, 16 52 | %.72 = or i48 %.71, %.69 53 | %.81 = add i64 %.12, 129 54 | %.82 = or i64 %.81, %.1 55 | %.83 = add i64 %.82, 25706 56 | %.84 = lshr i64 %.83, 8 57 | %1 = trunc i64 %.84 to i56 58 | %.86 = and i56 %1, 255 59 | %.87 = zext i48 %.72 to i56 60 | %.88 = shl nuw i56 %.87, 8 61 | %.89 = or i56 %.88, %.86 62 | %.98 = add i64 %.12, %const5 63 | %.99 = or i64 %.98, %.1 64 | %const_mat6 = add i64 %const5, 772432873 65 | %.100 = add i64 %.99, %const_mat6 66 | %.101 = lshr i64 %.100, 32 67 | %.102 = trunc i64 %.101 to i8 68 | %.104 = trunc i64 %.1 to i4 69 | %.105 = add i4 %.104, 2 70 | %.107 = zext i4 %.105 to i8 71 | %.108 = shl nuw i8 %.107, 4 72 | %.110 = or i8 %.108, %.102 73 | %.111 = zext i8 %.110 to i64 74 | %.112 = zext i56 %.89 to i64 75 | %.113 = shl nuw i64 %.112, 8 76 | %.114 = or i64 %.113, %.111 77 | %.129 = zext i8 %.49 to i32 78 | %2 = trunc i64 %.7 to i32 79 | %3 = add i32 %2, -1072693119 80 | %.131 = and i32 %3, -256 81 | %.132 = or i32 %.131, %.129 82 | %.142 = lshr i64 %.64, 32 83 | %.145 = zext i32 %.132 to i64 84 | %.146 = shl nuw i64 %.145, 32 85 | %.147 = or i64 %.146, %.142 86 | %.148 = add i64 %.114, %.147 87 | %.189 = shl i64 %.148, 1 88 | %.375 = lshr i64 %.148, 63 89 | %.376 = or i64 %.189, %.375 90 | ret i64 %.376 91 | } 92 | 93 | attributes #0 = { norecurse nounwind readnone } 94 | -------------------------------------------------------------------------------- /tigress.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import claripy 4 | import angr 5 | import logging 6 | 7 | from llvmlite import ir 8 | from llvmlite import binding 9 | from utils import * 10 | 11 | 12 | def main(path, module): 13 | l = logging.getLogger("tigress") 14 | l.info(module) 15 | 16 | # challenges all feed input to strtoul, and dump output hash via 17 | # printf; we hook them both here for ease of implementation 18 | l.info("Exploring all possible paths") 19 | p = angr.Project(path) 20 | input = claripy.BVS('input', 64) 21 | p.hook_symbol('strtoul', Strtol(input)) 22 | p.hook_symbol('printf', Printf()) 23 | s = p.factory.entry_state(args=[path, 'dummy'], 24 | add_options=angr.options.unicorn) 25 | sm = p.factory.simulation_manager(s) 26 | sm.explore() 27 | 28 | # Now we have multiple deadended paths, we can emit equivalent code 29 | # by looking up that path's predicate and the resulting hash's SMT 30 | # equation: 31 | # if path_predicate_1(input): return hash_1(input) 32 | # if path_predicate_2(input): return hash_2(input) 33 | # unreachable() 34 | mod = ir.Module(name=module) 35 | fun = ir.Function(mod, ir.FunctionType(ir.IntType(64), (ir.IntType(64),)), 36 | name="SECRET") 37 | bld = ir.IRBuilder(fun.append_basic_block()) 38 | for i in sm.deadended: 39 | l.info("Converting ast to branch on deadended path") 40 | pred = reduce(claripy.And, i.guards, claripy.true) 41 | l.debug(pred) 42 | with bld.if_then(LLVM(fun, bld, pred)): 43 | l.debug(i.state.scratch.hash.ast) 44 | bld.ret(LLVM(fun, bld, i.state.scratch.hash.ast)) 45 | bld.unreachable() 46 | 47 | l.info("Constructing execution engine and compiling IR") 48 | mod = compile_ir(str(mod)) 49 | with open("output/" + module + ".ll", "w") as f: 50 | f.write(str(mod)) 51 | with open("output/" + module + ".o", "wb") as f: 52 | target = binding.Target.from_default_triple() 53 | target_machine = target.create_target_machine() 54 | f.write(target_machine.emit_object(mod)) 55 | l.debug(str(mod)) 56 | 57 | 58 | class Strtol(angr.SimProcedure): 59 | 60 | def __init__(self, input): 61 | super(Strtol, self).__init__() 62 | self._input = input 63 | 64 | def run(self, nptr, endptr, base): 65 | # return a symbolic variable (this is easier 66 | # than using a symbolic argv) 67 | logging.getLogger('tigress.strtol').info("Returning symbolic input") 68 | self.return_type = angr.sim_type.SimTypeInt( 69 | self.state.arch, True) 70 | return self._input 71 | 72 | 73 | class Printf(angr.SimProcedure): 74 | 75 | def run(self, fmt, arg): 76 | # we save the argument in the path 77 | logging.getLogger('tigress.printf').info("Recording the final hash") 78 | self.state.scratch.hash = arg 79 | self.exit(1) 80 | 81 | 82 | if __name__ == '__main__': 83 | import argparse 84 | import os 85 | 86 | logging.getLogger('angr').setLevel('WARNING') 87 | logging.getLogger('tigress').setLevel('INFO') 88 | 89 | parser = argparse.ArgumentParser() 90 | parser.add_argument('binary') 91 | args = parser.parse_args() 92 | main(args.binary, os.path.basename(args.binary)) 93 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Tigress Protection 2 | ================== 3 | 4 | Another partial solution to the Tigress protection [challenges][tigress], inspired by the 5 | work done by Jonathan Salwan and Quarkslab, [here][Quarkslab]. Whereas Quarkslab's 6 | solution relies on Triton, ours is implemented via angr and llvmlite. 7 | 8 | Samples and challenges are taken directly from the [aforementioned][Quarkslab] repository 9 | as well. 10 | 11 | In summary, the script runs in two phases: 12 | 13 | 1. angr explores until there are no more paths to explore; we should end up with multiple 14 | deadended paths. 15 | 2. For each deadended path, we emit an if-then construct in llvm of the following form: 16 | ``` 17 | if path_predicate_1(input): return hash_1(input) 18 | if path_predicate_2(input): return hash_2(input) 19 | unreachable() 20 | ``` 21 | where `path_predicate_[1-2]` and `hash_[1-2]` are SMT equations. 22 | 23 | Note: this currently solves tigress challenges 0 and 1; challenge 2 requires angr to 24 | support `rt_sigreturn` and other yet-unsupported system calls, and challenges 3 and up 25 | have not been tested. 26 | 27 | ## Installation 28 | 29 | angr is required, which runs best in a virtual environment. llvmlite as of this writing 30 | requires llvm-6.0; it may be possible that [this][llvmpatch] patch is required as well. 31 | 32 | ## How to Run 33 | 34 | In order deobfuscate a binary (for example, tigress-0-challenge-2), use the following 35 | command: 36 | 37 | ``` 38 | $ ./tigress.py ./tigress-challenges/tigress-0-challenge-2 39 | ``` 40 | 41 | This will create two files in the `output` directory: `tigress-0-challenge-2.ll` and 42 | `tigress-0-challenge-2.o`. You may compile the given object file against the template.c 43 | file for a fully functioning binary. 44 | 45 | In order to verify the deobfuscated binary, Quarkslab employs a simple fuzzing technique. 46 | Instead, for each "deadended" path found by angr, we use z3 to generate a number of inputs 47 | to reach that path and verify this against the obfuscated binary. With this we achieve 48 | 100% branch coverage :) 49 | 50 | ``` 51 | $ ./testing_equality.py tigress-challenges/tigress-0-challenge-2 output/tigress-0-challenge-2 52 | ``` 53 | 54 | ## Musings and Random Thoughts 55 | 56 | Some thoughts, in no particular order: 57 | 58 | - Quarkslab's solution only deobfuscates the binary perfectly if there exists at most one 59 | symbolic branch--it takes one path, and then visits the other branch afterwards by 60 | inverting the path predicate. If Quarkslab's solution instead used a worklist algorithm, 61 | it would pretty much converge to our solution (XREF: samples/sample_multiple_paths) 62 | - Triton concretizes symbolic reads and writes; in hashes which require symbolic memory I 63 | would expect Quarkslab's solution to break. angr reportedly uses a similar algorithm to 64 | Mayhem, which concretizes symbolic writes, but handles symbolic reads up to a point, so 65 | it *should* theoretically handle more hash functions :) 66 | - If this is still a concern, i.e. symbolic writes need to be handled to maintain 67 | correctness of a hash algorithm, we can use the memsight plugin for angr, for 68 | example, which handles memory fully symbolically. 69 | - XREF: samples/sample_symbolic_memory_easy and samples/sample_symbolic_memory_hard, 70 | which exhibit code sequences which perform symbolic reads. One of the algorithms is 71 | a straight up crc32 72 | 73 | [tigress]: tigress.cs.arizona.edu 74 | [Quarkslab]: https://github.com/JonathanSalwan/Tigress_protection 75 | [llvmpatch]: https://github.com/numba/llvmlite/blob/master/conda-recipes/0001-Transforms-Add-missing-header-for-InstructionCombini.patch 76 | -------------------------------------------------------------------------------- /output/tigress-1-challenge-0.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = '' 2 | source_filename = "" 3 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 4 | target triple = "unknown-unknown-unknown" 5 | 6 | ; Function Attrs: norecurse nounwind readnone 7 | define i64 @SECRET(i64 %.1) local_unnamed_addr #0 { 8 | .3: 9 | %.6 = trunc i64 %.1 to i6 10 | %.7 = add i6 %.6, -6 11 | %.8 = lshr i64 %.1, 7 12 | %.9 = trunc i64 %.8 to i6 13 | %.10 = or i6 %.7, %.9 14 | %.16 = zext i6 %.10 to i64 15 | %.17 = shl nuw nsw i64 %.16, 4 16 | %.25 = shl i64 %.1, 57 17 | %.26 = or i64 %.25, %.8 18 | %.27 = or i64 %.26, %.17 19 | %.28 = lshr i64 %.1, 11 20 | %.29 = trunc i64 %.28 to i4 21 | %0 = trunc i64 %.8 to i3 22 | %1 = add i3 %0, 3 23 | %2 = and i3 %1, -2 24 | %.47 = zext i3 %2 to i4 25 | %.50 = sub i4 %.29, %.47 26 | %3 = or i4 %.50, 1 27 | %.60 = zext i4 %3 to i64 28 | %.61 = lshr i64 %.27, %.60 29 | %.117 = zext i4 %3 to i6 30 | %.118 = sub nsw i6 0, %.117 31 | %.119 = zext i6 %.118 to i64 32 | %.123 = shl i64 %.27, %.119 33 | %.124 = or i64 %.123, %.61 34 | %.131 = shl i64 %.1, 53 35 | %.132 = or i64 %.131, %.28 36 | %.141 = add nuw nsw i64 %.8, 223017115 37 | %.160 = add nuw nsw i64 %.8, 21690523 38 | %4 = lshr i64 %.160, 24 39 | %5 = trunc i64 %4 to i40 40 | %6 = and i40 %5, 1 41 | %7 = lshr i64 %.141, 24 42 | %8 = trunc i64 %7 to i38 43 | %9 = and i38 %8, 28 44 | %.165 = zext i38 %9 to i40 45 | %.166 = or i40 %6, %.165 46 | %10 = shl nuw nsw i40 %.166, 2 47 | %.179 = add nuw nsw i64 %.8, 4913307 48 | %11 = lshr i64 %.179, 22 49 | %12 = trunc i64 %11 to i42 50 | %13 = and i42 %12, 1 51 | %.184 = zext i40 %10 to i42 52 | %.185 = or i42 %13, %.184 53 | %14 = shl nuw nsw i42 %.185, 3 54 | %.198 = add nuw nsw i64 %.8, 719003 55 | %.199 = lshr i64 %.198, 19 56 | %15 = trunc i64 %.199 to i45 57 | %.201 = and i45 %15, 3 58 | %.203 = zext i42 %14 to i45 59 | %.204 = or i45 %.201, %.203 60 | %16 = shl nuw nsw i45 %.204, 2 61 | %.217 = add nuw nsw i64 %.8, 194715 62 | %17 = lshr i64 %.217, 17 63 | %18 = trunc i64 %17 to i47 64 | %19 = and i47 %18, 1 65 | %.222 = zext i45 %16 to i47 66 | %.223 = or i47 %19, %.222 67 | %20 = shl nuw nsw i47 %.223, 2 68 | %.236 = add nuw nsw i64 %.8, 63643 69 | %21 = lshr i64 %.236, 15 70 | %22 = trunc i64 %21 to i49 71 | %23 = and i49 %22, 1 72 | %.241 = zext i47 %20 to i49 73 | %.242 = or i49 %23, %.241 74 | %24 = shl nuw nsw i49 %.242, 1 75 | %.255 = add nuw nsw i64 %.8, 14491 76 | %.256 = lshr i64 %.255, 8 77 | %25 = trunc i64 %.256 to i56 78 | %.258 = and i56 %25, 63 79 | %.259 = zext i49 %24 to i56 80 | %.260 = shl nuw nsw i56 %.259, 6 81 | %.261 = or i56 %.260, %.258 82 | %26 = shl nuw nsw i56 %.261, 1 83 | %.274 = add nuw nsw i64 %.8, 27 84 | %.275 = lshr i64 %.274, 5 85 | %27 = trunc i64 %.275 to i59 86 | %.277 = and i59 %27, 3 87 | %.278 = zext i56 %26 to i59 88 | %.279 = shl nuw nsw i59 %.278, 2 89 | %.280 = or i59 %.279, %.277 90 | %.282 = zext i59 %.280 to i61 91 | %.283 = shl nuw nsw i61 %.282, 2 92 | %.293 = add nuw nsw i64 %.8, 3 93 | %.294 = lshr i64 %.293, 1 94 | %28 = trunc i64 %.294 to i63 95 | %.296 = and i63 %28, 3 96 | %.297 = zext i61 %.283 to i63 97 | %.298 = shl nuw nsw i63 %.297, 2 98 | %.299 = or i63 %.298, %.296 99 | %29 = shl nuw i63 %.299, 1 100 | %.302 = zext i63 %29 to i64 101 | %.305 = sub i64 %.132, %.302 102 | %30 = and i64 %.1, 129 103 | %31 = icmp ne i64 %30, 0 104 | %.312 = zext i1 %31 to i3 105 | %.313 = shl nuw i3 %.312, 2 106 | %.315 = lshr i64 %.1, 9 107 | %.316 = trunc i64 %.315 to i3 108 | %.317 = or i3 %.313, %.316 109 | %.323 = zext i3 %.317 to i64 110 | %.324 = shl nuw nsw i64 %.323, 1 111 | %.325 = or i64 %.324, 1 112 | %.326 = lshr i64 %.305, %.325 113 | %.525 = zext i3 %.317 to i6 114 | %.526 = shl nuw nsw i6 %.525, 1 115 | %.527 = or i6 %.526, 1 116 | %.528 = sub nsw i6 0, %.527 117 | %.529 = zext i6 %.528 to i64 118 | %.533 = shl i64 %.305, %.529 119 | %.534 = or i64 %.326, %.533 120 | %.535 = sub i64 3, %.1 121 | %.537 = add i64 %.535, %.8 122 | %.546 = add i64 %.537, %.534 123 | %.549 = add i64 %.1, 13 124 | %.559 = sub i64 %.549, %.8 125 | %.5474 = or i64 %.546, %.559 126 | %32 = lshr i64 %.5474, 1 127 | %.569 = and i64 %32, 6 128 | %.570 = or i64 %.569, 1 129 | %.571 = shl i64 %.124, %.570 130 | ret i64 %.571 131 | } 132 | 133 | attributes #0 = { norecurse nounwind readnone } 134 | -------------------------------------------------------------------------------- /output/tigress-1-challenge-1.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = '' 2 | source_filename = "" 3 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 4 | target triple = "unknown-unknown-unknown" 5 | 6 | ; Function Attrs: norecurse nounwind readnone 7 | define i64 @SECRET(i64 %.1) local_unnamed_addr #0 { 8 | .3: 9 | %.6 = lshr i64 %.1, 55 10 | %.10 = shl i64 %.1, 9 11 | %.11 = or i64 %.10, %.6 12 | %0 = lshr i64 %.1, 25 13 | %.16 = trunc i64 %0 to i39 14 | %.17 = or i39 %.16, 31 15 | %1 = lshr i64 %.1, 24 16 | %2 = trunc i64 %1 to i40 17 | %3 = and i40 %2, 1 18 | %.21 = zext i39 %.17 to i40 19 | %.22 = shl nuw i40 %.21, 1 20 | %.23 = or i40 %.22, %3 21 | %.25 = zext i40 %.23 to i41 22 | %.26 = shl nuw i41 %.25, 1 23 | %.27 = or i41 %.26, 1 24 | %.28 = lshr i64 %.1, 21 25 | %4 = trunc i64 %.28 to i43 26 | %.30 = and i43 %4, 3 27 | %.31 = zext i41 %.27 to i43 28 | %.32 = shl nuw i43 %.31, 2 29 | %.33 = or i43 %.32, %.30 30 | %.35 = zext i43 %.33 to i44 31 | %.36 = shl nuw i44 %.35, 1 32 | %.37 = or i44 %.36, 1 33 | %.38 = lshr i64 %.1, 16 34 | %5 = trunc i64 %.38 to i48 35 | %.40 = and i48 %5, 15 36 | %.41 = zext i44 %.37 to i48 37 | %.42 = shl nuw i48 %.41, 4 38 | %.43 = or i48 %.42, %.40 39 | %.45 = zext i48 %.43 to i49 40 | %.46 = shl nuw i49 %.45, 1 41 | %.47 = or i49 %.46, 1 42 | %.48 = lshr i64 %.1, 11 43 | %6 = trunc i64 %.48 to i53 44 | %.50 = and i53 %6, 15 45 | %.51 = zext i49 %.47 to i53 46 | %.52 = shl nuw i53 %.51, 4 47 | %.53 = or i53 %.52, %.50 48 | %.55 = zext i53 %.53 to i54 49 | %.56 = shl nuw i54 %.55, 1 50 | %.57 = or i54 %.56, 1 51 | %.58 = lshr i64 %.1, 8 52 | %7 = trunc i64 %.58 to i56 53 | %.60 = and i56 %7, 3 54 | %.61 = zext i54 %.57 to i56 55 | %.62 = shl nuw i56 %.61, 2 56 | %.63 = or i56 %.62, %.60 57 | %.65 = zext i56 %.63 to i57 58 | %.66 = shl nuw i57 %.65, 1 59 | %.67 = or i57 %.66, 1 60 | %.68 = lshr i64 %.1, 5 61 | %8 = trunc i64 %.68 to i59 62 | %.70 = and i59 %8, 3 63 | %.71 = zext i57 %.67 to i59 64 | %.72 = shl nuw i59 %.71, 2 65 | %.73 = or i59 %.72, %.70 66 | %.75 = zext i59 %.73 to i60 67 | %.76 = shl nuw i60 %.75, 1 68 | %.77 = or i60 %.76, 1 69 | %9 = lshr i64 %.1, 3 70 | %10 = trunc i64 %9 to i61 71 | %11 = and i61 %10, 1 72 | %.81 = zext i60 %.77 to i61 73 | %.82 = shl nuw i61 %.81, 1 74 | %.83 = or i61 %.82, %11 75 | %.85 = zext i61 %.83 to i64 76 | %.86 = shl nuw i64 %.85, 3 77 | %.87 = or i64 %.86, 7 78 | %.89 = sub i64 %.11, %.87 79 | %.92 = lshr i64 %.1, 13 80 | %.96 = shl i64 %.1, 51 81 | %.97 = or i64 %.96, %.92 82 | %.98 = add i64 %.97, 210061817713481728 83 | %.109 = sub i64 %.1, %.92 84 | %12 = lshr i64 %.109, 2 85 | %13 = trunc i64 %12 to i5 86 | %14 = and i5 %13, 14 87 | %15 = or i5 %14, 1 88 | %.119 = zext i5 %15 to i6 89 | %.120 = sub nsw i6 0, %.119 90 | %.121 = zext i6 %.120 to i64 91 | %.125 = shl i64 %.98, %.121 92 | %.154 = and i64 %12, 14 93 | %.155 = or i64 %.154, 1 94 | %.156 = lshr i64 %.98, %.155 95 | %.157 = or i64 %.125, %.156 96 | %.158 = icmp ugt i64 %.89, %.157 97 | br i1 %.158, label %.3.endif.if, label %.3.if 98 | 99 | .3.if: ; preds = %.3 100 | %16 = lshr i64 %.109, 4 101 | %17 = trunc i64 %16 to i5 102 | %18 = and i5 %17, 14 103 | %19 = or i5 %18, 1 104 | %.195 = zext i5 %19 to i6 105 | %.196 = sub nsw i6 0, %.195 106 | %.197 = zext i6 %.196 to i64 107 | %.201 = lshr i64 %.98, %.197 108 | %.230 = and i64 %16, 14 109 | %.231 = or i64 %.230, 1 110 | %.232 = shl i64 %.98, %.231 111 | %.233 = or i64 %.201, %.232 112 | %.236 = lshr i64 %.1, 60 113 | %.23813 = or i64 %.68, %.236 114 | %.244 = shl nuw nsw i64 %.23813, 1 115 | %.245 = and i64 %.244, 6 116 | %.246 = or i64 %.245, 1 117 | %.247 = lshr i64 %.233, %.246 118 | ret i64 %.247 119 | 120 | .3.endif.if: ; preds = %.3 121 | %.412 = trunc i64 %.6 to i5 122 | %.4195 = shl nuw nsw i64 %.92, 4 123 | %.4216 = or i64 %.4195, %.92 124 | %.421 = trunc i64 %.4216 to i5 125 | %.422 = add i5 %.421, %.412 126 | %.428 = zext i5 %.422 to i64 127 | %.429 = shl nuw nsw i64 %.428, 3 128 | %20 = lshr i64 %.1, 9 129 | %.449 = and i64 %20, 1008 130 | %.440 = or i64 %.98, %.449 131 | %.451 = or i64 %.440, %.429 132 | %.452 = add i64 %.1, 978284750848 133 | %.462 = sub i64 %.452, %.92 134 | %21 = lshr i64 %.462, 36 135 | %22 = trunc i64 %21 to i5 136 | %23 = and i5 %22, 14 137 | %24 = or i5 %23, 1 138 | %.472 = zext i5 %24 to i6 139 | %.473 = sub nsw i6 0, %.472 140 | %.474 = zext i6 %.473 to i64 141 | %.478 = lshr i64 %.451, %.474 142 | %.539 = and i64 %21, 14 143 | %.540 = or i64 %.539, 1 144 | %.541 = shl i64 %.451, %.540 145 | %.542 = or i64 %.478, %.541 146 | %.543 = lshr i64 %.1, 15 147 | %.54710 = or i64 %.543, %.68 148 | %.548 = lshr i64 %.1, 60 149 | %.55011 = or i64 %.54710, %.548 150 | %.556 = shl nuw nsw i64 %.55011, 1 151 | %.557 = and i64 %.556, 6 152 | %.558 = or i64 %.557, 1 153 | %.559 = lshr i64 %.542, %.558 154 | ret i64 %.559 155 | } 156 | 157 | attributes #0 = { norecurse nounwind readnone } 158 | -------------------------------------------------------------------------------- /utils.py: -------------------------------------------------------------------------------- 1 | import claripy 2 | import logging 3 | 4 | from z3 import * 5 | from llvmlite import ir 6 | from llvmlite import binding 7 | from functools import partial 8 | 9 | binding.initialize() 10 | binding.initialize_native_target() 11 | binding.initialize_native_asmprinter() 12 | 13 | l = logging.getLogger("tigress.utils") 14 | 15 | 16 | def z3_to_llvm(fun, bld, ast): 17 | args = map(partial(z3_to_llvm, fun, bld), z3_args(ast)) 18 | kind = ast.decl().kind() 19 | if kind == Z3_OP_TRUE: 20 | assert len(args) == 0 21 | return ir.Constant(ir.IntType(1), 1) 22 | elif kind == Z3_OP_FALSE: 23 | return ir.Constant(ir.IntType(1), 0) 24 | assert len(args) == 0 25 | elif kind == Z3_OP_BNUM: 26 | return ir.Constant(ir.IntType(ast.size()), ast.as_long()) 27 | elif kind == Z3_OP_UNINTERPRETED: 28 | # the only symbolic thing should be our input 29 | assert fun.args[0].type.width == ast.size() 30 | return fun.args[0] 31 | elif kind == Z3_OP_BNOT: 32 | assert len(args) == 1 33 | ret = bld.not_(args[0]) 34 | assert ret.type.width == ast.size() 35 | return ret 36 | elif kind == Z3_OP_BMUL: 37 | # note: signed multiplication 38 | assert len(args) == 2 39 | ret = bld.mul(args[0], args[1]) 40 | assert ret.type.width == ast.size() 41 | return ret 42 | elif kind == Z3_OP_BUDIV: 43 | assert len(args) == 2 44 | ret = bld.udiv(args[0], args[1]) 45 | assert ret.type.width == ast.size() 46 | return ret 47 | elif kind == Z3_OP_BADD: 48 | assert len(args) == 2 49 | ret = bld.add(args[0], args[1]) 50 | assert ret.type.width == ast.size() 51 | return ret 52 | elif kind == Z3_OP_BAND: 53 | assert len(args) == 2 54 | return bld.and_(args[0], args[1]) 55 | elif kind == Z3_OP_BOR: 56 | assert len(args) == 2 57 | return bld.or_(args[0], args[1]) 58 | elif kind == Z3_OP_AND: 59 | return reduce(bld.and_, args) 60 | elif kind == Z3_OP_OR: 61 | return reduce(bld.or_, args) 62 | elif kind == Z3_OP_BUREM_I or kind == Z3_OP_BUREM: 63 | assert len(args) == 2 64 | ret = bld.urem(args[0], args[1]) 65 | assert ret.type.width == ast.size() 66 | return ret 67 | elif kind == Z3_OP_BXOR: 68 | assert len(args) == 2 69 | ret = bld.xor(args[0], args[1]) 70 | assert ret.type.width == ast.size() 71 | return ret 72 | elif kind == Z3_OP_BSHL: 73 | assert len(args) == 2 74 | ret = bld.shl(args[0], args[1]) 75 | assert ret.type.width == ast.size() 76 | return ret 77 | elif kind == Z3_OP_BLSHR: 78 | assert len(args) == 2 79 | ret = bld.lshr(args[0], args[1]) 80 | assert ret.type.width == ast.size() 81 | return ret 82 | elif kind == Z3_OP_EXTRACT: 83 | assert len(args) == 1 84 | parms = ast.params() 85 | tmp1 = bld.lshr(args[0], ir.Constant(args[0].type, parms[1])) 86 | tmp2 = bld.trunc(tmp1, ir.IntType(int(parms[0] - parms[1] + 1))) 87 | assert tmp2.type.width == ast.size() 88 | return tmp2 89 | elif kind == Z3_OP_CONCAT: 90 | curr = args[0] 91 | for tmp0 in args[1:]: 92 | next = bld.zext(tmp0, ir.IntType(tmp0.type.width + curr.type.width)) 93 | curr = bld.zext(curr, ir.IntType(tmp0.type.width + curr.type.width)) 94 | curr = bld.shl(curr, ir.Constant(curr.type, int(tmp0.type.width))) 95 | curr = bld.or_(curr, next) 96 | assert curr.type.width == ast.size() 97 | return curr 98 | elif kind == Z3_OP_DISTINCT: 99 | assert len(args) == 2 100 | return bld.icmp_unsigned("!=", args[0], args[1]) 101 | elif kind == Z3_OP_EQ: 102 | assert len(args) == 2 103 | return bld.icmp_unsigned("==", args[0], args[1]) 104 | elif kind == Z3_OP_ULEQ: 105 | assert len(args) == 2 106 | return bld.icmp_unsigned("<=", args[0], args[1]) 107 | elif kind == Z3_OP_UGEQ: 108 | assert len(args) == 2 109 | return bld.icmp_unsigned(">=", args[0], args[1]) 110 | elif kind == Z3_OP_SLEQ: 111 | assert len(args) == 2 112 | return bld.icmp_signed("<=", args[0], args[1]) 113 | elif kind == Z3_OP_SGEQ: 114 | assert len(args) == 2 115 | return bld.icmp_signed(">=", args[0], args[1]) 116 | elif kind == Z3_OP_ITE: 117 | assert len(args) == 3 118 | ret = bld.select(args[0], args[1], args[2]) 119 | assert ret.type.width == ast.size() 120 | return ret 121 | else: 122 | raise NotImplementedError(ast.decl().name()) 123 | 124 | 125 | def z3_args(ast): 126 | return [ ast.arg(i) for i in range(ast.num_args()) ] 127 | 128 | 129 | def LLVM(fun, bld, ast): 130 | l.info("Converting z3 expression to LLVM IR") 131 | z = claripy.backends.z3.convert(ast) 132 | l.debug("{}".format(z)) 133 | return z3_to_llvm(fun, bld, z) 134 | 135 | 136 | def compile_ir(llvm_ir): 137 | mod = binding.parse_assembly(llvm_ir) 138 | mod.verify() 139 | pmb = binding.create_pass_manager_builder() 140 | pmb.opt_level = 2 141 | pm = binding.create_module_pass_manager() 142 | pmb.populate(pm) 143 | pm.run(mod) 144 | return mod 145 | -------------------------------------------------------------------------------- /output/tigress-1-challenge-3.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = '' 2 | source_filename = "" 3 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 4 | target triple = "unknown-unknown-unknown" 5 | 6 | ; Function Attrs: norecurse nounwind readnone 7 | define i64 @SECRET(i64 %.1) local_unnamed_addr #0 { 8 | .3: 9 | %.132 = mul i64 %.1, 107672031 10 | %0 = lshr i64 %.1, 4 11 | %1 = lshr i64 %.1, 23 12 | %2 = trunc i64 %1 to i41 13 | %3 = and i41 %2, 1 14 | %.155 = xor i41 %3, -63 15 | %.157 = zext i41 %.155 to i45 16 | %.158 = shl nuw i45 %.157, 4 17 | %.159 = or i45 %.158, 15 18 | %4 = lshr i64 %.1, 18 19 | %5 = trunc i64 %4 to i46 20 | %6 = and i46 %5, 1 21 | %.164 = zext i45 %.159 to i46 22 | %7 = shl nuw i46 %.164, 1 23 | %.165 = or i46 %7, %6 24 | %.166 = xor i46 %.165, 1 25 | %.168 = zext i46 %.166 to i47 26 | %.169 = shl nuw i47 %.168, 1 27 | %8 = lshr i64 %.1, 16 28 | %9 = trunc i64 %8 to i48 29 | %10 = and i48 %9, 1 30 | %.175 = zext i47 %.169 to i48 31 | %11 = shl nuw i48 %.175, 1 32 | %.176 = or i48 %11, %10 33 | %.177 = xor i48 %.176, 1 34 | %.179 = zext i48 %.177 to i51 35 | %.180 = shl nuw i51 %.179, 3 36 | %.181 = or i51 %.180, 3 37 | %12 = lshr i64 %.1, 12 38 | %13 = trunc i64 %12 to i52 39 | %14 = and i52 %13, 1 40 | %.186 = zext i51 %.181 to i52 41 | %15 = shl nuw i52 %.186, 1 42 | %.187 = or i52 %15, %14 43 | %.188 = xor i52 %.187, 1 44 | %.190 = zext i52 %.188 to i53 45 | %.191 = shl nuw i53 %.190, 1 46 | %.192 = or i53 %.191, 1 47 | %.193 = lshr i64 %.1, 9 48 | %.194 = trunc i64 %.193 to i2 49 | %.195 = xor i2 %.194, -1 50 | %.196 = zext i2 %.195 to i55 51 | %.197 = zext i53 %.192 to i55 52 | %.198 = shl nuw i55 %.197, 2 53 | %.199 = or i55 %.198, %.196 54 | %.201 = zext i55 %.199 to i56 55 | %.202 = shl nuw i56 %.201, 1 56 | %16 = lshr i64 %.1, 7 57 | %17 = trunc i64 %16 to i57 58 | %18 = and i57 %17, 1 59 | %.208 = zext i56 %.202 to i57 60 | %19 = shl nuw i57 %.208, 1 61 | %.209 = or i57 %19, %18 62 | %.210.not = xor i57 %.209, -2 63 | %.215 = and i57 %.210.not, %17 64 | %.216 = zext i57 %.215 to i64 65 | %.217 = shl i64 %.1, 57 66 | %.218 = and i64 %.217, -2017612633061982208 67 | %.219 = or i64 %.218, %.216 68 | %.220 = add i64 %.219, %.132 69 | %.221 = lshr i64 %.220, 56 70 | %.222 = trunc i64 %.221 to i8 71 | %.223 = xor i8 %.222, 31 72 | %.446 = mul i64 %.1, 430688124 73 | %.531 = shl i64 %.1, 57 74 | %.532 = and i64 %.531, 2594073385365405696 75 | %.533 = or i64 %.532, %.216 76 | %.534 = shl nuw i64 %.533, 2 77 | %.535 = add i64 %.534, %.446 78 | %.536 = lshr i64 %.535, 56 79 | %.537 = trunc i64 %.536 to i8 80 | %.538 = xor i8 %.537, 31 81 | %.54312 = or i8 %.538, %.223 82 | %.543 = zext i8 %.54312 to i60 83 | %.544 = shl nuw nsw i60 %.543, 4 84 | %.545 = or i60 %.544, -512 85 | %20 = xor i60 %.545, -16 86 | %21 = trunc i64 %.1 to i56 87 | %.622 = and i56 %21, 16 88 | %22 = xor i56 %.622, 16 89 | %.625 = zext i56 %22 to i60 90 | %.628 = trunc i64 %.1 to i60 91 | %.629 = xor i60 %.628, 18 92 | %.849 = xor i8 %.222, 18 93 | %.850 = zext i8 %.849 to i60 94 | %.626 = or i60 %.629, %.850 95 | %.630 = or i60 %.626, %.625 96 | %.855 = shl i60 %.630, 4 97 | %.856 = or i60 %.855, -304 98 | %23 = xor i60 %.856, -16 99 | %.86114 = or i60 %23, %20 100 | %.861 = zext i60 %.86114 to i64 101 | %24 = trunc i64 %4 to i41 102 | %25 = and i41 %24, 32 103 | %26 = or i41 %25, 1984 104 | %.876 = zext i41 %26 to i46 105 | %.877 = or i46 %6, %.876 106 | %27 = shl nuw nsw i46 %.877, 2 107 | %28 = or i46 %27, 2 108 | %.886 = zext i46 %28 to i48 109 | %.887 = or i48 %10, %.886 110 | %29 = shl nuw nsw i48 %.887, 4 111 | %30 = or i48 %29, 8 112 | %.896 = zext i48 %30 to i52 113 | %.897 = or i52 %14, %.896 114 | %31 = shl nuw nsw i52 %.897, 3 115 | %32 = trunc i64 %.193 to i55 116 | %.904 = and i55 %32, 3 117 | %.906 = zext i52 %31 to i55 118 | %.907 = or i55 %.904, %.906 119 | %33 = shl nuw nsw i55 %.907, 2 120 | %34 = or i55 %33, 2 121 | %.916 = zext i55 %34 to i57 122 | %.917 = or i57 %18, %.916 123 | %35 = shl nuw i57 %.917, 3 124 | %36 = or i57 %35, 2 125 | %37 = trunc i64 %0 to i60 126 | %38 = and i60 %37, 1 127 | %.926 = zext i57 %36 to i60 128 | %.927 = or i60 %38, %.926 129 | %.929 = zext i60 %.927 to i64 130 | %.930 = shl nuw nsw i64 %.929, 4 131 | %.931 = or i64 %.930, %.861 132 | %.932 = or i64 %.931, 2 133 | %39 = shl nuw nsw i64 %0, 2 134 | %.940 = lshr i64 %.1, 2 135 | %.943.demorgan15 = and i64 %39, %.940 136 | %40 = trunc i64 %.943.demorgan15 to i5 137 | %.945 = shl i5 %40, 1 138 | %41 = and i5 %.945, 14 139 | %42 = or i5 %41, 1 140 | %.952 = zext i5 %42 to i6 141 | %.953 = sub nsw i6 0, %.952 142 | %.954 = zext i6 %.953 to i64 143 | %.958 = shl i64 %.932, %.954 144 | %43 = lshr i64 %.1, 1 145 | %.1905 = and i64 %43, 8 146 | %.1906 = or i64 %.1905, 1 147 | %.1907 = lshr i64 %.932, %.1906 148 | %.1908 = or i64 %.958, %.1907 149 | %.199823 = or i64 %.535, %.220 150 | %44 = lshr i64 %.199823, 56 151 | %45 = trunc i64 %44 to i5 152 | %46 = and i5 %45, 14 153 | %47 = or i5 %46, 1 154 | %.2100 = zext i5 %47 to i6 155 | %.2101 = sub nsw i6 0, %.2100 156 | %.2102 = zext i6 %.2101 to i64 157 | %.2106 = lshr i64 %.1908, %.2102 158 | %.4201 = and i64 %44, 14 159 | %.4202 = or i64 %.4201, 1 160 | %.4203 = shl i64 %.1908, %.4202 161 | %.4204 = or i64 %.2106, %.4203 162 | ret i64 %.4204 163 | } 164 | 165 | attributes #0 = { norecurse nounwind readnone } 166 | -------------------------------------------------------------------------------- /output/sample15.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = '' 2 | source_filename = "" 3 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 4 | target triple = "unknown-unknown-unknown" 5 | 6 | ; Function Attrs: norecurse nounwind readnone 7 | define i64 @SECRET(i64 %.1) local_unnamed_addr #0 { 8 | .3: 9 | %const = bitcast i64 1125899906842624 to i64 10 | %.6 = trunc i64 %.1 to i36 11 | %.7 = add i36 %.6, 524114809 12 | %.8 = lshr i36 %.7, 1 13 | %.9 = trunc i36 %.8 to i35 14 | %.10 = lshr i64 %.1, 15 15 | %.11 = trunc i64 %.10 to i35 16 | %.12 = xor i35 %.9, %.11 17 | %.16 = add i64 %.1, 524114809 18 | %.17 = lshr i64 %.16, 60 19 | %0 = trunc i64 %.17 to i5 20 | %.19 = and i5 %0, 15 21 | %1 = trunc i64 %.1 to i5 22 | %2 = shl i5 %1, 4 23 | %.21 = or i5 %.19, %2 24 | %.23 = lshr i64 %.1, 10 25 | %.24 = trunc i64 %.23 to i5 26 | %.25 = xor i5 %.24, 15 27 | %.26 = xor i5 %.25, %.21 28 | %.27 = zext i5 %.26 to i40 29 | %.28 = zext i35 %.12 to i40 30 | %.29 = shl nuw i40 %.28, 5 31 | %.30 = or i40 %.29, %.27 32 | %.32 = lshr i64 %.16, 58 33 | %.34 = lshr i64 %.1, 8 34 | %.361 = xor i64 %.32, %.34 35 | %3 = trunc i64 %.361 to i42 36 | %.37 = and i42 %3, 3 37 | %.38 = zext i40 %.30 to i42 38 | %.39 = shl nuw i42 %.38, 2 39 | %.40 = or i42 %.39, %.37 40 | %.42 = lshr i64 %.16, 54 41 | %.44 = lshr i64 %.1, 4 42 | %.462 = xor i64 %.42, %.44 43 | %.46 = trunc i64 %.462 to i4 44 | %.47 = xor i4 %.46, -1 45 | %.48 = zext i4 %.47 to i46 46 | %.49 = zext i42 %.40 to i46 47 | %.50 = shl nuw i46 %.49, 4 48 | %.51 = or i46 %.50, %.48 49 | %4 = and i64 %.16, 9007199254740992 50 | %.54 = icmp ne i64 %4, 0 51 | %5 = and i64 %.1, 8 52 | %.56 = icmp ne i64 %5, 0 53 | %.57 = xor i1 %.56, %.54 54 | %.58 = zext i1 %.57 to i47 55 | %.59 = zext i46 %.51 to i47 56 | %.60 = shl nuw i47 %.59, 1 57 | %.61 = or i47 %.60, %.58 58 | %6 = and i64 %.16, 4503599627370496 59 | %.64 = icmp ne i64 %6, 0 60 | %7 = and i64 %.1, 4 61 | %.66 = icmp ne i64 %7, 0 62 | %.67 = xor i1 %.66, %.64 63 | %.68 = xor i1 %.67, true 64 | %.69 = zext i1 %.68 to i48 65 | %.70 = zext i47 %.61 to i48 66 | %.71 = shl nuw i48 %.70, 1 67 | %.72 = or i48 %.71, %.69 68 | %8 = and i64 %.16, 2251799813685248 69 | %.75 = icmp ne i64 %8, 0 70 | %9 = and i64 %.1, 2 71 | %.77 = icmp ne i64 %9, 0 72 | %.78 = xor i1 %.77, %.75 73 | %.79 = zext i1 %.78 to i49 74 | %.80 = zext i48 %.72 to i49 75 | %.81 = shl nuw i49 %.80, 1 76 | %.82 = or i49 %.81, %.79 77 | %10 = and i64 %.16, %const 78 | %.85 = icmp ne i64 %10, 0 79 | %11 = and i64 %.1, 1 80 | %.87 = icmp ne i64 %11, 0 81 | %.88 = xor i1 %.87, %.85 82 | %.89 = xor i1 %.88, true 83 | %.90 = zext i1 %.89 to i50 84 | %.91 = zext i49 %.82 to i50 85 | %.92 = shl nuw i50 %.91, 1 86 | %.93 = or i50 %.92, %.90 87 | %.95 = trunc i64 %.1 to i50 88 | %.96 = add i50 %.95, 524114809 89 | %.98 = icmp slt i50 %.96, 0 90 | %.100 = icmp slt i64 %.1, 0 91 | %.101 = xor i1 %.100, %.98 92 | %.102 = zext i1 %.101 to i51 93 | %.103 = zext i50 %.93 to i51 94 | %.104 = shl nuw i51 %.103, 1 95 | %.105 = or i51 %.104, %.102 96 | %.109 = lshr i50 %.96, 47 97 | %.110 = trunc i50 %.109 to i2 98 | %.111 = lshr i64 %.1, 61 99 | %.112 = trunc i64 %.111 to i2 100 | %.113 = xor i2 %.112, -1 101 | %.114 = xor i2 %.113, %.110 102 | %.115 = zext i2 %.114 to i53 103 | %.116 = zext i51 %.105 to i53 104 | %.117 = shl nuw i53 %.116, 2 105 | %.118 = or i53 %.117, %.115 106 | %12 = and i50 %.96, 70368744177664 107 | %.123 = icmp ne i50 %12, 0 108 | %13 = and i64 %.1, 1152921504606846976 109 | %.125 = icmp ne i64 %13, 0 110 | %.126 = xor i1 %.125, %.123 111 | %.127 = zext i1 %.126 to i54 112 | %.128 = zext i53 %.118 to i54 113 | %.129 = shl nuw i54 %.128, 1 114 | %.130 = or i54 %.129, %.127 115 | %.134 = lshr i50 %.96, 44 116 | %.135 = trunc i50 %.134 to i2 117 | %.136 = lshr i64 %.1, 58 118 | %.137 = trunc i64 %.136 to i2 119 | %.138 = xor i2 %.137, -1 120 | %.139 = xor i2 %.138, %.135 121 | %.140 = zext i2 %.139 to i56 122 | %.141 = zext i54 %.130 to i56 123 | %.142 = shl nuw i56 %.141, 2 124 | %.143 = or i56 %.142, %.140 125 | %14 = and i50 %.96, 8796093022208 126 | %.148 = icmp ne i50 %14, 0 127 | %15 = and i64 %.1, 144115188075855872 128 | %.150 = icmp ne i64 %15, 0 129 | %.151 = xor i1 %.150, %.148 130 | %.152 = zext i1 %.151 to i57 131 | %.153 = zext i56 %.143 to i57 132 | %.154 = shl nuw i57 %.153, 1 133 | %.155 = or i57 %.154, %.152 134 | %.159 = lshr i50 %.96, 39 135 | %.160 = trunc i50 %.159 to i4 136 | %.161 = lshr i64 %.1, 53 137 | %.162 = trunc i64 %.161 to i4 138 | %.163 = xor i4 %.162, -1 139 | %.164 = xor i4 %.163, %.160 140 | %.165 = zext i4 %.164 to i61 141 | %.166 = zext i57 %.155 to i61 142 | %.167 = shl nuw i61 %.166, 4 143 | %.168 = or i61 %.167, %.165 144 | %.172 = lshr i50 %.96, 37 145 | %.173 = trunc i50 %.172 to i2 146 | %.174 = lshr i64 %.1, 51 147 | %.175 = trunc i64 %.174 to i2 148 | %.176 = xor i2 %.173, %.175 149 | %.177 = zext i2 %.176 to i63 150 | %.178 = zext i61 %.168 to i63 151 | %.179 = shl nuw i63 %.178, 2 152 | %.180 = or i63 %.179, %.177 153 | %16 = and i50 %.96, 68719476736 154 | %.185 = icmp ne i50 %16, 0 155 | %17 = and i64 %.1, %const 156 | %.187 = icmp ne i64 %17, 0 157 | %.188 = xor i1 %.187, %.185 158 | %.189 = xor i1 %.188, true 159 | %.190 = zext i1 %.189 to i64 160 | %.191 = zext i63 %.180 to i64 161 | %.192 = shl nuw i64 %.191, 1 162 | %.193 = or i64 %.192, %.190 163 | %.194 = add i64 %.193, %.1 164 | ret i64 %.194 165 | } 166 | 167 | attributes #0 = { norecurse nounwind readnone } 168 | -------------------------------------------------------------------------------- /output/tigress-0-challenge-1.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = '' 2 | source_filename = "" 3 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 4 | target triple = "unknown-unknown-unknown" 5 | 6 | ; Function Attrs: norecurse nounwind readnone 7 | define i64 @SECRET(i64 %.1) local_unnamed_addr #0 { 8 | .3: 9 | %0 = lshr i64 %.1, 25 10 | %1 = trunc i64 %0 to i39 11 | %2 = and i39 %1, 1 12 | %3 = trunc i64 %0 to i35 13 | %4 = and i35 %3, 16 14 | %.18 = zext i35 %4 to i39 15 | %.19 = or i39 %2, %.18 16 | %5 = shl nuw nsw i39 %.19, 4 17 | %6 = lshr i64 %.1, 21 18 | %7 = trunc i64 %6 to i43 19 | %8 = and i43 %7, 1 20 | %.28 = zext i39 %5 to i43 21 | %.29 = or i43 %8, %.28 22 | %9 = shl nuw nsw i43 %.29, 3 23 | %.34 = lshr i64 %.1, 18 24 | %10 = trunc i64 %.34 to i46 25 | %.36 = and i46 %10, 3 26 | %.38 = zext i43 %9 to i46 27 | %.39 = or i46 %.36, %.38 28 | %11 = shl nuw i46 %.39, 4 29 | %12 = lshr i64 %.1, 13 30 | %13 = trunc i64 %12 to i51 31 | %14 = and i51 %13, 1 32 | %.47 = zext i46 %11 to i51 33 | %.48 = shl nuw nsw i51 %.47, 1 34 | %.49 = or i51 %.48, %14 35 | %15 = shl nuw nsw i51 %.49, 2 36 | %16 = lshr i64 %.1, 11 37 | %17 = trunc i64 %16 to i53 38 | %18 = and i53 %17, 1 39 | %.58 = zext i51 %15 to i53 40 | %.59 = or i53 %18, %.58 41 | %19 = shl nuw nsw i53 %.59, 2 42 | %20 = lshr i64 %.1, 9 43 | %21 = trunc i64 %20 to i55 44 | %22 = and i55 %21, 1 45 | %.68 = zext i53 %19 to i55 46 | %.69 = or i55 %22, %.68 47 | %23 = shl nuw nsw i55 %.69, 1 48 | %.74 = lshr i64 %.1, 2 49 | %24 = trunc i64 %.74 to i62 50 | %.76 = and i62 %24, 63 51 | %.77 = zext i55 %23 to i62 52 | %.78 = shl nuw nsw i62 %.77, 6 53 | %.79 = or i62 %.78, %.76 54 | %25 = shl nuw i62 %.79, 2 55 | %.82 = zext i62 %25 to i64 56 | %.84 = mul i64 %.82, 502412191 57 | %.85 = add i64 %.84, %.1 58 | %.86 = add i64 %.85, -171483177724227824 59 | %.167 = add nsw i64 %.82, -341319700 60 | %.168 = xor i64 %.86, %.167 61 | %26 = lshr i64 %.1, 26 62 | %27 = trunc i64 %26 to i38 63 | %28 = and i38 %27, 1 64 | %29 = trunc i64 %26 to i36 65 | %30 = and i36 %29, 4 66 | %.183 = zext i36 %30 to i38 67 | %.184 = or i38 %28, %.183 68 | %31 = shl nuw nsw i38 %.184, 8 69 | %32 = and i46 %10, 1 70 | %.193 = zext i38 %31 to i46 71 | %.194 = or i46 %32, %.193 72 | %33 = shl nuw nsw i46 %.194, 2 73 | %34 = lshr i64 %.1, 16 74 | %35 = trunc i64 %34 to i48 75 | %36 = and i48 %35, 1 76 | %.203 = zext i46 %33 to i48 77 | %.204 = or i48 %36, %.203 78 | %37 = shl nuw nsw i48 %.204, 5 79 | %.211 = and i53 %17, 7 80 | %.213 = zext i48 %37 to i53 81 | %.214 = or i53 %.211, %.213 82 | %38 = shl nuw i53 %.214, 6 83 | %.219 = lshr i64 %.1, 5 84 | %39 = trunc i64 %.219 to i59 85 | %.221 = and i59 %39, 7 86 | %.223 = zext i53 %38 to i59 87 | %.224 = or i59 %.221, %.223 88 | %40 = shl nuw nsw i59 %.224, 3 89 | %41 = and i62 %24, 1 90 | %.233 = zext i59 %40 to i62 91 | %.234 = or i62 %41, %.233 92 | %42 = shl nuw nsw i62 %.234, 2 93 | %.237 = zext i62 %42 to i64 94 | %.239 = add nsw i64 %.237, -1595821287 95 | %43 = lshr i64 %.1, 3 96 | %44 = trunc i64 %43 to i59 97 | %45 = and i59 %44, 4 98 | %46 = or i59 %45, 3 99 | %.403 = zext i59 %46 to i64 100 | %.404 = lshr i64 %.86, %.403 101 | %.405 = add i64 %.404, %.1 102 | %.406 = mul i64 %.405, %.239 103 | %.407 = icmp eq i64 %.168, %.406 104 | %47 = trunc i64 %.1 to i3 105 | %.419 = and i3 %47, -4 106 | %.424 = add i3 %.419, %47 107 | %.430 = zext i3 %.424 to i64 108 | %.431 = shl nuw nsw i64 %.430, 2 109 | br i1 %.407, label %.3.if, label %.3.endif.if 110 | 111 | .3.if: ; preds = %.3 112 | %.514 = or i64 %.167, %.431 113 | %.597 = add i64 %.85, 16 114 | %48 = lshr i64 %.597, 1 115 | %49 = trunc i64 %48 to i5 116 | %50 = and i5 %49, 14 117 | %51 = or i5 %50, 1 118 | %.607 = zext i5 %51 to i6 119 | %.608 = sub nsw i6 0, %.607 120 | %.609 = zext i6 %.608 to i64 121 | %.613 = shl i64 %.514, %.609 122 | %.805 = and i64 %48, 14 123 | %.806 = or i64 %.805, 1 124 | %.807 = lshr i64 %.514, %.806 125 | %.808 = or i64 %.613, %.807 126 | %52 = or i62 %42, 16 127 | %.1047 = zext i62 %52 to i64 128 | %.97547 = xor i64 %.405, %.1047 129 | %53 = lshr i64 %.97547, 3 130 | %54 = trunc i64 %53 to i5 131 | %55 = and i5 %54, 14 132 | %56 = or i5 %55, 1 133 | %.1058 = zext i5 %56 to i6 134 | %.1059 = sub nsw i6 0, %.1058 135 | %.1060 = zext i6 %.1059 to i64 136 | %.1064 = lshr i64 %.808, %.1060 137 | %.1707 = and i64 %53, 14 138 | %.1708 = or i64 %.1707, 1 139 | %.1709 = shl i64 %.808, %.1708 140 | %.1710 = or i64 %.1064, %.1709 141 | ret i64 %.1710 142 | 143 | .3.endif.if: ; preds = %.3 144 | %57 = shl nuw nsw i64 %12, 2 145 | %58 = trunc i64 %57 to i16 146 | %59 = and i16 %58, 4 147 | %60 = trunc i64 %16 to i16 148 | %61 = and i16 %60, 1 149 | %.2196 = or i16 %59, %61 150 | %62 = shl nuw nsw i16 %.2196, 2 151 | %63 = trunc i64 %20 to i16 152 | %64 = and i16 %63, 1 153 | %.2206 = or i16 %62, %64 154 | %65 = trunc i64 %.74 to i16 155 | %.2213 = and i16 %65, 63 156 | %.2215 = shl nuw nsw i16 %.2206, 7 157 | %.2216 = or i16 %.2215, %.2213 158 | %66 = shl nuw nsw i16 %.2216, 2 159 | %.2221 = add i16 %66, -8212 160 | %67 = trunc i64 %.1 to i8 161 | %.22283 = add i8 %67, -20 162 | %.2230 = and i8 %.22283, -4 163 | %.2231 = zext i8 %.2230 to i16 164 | %.2233 = and i16 %.2221, -256 165 | %.2234 = or i16 %.2233, %.2231 166 | %.2315 = add nuw nsw i64 %.82, 3953647596 167 | %.2316 = lshr i64 %.2315, 16 168 | %68 = trunc i64 %.2316 to i32 169 | %.2318 = and i32 %68, 65535 170 | %.2319 = zext i16 %.2234 to i32 171 | %.2320 = shl nuw i32 %.2319, 16 172 | %.2321 = or i32 %.2318, %.2320 173 | %.2402 = add nuw nsw i64 %.82, 281474635390956 174 | %.2403 = lshr i64 %.2402, 32 175 | %69 = trunc i64 %.2403 to i48 176 | %.2405 = and i48 %69, 65535 177 | %.2406 = zext i32 %.2321 to i48 178 | %.2407 = shl nuw i48 %.2406, 16 179 | %.2408 = or i48 %.2407, %.2405 180 | %.2490 = lshr i64 %.167, 48 181 | %.2493 = zext i48 %.2408 to i64 182 | %.2494 = shl nuw i64 %.2493, 16 183 | %.2495 = or i64 %.2490, %.431 184 | %.2496 = or i64 %.2495, %.2494 185 | %.2579 = add i64 %.85, 16 186 | %70 = lshr i64 %.2579, 1 187 | %71 = trunc i64 %70 to i5 188 | %72 = and i5 %71, 14 189 | %73 = or i5 %72, 1 190 | %.2589 = zext i5 %73 to i6 191 | %.2590 = sub nsw i6 0, %.2589 192 | %.2591 = zext i6 %.2590 to i64 193 | %.2595 = shl i64 %.2496, %.2591 194 | %.3061 = and i64 %70, 14 195 | %.3062 = or i64 %.3061, 1 196 | %.3063 = lshr i64 %.2496, %.3062 197 | %.3064 = or i64 %.2595, %.3063 198 | %74 = trunc i64 %.1 to i4 199 | %.314011 = add i4 %74, -4 200 | %.3142 = lshr i4 %.314011, 1 201 | %75 = trunc i4 %.3142 to i3 202 | %.3144 = and i3 %75, -2 203 | %.3150 = zext i3 %.3144 to i6 204 | %.3151 = shl nuw nsw i6 %.3150, 1 205 | %.3152 = or i6 %.3151, 1 206 | %.3153 = sub nsw i6 0, %.3152 207 | %.3154 = zext i6 %.3153 to i64 208 | %.3158 = lshr i64 %.239, %.3154 209 | %.3246 = zext i3 %.3144 to i64 210 | %.3247 = shl nuw nsw i64 %.3246, 1 211 | %.3248 = or i64 %.3247, 1 212 | %.3249 = shl i64 %.239, %.3248 213 | %.315915 = or i64 %.3158, %.3249 214 | %.325214 = lshr i64 %.315915, 2 215 | %76 = trunc i64 %.325214 to i3 216 | %.3253 = and i3 %76, 3 217 | %.3423 = lshr i64 %.405, 20 218 | %.3424 = trunc i64 %.3423 to i3 219 | %.3425 = or i3 %.3253, %.3424 220 | %.361320 = lshr i64 %.315915, 4 221 | %.3613 = trunc i64 %.361320 to i3 222 | %.3614 = xor i3 %.3425, %.3613 223 | %.3620 = zext i3 %.3614 to i6 224 | %.3621 = shl nuw nsw i6 %.3620, 1 225 | %.3622 = or i6 %.3621, 1 226 | %.3623 = sub nsw i6 0, %.3622 227 | %.3624 = zext i6 %.3623 to i64 228 | %.3628 = lshr i64 %.3064, %.3624 229 | %.5126 = zext i3 %.3614 to i64 230 | %.5127 = shl nuw nsw i64 %.5126, 1 231 | %.5128 = or i64 %.5127, 1 232 | %.5129 = shl i64 %.3064, %.5128 233 | %.5130 = or i64 %.3628, %.5129 234 | ret i64 %.5130 235 | } 236 | 237 | attributes #0 = { norecurse nounwind readnone } 238 | -------------------------------------------------------------------------------- /output/sample10.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = '' 2 | source_filename = "" 3 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 4 | target triple = "unknown-unknown-unknown" 5 | 6 | ; Function Attrs: norecurse nounwind readnone 7 | define i64 @SECRET(i64 %.1) local_unnamed_addr #0 { 8 | .3: 9 | %const234 = bitcast i64 -4417276706812531889 to i64 10 | %const = bitcast i64 -7046029288634856825 to i64 11 | %.6 = trunc i64 %.1 to i33 12 | %.7 = mul i33 %.6, -3626702001 13 | %.8 = mul i64 %.1, %const234 14 | %.9 = lshr i64 %.8, 33 15 | %.12 = zext i33 %.7 to i64 16 | %.13 = shl nuw i64 %.12, 31 17 | %.14 = or i64 %.13, %.9 18 | %.15 = mul i64 %.14, %const 19 | %.29 = lshr i64 %.15, 32 20 | %.30 = trunc i64 %.29 to i4 21 | %.31 = xor i4 %.30, -1 22 | %.32 = zext i4 %.31 to i5 23 | %0 = lshr i64 %.15, 36 24 | %.34100 = shl nuw nsw i64 %0, 4 25 | %.34 = trunc i64 %.34100 to i5 26 | %.35 = or i5 %.34, %.32 27 | %.47 = lshr i64 %.15, 29 28 | %1 = trunc i64 %.47 to i8 29 | %.49 = and i8 %1, 7 30 | %.50 = zext i5 %.35 to i8 31 | %.51 = shl nuw i8 %.50, 3 32 | %.52 = or i8 %.51, %.49 33 | %2 = lshr i64 %.15, 28 34 | %3 = trunc i64 %2 to i9 35 | %4 = and i9 %3, 1 36 | %.68 = zext i8 %.52 to i9 37 | %5 = shl nuw i9 %.68, 1 38 | %.69 = or i9 %5, %4 39 | %.70 = xor i9 %.69, 1 40 | %6 = lshr i64 %.15, 27 41 | %7 = trunc i64 %6 to i10 42 | %8 = and i10 %7, 1 43 | %.85 = zext i9 %.70 to i10 44 | %.86 = shl nuw i10 %.85, 1 45 | %.87 = or i10 %.86, %8 46 | %.99 = lshr i64 %.15, 25 47 | %.100 = trunc i64 %.99 to i2 48 | %.101 = xor i2 %.100, -1 49 | %.102 = zext i2 %.101 to i12 50 | %.103 = zext i10 %.87 to i12 51 | %.104 = shl nuw i12 %.103, 2 52 | %.105 = or i12 %.104, %.102 53 | %.117 = lshr i64 %.15, 23 54 | %9 = trunc i64 %.117 to i14 55 | %.119 = and i14 %9, 3 56 | %.120 = zext i12 %.105 to i14 57 | %.121 = shl nuw i14 %.120, 2 58 | %.122 = or i14 %.121, %.119 59 | %10 = lshr i64 %.15, 22 60 | %11 = trunc i64 %10 to i15 61 | %12 = and i15 %11, 1 62 | %.138 = zext i14 %.122 to i15 63 | %13 = shl nuw i15 %.138, 1 64 | %.139 = or i15 %13, %12 65 | %.140 = xor i15 %.139, 1 66 | %14 = lshr i64 %.15, 21 67 | %15 = trunc i64 %14 to i16 68 | %16 = and i16 %15, 1 69 | %.155 = zext i15 %.140 to i16 70 | %.156 = shl nuw i16 %.155, 1 71 | %.157 = or i16 %.156, %16 72 | %17 = lshr i64 %.15, 20 73 | %18 = trunc i64 %17 to i17 74 | %19 = and i17 %18, 1 75 | %.173 = zext i16 %.157 to i17 76 | %20 = shl nuw i17 %.173, 1 77 | %.174 = or i17 %20, %19 78 | %.175 = xor i17 %.174, 1 79 | %21 = lshr i64 %.15, 19 80 | %22 = trunc i64 %21 to i18 81 | %23 = and i18 %22, 1 82 | %.190 = zext i17 %.175 to i18 83 | %.191 = shl nuw i18 %.190, 1 84 | %.192 = or i18 %.191, %23 85 | %.204 = lshr i64 %.15, 17 86 | %.205 = trunc i64 %.204 to i2 87 | %.206 = xor i2 %.205, -1 88 | %.207 = zext i2 %.206 to i20 89 | %.208 = zext i18 %.192 to i20 90 | %.209 = shl nuw i20 %.208, 2 91 | %.210 = or i20 %.209, %.207 92 | %.222 = lshr i64 %.15, 15 93 | %24 = trunc i64 %.222 to i22 94 | %.224 = and i22 %24, 3 95 | %.225 = zext i20 %.210 to i22 96 | %.226 = shl nuw i22 %.225, 2 97 | %.227 = or i22 %.226, %.224 98 | %.239 = lshr i64 %.15, 13 99 | %.240 = trunc i64 %.239 to i2 100 | %.241 = xor i2 %.240, -1 101 | %.242 = zext i2 %.241 to i24 102 | %.243 = zext i22 %.227 to i24 103 | %.244 = shl nuw i24 %.243, 2 104 | %.245 = or i24 %.244, %.242 105 | %.257 = lshr i64 %.15, 11 106 | %25 = trunc i64 %.257 to i26 107 | %.259 = and i26 %25, 3 108 | %.260 = zext i24 %.245 to i26 109 | %.261 = shl nuw i26 %.260, 2 110 | %.262 = or i26 %.261, %.259 111 | %.274 = lshr i64 %.15, 6 112 | %.275 = trunc i64 %.274 to i5 113 | %.276 = xor i5 %.275, -1 114 | %.277 = zext i5 %.276 to i31 115 | %.278 = zext i26 %.262 to i31 116 | %.279 = shl nuw i31 %.278, 5 117 | %.280 = or i31 %.279, %.277 118 | %.292 = lshr i64 %.15, 4 119 | %26 = trunc i64 %.292 to i33 120 | %.294 = and i33 %26, 3 121 | %.295 = zext i31 %.280 to i33 122 | %.296 = shl nuw i33 %.295, 2 123 | %.297 = or i33 %.296, %.294 124 | %.309 = lshr i64 %.15, 2 125 | %.310 = trunc i64 %.309 to i2 126 | %.311 = xor i2 %.310, -1 127 | %.312 = zext i2 %.311 to i35 128 | %.313 = zext i33 %.297 to i35 129 | %.314 = shl nuw i35 %.313, 2 130 | %.315 = or i35 %.314, %.312 131 | %27 = lshr i64 %.15, 1 132 | %28 = trunc i64 %27 to i36 133 | %29 = and i36 %28, 1 134 | %.330 = zext i35 %.315 to i36 135 | %.331 = shl nuw i36 %.330, 1 136 | %.332 = or i36 %.331, %29 137 | %30 = trunc i64 %.9 to i37 138 | %31 = and i37 %30, 1 139 | %.338 = zext i36 %.332 to i37 140 | %32 = shl nuw i37 %.338, 1 141 | %.339 = or i37 %32, %31 142 | %.340 = xor i37 %.339, 1 143 | %.352 = lshr i64 %.15, 62 144 | %33 = trunc i64 %.352 to i39 145 | %.354 = and i39 %33, 3 146 | %.355 = zext i37 %.340 to i39 147 | %.356 = shl nuw i39 %.355, 2 148 | %.357 = or i39 %.356, %.354 149 | %34 = lshr i64 %.15, 61 150 | %35 = trunc i64 %34 to i40 151 | %36 = and i40 %35, 1 152 | %.373 = zext i39 %.357 to i40 153 | %37 = shl nuw i40 %.373, 1 154 | %.374 = or i40 %37, %36 155 | %.375 = xor i40 %.374, 1 156 | %.387 = lshr i64 %.15, 59 157 | %38 = trunc i64 %.387 to i42 158 | %.389 = and i42 %38, 3 159 | %.390 = zext i40 %.375 to i42 160 | %.391 = shl nuw i42 %.390, 2 161 | %.392 = or i42 %.391, %.389 162 | %.404 = lshr i64 %.15, 54 163 | %.405 = trunc i64 %.404 to i5 164 | %.406 = xor i5 %.405, -1 165 | %.407 = zext i5 %.406 to i47 166 | %.408 = zext i42 %.392 to i47 167 | %.409 = shl nuw i47 %.408, 5 168 | %.410 = or i47 %.409, %.407 169 | %39 = lshr i64 %.15, 53 170 | %40 = trunc i64 %39 to i48 171 | %41 = and i48 %40, 1 172 | %.425 = zext i47 %.410 to i48 173 | %.426 = shl nuw i48 %.425, 1 174 | %.427 = or i48 %.426, %41 175 | %42 = lshr i64 %.15, 52 176 | %43 = trunc i64 %42 to i49 177 | %44 = and i49 %43, 1 178 | %.443 = zext i48 %.427 to i49 179 | %45 = shl nuw i49 %.443, 1 180 | %.444 = or i49 %45, %44 181 | %.445 = xor i49 %.444, 1 182 | %46 = lshr i64 %.15, 51 183 | %47 = trunc i64 %46 to i50 184 | %48 = and i50 %47, 1 185 | %.460 = zext i49 %.445 to i50 186 | %.461 = shl nuw i50 %.460, 1 187 | %.462 = or i50 %.461, %48 188 | %49 = lshr i64 %.15, 50 189 | %50 = trunc i64 %49 to i51 190 | %51 = and i51 %50, 1 191 | %.478 = zext i50 %.462 to i51 192 | %52 = shl nuw i51 %.478, 1 193 | %.479 = or i51 %52, %51 194 | %.480 = xor i51 %.479, 1 195 | %.492 = lshr i64 %.15, 48 196 | %53 = trunc i64 %.492 to i53 197 | %.494 = and i53 %53, 3 198 | %.495 = zext i51 %.480 to i53 199 | %.496 = shl nuw i53 %.495, 2 200 | %.497 = or i53 %.496, %.494 201 | %.509 = lshr i64 %.15, 45 202 | %.510 = trunc i64 %.509 to i3 203 | %.511 = xor i3 %.510, -1 204 | %.512 = zext i3 %.511 to i56 205 | %.513 = zext i53 %.497 to i56 206 | %.514 = shl nuw i56 %.513, 3 207 | %.515 = or i56 %.514, %.512 208 | %54 = lshr i64 %.15, 44 209 | %55 = trunc i64 %54 to i57 210 | %56 = and i57 %55, 1 211 | %.530 = zext i56 %.515 to i57 212 | %.531 = shl nuw i57 %.530, 1 213 | %.532 = or i57 %.531, %56 214 | %57 = lshr i64 %.15, 43 215 | %58 = trunc i64 %57 to i58 216 | %59 = and i58 %58, 1 217 | %.548 = zext i57 %.532 to i58 218 | %60 = shl nuw i58 %.548, 1 219 | %.549 = or i58 %60, %59 220 | %.550 = xor i58 %.549, 1 221 | %61 = lshr i64 %.15, 42 222 | %62 = trunc i64 %61 to i59 223 | %63 = and i59 %62, 1 224 | %.565 = zext i58 %.550 to i59 225 | %.566 = shl nuw i59 %.565, 1 226 | %.567 = or i59 %.566, %63 227 | %.579 = lshr i64 %.15, 40 228 | %.580 = trunc i64 %.579 to i2 229 | %.581 = xor i2 %.580, -1 230 | %.582 = zext i2 %.581 to i61 231 | %.583 = zext i59 %.567 to i61 232 | %.584 = shl nuw i61 %.583, 2 233 | %.585 = or i61 %.584, %.582 234 | %.597 = lshr i64 %.15, 38 235 | %64 = trunc i64 %.597 to i63 236 | %.599 = and i63 %64, 3 237 | %.600 = zext i61 %.585 to i63 238 | %.601 = shl nuw i63 %.600, 2 239 | %.602 = or i63 %.601, %.599 240 | %65 = lshr i64 %.15, 37 241 | %.lobit = and i64 %65, 1 242 | %.618 = zext i63 %.602 to i64 243 | %66 = shl nuw i64 %.618, 1 244 | %.619 = or i64 %66, %.lobit 245 | %.620 = xor i64 %.619, 1 246 | %.621 = mul i64 %.620, %const 247 | %.622 = add i64 %.621, -8796714831421723037 248 | %.1241 = lshr i64 %.622, 33 249 | %.1247 = xor i64 %.1241, %.622 250 | %.1248 = mul i64 %.1247, %const234 251 | %.2493 = lshr i64 %.1248, 29 252 | %.2499 = xor i64 %.2493, %.1248 253 | %.2500 = mul i64 %.2499, 1609587929392839161 254 | %.4997 = lshr i64 %.2500, 32 255 | %.5003 = xor i64 %.4997, %.2500 256 | ret i64 %.5003 257 | } 258 | 259 | attributes #0 = { norecurse nounwind readnone } 260 | -------------------------------------------------------------------------------- /output/tigress-0-challenge-4.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = '' 2 | source_filename = "" 3 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 4 | target triple = "unknown-unknown-unknown" 5 | 6 | ; Function Attrs: norecurse nounwind readnone 7 | define i64 @SECRET(i64 %.1) local_unnamed_addr #0 { 8 | .3: 9 | %.4 = lshr i64 %.1, 5 10 | %.5 = trunc i64 %.4 to i3 11 | %0 = lshr i64 %.1, 6 12 | %1 = trunc i64 %0 to i2 13 | %2 = and i2 %1, 1 14 | %3 = lshr i64 %.1, 7 15 | %4 = shl nuw nsw i64 %3, 1 16 | %5 = trunc i64 %4 to i2 17 | %.13 = or i2 %2, %5 18 | %.14 = xor i2 %.13, -2 19 | %6 = and i3 %.5, 1 20 | %.19 = zext i2 %.14 to i3 21 | %7 = shl nuw i3 %.19, 1 22 | %.20 = or i3 %7, %6 23 | %.21 = xor i3 %.20, 1 24 | %.22 = add i3 %.21, -1 25 | %.24 = trunc i64 %.1 to i3 26 | %.25 = shl i3 %.24, 1 27 | %.26 = add i3 %.25, %.5 28 | %.29 = add i3 %.26, %.22 29 | %.30 = mul i3 %.29, %.5 30 | %.36 = zext i3 %.30 to i64 31 | %.37 = shl nuw nsw i64 %.36, 2 32 | %.45 = or i64 %.37, %.4 33 | %.48 = mul i3 %.5, -2 34 | %8 = or i3 %.48, 1 35 | %.58 = zext i3 %8 to i64 36 | %.59 = lshr i64 %.1, %.58 37 | %.66 = lshr i64 %.1, 61 38 | %.67 = trunc i64 %.66 to i2 39 | %.68 = xor i2 %.67, -1 40 | %.69 = zext i2 %.68 to i8 41 | %9 = trunc i64 %.66 to i6 42 | %.65 = and i6 %9, 4 43 | %10 = or i6 %.65, 8 44 | %.71 = zext i6 %10 to i8 45 | %.72 = or i8 %.71, %.69 46 | %11 = lshr i64 %.1, 60 47 | %12 = trunc i64 %11 to i9 48 | %13 = and i9 %12, 1 49 | %14 = shl nuw nsw i8 %.72, 1 50 | %.77 = zext i8 %14 to i9 51 | %.78 = or i9 %13, %.77 52 | %15 = lshr i64 %.1, 59 53 | %16 = trunc i64 %15 to i10 54 | %17 = and i10 %16, 1 55 | %18 = shl nuw nsw i9 %.78, 1 56 | %.84 = zext i9 %18 to i10 57 | %19 = or i10 %17, %.84 58 | %.85 = xor i10 %19, 1 59 | %.86 = lshr i64 %.1, 53 60 | %20 = trunc i64 %.86 to i16 61 | %.88 = and i16 %20, 63 62 | %.89 = zext i10 %.85 to i16 63 | %.90 = shl nuw nsw i16 %.89, 6 64 | %.91 = or i16 %.90, %.88 65 | %21 = lshr i64 %.1, 52 66 | %22 = trunc i64 %21 to i17 67 | %23 = and i17 %22, 1 68 | %24 = shl nuw i16 %.91, 1 69 | %.97 = zext i16 %24 to i17 70 | %25 = or i17 %23, %.97 71 | %.98 = xor i17 %25, 1 72 | %.99 = lshr i64 %.1, 49 73 | %26 = trunc i64 %.99 to i20 74 | %.101 = and i20 %26, 7 75 | %.102 = zext i17 %.98 to i20 76 | %.103 = shl nuw nsw i20 %.102, 3 77 | %.104 = or i20 %.103, %.101 78 | %27 = lshr i64 %.1, 48 79 | %28 = trunc i64 %27 to i21 80 | %29 = and i21 %28, 1 81 | %30 = shl nuw i20 %.104, 1 82 | %.110 = zext i20 %30 to i21 83 | %31 = or i21 %29, %.110 84 | %.111 = xor i21 %31, 1 85 | %.112 = lshr i64 %.1, 45 86 | %32 = trunc i64 %.112 to i24 87 | %.114 = and i24 %32, 7 88 | %.115 = zext i21 %.111 to i24 89 | %.116 = shl nuw nsw i24 %.115, 3 90 | %.117 = or i24 %.116, %.114 91 | %33 = lshr i64 %.1, 44 92 | %34 = trunc i64 %33 to i25 93 | %35 = and i25 %34, 1 94 | %36 = shl nuw i24 %.117, 1 95 | %.123 = zext i24 %36 to i25 96 | %37 = or i25 %35, %.123 97 | %38 = lshr i64 %.1, 43 98 | %39 = trunc i64 %38 to i26 99 | %40 = and i26 %39, 1 100 | %.124 = shl nuw i25 %37, 1 101 | %41 = xor i25 %.124, 2 102 | %.129 = zext i25 %41 to i26 103 | %.130 = or i26 %40, %.129 104 | %42 = lshr i64 %.1, 42 105 | %43 = trunc i64 %42 to i27 106 | %44 = and i27 %43, 1 107 | %45 = shl nuw i26 %.130, 1 108 | %.136 = zext i26 %45 to i27 109 | %46 = or i27 %44, %.136 110 | %.137 = xor i27 %46, 1 111 | %.138 = lshr i64 %.1, 39 112 | %47 = trunc i64 %.138 to i30 113 | %.140 = and i30 %47, 7 114 | %.141 = zext i27 %.137 to i30 115 | %.142 = shl nuw nsw i30 %.141, 3 116 | %.143 = or i30 %.142, %.140 117 | %48 = lshr i64 %.1, 38 118 | %49 = trunc i64 %48 to i31 119 | %50 = and i31 %49, 1 120 | %51 = shl nuw i30 %.143, 1 121 | %.149 = zext i30 %51 to i31 122 | %52 = or i31 %50, %.149 123 | %53 = lshr i64 %.1, 37 124 | %54 = trunc i64 %53 to i32 125 | %55 = and i32 %54, 1 126 | %.150 = shl nuw i31 %52, 1 127 | %56 = xor i31 %.150, 2 128 | %.155 = zext i31 %56 to i32 129 | %.156 = or i32 %55, %.155 130 | %57 = lshr i64 %.1, 36 131 | %58 = trunc i64 %57 to i33 132 | %59 = and i33 %58, 1 133 | %60 = shl nuw i32 %.156, 1 134 | %.162 = zext i32 %60 to i33 135 | %61 = or i33 %59, %.162 136 | %.163 = xor i33 %61, 1 137 | %.164 = lshr i64 %.1, 34 138 | %62 = trunc i64 %.164 to i35 139 | %.166 = and i35 %62, 3 140 | %.167 = zext i33 %.163 to i35 141 | %.168 = shl nuw nsw i35 %.167, 2 142 | %.169 = or i35 %.168, %.166 143 | %63 = lshr i64 %.1, 33 144 | %64 = trunc i64 %63 to i36 145 | %65 = and i36 %64, 1 146 | %66 = shl nuw i35 %.169, 1 147 | %.175 = zext i35 %66 to i36 148 | %67 = or i36 %65, %.175 149 | %.176 = xor i36 %67, 1 150 | %.177 = lshr i64 %.1, 29 151 | %68 = trunc i64 %.177 to i40 152 | %.179 = and i40 %68, 15 153 | %.180 = zext i36 %.176 to i40 154 | %.181 = shl nuw nsw i40 %.180, 4 155 | %.182 = or i40 %.181, %.179 156 | %.183 = lshr i64 %.1, 26 157 | %.184 = trunc i64 %.183 to i3 158 | %.185 = xor i3 %.184, -1 159 | %.186 = zext i3 %.185 to i43 160 | %.187 = zext i40 %.182 to i43 161 | %.188 = shl nuw nsw i43 %.187, 3 162 | %.189 = or i43 %.188, %.186 163 | %.190 = lshr i64 %.1, 23 164 | %69 = trunc i64 %.190 to i46 165 | %.192 = and i46 %69, 7 166 | %.193 = zext i43 %.189 to i46 167 | %.194 = shl nuw nsw i46 %.193, 3 168 | %.195 = or i46 %.194, %.192 169 | %70 = lshr i64 %.1, 22 170 | %71 = trunc i64 %70 to i47 171 | %72 = and i47 %71, 1 172 | %73 = shl nuw i46 %.195, 1 173 | %.201 = zext i46 %73 to i47 174 | %74 = or i47 %72, %.201 175 | %.202 = xor i47 %74, 1 176 | %.203 = lshr i64 %.1, 19 177 | %75 = trunc i64 %.203 to i50 178 | %.205 = and i50 %75, 7 179 | %.206 = zext i47 %.202 to i50 180 | %.207 = shl nuw nsw i50 %.206, 3 181 | %.208 = or i50 %.207, %.205 182 | %.209 = lshr i64 %.1, 16 183 | %.210 = trunc i64 %.209 to i3 184 | %.211 = xor i3 %.210, -1 185 | %.212 = zext i3 %.211 to i53 186 | %.213 = zext i50 %.208 to i53 187 | %.214 = shl nuw nsw i53 %.213, 3 188 | %.215 = or i53 %.214, %.212 189 | %.216 = lshr i64 %.1, 14 190 | %76 = trunc i64 %.216 to i55 191 | %.218 = and i55 %76, 3 192 | %.219 = zext i53 %.215 to i55 193 | %.220 = shl nuw nsw i55 %.219, 2 194 | %.221 = or i55 %.220, %.218 195 | %77 = lshr i64 %.1, 13 196 | %78 = trunc i64 %77 to i56 197 | %79 = and i56 %78, 1 198 | %80 = shl nuw i55 %.221, 1 199 | %.227 = zext i55 %80 to i56 200 | %81 = or i56 %79, %.227 201 | %.228 = xor i56 %81, 1 202 | %.229 = lshr i64 %.1, 8 203 | %82 = trunc i64 %.229 to i61 204 | %.231 = and i61 %82, 31 205 | %.232 = zext i56 %.228 to i61 206 | %.233 = shl nuw nsw i61 %.232, 5 207 | %.234 = or i61 %.233, %.231 208 | %83 = trunc i64 %3 to i62 209 | %84 = and i62 %83, 1 210 | %85 = shl nuw i61 %.234, 1 211 | %.240 = zext i61 %85 to i62 212 | %86 = or i62 %84, %.240 213 | %87 = trunc i64 %0 to i63 214 | %88 = and i63 %87, 1 215 | %.241 = shl nuw i62 %86, 1 216 | %89 = xor i62 %.241, 2 217 | %.246 = zext i62 %89 to i63 218 | %.247 = or i63 %88, %.246 219 | %.lobit = and i64 %.4, 1 220 | %90 = shl nuw i63 %.247, 1 221 | %.253 = zext i63 %90 to i64 222 | %91 = or i64 %.lobit, %.253 223 | %.254 = xor i64 %91, 1 224 | %.255 = add i64 %.1, 127 225 | %.256 = add i64 %.255, %.254 226 | %92 = lshr i64 %.256, 4 227 | %93 = trunc i64 %92 to i5 228 | %94 = and i5 %93, 14 229 | %95 = or i5 %94, 1 230 | %.266 = zext i5 %95 to i6 231 | %.267 = sub nsw i6 0, %.266 232 | %.268 = zext i6 %.267 to i64 233 | %96 = shl i64 1, %.268 234 | %97 = and i64 %96, %.59 235 | %.494 = and i64 %92, 14 236 | %.495 = or i64 %.494, 1 237 | %98 = icmp ne i64 %97, 0 238 | %.501 = zext i1 %98 to i3 239 | %.502 = shl nuw i3 %.501, 2 240 | %99 = trunc i64 %3 to i2 241 | %100 = and i2 %99, 1 242 | %.511121 = shl nuw nsw i64 %.229, 1 243 | %.511 = trunc i64 %.511121 to i2 244 | %101 = or i2 %100, %.511 245 | %.512 = xor i2 %101, 1 246 | %102 = trunc i64 %0 to i3 247 | %103 = and i3 %102, 1 248 | %.516 = zext i2 %.512 to i3 249 | %.517 = shl nuw i3 %.516, 1 250 | %.518 = or i3 %.517, %103 251 | %104 = trunc i64 %.4 to i4 252 | %105 = and i4 %104, 1 253 | %.523 = zext i3 %.518 to i4 254 | %106 = shl nuw i4 %.523, 1 255 | %.524 = or i4 %106, %105 256 | %.525 = xor i4 %.524, 1 257 | %.528 = trunc i64 %.1 to i4 258 | %.526 = add i4 %.528, -1 259 | %.529 = add i4 %.526, %.525 260 | %.530 = lshr i4 %.529, 1 261 | %.531 = trunc i4 %.530 to i3 262 | %.532 = or i3 %.502, %.531 263 | %.538 = zext i3 %.532 to i6 264 | %.539 = shl nuw nsw i6 %.538, 1 265 | %.540 = or i6 %.539, 1 266 | %.541 = sub nsw i6 0, %.540 267 | %.542 = zext i6 %.541 to i64 268 | %.546 = lshr i64 %.45, %.542 269 | %.1081 = zext i3 %.532 to i64 270 | %.1082 = shl nuw nsw i64 %.1081, 1 271 | %.1083 = or i64 %.1082, 1 272 | %.1084 = shl i64 %.45, %.1083 273 | %.1085 = or i64 %.546, %.1084 274 | %.1281 = add nsw i64 %.254, -275339905 275 | %.1282 = shl i64 %.1, 1 276 | %.1283 = add i64 %.4, %.1282 277 | %.1290 = add i64 %.1283, %.1281 278 | %107 = lshr i64 %.59, 3 279 | %108 = trunc i64 %107 to i5 280 | %109 = and i5 %108, 14 281 | %110 = or i5 %109, 1 282 | %.1314 = zext i5 %110 to i6 283 | %.1315 = sub nsw i6 0, %.1314 284 | %.1316 = zext i6 %.1315 to i64 285 | %.1320 = lshr i64 %.1290, %.1316 286 | %.1548 = and i64 %107, 14 287 | %.1549 = or i64 %.1548, 1 288 | %.1550 = shl i64 %.1290, %.1549 289 | %.1551 = or i64 %.1320, %.1550 290 | %.1552 = icmp ugt i64 %.1085, %.1551 291 | br i1 %.1552, label %.3.endif.if, label %.3.if 292 | 293 | .3.if: ; preds = %.3 294 | %.1588 = zext i3 %.30 to i5 295 | %.1589 = shl nuw i5 %.1588, 2 296 | %.1592 = trunc i64 %.4 to i5 297 | %.1593 = or i5 %.1589, %.1592 298 | %111 = trunc i64 %3 to i3 299 | %112 = and i3 %111, 1 300 | %.1602 = trunc i64 %.511121 to i3 301 | %113 = or i3 %112, %.1602 302 | %.1603 = xor i3 %113, 1 303 | %114 = trunc i64 %0 to i4 304 | %115 = and i4 %114, 1 305 | %.1607 = zext i3 %.1603 to i4 306 | %.1608 = shl nuw i4 %.1607, 1 307 | %.1609 = or i4 %.1608, %115 308 | %116 = and i5 %.1592, 1 309 | %.1614 = zext i4 %.1609 to i5 310 | %117 = shl nuw i5 %.1614, 1 311 | %.1615 = or i5 %117, %116 312 | %.1616 = xor i5 %.1615, 1 313 | %.1620 = trunc i64 %.1 to i5 314 | %.1621 = mul i5 %.1620, -2 315 | %.1594 = or i5 %.1621, 1 316 | %.1618 = sub i5 %.1594, %.1592 317 | %.1622 = sub i5 %.1618, %.1616 318 | %.1626 = add i5 %.1622, %.1593 319 | %.1632 = zext i5 %.1626 to i64 320 | %.1633 = shl nuw nsw i64 %.1632, 3 321 | %.1649 = or i64 %.1633, %.59 322 | %.1846 = add i64 %.1281, %.1 323 | %.1847 = and i64 %.1846, -256 324 | %.2075 = lshr i64 %.59, %.268 325 | %.2299 = shl i64 %.59, %.495 326 | %.2302572 = or i64 %.2075, %.2299 327 | %118 = trunc i64 %.2302572 to i5 328 | %.2303 = and i5 %118, 15 329 | %.2308 = zext i5 %.2303 to i8 330 | %.2309 = shl nuw nsw i8 %.2308, 3 331 | %119 = trunc i64 %3 to i6 332 | %120 = and i6 %119, 1 333 | %.2318 = trunc i64 %.511121 to i6 334 | %121 = or i6 %120, %.2318 335 | %.2319 = xor i6 %121, 1 336 | %122 = trunc i64 %0 to i7 337 | %123 = and i7 %122, 1 338 | %.2323 = zext i6 %.2319 to i7 339 | %.2324 = shl nuw i7 %.2323, 1 340 | %.2325 = or i7 %.2324, %123 341 | %124 = trunc i64 %.4 to i8 342 | %125 = and i8 %124, 1 343 | %.2330 = zext i7 %.2325 to i8 344 | %126 = shl nuw i8 %.2330, 1 345 | %.2331 = or i8 %126, %125 346 | %.2332 = xor i8 %.2331, 1 347 | %.2335 = trunc i64 %.1 to i8 348 | %.2333 = add i8 %.2332, %.2335 349 | %.2336 = add i8 %.2333, 127 350 | %.2337 = or i8 %.2309, %.2336 351 | %.2338 = zext i8 %.2337 to i64 352 | %.2341 = or i64 %.1847, %.2338 353 | %.2798 = shl i5 %118, 3 354 | %.2822 = add i5 %.1620, -1 355 | %.2825 = add i5 %.2822, %.1616 356 | %.2826 = or i5 %.2798, %.2825 357 | %.2832 = zext i5 %.2826 to i64 358 | %.2833 = shl nuw nsw i64 %.2832, 4 359 | %.2877 = or i64 %.45, %.2833 360 | %.2879 = sub i64 %.2341, %.2877 361 | %.2880 = or i64 %.1649, %.2879 362 | %127 = trunc i64 %.2302572 to i6 363 | %.3337 = shl i6 %127, 3 364 | %128 = trunc i64 %3 to i4 365 | %129 = and i4 %128, 1 366 | %.3346 = trunc i64 %.511121 to i4 367 | %130 = or i4 %129, %.3346 368 | %.3347 = xor i4 %130, 1 369 | %131 = trunc i64 %0 to i5 370 | %132 = and i5 %131, 1 371 | %.3351 = zext i4 %.3347 to i5 372 | %.3352 = shl nuw i5 %.3351, 1 373 | %.3353 = or i5 %.3352, %132 374 | %133 = trunc i64 %.4 to i6 375 | %134 = and i6 %133, 1 376 | %.3358 = zext i5 %.3353 to i6 377 | %135 = shl nuw i6 %.3358, 1 378 | %.3359 = or i6 %135, %134 379 | %.3360 = xor i6 %.3359, 1 380 | %.3363 = trunc i64 %.1 to i6 381 | %.3361 = add i6 %.3363, -1 382 | %.3364 = add i6 %.3361, %.3360 383 | %.3365 = or i6 %.3337, %.3364 384 | %136 = trunc i64 %.4 to i2 385 | %137 = and i2 %136, 1 386 | %.3373662 = shl nuw nsw i64 %0, 1 387 | %.3373 = trunc i64 %.3373662 to i2 388 | %138 = or i2 %137, %.3373 389 | %.3374 = xor i2 %138, 1 390 | %.3377 = trunc i64 %.1 to i2 391 | %.3375 = add i2 %.3377, -1 392 | %.3378 = add i2 %.3375, %.3374 393 | %.3380 = zext i2 %.3378 to i6 394 | %.3381 = shl nuw i6 %.3380, 4 395 | %.3415 = zext i3 %.30 to i6 396 | %.3416 = shl nuw nsw i6 %.3415, 2 397 | %.3418 = or i6 %.3381, %133 398 | %.3421 = or i6 %.3418, %.3416 399 | %.3423 = sub i6 %.3365, %.3421 400 | %.3429 = zext i6 %.3423 to i64 401 | %.3430706 = or i64 %.3429, %.2832 402 | %.3925 = shl nuw nsw i64 %.3430706, 4 403 | %.3968 = or i64 %.45, %.3925 404 | %.4422 = trunc i64 %.2302572 to i2 405 | %.4448 = add i8 %.2333, 31 406 | %.4449 = lshr i8 %.4448, 3 407 | %.4450 = trunc i8 %.4449 to i2 408 | %.4451 = or i2 %.4422, %.4450 409 | %.4457 = zext i2 %.4451 to i64 410 | %.4458 = shl nuw nsw i64 %.4457, 1 411 | %.4459 = or i64 %.4458, 1 412 | %.4460 = shl i64 %.3968, %.4459 413 | %.4461 = add i64 %.4460, %.2880 414 | ret i64 %.4461 415 | 416 | .3.endif.if: ; preds = %.3 417 | %139 = and i64 %96, %.59 418 | %140 = icmp ne i64 %139, 0 419 | %141 = trunc i64 %77 to i56 420 | %.6229 = add i64 %.1281, %.1 421 | %.6230 = and i64 %.6229, -256 422 | %.6687 = zext i1 %140 to i4 423 | %.6688 = shl nuw i4 %.6687, 3 424 | %.6716 = or i4 %.6688, %.529 425 | %.6722 = zext i4 %.6716 to i8 426 | %.6951 = lshr i64 %.59, %.268 427 | %.7175 = shl i64 %.59, %.495 428 | %.7178415 = or i64 %.6951, %.7175 429 | %142 = trunc i64 %.7178415 to i5 430 | %.7179 = and i5 %142, 15 431 | %.7184 = zext i5 %.7179 to i8 432 | %.6723416 = or i8 %.6722, %.7184 433 | %.7187 = shl nuw nsw i8 %.6723416, 3 434 | %143 = trunc i64 %3 to i6 435 | %144 = and i6 %143, 1 436 | %.7195 = trunc i64 %.511121 to i6 437 | %145 = or i6 %144, %.7195 438 | %.7196 = xor i6 %145, 1 439 | %146 = trunc i64 %0 to i7 440 | %147 = and i7 %146, 1 441 | %.7200 = zext i6 %.7196 to i7 442 | %.7201 = shl nuw i7 %.7200, 1 443 | %.7202 = or i7 %.7201, %147 444 | %148 = trunc i64 %.4 to i8 445 | %149 = and i8 %148, 1 446 | %.7207 = zext i7 %.7202 to i8 447 | %150 = shl nuw i8 %.7207, 1 448 | %.7208 = or i8 %150, %149 449 | %.7209 = xor i8 %.7208, 1 450 | %.7212 = trunc i64 %.1 to i8 451 | %.7210 = add i8 %.7209, %.7212 452 | %.7213 = add i8 %.7210, 127 453 | %.7214 = or i8 %.7187, %.7213 454 | %.7215 = zext i8 %.7214 to i64 455 | %.7218 = or i64 %.6230, %.7215 456 | %.7251 = zext i3 %.30 to i8 457 | %.7252 = shl nuw nsw i8 %.7251, 2 458 | %.7256 = or i8 %.7252, %148 459 | %.7259 = and i56 %141, 281474976710655 460 | %.7260 = zext i8 %.7256 to i56 461 | %.7261 = shl nuw i56 %.7260, 48 462 | %.7262 = or i56 %.7261, %.7259 463 | %.7264 = zext i56 %.7262 to i61 464 | %.7265 = shl nuw i61 %.7264, 5 465 | %.7270 = zext i61 %.7265 to i64 466 | %.7271 = shl nuw i64 %.7270, 3 467 | %.7272 = or i64 %.7271, %.66 468 | %.7274 = sub i64 %.7218, %.7272 469 | %.7275 = or i64 %.7274, %.59 470 | %.7295 = add i3 %.22, %.24 471 | %.7297 = zext i3 %.7295 to i6 472 | %151 = trunc i64 %.7178415 to i6 473 | %.7298463 = or i6 %151, %.7297 474 | %.7758 = shl i6 %.7298463, 3 475 | %152 = trunc i64 %3 to i4 476 | %153 = and i4 %152, 1 477 | %.7766 = trunc i64 %.511121 to i4 478 | %154 = or i4 %153, %.7766 479 | %.7767 = xor i4 %154, 1 480 | %155 = trunc i64 %0 to i5 481 | %156 = and i5 %155, 1 482 | %.7771 = zext i4 %.7767 to i5 483 | %.7772 = shl nuw i5 %.7771, 1 484 | %.7773 = or i5 %.7772, %156 485 | %157 = trunc i64 %.4 to i6 486 | %158 = and i6 %157, 1 487 | %.7778 = zext i5 %.7773 to i6 488 | %159 = shl nuw i6 %.7778, 1 489 | %.7779 = or i6 %159, %158 490 | %.7780 = xor i6 %.7779, 1 491 | %.7783 = trunc i64 %.1 to i6 492 | %.7781 = add i6 %.7783, -1 493 | %.7784 = add i6 %.7781, %.7780 494 | %.7785 = or i6 %.7758, %.7784 495 | %.7793 = sub i6 %.7785, %9 496 | %.7799 = zext i6 %.7793 to i64 497 | %.7800 = shl nuw nsw i64 %.7799, 4 498 | %.7856 = or i64 %.7800, %.7272 499 | %160 = trunc i64 %.4 to i2 500 | %161 = and i2 %160, 1 501 | %.7864473 = shl nuw nsw i64 %0, 1 502 | %.7864 = trunc i64 %.7864473 to i2 503 | %162 = or i2 %161, %.7864 504 | %.7865 = xor i2 %162, 1 505 | %.7868 = trunc i64 %.1 to i2 506 | %.7866 = add i2 %.7868, -1 507 | %.7869 = add i2 %.7866, %.7865 508 | %.8098 = trunc i64 %.6951 to i2 509 | %.8323 = trunc i64 %.7175 to i2 510 | %.8350 = add i8 %.7210, 31 511 | %.8351 = lshr i8 %.8350, 3 512 | %.8352 = trunc i8 %.8351 to i2 513 | %.8099 = or i2 %.7869, %.8352 514 | %.8324 = or i2 %.8099, %.8323 515 | %.8353 = or i2 %.8324, %.8098 516 | %.8359 = zext i2 %.8353 to i64 517 | %.8360 = shl nuw nsw i64 %.8359, 1 518 | %.8361 = or i64 %.8360, 1 519 | %.8362 = shl i64 %.7856, %.8361 520 | %.8363 = add i64 %.7275, %.8362 521 | ret i64 %.8363 522 | } 523 | 524 | attributes #0 = { norecurse nounwind readnone } 525 | -------------------------------------------------------------------------------- /output/tigress-0-challenge-2.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = '' 2 | source_filename = "" 3 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 4 | target triple = "unknown-unknown-unknown" 5 | 6 | ; Function Attrs: norecurse nounwind readnone 7 | define i64 @SECRET(i64 %.1) local_unnamed_addr #0 { 8 | .3: 9 | %.4 = add i64 %.1, -896446207 10 | %.5 = or i64 %.4, %.1 11 | %.7 = xor i64 %.5, %.4 12 | %.8 = shl i64 %.1, 1 13 | %0 = udiv i64 %.1, 3 14 | %.10.not = add i64 %.8, -896446207 15 | %.20 = and i64 %.10.not, %0 16 | %.21 = icmp ule i64 %.7, %.20 17 | %1 = lshr i64 %0, 48 18 | %2 = trunc i64 %1 to i32 19 | %3 = lshr i64 %0, 16 20 | %.54 = and i64 %0, 4294967295 21 | %.4521.masked = and i64 %3, 4294901760 22 | %.55 = or i64 %.4521.masked, %1 23 | %.56 = shl nuw i64 %.55, 32 24 | %.57 = or i64 %.56, %.54 25 | %4 = lshr i64 %.1, 3 26 | %.68 = and i64 %4, 6 27 | %.69 = or i64 %.68, 1 28 | %.70 = shl i64 %.57, %.69 29 | %.78 = icmp ule i64 %.70, %.4 30 | %.87 = trunc i64 %.1 to i4 31 | %.88 = add i4 %.87, 1 32 | %.89 = lshr i4 %.88, 1 33 | %.90 = trunc i4 %.89 to i3 34 | %.91 = lshr i64 %.1, 1 35 | %.92 = trunc i64 %.91 to i3 36 | %.93 = or i3 %.90, %.92 37 | %.99 = zext i3 %.93 to i6 38 | %.100 = shl nuw nsw i6 %.99, 1 39 | %.101 = or i6 %.100, 1 40 | %.102 = sub nsw i6 0, %.101 41 | %.103 = zext i6 %.102 to i64 42 | %.107 = lshr i64 %.4, %.103 43 | %.122 = zext i3 %.93 to i64 44 | %.123 = shl nuw nsw i64 %.122, 1 45 | %.124 = or i64 %.123, 1 46 | %.125 = shl i64 %.4, %.124 47 | %.126 = or i64 %.107, %.125 48 | %.158 = xor i64 %.57, %.10.not 49 | %.159 = icmp ugt i64 %.126, %.158 50 | %.167 = and i1 %.21, %.78 51 | %.168 = and i1 %.167, %.159 52 | br i1 %.168, label %.3.if, label %.3.endif 53 | 54 | .3.if: ; preds = %.3 55 | %5 = trunc i64 %.1 to i5 56 | %.178 = shl i5 %5, 1 57 | %6 = and i5 %.178, 14 58 | %7 = or i5 %6, 1 59 | %.185 = zext i5 %7 to i6 60 | %.186 = sub nsw i6 0, %.185 61 | %.187 = zext i6 %.186 to i64 62 | %.191 = lshr i64 %.5, %.187 63 | %.206 = and i64 %.8, 14 64 | %.207 = or i64 %.206, 1 65 | %.208 = shl i64 %.5, %.207 66 | %.209 = or i64 %.191, %.208 67 | %8 = and i5 %5, 14 68 | %9 = or i5 %8, 1 69 | %.221 = zext i5 %9 to i6 70 | %.222 = sub nsw i6 0, %.221 71 | %.223 = zext i6 %.222 to i64 72 | %.227 = shl i64 %.209, %.223 73 | %.278 = and i64 %.1, 14 74 | %.279 = or i64 %.278, 1 75 | %.280 = lshr i64 %.209, %.279 76 | %.281 = or i64 %.227, %.280 77 | %10 = or i4 %.88, 1 78 | %.335 = zext i4 %10 to i6 79 | %.336 = sub nsw i6 0, %.335 80 | %.337 = zext i6 %.336 to i64 81 | %.341 = lshr i64 %.209, %.337 82 | %.396 = zext i4 %10 to i64 83 | %.397 = shl i64 %.209, %.396 84 | %.342426 = or i64 %.341, %.397 85 | %11 = lshr i64 %.342426, 2 86 | %12 = trunc i64 %11 to i5 87 | %13 = and i5 %12, 14 88 | %14 = or i5 %13, 1 89 | %.408 = zext i5 %14 to i6 90 | %.409 = sub nsw i6 0, %.408 91 | %.410 = zext i6 %.409 to i64 92 | %.414 = shl i64 %.4, %.410 93 | %.540 = and i64 %11, 14 94 | %.541 = or i64 %.540, 1 95 | %.542 = lshr i64 %.4, %.541 96 | %.543 = or i64 %.414, %.542 97 | %.544 = mul i64 %.543, %.281 98 | ret i64 %.544 99 | 100 | .3.endif: ; preds = %.3 101 | %.701 = icmp ule i64 %.126, %.158 102 | %.710 = and i1 %.167, %.701 103 | br i1 %.710, label %.3.endif.if, label %.3.endif.endif 104 | 105 | .3.endif.if: ; preds = %.3.endif 106 | %.713 = trunc i64 %.1 to i5 107 | %.714 = shl i5 %.713, 1 108 | %15 = or i5 %.714, 1 109 | %.721 = zext i5 %15 to i64 110 | %.722 = shl nuw nsw i64 %.721, 4 111 | %.725 = or i64 %.722, %.4 112 | %.726 = add i64 %.1, 1 113 | %.727417 = or i64 %.726, %.1 114 | %16 = lshr i64 %.727417, 2 115 | %17 = trunc i64 %16 to i5 116 | %18 = and i5 %17, 14 117 | %19 = or i5 %18, 1 118 | %.739 = zext i5 %19 to i6 119 | %.740 = sub nsw i6 0, %.739 120 | %.741 = zext i6 %.740 to i64 121 | %.745 = shl i64 %.725, %.741 122 | %.772 = and i64 %16, 14 123 | %.773 = or i64 %.772, 1 124 | %.774 = lshr i64 %.725, %.773 125 | %.775 = or i64 %.745, %.774 126 | %20 = lshr i64 %0, 24 127 | %.790 = and i32 %2, 255 128 | %.792421 = shl nuw nsw i64 %20, 8 129 | %.792 = trunc i64 %.792421 to i32 130 | %.793 = or i32 %.790, %.792 131 | %.799 = or i4 %.88, %.87 132 | %.803 = mul i4 %.87, -2 133 | %.800 = add i4 %.803, -1 134 | %.804 = add i4 %.800, %.799 135 | %.810 = zext i4 %.804 to i8 136 | %.811 = shl nuw nsw i8 %.810, 3 137 | %.819 = trunc i64 %0 to i8 138 | %.820 = or i8 %.811, %.819 139 | %.821 = zext i8 %.820 to i40 140 | %.822 = zext i32 %.793 to i40 141 | %.823 = shl nuw i40 %.822, 8 142 | %.824 = or i40 %.823, %.821 143 | %21 = lshr i64 %0, 8 144 | %22 = trunc i64 %21 to i56 145 | %.832 = and i56 %22, 65535 146 | %.833 = zext i40 %.824 to i56 147 | %.834 = shl nuw i56 %.833, 16 148 | %.835 = or i56 %.834, %.832 149 | %23 = lshr i64 %0, 56 150 | %.844 = zext i56 %.835 to i64 151 | %.845 = shl nuw i64 %.844, 8 152 | %.846 = or i64 %.845, %23 153 | %24 = and i5 %.713, 14 154 | %25 = or i5 %24, 1 155 | %.858 = zext i5 %25 to i6 156 | %.859 = sub nsw i6 0, %.858 157 | %.860 = zext i6 %.859 to i64 158 | %.864 = shl i64 %.846, %.860 159 | %.946 = and i64 %.1, 14 160 | %.947 = or i64 %.946, 1 161 | %.948 = lshr i64 %.846, %.947 162 | %.949 = or i64 %.864, %.948 163 | %.950 = mul i64 %.949, %.775 164 | ret i64 %.950 165 | 166 | .3.endif.endif: ; preds = %.3.endif 167 | %.969 = icmp ugt i64 %.7, %.20 168 | %.1020 = trunc i64 %.1 to i6 169 | %.1021 = shl i6 %.1020, 2 170 | %26 = or i6 %.1021, 2 171 | %.1028 = zext i6 %26 to i64 172 | %.1029 = shl nuw nsw i64 %.1028, 4 173 | %.1033 = or i64 %.5, %.1029 174 | %.1036 = trunc i64 %.1 to i3 175 | %.1037 = add i3 %.1036, 1 176 | %.1040 = or i3 %.1037, %.1036 177 | %.1046 = zext i3 %.1040 to i64 178 | %.1047 = shl nuw nsw i64 %.1046, 2 179 | %.1050 = or i64 %.1047, %.4 180 | %.1052.demorgan = and i64 %.1033, %.1050 181 | %.1054 = icmp ule i64 %.70, %.1052.demorgan 182 | %.1098 = lshr i64 %.1050, %.103 183 | %.1131 = shl i64 %.1050, %.124 184 | %.1132 = or i64 %.1098, %.1131 185 | %.1165 = icmp ugt i64 %.1132, %.158 186 | %.1173 = and i1 %.969, %.1054 187 | %.1174 = and i1 %.1173, %.1165 188 | br i1 %.1174, label %.3.endif.endif.if, label %.3.endif.endif.endif 189 | 190 | .3.endif.endif.if: ; preds = %.3.endif.endif 191 | %27 = trunc i4 %.89 to i3 192 | %28 = trunc i64 %.1 to i5 193 | %.1197 = shl i5 %28, 1 194 | %29 = and i5 %.1197, 14 195 | %30 = or i5 %29, 1 196 | %.1204 = zext i5 %30 to i6 197 | %.1205 = sub nsw i6 0, %.1204 198 | %.1206 = zext i6 %.1205 to i64 199 | %.1210 = lshr i64 %.1033, %.1206 200 | %.1238 = and i64 %.8, 14 201 | %.1239 = or i64 %.1238, 1 202 | %.1240 = shl i64 %.1033, %.1239 203 | %.1241 = or i64 %.1210, %.1240 204 | %31 = and i5 %28, 14 205 | %32 = or i5 %31, 1 206 | %.1253 = zext i5 %32 to i6 207 | %.1254 = sub nsw i6 0, %.1253 208 | %.1255 = zext i6 %.1254 to i64 209 | %.1259 = shl i64 %.1241, %.1255 210 | %.1336 = and i64 %.1, 14 211 | %.1337 = or i64 %.1336, 1 212 | %.1338 = lshr i64 %.1241, %.1337 213 | %.1339 = or i64 %.1259, %.1338 214 | %.1423 = trunc i64 %.1 to i2 215 | %.1424 = add i2 %.1423, 1 216 | %.1427 = or i2 %.1424, %.1423 217 | %.1429 = zext i2 %.1427 to i3 218 | %.1430 = shl nuw i3 %.1429, 1 219 | %.1437 = or i3 %.1430, %27 220 | %.1443 = zext i3 %.1437 to i6 221 | %.1444 = shl nuw nsw i6 %.1443, 1 222 | %.1445 = or i6 %.1444, 1 223 | %.1446 = sub nsw i6 0, %.1445 224 | %.1447 = zext i6 %.1446 to i64 225 | %.1451 = lshr i64 %.1241, %.1447 226 | %.1541 = zext i3 %.1437 to i64 227 | %.1542 = shl nuw nsw i64 %.1541, 1 228 | %.1543 = or i64 %.1542, 1 229 | %.1544 = shl i64 %.1241, %.1543 230 | %.1452412 = or i64 %.1451, %.1544 231 | %33 = lshr i64 %.1452412, 2 232 | %34 = trunc i64 %33 to i5 233 | %35 = and i5 %34, 14 234 | %36 = or i5 %35, 1 235 | %.1555 = zext i5 %36 to i6 236 | %.1556 = sub nsw i6 0, %.1555 237 | %.1557 = zext i6 %.1556 to i64 238 | %.1561 = shl i64 %.1050, %.1557 239 | %.1776 = and i64 %33, 14 240 | %.1777 = or i64 %.1776, 1 241 | %.1778 = lshr i64 %.1050, %.1777 242 | %.1779 = or i64 %.1561, %.1778 243 | %.1780 = mul i64 %.1779, %.1339 244 | ret i64 %.1780 245 | 246 | .3.endif.endif.endif: ; preds = %.3.endif.endif 247 | %37 = icmp ule i64 %.7, %.20 248 | %.1856 = icmp ugt i64 %.70, %.4 249 | %.1875 = shl i64 %0, 4 250 | %.1876 = and i64 %.1875, 1008 251 | %.1879 = or i64 %.1876, %.4 252 | %.1901 = lshr i64 %.1879, %.103 253 | %.1935 = shl i64 %.1879, %.124 254 | %.1936 = or i64 %.1901, %.1935 255 | %.1969 = icmp ugt i64 %.1936, %.158 256 | %.1977 = and i1 %37, %.1856 257 | %.1978 = and i1 %.1977, %.1969 258 | br i1 %.1978, label %.3.endif.endif.endif.if, label %.3.endif.endif.endif.endif 259 | 260 | .3.endif.endif.endif.if: ; preds = %.3.endif.endif.endif 261 | %const441 = bitcast i64 72057593141481729 to i64 262 | %const439 = bitcast i64 281474080264449 to i64 263 | %const437 = bitcast i64 1098615181569 to i64 264 | %const435 = bitcast i64 3398521089 to i64 265 | %.1985248 = lshr i64 %.5, 56 266 | %.1986 = add i64 %.1, %const439 267 | %.1987251 = or i64 %.1986, %.1 268 | %.1991250 = lshr i64 %.1987251, 40 269 | %38 = trunc i64 %.1991250 to i16 270 | %.1992 = and i16 %38, 255 271 | %.1994252 = shl nuw nsw i64 %.1985248, 8 272 | %.1994 = trunc i64 %.1994252 to i16 273 | %.1995 = or i16 %.1992, %.1994 274 | %.1996 = add i64 %.1, %const441 275 | %.1997254 = or i64 %.1996, %.1 276 | %.2001253 = lshr i64 %.1997254, 48 277 | %39 = trunc i64 %.2001253 to i24 278 | %.2002 = and i24 %39, 255 279 | %.2003 = zext i16 %.1995 to i24 280 | %.2004 = shl nuw i24 %.2003, 8 281 | %.2005 = or i24 %.2004, %.2002 282 | %.2006 = add i64 %.1, %const437 283 | %.2007256 = or i64 %.2006, %.1 284 | %.2011255 = lshr i64 %.2007256, 32 285 | %40 = trunc i64 %.2011255 to i32 286 | %.2012 = and i32 %40, 255 287 | %.2013 = zext i24 %.2005 to i32 288 | %.2014 = shl nuw i32 %.2013, 8 289 | %.2015 = or i32 %.2014, %.2012 290 | %.2016 = add i64 %.1, %const435 291 | %.2017258 = or i64 %.2016, %.1 292 | %.2021257 = lshr i64 %.2017258, 24 293 | %41 = trunc i64 %.2021257 to i40 294 | %.2022 = and i40 %41, 255 295 | %.2023 = zext i32 %.2015 to i40 296 | %.2024 = shl nuw i40 %.2023, 8 297 | %.2025 = or i40 %.2024, %.2022 298 | %.2026 = add i64 %.1, 9523457 299 | %.2027260 = or i64 %.2026, %.1 300 | %.2031259 = lshr i64 %.2027260, 16 301 | %42 = trunc i64 %.2031259 to i48 302 | %.2032 = and i48 %42, 255 303 | %.2033 = zext i40 %.2025 to i48 304 | %.2034 = shl nuw i48 %.2033, 8 305 | %.2035 = or i48 %.2034, %.2032 306 | %.2042 = trunc i64 %0 to i6 307 | %.2045 = shl i6 %.1020, 1 308 | %.2046 = or i6 %.2045, 1 309 | %.2047 = mul i6 %.2046, %.2042 310 | %.2048 = lshr i6 %.2047, 4 311 | %.2050 = zext i6 %.2048 to i8 312 | %.2054 = add i64 %.1, 20737 313 | %.2055434 = or i64 %.2054, %.1 314 | %.2057433 = lshr i64 %.2055434, 8 315 | %.2057 = trunc i64 %.2057433 to i8 316 | %.2060 = or i8 %.2057, %.2050 317 | %.2061 = zext i8 %.2060 to i56 318 | %.2062 = zext i48 %.2035 to i56 319 | %.2063 = shl nuw i56 %.2062, 8 320 | %.2064 = or i56 %.2063, %.2061 321 | %.2071 = trunc i64 %0 to i4 322 | %.2074 = shl i4 %.87, 1 323 | %.2075 = or i4 %.2074, 1 324 | %.2076 = mul i4 %.2075, %.2071 325 | %.2078 = zext i4 %.2076 to i8 326 | %.2079 = shl nuw i8 %.2078, 4 327 | %.2082 = trunc i64 %.1 to i8 328 | %.2083 = add i8 %.2082, 1 329 | %.2084 = or i8 %.2083, %.2082 330 | %.2087 = or i8 %.2084, %.2079 331 | %.2088 = zext i8 %.2087 to i64 332 | %.2089 = zext i56 %.2064 to i64 333 | %.2090 = shl nuw i64 %.2089, 8 334 | %.2091 = or i64 %.2090, %.2088 335 | %43 = trunc i64 %.1 to i5 336 | %.2098 = shl i5 %43, 1 337 | %44 = and i5 %.2098, 14 338 | %45 = or i5 %44, 1 339 | %.2105 = zext i5 %45 to i6 340 | %.2106 = sub nsw i6 0, %.2105 341 | %.2107 = zext i6 %.2106 to i64 342 | %.2111 = lshr i64 %.2091, %.2107 343 | %.2236 = and i64 %.8, 14 344 | %.2237 = or i64 %.2236, 1 345 | %.2238 = shl i64 %.2091, %.2237 346 | %.2239 = or i64 %.2111, %.2238 347 | %46 = and i5 %43, 14 348 | %47 = or i5 %46, 1 349 | %.2251 = zext i5 %47 to i6 350 | %.2252 = sub nsw i6 0, %.2251 351 | %.2253 = zext i6 %.2252 to i64 352 | %.2257 = shl i64 %.2239, %.2253 353 | %.2528 = and i64 %.1, 14 354 | %.2529 = or i64 %.2528, 1 355 | %.2530 = lshr i64 %.2239, %.2529 356 | %.2531 = or i64 %.2257, %.2530 357 | %48 = or i4 %.88, 1 358 | %.2821 = zext i4 %48 to i6 359 | %.2822 = sub nsw i6 0, %.2821 360 | %.2823 = zext i6 %.2822 to i64 361 | %.2827 = lshr i64 %.2239, %.2823 362 | %.3102 = zext i4 %48 to i64 363 | %.3103 = shl i64 %.2239, %.3102 364 | %.2828354 = or i64 %.2827, %.3103 365 | %49 = lshr i64 %.2828354, 2 366 | %50 = trunc i64 %49 to i5 367 | %51 = and i5 %50, 14 368 | %52 = or i5 %51, 1 369 | %.3114 = zext i5 %52 to i6 370 | %.3115 = sub nsw i6 0, %.3114 371 | %.3116 = zext i6 %.3115 to i64 372 | %.3120 = shl i64 %.1879, %.3116 373 | %.3702 = and i64 %49, 14 374 | %.3703 = or i64 %.3702, 1 375 | %.3704 = lshr i64 %.1879, %.3703 376 | %.3705 = or i64 %.3120, %.3704 377 | %.3706 = mul i64 %.3705, %.2531 378 | ret i64 %.3706 379 | 380 | .3.endif.endif.endif.endif: ; preds = %.3.endif.endif.endif 381 | %.3921 = icmp ule i64 %.1132, %.158 382 | %.3930 = and i1 %.1173, %.3921 383 | br i1 %.3930, label %.3.endif.endif.endif.endif.if, label %.3.endif.endif.endif.endif.endif 384 | 385 | .3.endif.endif.endif.endif.if: ; preds = %.3.endif.endif.endif.endif 386 | %.3933 = trunc i64 %.1 to i5 387 | %.3934 = shl i5 %.3933, 1 388 | %53 = or i5 %.3934, 1 389 | %.3941 = zext i5 %53 to i64 390 | %.3942 = shl nuw nsw i64 %.3941, 4 391 | %.3960 = or i64 %.1050, %.3942 392 | %.3961 = add i64 %.1, 1 393 | %.3962242 = or i64 %.3961, %.1 394 | %.3964241 = lshr i64 %.3962242, 3 395 | %.3964 = trunc i64 %.3964241 to i3 396 | %54 = or i3 %.3964, -4 397 | %.3973 = zext i3 %54 to i6 398 | %.3974 = shl nuw nsw i6 %.3973, 1 399 | %.3975 = or i6 %.3974, 1 400 | %.3976 = sub nsw i6 0, %.3975 401 | %.3977 = zext i6 %.3976 to i64 402 | %.3981 = shl i64 %.3960, %.3977 403 | %.4023 = zext i3 %54 to i64 404 | %.4024 = shl nuw nsw i64 %.4023, 1 405 | %.4025 = or i64 %.4024, 1 406 | %.4026 = lshr i64 %.3960, %.4025 407 | %.4027 = or i64 %.3981, %.4026 408 | %55 = lshr i64 %0, 24 409 | %.4042 = and i32 %2, 255 410 | %.4044245 = shl nuw nsw i64 %55, 8 411 | %.4044 = trunc i64 %.4044245 to i32 412 | %.4045 = or i32 %.4042, %.4044 413 | %.4051 = or i4 %.88, %.87 414 | %.4055 = mul i4 %.87, -2 415 | %.4052 = add i4 %.4055, -1 416 | %.4056 = add i4 %.4052, %.4051 417 | %.4062 = zext i4 %.4056 to i8 418 | %.4063 = shl nuw nsw i8 %.4062, 3 419 | %.4071 = trunc i64 %0 to i8 420 | %.4072 = or i8 %.4063, %.4071 421 | %.4073 = zext i8 %.4072 to i40 422 | %.4074 = zext i32 %.4045 to i40 423 | %.4075 = shl nuw i40 %.4074, 8 424 | %.4076 = or i40 %.4075, %.4073 425 | %56 = lshr i64 %0, 8 426 | %57 = trunc i64 %56 to i56 427 | %.4084 = and i56 %57, 65535 428 | %.4085 = zext i40 %.4076 to i56 429 | %.4086 = shl nuw i56 %.4085, 16 430 | %.4087 = or i56 %.4086, %.4084 431 | %58 = lshr i64 %0, 56 432 | %.4096 = zext i56 %.4087 to i64 433 | %.4097 = shl nuw i64 %.4096, 8 434 | %.4098 = or i64 %.4097, %58 435 | %59 = and i5 %.3933, 14 436 | %60 = or i5 %59, 1 437 | %.4110 = zext i5 %60 to i6 438 | %.4111 = sub nsw i6 0, %.4110 439 | %.4112 = zext i6 %.4111 to i64 440 | %.4116 = shl i64 %.4098, %.4112 441 | %.4198 = and i64 %.1, 14 442 | %.4199 = or i64 %.4198, 1 443 | %.4200 = lshr i64 %.4098, %.4199 444 | %.4201 = or i64 %.4116, %.4200 445 | %.4202 = mul i64 %.4201, %.4027 446 | ret i64 %.4202 447 | 448 | .3.endif.endif.endif.endif.endif: ; preds = %.3.endif.endif.endif.endif 449 | %.4391 = icmp ule i64 %.1936, %.158 450 | %.4400 = and i1 %.1977, %.4391 451 | br i1 %.4400, label %.3.endif.endif.endif.endif.endif.if, label %.3.endif.endif.endif.endif.endif.endif 452 | 453 | .3.endif.endif.endif.endif.endif.if: ; preds = %.3.endif.endif.endif.endif.endif 454 | %61 = lshr i64 %0, 24 455 | %.4416 = and i32 %2, 255 456 | %.4418238 = shl nuw nsw i64 %61, 8 457 | %.4418 = trunc i64 %.4418238 to i32 458 | %.4419 = or i32 %.4416, %.4418 459 | %.4425 = or i4 %.88, %.87 460 | %.4429 = mul i4 %.87, -2 461 | %.4426 = add i4 %.4429, -1 462 | %.4430 = add i4 %.4426, %.4425 463 | %.4436 = zext i4 %.4430 to i8 464 | %.4437 = shl nuw nsw i8 %.4436, 3 465 | %.4445 = trunc i64 %0 to i8 466 | %.4446 = or i8 %.4437, %.4445 467 | %.4447 = zext i8 %.4446 to i40 468 | %.4448 = zext i32 %.4419 to i40 469 | %.4449 = shl nuw i40 %.4448, 8 470 | %.4450 = or i40 %.4449, %.4447 471 | %62 = lshr i64 %0, 8 472 | %63 = trunc i64 %62 to i56 473 | %.4458 = and i56 %63, 65535 474 | %.4459 = zext i40 %.4450 to i56 475 | %.4460 = shl nuw i56 %.4459, 16 476 | %.4461 = or i56 %.4460, %.4458 477 | %64 = lshr i64 %0, 56 478 | %.4470 = zext i56 %.4461 to i64 479 | %.4471 = shl nuw i64 %.4470, 8 480 | %.4472 = or i64 %.4471, %64 481 | %65 = trunc i64 %.1 to i5 482 | %66 = and i5 %65, 14 483 | %67 = or i5 %66, 1 484 | %.4484 = zext i5 %67 to i6 485 | %.4485 = sub nsw i6 0, %.4484 486 | %.4486 = zext i6 %.4485 to i64 487 | %.4490 = shl i64 %.4472, %.4486 488 | %.4572 = and i64 %.1, 14 489 | %.4573 = or i64 %.4572, 1 490 | %.4574 = lshr i64 %.4472, %.4573 491 | %.4575 = or i64 %.4490, %.4574 492 | %.4578 = shl i5 %65, 1 493 | %68 = or i5 %.4578, 1 494 | %.4585 = zext i5 %68 to i64 495 | %.4586 = shl nuw nsw i64 %.4585, 4 496 | %.4605 = or i64 %.1879, %.4586 497 | %.4612 = trunc i64 %0 to i2 498 | %.4614 = trunc i64 %.1 to i2 499 | %.4615 = shl i2 %.4614, 1 500 | %.4616 = or i2 %.4615, 1 501 | %.4617 = mul i2 %.4616, %.4612 502 | %.4619 = zext i2 %.4617 to i3 503 | %.4620 = shl nuw i3 %.4619, 1 504 | %.4623 = trunc i64 %.1 to i8 505 | %.4624 = add i8 %.4623, 1 506 | %.4625 = lshr i8 %.4624, 3 507 | %.4626 = trunc i8 %.4625 to i3 508 | %.4629 = trunc i64 %4 to i3 509 | %.4627 = or i3 %.4626, %.4629 510 | %.4630 = or i3 %.4627, %.4620 511 | %.4636 = zext i3 %.4630 to i6 512 | %.4637 = shl nuw nsw i6 %.4636, 1 513 | %.4638 = or i6 %.4637, 1 514 | %.4639 = sub nsw i6 0, %.4638 515 | %.4640 = zext i6 %.4639 to i64 516 | %.4644 = shl i64 %.4605, %.4640 517 | %.4705 = zext i3 %.4630 to i64 518 | %.4706 = shl nuw nsw i64 %.4705, 1 519 | %.4707 = or i64 %.4706, 1 520 | %.4708 = lshr i64 %.4605, %.4707 521 | %.4709 = or i64 %.4644, %.4708 522 | %.4710 = mul i64 %.4575, %.4709 523 | ret i64 %.4710 524 | 525 | .3.endif.endif.endif.endif.endif.endif: ; preds = %.3.endif.endif.endif.endif.endif 526 | %69 = icmp ugt i64 %.7, %.20 527 | %.4814 = icmp ugt i64 %.70, %.1052.demorgan 528 | %.4852 = or i64 %.1879, %.1047 529 | %.4874 = lshr i64 %.4852, %.103 530 | %.4923 = shl i64 %.4852, %.124 531 | %.4924 = or i64 %.4874, %.4923 532 | %.4957 = icmp ugt i64 %.4924, %.158 533 | %.4965 = and i1 %69, %.4814 534 | %.4966 = and i1 %.4965, %.4957 535 | br i1 %.4966, label %.3.endif.endif.endif.endif.endif.endif.if, label %.3.endif.endif.endif.endif.endif.endif.endif.if 536 | 537 | .3.endif.endif.endif.endif.endif.endif.if: ; preds = %.3.endif.endif.endif.endif.endif.endif 538 | %70 = trunc i4 %.89 to i3 539 | %const440 = bitcast i64 72057593141481729 to i64 540 | %const438 = bitcast i64 281474080264449 to i64 541 | %const436 = bitcast i64 1098615181569 to i64 542 | %const = bitcast i64 3398521089 to i64 543 | %.497340 = lshr i64 %.5, 56 544 | %.4974 = add i64 %.1, %const438 545 | %.497543 = or i64 %.4974, %.1 546 | %.497942 = lshr i64 %.497543, 40 547 | %71 = trunc i64 %.497942 to i16 548 | %.4980 = and i16 %71, 255 549 | %.498244 = shl nuw nsw i64 %.497340, 8 550 | %.4982 = trunc i64 %.498244 to i16 551 | %.4983 = or i16 %.4980, %.4982 552 | %.4984 = add i64 %.1, %const440 553 | %.498546 = or i64 %.4984, %.1 554 | %.498945 = lshr i64 %.498546, 48 555 | %72 = trunc i64 %.498945 to i24 556 | %.4990 = and i24 %72, 255 557 | %.4991 = zext i16 %.4983 to i24 558 | %.4992 = shl nuw i24 %.4991, 8 559 | %.4993 = or i24 %.4992, %.4990 560 | %.4994 = add i64 %.1, %const436 561 | %.499548 = or i64 %.4994, %.1 562 | %.499947 = lshr i64 %.499548, 32 563 | %73 = trunc i64 %.499947 to i32 564 | %.5000 = and i32 %73, 255 565 | %.5001 = zext i24 %.4993 to i32 566 | %.5002 = shl nuw i32 %.5001, 8 567 | %.5003 = or i32 %.5002, %.5000 568 | %.5004 = add i64 %.1, %const 569 | %.500550 = or i64 %.5004, %.1 570 | %.500949 = lshr i64 %.500550, 24 571 | %74 = trunc i64 %.500949 to i40 572 | %.5010 = and i40 %74, 255 573 | %.5011 = zext i32 %.5003 to i40 574 | %.5012 = shl nuw i40 %.5011, 8 575 | %.5013 = or i40 %.5012, %.5010 576 | %.5014 = add i64 %.1, 9523457 577 | %.501552 = or i64 %.5014, %.1 578 | %.501951 = lshr i64 %.501552, 16 579 | %75 = trunc i64 %.501951 to i48 580 | %.5020 = and i48 %75, 255 581 | %.5021 = zext i40 %.5013 to i48 582 | %.5022 = shl nuw i48 %.5021, 8 583 | %.5023 = or i48 %.5022, %.5020 584 | %.5030 = trunc i64 %0 to i6 585 | %.5033 = shl i6 %.1020, 1 586 | %.5034 = or i6 %.5033, 1 587 | %.5035 = mul i6 %.5034, %.5030 588 | %.5036 = lshr i6 %.5035, 4 589 | %76 = lshr i6 %.1020, 2 590 | %.5047.mask = and i6 %76, 3 591 | %.505253 = or i6 %.5036, %.5047.mask 592 | %.5052 = zext i6 %.505253 to i8 593 | %.5053 = add i64 %.1, 20737 594 | %.5054432 = or i64 %.5053, %.1 595 | %.5056431 = lshr i64 %.5054432, 8 596 | %.5056 = trunc i64 %.5056431 to i8 597 | %.5059 = or i8 %.5056, %.5052 598 | %.5060 = zext i8 %.5059 to i56 599 | %.5061 = zext i48 %.5023 to i56 600 | %.5062 = shl nuw i56 %.5061, 8 601 | %.5063 = or i56 %.5062, %.5060 602 | %.5070 = trunc i64 %0 to i4 603 | %.5073 = shl i4 %.87, 1 604 | %.5074 = or i4 %.5073, 1 605 | %.5075 = mul i4 %.5074, %.5070 606 | %.5082 = shl i4 %.87, 2 607 | %.5083 = or i4 %.5082, %.5075 608 | %.50785455 = or i4 %.5083, 2 609 | %.507854 = zext i4 %.50785455 to i8 610 | %.5088 = shl nuw i8 %.507854, 4 611 | %.5090 = trunc i64 %.1 to i8 612 | %.5091 = add i8 %.5090, 1 613 | %.5092 = or i8 %.5091, %.5090 614 | %.5095 = or i8 %.5092, %.5088 615 | %.5096 = zext i8 %.5095 to i64 616 | %.5097 = zext i56 %.5063 to i64 617 | %.5098 = shl nuw i64 %.5097, 8 618 | %.5099 = or i64 %.5098, %.5096 619 | %77 = trunc i64 %.1 to i5 620 | %.5106 = shl i5 %77, 1 621 | %78 = and i5 %.5106, 14 622 | %79 = or i5 %78, 1 623 | %.5113 = zext i5 %79 to i6 624 | %.5114 = sub nsw i6 0, %.5113 625 | %.5115 = zext i6 %.5114 to i64 626 | %.5119 = lshr i64 %.5099, %.5115 627 | %.5264 = and i64 %.8, 14 628 | %.5265 = or i64 %.5264, 1 629 | %.5266 = shl i64 %.5099, %.5265 630 | %.5267 = or i64 %.5119, %.5266 631 | %80 = and i5 %77, 14 632 | %81 = or i5 %80, 1 633 | %.5279 = zext i5 %81 to i6 634 | %.5280 = sub nsw i6 0, %.5279 635 | %.5281 = zext i6 %.5280 to i64 636 | %.5285 = shl i64 %.5267, %.5281 637 | %.5596 = and i64 %.1, 14 638 | %.5597 = or i64 %.5596, 1 639 | %.5598 = lshr i64 %.5267, %.5597 640 | %.5599 = or i64 %.5285, %.5598 641 | %.5933 = trunc i64 %.1 to i2 642 | %.5934 = add i2 %.5933, 1 643 | %.5937 = or i2 %.5934, %.5933 644 | %.5939 = zext i2 %.5937 to i3 645 | %.5940 = shl nuw i3 %.5939, 1 646 | %.5947 = or i3 %.5940, %70 647 | %.5953 = zext i3 %.5947 to i6 648 | %.5954 = shl nuw nsw i6 %.5953, 1 649 | %.5955 = or i6 %.5954, 1 650 | %.5956 = sub nsw i6 0, %.5955 651 | %.5957 = zext i6 %.5956 to i64 652 | %.5961 = lshr i64 %.5267, %.5957 653 | %.6285 = zext i3 %.5947 to i64 654 | %.6286 = shl nuw nsw i64 %.6285, 1 655 | %.6287 = or i64 %.6286, 1 656 | %.6288 = shl i64 %.5267, %.6287 657 | %.5962170 = or i64 %.5961, %.6288 658 | %82 = lshr i64 %.5962170, 2 659 | %83 = trunc i64 %82 to i5 660 | %84 = and i5 %83, 14 661 | %85 = or i5 %84, 1 662 | %.6299 = zext i5 %85 to i6 663 | %.6300 = sub nsw i6 0, %.6299 664 | %.6301 = zext i6 %.6300 to i64 665 | %.6305 = shl i64 %.4852, %.6301 666 | %.7004 = and i64 %82, 14 667 | %.7005 = or i64 %.7004, 1 668 | %.7006 = lshr i64 %.4852, %.7005 669 | %.7007 = or i64 %.6305, %.7006 670 | %.7008 = mul i64 %.7007, %.5599 671 | ret i64 %.7008 672 | 673 | .3.endif.endif.endif.endif.endif.endif.endif.if: ; preds = %.3.endif.endif.endif.endif.endif.endif 674 | %86 = lshr i64 %0, 24 675 | %.7280 = and i32 %2, 255 676 | %.728237 = shl nuw nsw i64 %86, 8 677 | %.7282 = trunc i64 %.728237 to i32 678 | %.7283 = or i32 %.7280, %.7282 679 | %.7289 = or i4 %.88, %.87 680 | %.7293 = mul i4 %.87, -2 681 | %.7290 = add i4 %.7293, -1 682 | %.7294 = add i4 %.7290, %.7289 683 | %.7300 = zext i4 %.7294 to i8 684 | %.7301 = shl nuw nsw i8 %.7300, 3 685 | %.7309 = trunc i64 %0 to i8 686 | %.7310 = or i8 %.7301, %.7309 687 | %.7311 = zext i8 %.7310 to i40 688 | %.7312 = zext i32 %.7283 to i40 689 | %.7313 = shl nuw i40 %.7312, 8 690 | %.7314 = or i40 %.7313, %.7311 691 | %87 = lshr i64 %0, 8 692 | %88 = trunc i64 %87 to i56 693 | %.7322 = and i56 %88, 65535 694 | %.7323 = zext i40 %.7314 to i56 695 | %.7324 = shl nuw i56 %.7323, 16 696 | %.7325 = or i56 %.7324, %.7322 697 | %89 = lshr i64 %0, 56 698 | %.7334 = zext i56 %.7325 to i64 699 | %.7335 = shl nuw i64 %.7334, 8 700 | %.7336 = or i64 %.7335, %89 701 | %90 = trunc i64 %.1 to i5 702 | %91 = and i5 %90, 14 703 | %92 = or i5 %91, 1 704 | %.7348 = zext i5 %92 to i6 705 | %.7349 = sub nsw i6 0, %.7348 706 | %.7350 = zext i6 %.7349 to i64 707 | %.7354 = shl i64 %.7336, %.7350 708 | %.7436 = and i64 %.1, 14 709 | %.7437 = or i64 %.7436, 1 710 | %.7438 = lshr i64 %.7336, %.7437 711 | %.7439 = or i64 %.7354, %.7438 712 | %.7442 = shl i5 %90, 1 713 | %93 = or i5 %.7442, 1 714 | %.7449 = zext i5 %93 to i64 715 | %.7450 = shl nuw nsw i64 %.7449, 4 716 | %.7482 = or i64 %.1879, %.7450 717 | %.7484 = or i64 %.7482, %.1047 718 | %94 = trunc i64 %0 to i3 719 | %.7499 = shl i3 %94, 1 720 | %.7503 = trunc i64 %.1 to i8 721 | %.7504 = add i8 %.7503, 1 722 | %.7505 = lshr i8 %.7504, 3 723 | %.7506 = trunc i8 %.7505 to i3 724 | %.7509 = trunc i64 %4 to i3 725 | %.7501 = or i3 %.7509, %.7506 726 | %.7507 = or i3 %.7501, %.7499 727 | %95 = or i3 %.7507, -4 728 | %.7516 = zext i3 %95 to i6 729 | %.7517 = shl nuw nsw i6 %.7516, 1 730 | %.7518 = or i6 %.7517, 1 731 | %.7519 = sub nsw i6 0, %.7518 732 | %.7520 = zext i6 %.7519 to i64 733 | %.7524 = shl i64 %.7484, %.7520 734 | %.7601 = zext i3 %95 to i64 735 | %.7602 = shl nuw nsw i64 %.7601, 1 736 | %.7603 = or i64 %.7602, 1 737 | %.7604 = lshr i64 %.7484, %.7603 738 | %.7605 = or i64 %.7524, %.7604 739 | %.7606 = mul i64 %.7439, %.7605 740 | ret i64 %.7606 741 | } 742 | 743 | attributes #0 = { norecurse nounwind readnone } 744 | --------------------------------------------------------------------------------