Skip to content

Instantly share code, notes, and snippets.

@ajdust
Last active July 4, 2021 18:56
Show Gist options
  • Save ajdust/5e92cab52ffab5ea2a52edbd47aa348a to your computer and use it in GitHub Desktop.
Save ajdust/5e92cab52ffab5ea2a52edbd47aa348a to your computer and use it in GitHub Desktop.
Under a second compile time C++ equivalent
//$ clang++ -O3 test_20.cpp
// takes under 300ms to compile, clang version 11.0.0
// see Rust equivalent at https://gist.github.com/ajdust/9cf976ed2935ad428ee5465cbdef7d56
#include <iostream>
int f0(const int p) {
const int x1 = (p - ((((21 | 1) | p) ^ 84) & ((48 ^ (52 | (p & (2 ^ 61)))) - 67)));
const int x2 = x1;
int x3 = 54;
const int x4 = 75;
const int x5 = (77 & 39);
const int x6 = (x2 * x5);
const int x7 = (88 * (8 + x1));
x3 = (x3 + 60);
return ((((((((32 * p) & x1) ^ x2) - x3) ^ x4) & x5) | x6) | x7);
}
int f1(const int p) {
int x1 = f0(78);
x1 = (x1 ^ p);
int x2 = f0(x1);
x2 = (x2 * 3);
const int x3 = f0(x1);
const int x4 = ((21 & (x3 - ((93 * (x3 - (f0(x3) - (x2 - (f0(x1) | 43))))) | (f0(p) - f0(x1))))) * 41);
return ((((((f0(p) | x2) ^ p) & x1) ^ x2) | x3) - x4);
}
int f2(const int p) {
int x1 = f1(50);
x1 = (x1 * p);
x1 = (x1 | f0(p));
int x2 = f1(x1);
x2 = (x2 | f1(x2));
int x3 = (24 * f0(x1));
x2 = (x2 & f0(p));
x3 = (x3 ^ x1);
const int x4 = x1;
return (((((x4 ^ p) | x1) * x2) + x3) | x4);
}
int f3(const int p) {
int x1 = f2(75);
const int x2 = x1;
x1 = (x1 & x2);
const int x3 = f0(p);
const int x4 = ((f1(x3) ^ f1(x2)) + 92);
x1 = (x1 | (x2 ^ 94));
x1 = (x1 * x2);
const int x5 = (f0(x1) & (3 ^ (f0(x1) * f2(x4))));
x1 = (x1 + x2);
return (((((((x1 * x5) * p) - x1) | x2) * x3) - x4) - x5);
}
int f4(const int p) {
int x1 = f3(14);
x1 = (x1 + f0(p));
int x2 = f1(x1);
x1 = (x1 - 41);
x2 = (x2 ^ 61);
const int x3 = f2(p);
x2 = (x2 ^ p);
const int x4 = x2;
x1 = (x1 - p);
x1 = (x1 * x4);
return ((((((88 & 11) & p) - x1) * x2) ^ x3) | x4);
}
int f5(const int p) {
int x1 = f4(50);
x1 = (x1 ^ 13);
return ((35 + p) | x1);
}
int f6(const int p) {
int x1 = f5(51);
x1 = (x1 + 27);
const int x2 = (p + (p | f1(x1)));
x1 = (x1 + f0(x2));
const int x3 = f0(x1);
int x4 = 48;
x1 = (x1 ^ f0(p));
x1 = (x1 & 26);
x4 = (x4 * f1(x4));
return (((((99 - p) * x1) ^ x2) & x3) + x4);
}
int f7(const int p) {
int x1 = f6(71);
x1 = (x1 & 66);
x1 = (x1 & p);
const int x2 = 57;
x1 = (x1 * 26);
const int x3 = (21 & p);
const int x4 = (f0(x1) & (f3(p) * f2(p)));
const int x5 = f6(x3);
return ((((((x5 + p) | x1) + x2) - x3) & x4) * x5);
}
int f8(const int p) {
int x1 = f7(57);
x1 = (x1 & f5(p));
x1 = (x1 ^ (x1 & f1(p)));
const int x2 = 25;
const int x3 = f5(x1);
return ((((x1 - p) * x1) & x2) ^ x3);
}
int f9(const int p) {
int x1 = f8(23);
x1 = (x1 | (((26 | f4(x1)) - f0(p)) | f8(p)));
const int x2 = x1;
int x3 = 58;
x3 = (x3 - p);
const int x4 = f7(x1);
const int x5 = f7(x2);
const int x6 = (f7(x1) & 79);
return (((((((33 | p) - x1) + x2) + x3) * x4) ^ x5) + x6);
}
int f10(const int p) {
int x1 = f9(75);
x1 = (x1 | 37);
return (((f8(x1) + f3(x1)) | p) * x1);
}
int f11(const int p) {
int x1 = f10(8);
x1 = (x1 ^ f6(x1));
int x2 = p;
x2 = (x2 ^ 84);
const int x3 = (f5(p) ^ f5(p));
x1 = (x1 * f5(p));
x1 = (x1 | f1(x2));
x1 = (x1 * f8(p));
return ((((((f0(x3) | f9(p)) - f4(x1)) + p) & x1) & x2) - x3);
}
int f12(const int p) {
int x1 = f11(33);
x1 = (x1 * 84);
int x2 = (67 - f0(p));
x2 = (x2 | x1);
x1 = (x1 - 67);
x2 = (x2 - f6(p));
return (((p - p) * x1) | x2);
}
int f13(const int p) {
int x1 = f12(90);
x1 = (x1 + (f6(x1) - f4(p)));
x1 = (x1 - 19);
const int x2 = 92;
int x3 = f9(x1);
int x4 = x3;
x4 = (x4 - (87 | f5(x3)));
x3 = (x3 | 49);
const int x5 = 25;
const int x6 = x3;
return (((((((2 & p) - x1) ^ x2) ^ x3) ^ x4) | x5) | x6);
}
int f14(const int p) {
int x1 = f13(66);
const int x2 = f2(p);
x1 = (x1 - 11);
int x3 = 69;
x3 = (x3 * x2);
const int x4 = 91;
return (((((19 * p) + x1) | x2) ^ x3) & x4);
}
int f15(const int p) {
int x1 = f14(79);
x1 = (x1 + (f8(p) & p));
const int x2 = p;
x1 = (x1 | ((f5(p) & x2) ^ x2));
int x3 = x1;
x1 = (x1 - p);
x3 = (x3 * p);
return ((((40 * p) ^ x1) + x2) + x3);
}
int f16(const int p) {
const int x1 = f15(77);
int x2 = 5;
int x3 = x1;
const int x4 = p;
x2 = (x2 + p);
const int x5 = x4;
x3 = (x3 | f9(x4));
const int x6 = (68 ^ (61 ^ (24 * f14(x4))));
return (((((((88 + p) - x1) & x2) | x3) & x4) ^ x5) | x6);
}
int f17(const int p) {
int x1 = f16(41);
x1 = (x1 | 4);
int x2 = x1;
x1 = (x1 | 52);
x1 = (x1 & 49);
x2 = (x2 & (f8(x2) ^ p));
int x3 = x2;
x3 = (x3 ^ ((x1 ^ x2) + f15(x2)));
int x4 = (f13(x2) ^ 73);
x4 = (x4 - f12(x1));
return (((((x3 - p) + x1) ^ x2) + x3) | x4);
}
int f18(const int p) {
int x1 = f17(3);
x1 = (x1 & (p - ((33 * (95 | 87)) | (9 - f1(x1)))));
x1 = (x1 & (80 - f16(x1)));
x1 = (x1 & p);
x1 = (x1 + p);
x1 = (x1 | (82 - ((81 ^ p) - 97)));
return ((20 - p) * x1);
}
int f19(const int p) {
const int x1 = f18(24);
const int x2 = (p & p);
int x3 = 82;
const int x4 = (4 + x1);
x3 = (x3 | ((f10(p) + (f16(x3) - 34)) - f10(x1)));
const int x5 = (x4 | (x1 * (((f16(x1) + f4(x4)) - 43) & f7(x3))));
return (((((((f14(x3) | f9(x5)) - p) & x1) * x2) & x3) * x4) + x5);
}
int f20(const int p) {
const int x1 = f19(78);
const int x2 = 81;
const int x3 = (x2 + (59 & x1));
return (((((f9(x3) ^ f11(x3)) * p) * x1) - x2) ^ x3);
}
int main() {
int x0 = f20(65);
x0 = (x0 * (53 + 37));
int x1 = (x0 - ((41 | ((f20(x0) * f9(x0)) + ((((f20(x0) + (77 + (f14(x0) ^ 60))) * 27) & 62) + x0))) & f20(x0)));
const int x2 = f15(x1);
x1 = (x1 | (x0 * (4 ^ 37)));
const int m = (((x2 | x0) | x1) | x2);
std::cout << m << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment