View difference between Paste ID: CADwLPAH and zJNEtQyL
SHOW: | | - or go back to the newest paste.
1
static thread_local uint64_t RandomStateA =
2-
  static thread_local uint64_t RandomStateA =
2+
    static_cast<uint64_t>(time(nullptr));
3-
      static_cast<uint64_t>(time(nullptr));
3+
static thread_local uint64_t RandomStateB = xorShiftStar64();
4-
  static thread_local uint64_t RandomStateB = xorShiftStar64();
4+
5
uint64_t getRandomUnsigned64() {
6
  uint64_t A = RandomStateA;
7
  const uint64_t B = RandomStateB;
8
  RandomStateA = B;
9
10
  A ^= A << 23;
11
  A ^= A >> 17;
12
  A ^= B ^ (B >> 26);
13
14
  RandomStateB = A;
15
  return A + B;
16
}
17
18
==========================================================================
19-
00000000004006b0 <gwp_asan::random::getRandomUnsigned64()>:
19+
0000000000400780 <gwp_asan::random::getRandomUnsigned64()>:
20-
  4006b0:       53                      push   %rbx
20+
  400780:       41 57                   push   %r15
21-
  4006b1:       66 66 66 64 48 8b 04    data16 data16 data16 mov %fs:0x0,%rax
21+
  400782:       41 56                   push   %r14
22-
  4006b8:       25 00 00 00 00 
22+
  400784:       41 55                   push   %r13
23-
  4006bd:       48 89 c3                mov    %rax,%rbx
23+
  400786:       41 54                   push   %r12
24-
# TLS init check/branch for RandomStateA.
24+
  400788:       53                      push   %rbx
25-
  4006c0:       80 b8 d8 ff ff ff 00    cmpb   $0x0,-0x28(%rax)
25+
  400789:       66 66 66 64 48 8b 04    data16 data16 data16 mov %fs:0x0,%rax
26-
  4006c7:       74 51                   je     40071a <gwp_asan::random::getRandomUnsigned64()+0x6a> #
26+
  400790:       25 00 00 00 00 
27-
# TLS init check/branch for RandomStateB (with an unneccessary `%rbx = %rax` copy).
27+
  400795:       49 89 c6                mov    %rax,%r14
28-
  4006c9:       48 89 d8                mov    %rbx,%rax
28+
  400798:       8a 88 f8 ff ff ff       mov    -0x8(%rax),%cl
29-
  4006cc:       80 bb e8 ff ff ff 01    cmpb   $0x1,-0x18(%rbx)
29+
  40079e:       84 c9                   test   %cl,%cl
30-
  4006d3:       75 6c                   jne    400741 <gwp_asan::random::getRandomUnsigned64()+0x91>
30+
  4007a0:       74 55                   je     4007f7 <gwp_asan::random::getRandomUnsigned64()+0x77>
31-
  4006d5:       48 89 d8                mov    %rbx,%rax
31+
  4007a2:       4d 8b a6 e8 ff ff ff    mov    -0x18(%r14),%r12
32-
  4006d8:       48 8b 93 e0 ff ff ff    mov    -0x20(%rbx),%rdx
32+
  4007a9:       4d 8b ae f0 ff ff ff    mov    -0x10(%r14),%r13
33-
  4006df:       48 8b b3 d0 ff ff ff    mov    -0x30(%rbx),%rsi
33+
  4007b0:       4c 89 f0                mov    %r14,%rax
34-
  4006e6:       48 89 93 d0 ff ff ff    mov    %rdx,-0x30(%rbx)
34+
  4007b3:       4d 89 ae e8 ff ff ff    mov    %r13,-0x18(%r14)
35-
  4006ed:       48 89 f1                mov    %rsi,%rcx
35+
  4007ba:       4c 89 e3                mov    %r12,%rbx
36-
  4006f0:       48 c1 e1 17             shl    $0x17,%rcx
36+
  4007bd:       48 c1 e3 17             shl    $0x17,%rbx
37-
  4006f4:       48 31 f1                xor    %rsi,%rcx
37+
  4007c1:       4c 31 e3                xor    %r12,%rbx
38-
  4006f7:       48 89 d0                mov    %rdx,%rax
38+
  4007c4:       4c 89 e8                mov    %r13,%rax
39-
  4006fa:       48 c1 e8 1a             shr    $0x1a,%rax
39+
  4007c7:       48 c1 e8 1a             shr    $0x1a,%rax
40-
  4006fe:       48 31 d0                xor    %rdx,%rax
40+
  4007cb:       4c 31 e8                xor    %r13,%rax
41-
  400701:       48 31 c8                xor    %rcx,%rax
41+
  4007ce:       48 31 d8                xor    %rbx,%rax
42-
  400704:       48 c1 e9 11             shr    $0x11,%rcx
42+
  4007d1:       48 c1 eb 11             shr    $0x11,%rbx
43-
  400708:       48 31 c1                xor    %rax,%rcx
43+
  4007d5:       48 31 c3                xor    %rax,%rbx
44-
  40070b:       48 89 8b e0 ff ff ff    mov    %rcx,-0x20(%rbx)
44+
  4007d8:       84 c9                   test   %cl,%cl
45-
  400712:       48 01 d1                add    %rdx,%rcx
45+
  4007da:       0f 84 d6 00 00 00       je     4008b6 <gwp_asan::random::getRandomUnsigned64()+0x136>
46-
  400715:       48 89 c8                mov    %rcx,%rax
46+
  4007e0:       49 89 9e f0 ff ff ff    mov    %rbx,-0x10(%r14)
47-
  400718:       5b                      pop    %rbx
47+
  4007e7:       49 01 dd                add    %rbx,%r13
48-
  400719:       c3                      retq
48+
  4007ea:       4c 89 e8                mov    %r13,%rax
49
  4007ed:       5b                      pop    %rbx
50
  4007ee:       41 5c                   pop    %r12
51
  4007f0:       41 5d                   pop    %r13
52
  4007f2:       41 5e                   pop    %r14
53
  4007f4:       41 5f                   pop    %r15
54
  4007f6:       c3                      retq