#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef unsigned long long uint64_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t fastrand2() {
  static uint64_t state = 0x853c49e6748fea9bull;
  static uint64_t inc = 0xda3e39cb94b95bdbull;
  uint64_t oldstate = state;
  state = oldstate * 6364136223846793005ull + (inc | 1);
  uint32_t xorshifted = ((oldstate >> 18u) ^ oldstate) >> 27u;
  uint32_t rot = oldstate >> 59u;
  return (xorshifted >> rot) | (xorshifted << ((-rot) & 31));
}


x86 assembly (clang, -O0):
<fastrand2>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f15(%rip),%rax
mov    %rax,-0x8(%rbp)
movabs $0x5851f42d4c957f2d,%rax
f4 51 58
imul   -0x8(%rbp),%rax
mov    0x2f03(%rip),%rcx
or     $0x1,%rcx
add    %rcx,%rax
mov    %rax,0x2eed(%rip)
mov    -0x8(%rbp),%rax
shr    $0x12,%rax
xor    -0x8(%rbp),%rax
shr    $0x1b,%rax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x3b,%rax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
sar    %cl,%eax
mov    -0xc(%rbp),%edx
xor    %ecx,%ecx
sub    -0x10(%rbp),%ecx
and    $0x1f,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fastrand2>:
mov    0x2f19(%rip),%rcx
movabs $0x5851f42d4c957f2d,%rax
f4 51 58
imul   %rcx,%rax
movabs $0xda3e39cb94b95bdb,%rdx
39 3e da
add    %rax,%rdx
mov    %rdx,0x2ef7(%rip)
mov    %rcx,%rax
shr    $0x2d,%rax
mov    %rcx,%rdx
shr    $0x1b,%rdx
xor    %edx,%eax
shr    $0x3b,%rcx
mov    %eax,%edx
sar    %cl,%edx
neg    %cl
shl    %cl,%eax
or     %edx,%eax
ret

LLVM IR (-O0):
@fastrand2.state = internal global i64 -8846114313915602277
@fastrand2.inc = internal global i64 -2720673578348880933
define i32 @fastrand2() {
%1 = alloca i64
%2 = alloca i32
%3 = alloca i32
%4 = load i64, i64* @fastrand2.state
store i64 %4, i64* %1
%5 = load i64, i64* %1
%6 = mul i64 %5, 6364136223846793005
%7 = load i64, i64* @fastrand2.inc
%8 = or i64 %7, 1
%9 = add i64 %6, %8
store i64 %9, i64* @fastrand2.state
%10 = load i64, i64* %1
%11 = lshr i64 %10, 18
%12 = load i64, i64* %1
%13 = xor i64 %11, %12
%14 = lshr i64 %13, 27
%15 = trunc i64 %14 to i32
store i32 %15, i32* %2
%16 = load i64, i64* %1
%17 = lshr i64 %16, 59
%18 = trunc i64 %17 to i32
store i32 %18, i32* %3
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = ashr i32 %19, %20
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = sub nsw i32 0, %23
%25 = and i32 %24, 31
%26 = shl i32 %22, %25
%27 = or i32 %21, %26
ret i32 %27
}

LLVM IR (-O2):
@fastrand2.state = internal unnamed_addr global i64 -8846114313915602277
define i32 @fastrand2() {
%1 = load i64, i64* @fastrand2.state
%2 = mul i64 %1, 6364136223846793005
%3 = add i64 %2, -2720673578348880933
store i64 %3, i64* @fastrand2.state
%4 = lshr i64 %1, 45
%5 = lshr i64 %1, 27
%6 = xor i64 %4, %5
%7 = trunc i64 %6 to i32
%8 = lshr i64 %1, 59
%9 = trunc i64 %8 to i32
%10 = ashr i32 %7, %9
%11 = sub nsw i32 0, %9
%12 = and i32 %11, 31
%13 = shl i32 %7, %12
%14 = or i32 %10, %13
ret i32 %14
}