#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 /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *, long,
                           long, int, int, int);
int /*<<< orphan*/ run_random_one(char *, int, int, long, char *, long, int,
                                  int, int, int, long);
int /*<<< orphan*/ stderr;
int run_random_all(char *label, int writeops, int fd, long fsize, char *buf,
                   long msize, int alignment, int direct, int max_seconds,
                   int timeofday_latency) {
  long iosize;
  fprintf(stderr,
          "= %s RND %-6s "
          "(fsize=%ld,msize=%ld,alignment=%d,direct=%d,max_seconds=%d)\n",
          label, writeops ? (writeops == 2 ? "RDWR" : "WRONLY") : "RDONLY",
          fsize, msize, alignment, direct, max_seconds);
  for (iosize = alignment; iosize <= msize; iosize <<= 1) {
    if (!run_random_one(label, writeops, fd, fsize, buf, msize, alignment,
                        direct, max_seconds, timeofday_latency, iosize))
      return (0);
  }
  return (1);
}


x86 assembly (clang, -O0):
<run_random_all>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x80,%rsp
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x20(%rbp)
mov    %esi,-0x24(%rbp)
mov    %edx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
mov    %r9,-0x40(%rbp)
mov    0x2e89(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x50(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     118f <run_random_all+0x6f>
mov    -0x24(%rbp),%edx
lea    0xed8(%rip),%rax
lea    0xecc(%rip),%rcx
cmp    $0x2,%edx
cmove  %rcx,%rax
mov    %rax,-0x60(%rbp)
jmp    119f <run_random_all+0x7f>
lea    0xec1(%rip),%rax
mov    %rax,-0x60(%rbp)
jmp    119f <run_random_all+0x7f>
mov    -0x50(%rbp),%rdx
mov    -0x54(%rbp),%edi
mov    -0x60(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x40(%rbp),%r9
mov    0x10(%rbp),%r11d
mov    0x18(%rbp),%r10d
mov    0x20(%rbp),%eax
lea    0xe3c(%rip),%rsi
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1030 <fprintf@plt>
movslq 0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
cmp    -0x40(%rbp),%rax
jg     125c <run_random_all+0x13c>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%r8
mov    -0x40(%rbp),%r9
mov    0x10(%rbp),%r14d
mov    0x18(%rbp),%ebx
mov    0x20(%rbp),%r11d
mov    0x28(%rbp),%r10d
mov    -0x48(%rbp),%rax
mov    %r14d,(%rsp)
mov    %ebx,0x8(%rsp)
mov    %r11d,0x10(%rsp)
mov    %r10d,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1040 <run_random_one@plt>
cmp    $0x0,%eax
jne    1246 <run_random_all+0x126>
movl   $0x0,-0x14(%rbp)
jmp    1263 <run_random_all+0x143>
jmp    124b <run_random_all+0x12b>
mov    -0x48(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    11de <run_random_all+0xbe>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_random_all>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%rbx
mov    %r8,(%rsp)
mov    %rcx,%r15
mov    %edx,%r12d
mov    %esi,%ebp
mov    %rdi,%r13
mov    0x50(%rsp),%r10d
mov    0x48(%rsp),%r11d
mov    0x40(%rsp),%r14d
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
cmp    $0x2,%esi
lea    0xeec(%rip),%rax
lea    0xeea(%rip),%rdx
cmove  %rax,%rdx
test   %esi,%esi
lea    0xee4(%rip),%rcx
cmovne %rdx,%rcx
sub    $0x8,%rsp
lea    0xe7e(%rip),%rsi
mov    %r13,%rdx
mov    %r15,%r8
push   %r10
push   %r11
push   %r14
call   1030 <fprintf@plt>
add    $0x20,%rsp
movslq %r14d,%r14
mov    $0x1,%eax
cmp    %rbx,%r14
jg     11fb <run_random_all+0xdb>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
sub    $0x8,%rsp
mov    %r13,%rdi
mov    %ebp,%esi
mov    %r12d,%edx
mov    %r15,%rcx
mov    0x8(%rsp),%r8
mov    %rbx,%r9
push   %r14
mov    0x68(%rsp),%eax
push   %rax
mov    0x68(%rsp),%eax
push   %rax
mov    0x68(%rsp),%eax
push   %rax
mov    0x68(%rsp),%eax
push   %rax
call   1040 <run_random_one@plt>
add    $0x30,%rsp
test   %eax,%eax
je     11f9 <run_random_all+0xd9>
add    %r14,%r14
cmp    %rbx,%r14
jle    11b0 <run_random_all+0x90>
mov    $0x1,%eax
jmp    11fb <run_random_all+0xdb>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [75 x i8] c"= %s RND %-6s (fsize=%ld,msize=%ld,alignment=%d,direct=%d,max_seconds=%d)\0A\00"
@.str.1 = [5 x i8] c"RDWR\00"
@.str.2 = [7 x i8] c"WRONLY\00"
@.str.3 = [7 x i8] c"RDONLY\00"
define i32 @run_random_all(i8* %0, i32 %1, i32 %2, i64 %3, i8* %4, i64 %5, i32 %6, i32 %7, i32 %8, i32 %9) {
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i64
%16 = alloca i8*
%17 = alloca i64
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i64
store i8* %0, i8** %12
store i32 %1, i32* %13
store i32 %2, i32* %14
store i64 %3, i64* %15
store i8* %4, i8** %16
store i64 %5, i64* %17
store i32 %6, i32* %18
store i32 %7, i32* %19
store i32 %8, i32* %20
store i32 %9, i32* %21
%23 = load i32, i32* @stderr
%24 = load i8*, i8** %12
%25 = load i32, i32* %13
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %32
27: ; preds = %10
%28 = load i32, i32* %13
%29 = icmp eq i32 %28, 2
%30 = zext i1 %29 to i64
%31 = select i1 %29, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0)
br label %33
32: ; preds = %10
br label %33
33: ; preds = %32, %27
%34 = phi i8* [ %31, %27 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), %32 ]
%35 = load i64, i64* %15
%36 = load i64, i64* %17
%37 = load i32, i32* %18
%38 = load i32, i32* %19
%39 = load i32, i32* %20
%40 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i8* %24, i8* %34, i64 %35, i64 %36, i32 %37, i32 %38, i32 %39)
%41 = load i32, i32* %18
%42 = sext i32 %41 to i64
store i64 %42, i64* %22
br label %43
43: ; preds = %63, %33
%44 = load i64, i64* %22
%45 = load i64, i64* %17
%46 = icmp sle i64 %44, %45
br i1 %46, label %47, label %66
47: ; preds = %43
%48 = load i8*, i8** %12
%49 = load i32, i32* %13
%50 = load i32, i32* %14
%51 = load i64, i64* %15
%52 = load i8*, i8** %16
%53 = load i64, i64* %17
%54 = load i32, i32* %18
%55 = load i32, i32* %19
%56 = load i32, i32* %20
%57 = load i32, i32* %21
%58 = load i64, i64* %22
%59 = call i32 @run_random_one(i8* %48, i32 %49, i32 %50, i64 %51, i8* %52, i64 %53, i32 %54, i32 %55, i32 %56, i32 %57, i64 %58)
%60 = icmp ne i32 %59, 0
br i1 %60, label %62, label %61
61: ; preds = %47
store i32 0, i32* %11
br label %67
62: ; preds = %47
br label %63
63: ; preds = %62
%64 = load i64, i64* %22
%65 = shl i64 %64, 1
store i64 %65, i64* %22
br label %43
66: ; preds = %43
store i32 1, i32* %11
br label %67
67: ; preds = %66, %61
%68 = load i32, i32* %11
ret i32 %68
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [75 x i8] c"= %s RND %-6s (fsize=%ld,msize=%ld,alignment=%d,direct=%d,max_seconds=%d)\0A\00"
@.str.1 = [5 x i8] c"RDWR\00"
@.str.2 = [7 x i8] c"WRONLY\00"
@.str.3 = [7 x i8] c"RDONLY\00"
define i32 @run_random_all(i8* %0, i32 %1, i32 %2, i64 %3, i8* %4, i64 %5, i32 %6, i32 %7, i32 %8, i32 %9) {
%11 = load i32, i32* @stderr
%12 = icmp eq i32 %1, 0
%13 = icmp eq i32 %1, 2
%14 = select i1 %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0)
%15 = select i1 %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %14
%16 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %15, i64 %3, i64 %5, i32 %6, i32 %7, i32 %8)
%17 = sext i32 %6 to i64
%18 = icmp sgt i64 %17, %5
br i1 %18, label %26, label %21
19: ; preds = %21
%20 = icmp sgt i64 %25, %5
br i1 %20, label %26, label %21
21: ; preds = %10, %19
%22 = phi i64 [ %25, %19 ], [ %17, %10 ]
%23 = tail call i32 @run_random_one(i8* %0, i32 %1, i32 %2, i64 %3, i8* %4, i64 %5, i32 %6, i32 %7, i32 %8, i32 %9, i64 %22)
%24 = icmp eq i32 %23, 0
%25 = shl i64 %22, 1
br i1 %24, label %26, label %19
26: ; preds = %21, %19, %10
%27 = phi i32 [ 1, %10 ], [ 1, %19 ], [ 0, %21 ]
ret i32 %27
}