#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 uint64_t;
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ buffer;

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fwrite(void *, int, int, int /*<<< orphan*/);
int getopt(int, char **, char *);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ wyrand();
int /*<<< orphan*/ wyrand_seed(int);
int main(int argc, char **argv) {
  int c;
  while ((c = getopt(argc, argv, "")) != -1)
    switch (c) {
    default:
      abort();
    }
  uint64_t seedvalue = 12345678;
  wyrand_seed(seedvalue);
  uint32_t buffer[512];
  while (1) {
    for (int k = 0; k < 512; k++)
      buffer[k] = wyrand();
    fwrite((void *)buffer, sizeof(buffer), 1, stdout);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x830,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe89(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     118f <main+0x3f>
mov    $0x0,%al
call   1030 <abort@plt>
movl   $0xbc614e,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1040 <wyrand_seed@plt>
movl   $0x0,-0x824(%rbp)
cmpl   $0x200,-0x824(%rbp)
jge    11e3 <main+0x93>
mov    $0x0,%al
call   1050 <wyrand@plt>
mov    %eax,%ecx
movslq -0x824(%rbp),%rax
mov    %ecx,-0x820(%rbp,%rax,4)
mov    -0x824(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x824(%rbp)
jmp    11a8 <main+0x58>
lea    -0x820(%rbp),%rdi
mov    0x2def(%rip),%rax
mov    (%rax),%ecx
mov    $0x800,%esi
mov    $0x1,%edx
call   1070 <fwrite@plt>
jmp    119e <main+0x4e>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x800,%rsp
lea    0xe9d(%rip),%rdx
call   1060 <getopt@plt>
cmp    $0xffffffff,%eax
jne    11c0 <main+0x70>
mov    $0xbc614e,%edi
call   1040 <wyrand_seed@plt>
mov    0x2e62(%rip),%r14
mov    %rsp,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <wyrand@plt>
mov    %eax,(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x200,%rbx
jne    1192 <main+0x42>
mov    (%r14),%ecx
mov    %r15,%rdi
mov    $0x800,%esi
mov    $0x1,%edx
call   1070 <fwrite@plt>
jmp    1190 <main+0x40>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [512 x i32]
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %10
10: ; preds = %2
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = call i32 @getopt(i32 %11, i8** %12, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i32 %13, i32* %6
%14 = icmp ne i32 %13, -1
br i1 %14, label %15, label %19
15: ; preds = %10
%16 = load i32, i32* %6
switch i32 %16, label %17 [
]
17: ; preds = %15
%18 = call i32 (...) @abort()
unreachable
19: ; preds = %10
store i32 12345678, i32* %7
%20 = load i32, i32* %7
%21 = call i32 @wyrand_seed(i32 %20)
br label %22
22: ; preds = %19, %34
store i32 0, i32* %9
br label %23
23: ; preds = %31, %22
%24 = load i32, i32* %9
%25 = icmp slt i32 %24, 512
br i1 %25, label %26, label %34
26: ; preds = %23
%27 = call i32 (...) @wyrand()
%28 = load i32, i32* %9
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [512 x i32], [512 x i32]* %8, i64 0, i64 %29
store i32 %27, i32* %30
br label %31
31: ; preds = %26
%32 = load i32, i32* %9
%33 = add nsw i32 %32, 1
store i32 %33, i32* %9
br label %23
34: ; preds = %23
%35 = getelementptr inbounds [512 x i32], [512 x i32]* %8, i64 0, i64 0
%36 = bitcast i32* %35 to i8*
%37 = load i32, i32* @stdout
%38 = call i32 @fwrite(i8* %36, i32 2048, i32 1, i32 %37)
br label %22
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [512 x i32]
%4 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %4, -1
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %2
%9 = tail call i32 @wyrand_seed(i32 12345678)
%10 = bitcast [512 x i32]* %3 to i8*
br label %14
11: ; preds = %14
%12 = load i32, i32* @stdout
%13 = call i32 @fwrite(i8* %10, i32 2048, i32 1, i32 %12)
br label %20
14: ; preds = %20, %8
%15 = phi i64 [ 0, %8 ], [ %21, %20 ]
%16 = call i32 (...) @wyrand()
%17 = getelementptr inbounds [512 x i32], [512 x i32]* %3, i64 0, i64 %15
store i32 %16, i32* %17
%18 = add nuw nsw i64 %15, 1
%19 = icmp eq i64 %18, 512
br i1 %19, label %11, label %20
20: ; preds = %14, %11
%21 = phi i64 [ %18, %14 ], [ 0, %11 ]
br label %14
}