#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 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 lehmer64();
int /*<<< orphan*/ lehmer64_seed(int);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  int c;
  int castingtohigh32 = 0;
  while ((c = getopt(argc, argv, "H")) != -1)
    switch (c) {
    case 'H':
      castingtohigh32 = 1;
      break;
    default:
      abort();
    }
  uint64_t seedvalue = 12345678;
  lehmer64_seed(seedvalue);
  if (castingtohigh32) {
    uint32_t buffer[512];
    while (1) {
      for (int k = 0; k < 512; k++)
        buffer[k] = (lehmer64() >> 32);
      fwrite((void *)buffer, sizeof(buffer), 1, stdout);
    }
  } else {
    uint64_t buffer[512];
    while (1) {
      for (int k = 0; k < 512; k++)
        buffer[k] = lehmer64();
      fwrite((void *)buffer, sizeof(buffer), 1, stdout);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1040,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe82(%rip),%rdx
call   1050 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     11b8 <main+0x68>
mov    -0x14(%rbp),%eax
sub    $0x48,%eax
jne    11ac <main+0x5c>
jmp    11a0 <main+0x50>
movl   $0x1,-0x18(%rbp)
jmp    11b3 <main+0x63>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1170 <main+0x20>
movl   $0xbc614e,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1070 <lehmer64_seed@plt>
cmpl   $0x0,-0x18(%rbp)
je     1246 <main+0xf6>
jmp    11d6 <main+0x86>
movl   $0x0,-0x824(%rbp)
cmpl   $0x200,-0x824(%rbp)
jge    1222 <main+0xd2>
mov    $0x0,%al
call   1040 <lehmer64@plt>
mov    $0x20,%ecx
sar    %cl,%eax
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    11e0 <main+0x90>
lea    -0x820(%rbp),%rdi
mov    0x2db0(%rip),%rax
mov    (%rax),%ecx
mov    $0x800,%esi
mov    $0x1,%edx
call   1060 <fwrite@plt>
jmp    11d6 <main+0x86>
jmp    124b <main+0xfb>
movl   $0x0,-0x1034(%rbp)
cmpl   $0x200,-0x1034(%rbp)
jge    1290 <main+0x140>
mov    $0x0,%al
call   1040 <lehmer64@plt>
mov    %eax,%ecx
movslq -0x1034(%rbp),%rax
mov    %ecx,-0x1030(%rbp,%rax,4)
mov    -0x1034(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1034(%rbp)
jmp    1255 <main+0x105>
lea    -0x1030(%rbp),%rdi
mov    0x2d42(%rip),%rax
mov    (%rax),%ecx
mov    $0x800,%esi
mov    $0x1,%edx
call   1060 <fwrite@plt>
jmp    124b <main+0xfb>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x808,%rsp
mov    %rsi,%r15
mov    %edi,%ebp
mov    $0x1,%cl
lea    0xe95(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %ecx,%ebx
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r14,%rdx
call   1050 <getopt@plt>
xor    %ecx,%ecx
cmp    $0x48,%eax
je     1170 <main+0x20>
cmp    $0xffffffff,%eax
jne    121b <main+0xcb>
mov    $0xbc614e,%edi
call   1070 <lehmer64_seed@plt>
mov    0x2e40(%rip),%r14
test   $0x1,%bl
je     11e0 <main+0x90>
mov    %rsp,%rbx
nopl   0x0(%rax,%rax,1)
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <lehmer64@plt>
mov    %eax,(%rsp,%rbp,4)
add    $0x1,%rbp
cmp    $0x200,%rbp
jne    11b2 <main+0x62>
mov    (%r14),%ecx
mov    %rbx,%rdi
mov    $0x800,%esi
mov    $0x1,%edx
call   1060 <fwrite@plt>
jmp    11b0 <main+0x60>
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <lehmer64@plt>
add    $0x1,%ebp
cmp    $0x200,%ebp
jne    11f2 <main+0xa2>
mov    (%r14),%ecx
mov    %rbx,%rdi
mov    $0x800,%esi
mov    $0x1,%edx
call   1060 <fwrite@plt>
jmp    11f0 <main+0xa0>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"H\00"
@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 i32
%9 = alloca [512 x i32]
%10 = alloca i32
%11 = alloca [512 x i32]
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %13
13: ; preds = %23, %2
%14 = load i32, i32* %4
%15 = load i8**, i8*** %5
%16 = call i32 @getopt(i32 %14, i8** %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 %16, i32* %6
%17 = icmp ne i32 %16, -1
br i1 %17, label %18, label %24
18: ; preds = %13
%19 = load i32, i32* %6
switch i32 %19, label %21 [
i32 72, label %20
]
20: ; preds = %18
store i32 1, i32* %7
br label %23
21: ; preds = %18
%22 = call i32 (...) @abort()
unreachable
23: ; preds = %20
br label %13
24: ; preds = %13
store i32 12345678, i32* %8
%25 = load i32, i32* %8
%26 = call i32 @lehmer64_seed(i32 %25)
%27 = load i32, i32* %7
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %48
29: ; preds = %24
br label %30
30: ; preds = %29, %43
store i32 0, i32* %10
br label %31
31: ; preds = %40, %30
%32 = load i32, i32* %10
%33 = icmp slt i32 %32, 512
br i1 %33, label %34, label %43
34: ; preds = %31
%35 = call i32 (...) @lehmer64()
%36 = ashr i32 %35, 32
%37 = load i32, i32* %10
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [512 x i32], [512 x i32]* %9, i64 0, i64 %38
store i32 %36, i32* %39
br label %40
40: ; preds = %34
%41 = load i32, i32* %10
%42 = add nsw i32 %41, 1
store i32 %42, i32* %10
br label %31
43: ; preds = %31
%44 = getelementptr inbounds [512 x i32], [512 x i32]* %9, i64 0, i64 0
%45 = bitcast i32* %44 to i8*
%46 = load i32, i32* @stdout
%47 = call i32 @fwrite(i8* %45, i32 2048, i32 1, i32 %46)
br label %30
48: ; preds = %24
br label %49
49: ; preds = %48, %61
store i32 0, i32* %12
br label %50
50: ; preds = %58, %49
%51 = load i32, i32* %12
%52 = icmp slt i32 %51, 512
br i1 %52, label %53, label %61
53: ; preds = %50
%54 = call i32 (...) @lehmer64()
%55 = load i32, i32* %12
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [512 x i32], [512 x i32]* %11, i64 0, i64 %56
store i32 %54, i32* %57
br label %58
58: ; preds = %53
%59 = load i32, i32* %12
%60 = add nsw i32 %59, 1
store i32 %60, i32* %12
br label %50
61: ; preds = %50
%62 = getelementptr inbounds [512 x i32], [512 x i32]* %11, i64 0, i64 0
%63 = bitcast i32* %62 to i8*
%64 = load i32, i32* @stdout
%65 = call i32 @fwrite(i8* %63, i32 2048, i32 1, i32 %64)
br label %49
}

LLVM IR (-O2):
@.str = [2 x i8] c"H\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [512 x i32]
%4 = alloca [512 x i32]
br label %5
5: ; preds = %5, %2
%6 = phi i1 [ true, %2 ], [ false, %5 ]
%7 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
switch i32 %7, label %8 [
i32 -1, label %10
i32 72, label %5
]
8: ; preds = %5
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %5
%11 = tail call i32 @lehmer64_seed(i32 12345678)
br i1 %6, label %24, label %12
12: ; preds = %10
%13 = bitcast [512 x i32]* %3 to i8*
br label %17
14: ; preds = %17
%15 = load i32, i32* @stdout
%16 = call i32 @fwrite(i8* %13, i32 2048, i32 1, i32 %15)
br label %22
17: ; preds = %22, %12
%18 = phi i32 [ 0, %12 ], [ %23, %22 ]
%19 = call i32 (...) @lehmer64()
%20 = add nuw nsw i32 %18, 1
%21 = icmp eq i32 %20, 512
br i1 %21, label %14, label %22
22: ; preds = %17, %14
%23 = phi i32 [ %20, %17 ], [ 0, %14 ]
br label %17
24: ; preds = %10
%25 = bitcast [512 x i32]* %4 to i8*
br label %29
26: ; preds = %29
%27 = load i32, i32* @stdout
%28 = call i32 @fwrite(i8* %25, i32 2048, i32 1, i32 %27)
br label %35
29: ; preds = %35, %24
%30 = phi i64 [ 0, %24 ], [ %36, %35 ]
%31 = call i32 (...) @lehmer64()
%32 = getelementptr inbounds [512 x i32], [512 x i32]* %4, i64 0, i64 %30
store i32 %31, i32* %32
%33 = add nuw nsw i64 %30, 1
%34 = icmp eq i64 %33, 512
br i1 %34, label %26, label %35
35: ; preds = %29, %26
%36 = phi i64 [ %33, %29 ], [ 0, %26 ]
br label %29
}