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

/* Variables and functions */
scalar_t__ fwrite(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ mmix(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ progress(size_t);
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  uint64_t randbuf[32768];
  size_t written;
  bool print_progress;
  if (argc == 2 && strcmp(argv[1], "-p") == 0) {
    print_progress = true;
  } else {
    print_progress = false;
  }
  randbuf[32768 - 1] = time(NULL);
  while (true) {
    written = 0;
    for (int i = 0; i < 100; ++i) {
      mmix(randbuf, 32768);
      written += fwrite(randbuf, sizeof(randbuf[0]), 32768, stdout);
    }
    if (print_progress) {
      progress(written * sizeof(randbuf[0]));
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20020,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    11a0 <main+0x50>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe7e(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11a0 <main+0x50>
movl   $0x1,-0x2001c(%rbp)
jmp    11aa <main+0x5a>
movl   $0x0,-0x2001c(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,-0x14(%rbp)
movq   $0x0,-0x20018(%rbp)
movl   $0x0,-0x20020(%rbp)
cmpl   $0x64,-0x20020(%rbp)
jge    122a <main+0xda>
lea    -0x20010(%rbp),%rdi
mov    $0x8000,%esi
call   1040 <mmix@plt>
lea    -0x20010(%rbp),%rdi
mov    0x2de9(%rip),%rax
mov    (%rax),%ecx
mov    $0x4,%esi
mov    $0x8000,%edx
call   1070 <fwrite@plt>
add    -0x20018(%rbp),%rax
mov    %rax,-0x20018(%rbp)
mov    -0x20020(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20020(%rbp)
jmp    11cb <main+0x7b>
cmpl   $0x0,-0x2001c(%rbp)
je     1247 <main+0xf7>
mov    -0x20018(%rbp),%rdi
shl    $0x2,%rdi
call   1030 <progress@plt>
jmp    11b6 <main+0x66>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20008,%rsp
cmp    $0x2,%edi
jne    117b <main+0x2b>
mov    0x8(%rsi),%rdi
lea    0xe8f(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1180 <main+0x30>
mov    $0x1,%r12b
jmp    1183 <main+0x33>
xor    %r12d,%r12d
xor    %r14d,%r14d
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,0x1fffc(%rsp)
mov    %rsp,%r13
mov    0x2e42(%rip),%r15
xchg   %ax,%ax
xor    %ebp,%ebp
xor    %ebx,%ebx
mov    %r13,%rdi
mov    $0x8000,%esi
call   1040 <mmix@plt>
mov    (%r15),%ecx
mov    %r13,%rdi
mov    $0x4,%esi
mov    $0x8000,%edx
call   1070 <fwrite@plt>
add    %rbx,%rax
add    $0x1,%ebp
cmp    $0x64,%ebp
setne  %cl
cmove  %r14d,%ebp
mov    $0x0,%ebx
cmovne %rax,%rbx
or     %r12b,%cl
jne    11a4 <main+0x54>
shl    $0x2,%rax
mov    %rax,%rdi
call   1030 <progress@plt>
jmp    11a0 <main+0x50>

LLVM IR (-O0):
@.str = [3 x i8] c"-p\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [32768 x i32]
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 2
br i1 %11, label %12, label %19
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %12
store i32 1, i32* %8
br label %20
19: ; preds = %12, %2
store i32 0, i32* %8
br label %20
20: ; preds = %19, %18
%21 = call i32 @time(i32* null)
%22 = getelementptr inbounds [32768 x i32], [32768 x i32]* %6, i64 0, i64 32767
store i32 %21, i32* %22
br label %23
23: ; preds = %20, %45
store i64 0, i64* %7
store i32 0, i32* %9
br label %24
24: ; preds = %35, %23
%25 = load i32, i32* %9
%26 = icmp slt i32 %25, 100
br i1 %26, label %27, label %38
27: ; preds = %24
%28 = getelementptr inbounds [32768 x i32], [32768 x i32]* %6, i64 0, i64 0
%29 = call i32 @mmix(i32* %28, i32 32768)
%30 = getelementptr inbounds [32768 x i32], [32768 x i32]* %6, i64 0, i64 0
%31 = load i32, i32* @stdout
%32 = call i64 @fwrite(i32* %30, i32 4, i32 32768, i32 %31)
%33 = load i64, i64* %7
%34 = add i64 %33, %32
store i64 %34, i64* %7
br label %35
35: ; preds = %27
%36 = load i32, i32* %9
%37 = add nsw i32 %36, 1
store i32 %37, i32* %9
br label %24
38: ; preds = %24
%39 = load i32, i32* %8
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %45
41: ; preds = %38
%42 = load i64, i64* %7
%43 = mul i64 %42, 4
%44 = call i32 @progress(i64 %43)
br label %45
45: ; preds = %41, %38
br label %23
}

LLVM IR (-O2):
@.str = [3 x i8] c"-p\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [32768 x i32]
%4 = bitcast [32768 x i32]* %3 to i8*
%5 = icmp eq i32 %0, 2
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %6, %2
br label %12
12: ; preds = %6, %11
%13 = phi i1 [ true, %11 ], [ false, %6 ]
%14 = tail call i32 @time(i32* null)
%15 = getelementptr inbounds [32768 x i32], [32768 x i32]* %3, i64 0, i64 32767
store i32 %14, i32* %15
%16 = getelementptr inbounds [32768 x i32], [32768 x i32]* %3, i64 0, i64 0
br label %17
17: ; preds = %32, %12
%18 = phi i32 [ 0, %12 ], [ %33, %32 ]
%19 = phi i64 [ 0, %12 ], [ %34, %32 ]
%20 = call i32 @mmix(i32* %16, i32 32768)
%21 = load i32, i32* @stdout
%22 = call i64 @fwrite(i32* %16, i32 4, i32 32768, i32 %21)
%23 = add i64 %22, %19
%24 = add nuw nsw i32 %18, 1
%25 = icmp ne i32 %24, 100
%26 = or i1 %25, %13
%27 = select i1 %25, i32 %24, i32 0
%28 = select i1 %25, i64 %23, i64 0
br i1 %26, label %32, label %29
29: ; preds = %17
%30 = shl i64 %23, 2
%31 = call i32 @progress(i64 %30)
br label %32
32: ; preds = %29, %17
%33 = phi i32 [ %27, %17 ], [ 0, %29 ]
%34 = phi i64 [ %28, %17 ], [ 0, %29 ]
br label %17
}