#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 */

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
unsigned long randomMT();
int /*<<< orphan*/ seedMT(int);
int /*<<< orphan*/ write(int, unsigned long *, int);
int main(int argc, char *argv[]) {
  int j;
  int arg1;
  unsigned long output;
  if (argc != 2) {
    printf("Usage: random-stream SEED\n");
    exit(1);
  }
  arg1 = atoi(argv[1]);
  seedMT(arg1);
  while (1) {
    output = randomMT();
    write(1, &output, 1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1196 <main+0x36>
lea    0xe79(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1050 <seedMT@plt>
mov    $0x0,%al
call   1060 <randomMT@plt>
mov    %rax,-0x20(%rbp)
mov    $0x1,%edx
lea    -0x20(%rbp),%rsi
mov    %edx,%edi
call   1030 <write@plt>
jmp    11ae <main+0x4e>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
cmp    $0x2,%edi
jne    11a0 <main+0x40>
mov    0x8(%rsi),%rdi
call   1070 <atoi@plt>
mov    %eax,%edi
call   1050 <seedMT@plt>
lea    0x8(%rsp),%rbx
nop
xor    %eax,%eax
call   1060 <randomMT@plt>
mov    %rax,0x8(%rsp)
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1040 <write@plt>
jmp    1180 <main+0x20>
lea    0xe59(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"Usage: random-stream SEED\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @atoi(i8* %17)
store i32 %18, i32* %7
%19 = load i32, i32* %7
%20 = call i32 @seedMT(i32 %19)
br label %21
21: ; preds = %14, %21
%22 = call i64 (...) @randomMT()
store i64 %22, i64* %8
%23 = call i32 @write(i32 1, i64* %8, i32 1)
br label %21
}

LLVM IR (-O2):
@str = [26 x i8] c"Usage: random-stream SEED\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
%5 = icmp eq i32 %0, 2
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = tail call i32 @seedMT(i32 %12)
br label %14
14: ; preds = %14, %9
%15 = tail call i64 (...) @randomMT()
store i64 %15, i64* %3
%16 = call i32 @write(i32 1, i64* %3, i32 1)
br label %14
}