#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 int uint32_t;

/* Variables and functions */
void generate_predicted_states(uint32_t mt_states[]) {
  uint32_t tmp;
  unsigned int i;
  for (i = 0; i < (624); i++) {
    tmp =
        (mt_states[i] & 0x80000000) + (mt_states[(i + 1) % (624)] & 0x7fffffff);
    mt_states[i] = mt_states[(i + 397) % (624)] ^ (tmp >> 1);
    if (tmp % 2)
      mt_states[i] ^= 0x9908b0df;
  }
}


x86 assembly (clang, -O0):
<generate_predicted_states>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x270,-0x10(%rbp)
jae    11c2 <generate_predicted_states+0xc2>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
and    $0x80000000,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    $0x270,%esi
xor    %edx,%edx
div    %esi
mov    -0x1c(%rbp),%eax
mov    %edx,%edx
mov    (%rcx,%rdx,4),%ecx
and    $0x7fffffff,%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    $0x18d,%eax
mov    $0x270,%ecx
xor    %edx,%edx
div    %ecx
mov    -0x18(%rbp),%rax
mov    %edx,%ecx
mov    (%rax,%rcx,4),%edx
mov    -0xc(%rbp),%eax
sar    $0x1,%eax
xor    %eax,%edx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11af <generate_predicted_states+0xaf>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    (%rax,%rcx,4),%edx
xor    $0x9908b0df,%edx
mov    %edx,(%rax,%rcx,4)
jmp    11b4 <generate_predicted_states+0xb4>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    110f <generate_predicted_states+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_predicted_states>:
push   %r14
push   %rbx
lea    0x634(%rdi),%r8
mov    $0x18d,%r11d
mov    $0x1,%ecx
xor    %esi,%esi
movabs $0xd20d20d20d20d21,%r9
d2 20 0d
mov    $0x80000000,%r10d
nopw   0x0(%rax,%rax,1)
mov    %r11,%rax
shr    $0x4,%rax
mul    %r9
shr    %rdx
imul   $0xfffffffffffff640,%rdx,%r14
mov    %rcx,%rax
shr    $0x4,%rax
mul    %r9
shr    %rdx
imul   $0x9c0,%rdx,%rax
mov    (%rdi,%rsi,4),%edx
and    %r10d,%edx
mov    %rdi,%rbx
sub    %rax,%rbx
mov    0x4(%rbx,%rsi,4),%eax
mov    %eax,%ebx
and    $0x7ffffffe,%ebx
or     %edx,%ebx
sar    %ebx
xor    (%r8,%r14,1),%ebx
mov    %ebx,%edx
xor    $0x9908b0df,%edx
test   $0x1,%al
cmove  %ebx,%edx
mov    %edx,(%rdi,%rsi,4)
lea    0x1(%rsi),%rax
add    $0x4,%r8
add    $0x1,%r11
add    $0x1,%rcx
mov    %rax,%rsi
cmp    $0x270,%rax
jne    1130 <generate_predicted_states+0x30>
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @generate_predicted_states(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %4
br label %5
5: ; preds = %49, %1
%6 = load i32, i32* %4
%7 = icmp ult i32 %6, 624
br i1 %7, label %8, label %52
8: ; preds = %5
%9 = load i32*, i32** %2
%10 = load i32, i32* %4
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %9, i64 %11
%13 = load i32, i32* %12
%14 = and i32 %13, -2147483648
%15 = load i32*, i32** %2
%16 = load i32, i32* %4
%17 = add i32 %16, 1
%18 = urem i32 %17, 624
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %15, i64 %19
%21 = load i32, i32* %20
%22 = and i32 %21, 2147483647
%23 = add i32 %14, %22
store i32 %23, i32* %3
%24 = load i32*, i32** %2
%25 = load i32, i32* %4
%26 = add i32 %25, 397
%27 = urem i32 %26, 624
%28 = zext i32 %27 to i64
%29 = getelementptr inbounds i32, i32* %24, i64 %28
%30 = load i32, i32* %29
%31 = load i32, i32* %3
%32 = ashr i32 %31, 1
%33 = xor i32 %30, %32
%34 = load i32*, i32** %2
%35 = load i32, i32* %4
%36 = zext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %34, i64 %36
store i32 %33, i32* %37
%38 = load i32, i32* %3
%39 = srem i32 %38, 2
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %48
41: ; preds = %8
%42 = load i32*, i32** %2
%43 = load i32, i32* %4
%44 = zext i32 %43 to i64
%45 = getelementptr inbounds i32, i32* %42, i64 %44
%46 = load i32, i32* %45
%47 = xor i32 %46, -1727483681
store i32 %47, i32* %45
br label %48
48: ; preds = %41, %8
br label %49
49: ; preds = %48
%50 = load i32, i32* %4
%51 = add i32 %50, 1
store i32 %51, i32* %4
br label %5
52: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @generate_predicted_states(i32* nocapture %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i64 [ 0, %1 ], [ %7, %2 ]
%4 = getelementptr inbounds i32, i32* %0, i64 %3
%5 = load i32, i32* %4
%6 = and i32 %5, -2147483648
%7 = add nuw nsw i64 %3, 1
%8 = trunc i64 %7 to i16
%9 = urem i16 %8, 624
%10 = zext i16 %9 to i64
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = load i32, i32* %11
%13 = and i32 %12, 2147483646
%14 = or i32 %13, %6
%15 = trunc i64 %3 to i16
%16 = add i16 %15, 397
%17 = urem i16 %16, 624
%18 = zext i16 %17 to i64
%19 = getelementptr inbounds i32, i32* %0, i64 %18
%20 = load i32, i32* %19
%21 = ashr exact i32 %14, 1
%22 = xor i32 %21, %20
%23 = and i32 %12, 1
%24 = icmp eq i32 %23, 0
%25 = xor i32 %22, -1727483681
%26 = select i1 %24, i32 %22, i32 %25
store i32 %26, i32* %4
%27 = icmp eq i64 %7, 624
br i1 %27, label %28, label %2
28: ; preds = %2
ret void
}