Advertisement
Guest User

Untitled

a guest
Apr 30th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <climits>
  4. using namespace std;
  5.  
  6. void seed_mt(unsigned int *result, int a2)
  7. {
  8. signed int v2; // r3@1
  9. signed int v3; // r1@1
  10. int v4; // r2@1
  11. unsigned int *v5; // r12@2
  12. int v6; // r4@2
  13.  
  14. v2 = 623;
  15. result[1] = a2;
  16. v3 = 1;
  17. v4 = 0;
  18. do
  19. {
  20. v5 = &result[v4];
  21. --v2;
  22. ++v4;
  23. v6 = v3++ + 0x6C078965 * (v5[1] ^ (v5[1] >> 30));
  24. v5[2] = v6;
  25. }
  26. while ( v2 );
  27. *result = 0;
  28.  
  29. }
  30.  
  31. unsigned int nextuint32(unsigned int *a1)
  32. {
  33. signed int v1; // r1@1
  34. signed int v2; // r2@1
  35. unsigned int *v3; // r3@5
  36. unsigned int *v4; // r5@5
  37. unsigned int v5; // r2@5
  38. unsigned int v6; // r2@7
  39. unsigned int v7; // r0@7
  40.  
  41. v1 = *a1 + 1;
  42. v2 = *a1 + 397;
  43. if ( v1 >= 624 )
  44. v1 = *a1 - 623;
  45. if ( v2 >= 624 )
  46. v2 = *a1 - 227;
  47. v3 = &a1[*a1];
  48. v4 = &a1[v2];
  49. v5 = (v3[1] & 0x80000000 | a1[v1 + 1] & 0x7FFFFFFF) >> 1;
  50. if ( a1[v1 + 1] & 1 )
  51. v5 ^= 0x9908B0DF;
  52. v6 = v5 ^ v4[1];
  53. v3[1] = v6;
  54. *a1 = v1;
  55. v7 = v6 ^ (v6 >> 11) ^ ((v6 ^ (v6 >> 11)) << 7) & 0x9D2C56FF;
  56. return v7 ^ (v7 << 15) & 0xEFC67FFF ^ ((v7 ^ (v7 << 15) & 0xEFC67FFF) >> 18);
  57. }
  58.  
  59. void retwist(unsigned int*a1) {
  60. if (a1[0] == 0) {
  61. nextuint32(a1);
  62. }
  63. while (a1[0] != 0) {
  64. nextuint32(a1);
  65. }
  66. }
  67. int main() {
  68. unsigned int init = 0x0;
  69. unsigned int curr_index = 0x0;
  70. unsigned int current_table0 = 0x0;
  71. unsigned int*mt = new unsigned int[625];
  72. seed_mt(mt, init);
  73. int f = 0;
  74. while (true) {
  75. nextuint32(mt);
  76. f++;
  77. if (mt[0] == curr_index && mt[1] == current_table0) {
  78. break;
  79. }
  80. }
  81. cout << f << endl;
  82. delete mt;
  83.  
  84. return 0;
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement