#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 long time_t;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ free(unsigned char *);
unsigned char *malloc(size_t);
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ sprintf(char *, char *, unsigned long);
int /*<<< orphan*/ srand(long);
int sscanf(char *, char *, long *);
long time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  time_t started;
  unsigned char *memblock;
  size_t blocksize;
  time_t runtime;
  long int arg1, arg2;
  char sizestr[80];
  unsigned long granularity, pos, skip;
  if (argc != 3) {
    printf("Failed: wrong number of arguments "
           "(expected 3, got %d)\n",
           argc);
    return EXIT_FAILURE;
  }
  if (sscanf(argv[1], "%ld", &arg1) != 1 || arg1 < 0 ||
      sscanf(argv[2], "%ld", &arg2) != 1 || arg2 < 0) {
    printf("Failed: usage %s <BYTES> <SECONDS>\n", argv[0]);
    return EXIT_FAILURE;
  }
  blocksize = arg1;
  runtime = arg2;
  if (blocksize > ((((size_t)1024) * (size_t)1024) * (size_t)1024)) {
    sprintf(sizestr, "%.2f GB",
            (double)blocksize /
                (double)((((size_t)1024) * (size_t)1024) * (size_t)1024));
  } else if (blocksize > (((size_t)1024) * (size_t)1024)) {
    sprintf(sizestr, "%.2f MB",
            (double)blocksize / (double)(((size_t)1024) * (size_t)1024));
  } else if (blocksize > ((size_t)1024)) {
    sprintf(sizestr, "%.2f KB", (double)blocksize / (double)((size_t)1024));
  } else {
    sprintf(sizestr, "%lu bytes", (unsigned long)blocksize);
  }
  printf("Trying to allocate %s\n", sizestr);
  if (!(memblock = malloc(blocksize))) {
    printf("Failed: could not allocate %s\n", sizestr);
    return EXIT_FAILURE;
  }
  printf("Accessing data pages...\n");
  memblock[0] = rand() % 256;
  memblock[blocksize - 1] = rand() % 256;
  started = time(NULL);
  srand(started);
  granularity = 1;
  while (time(NULL) - started < runtime) {
    granularity++;
    skip = (unsigned long)blocksize / granularity;
    skip = skip > 1 ? skip : 1;
    pos = skip;
    while (time(NULL) - started < runtime && (size_t)pos < blocksize) {
      memblock[pos] = rand() % 256;
      pos += skip;
    }
  }
  free(memblock);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11c5 <main+0x45>
mov    -0x8(%rbp),%esi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e25(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    15ce <main+0x44e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xea4(%rip),%rsi
lea    -0x38(%rbp),%rdx
call   1080 <sscanf@plt>
cmp    $0x1,%eax
jne    121d <main+0x9d>
cmpq   $0x0,-0x38(%rbp)
jl     121d <main+0x9d>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe78(%rip),%rsi
lea    -0x40(%rbp),%rdx
call   1080 <sscanf@plt>
cmp    $0x1,%eax
jne    121d <main+0x9d>
cmpq   $0x0,-0x40(%rbp)
jge    1243 <main+0xc3>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2da7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    15ce <main+0x44e>
mov    -0x38(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x30(%rbp)
cmpq   $0x40000000,-0x28(%rbp)
40
jbe    12d2 <main+0x152>
lea    -0x90(%rbp),%rdi
movaps 0xd91(%rip),%xmm1
movq   -0x28(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xd90(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xda1(%rip),%xmm1
divsd  %xmm1,%xmm0
movaps %xmm0,%xmm1
cvttsd2si %xmm1,%rdx
mov    %rdx,%rcx
sar    $0x3f,%rcx
movsd  0xd76(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
and    %rcx,%rax
or     %rax,%rdx
lea    0xdd8(%rip),%rsi
call   1090 <sprintf@plt>
jmp    13f1 <main+0x271>
cmpq   $0x100000,-0x28(%rbp)
jbe    1351 <main+0x1d1>
lea    -0x90(%rbp),%rdi
movaps 0xd12(%rip),%xmm1
movq   -0x28(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xd11(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd1a(%rip),%xmm1
divsd  %xmm1,%xmm0
movaps %xmm0,%xmm1
cvttsd2si %xmm1,%rdx
mov    %rdx,%rcx
sar    $0x3f,%rcx
movsd  0xcf7(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
and    %rcx,%rax
or     %rax,%rdx
lea    0xd61(%rip),%rsi
call   1090 <sprintf@plt>
jmp    13ec <main+0x26c>
cmpq   $0x400,-0x28(%rbp)
jbe    13d0 <main+0x250>
lea    -0x90(%rbp),%rdi
movaps 0xc93(%rip),%xmm1
movq   -0x28(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xc92(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xc8b(%rip),%xmm1
divsd  %xmm1,%xmm0
movaps %xmm0,%xmm1
cvttsd2si %xmm1,%rdx
mov    %rdx,%rcx
sar    $0x3f,%rcx
movsd  0xc78(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
and    %rcx,%rax
or     %rax,%rdx
lea    0xcea(%rip),%rsi
call   1090 <sprintf@plt>
jmp    13e7 <main+0x267>
lea    -0x90(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xcd6(%rip),%rsi
call   1090 <sprintf@plt>
jmp    13ec <main+0x26c>
jmp    13f1 <main+0x271>
lea    -0x90(%rbp),%rsi
lea    0xcc3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1070 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1443 <main+0x2c3>
lea    -0x90(%rbp),%rsi
lea    0xcae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2ba7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    15ce <main+0x44e>
lea    0xcae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   10a0 <rand@plt>
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %dl,%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    $0x0,%al
call   10a0 <rand@plt>
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    $0x1,%rcx
mov    %dl,(%rax,%rcx,1)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <srand@plt>
movq   $0x1,-0x98(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
sub    -0x18(%rbp),%rax
cmp    -0x30(%rbp),%rax
jge    15b9 <main+0x439>
mov    -0x98(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x98(%rbp)
mov    -0x28(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x98(%rbp)
mov    %rax,-0xa8(%rbp)
cmpq   $0x1,-0xa8(%rbp)
01
jbe    1507 <main+0x387>
mov    -0xa8(%rbp),%rax
mov    %rax,-0xb0(%rbp)
jmp    1518 <main+0x398>
mov    $0x1,%eax
mov    %rax,-0xb0(%rbp)
jmp    1518 <main+0x398>
mov    -0xb0(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    -0xa8(%rbp),%rax
mov    %rax,-0xa0(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %rax,%rcx
sub    -0x18(%rbp),%rcx
xor    %eax,%eax
cmp    -0x30(%rbp),%rcx
mov    %al,-0xb1(%rbp)
jge    156a <main+0x3ea>
mov    -0xa0(%rbp),%rax
cmp    -0x28(%rbp),%rax
setb   %al
mov    %al,-0xb1(%rbp)
mov    -0xb1(%rbp),%al
test   $0x1,%al
jne    157d <main+0x3fd>
jmp    15b4 <main+0x434>
mov    $0x0,%al
call   10a0 <rand@plt>
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%rax
mov    -0xa0(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xa8(%rbp),%rax
add    -0xa0(%rbp),%rax
mov    %rax,-0xa0(%rbp)
jmp    1534 <main+0x3b4>
jmp    14a7 <main+0x327>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    0x2a0f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
cmp    $0x3,%edi
jne    1267 <main+0xd7>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xec3(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1090 <sscanf@plt>
cmp    $0x1,%eax
jne    1279 <main+0xe9>
cmpq   $0x0,0x8(%rsp)
js     1279 <main+0xe9>
mov    0x10(%rbx),%rdi
lea    0xe99(%rip),%rsi
lea    0x18(%rsp),%rdx
call   1090 <sscanf@plt>
cmp    $0x1,%eax
jne    1279 <main+0xe9>
mov    0x18(%rsp),%r13
test   %r13,%r13
js     1279 <main+0xe9>
mov    0x8(%rsp),%r14
cmp    $0x40000001,%r14
jb     12a2 <main+0x112>
movq   %r14,%xmm0
punpckldq 0xde5(%rip),%xmm0
subpd  0xded(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
mulsd  0xe01(%rip),%xmm1
cvttsd2si %xmm1,%rax
mov    %rax,%rcx
sar    $0x3f,%rcx
subsd  0xddd(%rip),%xmm1
cvttsd2si %xmm1,%rdx
and    %rcx,%rdx
or     %rax,%rdx
lea    0xe43(%rip),%rsi
lea    0x20(%rsp),%rdi
jmp    136f <main+0x1df>
mov    %edi,%esi
lea    0xdd0(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    128a <main+0xfa>
mov    (%rbx),%rsi
lea    0xdf9(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2d4f(%rip),%rax
mov    (%rax),%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0x100001,%r14
jb     1301 <main+0x171>
movq   %r14,%xmm0
punpckldq 0xd48(%rip),%xmm0
subpd  0xd50(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
mulsd  0xd5c(%rip),%xmm1
cvttsd2si %xmm1,%rax
mov    %rax,%rcx
sar    $0x3f,%rcx
subsd  0xd40(%rip),%xmm1
cvttsd2si %xmm1,%rdx
and    %rcx,%rdx
or     %rax,%rdx
lea    0xdae(%rip),%rsi
lea    0x20(%rsp),%rdi
jmp    136f <main+0x1df>
cmp    $0x401,%r14
jb     1360 <main+0x1d0>
movq   %r14,%xmm0
punpckldq 0xce9(%rip),%xmm0
subpd  0xcf1(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
mulsd  0xced(%rip),%xmm1
cvttsd2si %xmm1,%rax
mov    %rax,%rcx
sar    $0x3f,%rcx
subsd  0xce1(%rip),%xmm1
cvttsd2si %xmm1,%rdx
and    %rcx,%rdx
or     %rax,%rdx
lea    0xd57(%rip),%rsi
lea    0x20(%rsp),%rdi
jmp    136f <main+0x1df>
lea    0xd51(%rip),%rsi
lea    0x20(%rsp),%rdi
mov    %r14,%rdx
call   10a0 <sprintf@plt>
lea    0xd47(%rip),%rdi
lea    0x20(%rsp),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
call   1080 <malloc@plt>
test   %rax,%rax
je     149f <main+0x30f>
mov    %rax,%r15
lea    0xd56(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   10b0 <rand@plt>
mov    %al,(%r15)
xor    %eax,%eax
call   10b0 <rand@plt>
mov    %al,-0x1(%r14,%r15,1)
xor    %edi,%edi
call   1070 <time@plt>
mov    %rax,%r12
mov    %rax,%rdi
call   1060 <srand@plt>
xor    %edi,%edi
call   1070 <time@plt>
sub    %r12,%rax
cmp    %r13,%rax
jge    148b <main+0x2fb>
mov    $0x1,%ecx
jmp    1408 <main+0x278>
nopl   0x0(%rax)
xor    %edi,%edi
call   1070 <time@plt>
sub    %r12,%rax
cmp    %r13,%rax
mov    0x10(%rsp),%rcx
jge    148b <main+0x2fb>
add    $0x1,%rcx
mov    %r14,%rax
or     %rcx,%rax
shr    $0x20,%rax
mov    %rcx,0x10(%rsp)
je     1430 <main+0x2a0>
mov    %r14,%rax
xor    %edx,%edx
div    %rcx
mov    %rax,%rbp
jmp    1439 <main+0x2a9>
nopw   0x0(%rax,%rax,1)
mov    %r14d,%eax
xor    %edx,%edx
div    %ecx
mov    %eax,%ebp
test   %rbp,%rbp
mov    $0x1,%eax
cmove  %rax,%rbp
xor    %edi,%edi
call   1070 <time@plt>
sub    %r12,%rax
cmp    %r13,%rax
jge    13f0 <main+0x260>
cmp    %r14,%rbp
jae    13f0 <main+0x260>
mov    %rbp,%rbx
nopl   0x0(%rax)
xor    %eax,%eax
call   10b0 <rand@plt>
mov    %al,(%r15,%rbx,1)
xor    %edi,%edi
call   1070 <time@plt>
sub    %r12,%rax
cmp    %r13,%rax
jge    13f0 <main+0x260>
add    %rbp,%rbx
cmp    %r14,%rbx
jb     1460 <main+0x2d0>
jmp    13f0 <main+0x260>
mov    %r15,%rdi
call   1030 <free@plt>
mov    0x2b3e(%rip),%rax
jmp    1291 <main+0x101>
lea    0xc33(%rip),%rdi
lea    0x20(%rsp),%rsi
jmp    1283 <main+0xf3>

LLVM IR (-O0):
@.str = [56 x i8] c"Failed: wrong number of arguments (expected 3, got %d)\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [4 x i8] c"%ld\00"
@.str.2 = [36 x i8] c"Failed: usage %s <BYTES> <SECONDS>\0A\00"
@.str.3 = [8 x i8] c"%.2f GB\00"
@.str.4 = [8 x i8] c"%.2f MB\00"
@.str.5 = [8 x i8] c"%.2f KB\00"
@.str.6 = [10 x i8] c"%lu bytes\00"
@.str.7 = [23 x i8] c"Trying to allocate %s\0A\00"
@.str.8 = [31 x i8] c"Failed: could not allocate %s\0A\00"
@.str.9 = [25 x i8] c"Accessing data pages...\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca [80 x i8]
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 3
br i1 %17, label %18, label %22
18: ; preds = %2
%19 = load i32, i32* %4
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = load i32, i32* @EXIT_FAILURE
store i32 %21, i32* %3
br label %158
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 @sscanf(i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %10)
%27 = icmp ne i32 %26, 1
br i1 %27, label %40, label %28
28: ; preds = %22
%29 = load i64, i64* %10
%30 = icmp slt i64 %29, 0
br i1 %30, label %40, label %31
31: ; preds = %28
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 2
%34 = load i8*, i8** %33
%35 = call i32 @sscanf(i8* %34, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %11)
%36 = icmp ne i32 %35, 1
br i1 %36, label %40, label %37
37: ; preds = %31
%38 = load i64, i64* %11
%39 = icmp slt i64 %38, 0
br i1 %39, label %40, label %46
40: ; preds = %37, %31, %28, %22
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 0
%43 = load i8*, i8** %42
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* %43)
%45 = load i32, i32* @EXIT_FAILURE
store i32 %45, i32* %3
br label %158
46: ; preds = %37
%47 = load i64, i64* %10
store i64 %47, i64* %8
%48 = load i64, i64* %11
store i64 %48, i64* %9
%49 = load i64, i64* %8
%50 = icmp ugt i64 %49, 1073741824
br i1 %50, label %51, label %58
51: ; preds = %46
%52 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%53 = load i64, i64* %8
%54 = uitofp i64 %53 to double
%55 = fdiv double %54, 0x41D0000000000000
%56 = fptoui double %55 to i64
%57 = call i32 @sprintf(i8* %52, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i64 %56)
br label %84
58: ; preds = %46
%59 = load i64, i64* %8
%60 = icmp ugt i64 %59, 1048576
br i1 %60, label %61, label %68
61: ; preds = %58
%62 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%63 = load i64, i64* %8
%64 = uitofp i64 %63 to double
%65 = fdiv double %64, 0x4130000000000000
%66 = fptoui double %65 to i64
%67 = call i32 @sprintf(i8* %62, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i64 %66)
br label %83
68: ; preds = %58
%69 = load i64, i64* %8
%70 = icmp ugt i64 %69, 1024
br i1 %70, label %71, label %78
71: ; preds = %68
%72 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%73 = load i64, i64* %8
%74 = uitofp i64 %73 to double
%75 = fdiv double %74, 1.024000e+03
%76 = fptoui double %75 to i64
%77 = call i32 @sprintf(i8* %72, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i64 %76)
br label %82
78: ; preds = %68
%79 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%80 = load i64, i64* %8
%81 = call i32 @sprintf(i8* %79, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i64 %80)
br label %82
82: ; preds = %78, %71
br label %83
83: ; preds = %82, %61
br label %84
84: ; preds = %83, %51
%85 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %85)
%87 = load i64, i64* %8
%88 = call i8* @malloc(i64 %87)
store i8* %88, i8** %7
%89 = icmp ne i8* %88, null
br i1 %89, label %94, label %90
90: ; preds = %84
%91 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %91)
%93 = load i32, i32* @EXIT_FAILURE
store i32 %93, i32* %3
br label %158
94: ; preds = %84
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0))
%96 = call i32 (...) @rand()
%97 = srem i32 %96, 256
%98 = trunc i32 %97 to i8
%99 = load i8*, i8** %7
%100 = getelementptr inbounds i8, i8* %99, i64 0
store i8 %98, i8* %100
%101 = call i32 (...) @rand()
%102 = srem i32 %101, 256
%103 = trunc i32 %102 to i8
%104 = load i8*, i8** %7
%105 = load i64, i64* %8
%106 = sub i64 %105, 1
%107 = getelementptr inbounds i8, i8* %104, i64 %106
store i8 %103, i8* %107
%108 = call i64 @time(i32* null)
store i64 %108, i64* %6
%109 = load i64, i64* %6
%110 = call i32 @srand(i64 %109)
store i64 1, i64* %13
br label %111
111: ; preds = %153, %94
%112 = call i64 @time(i32* null)
%113 = load i64, i64* %6
%114 = sub nsw i64 %112, %113
%115 = load i64, i64* %9
%116 = icmp slt i64 %114, %115
br i1 %116, label %117, label %154
117: ; preds = %111
%118 = load i64, i64* %13
%119 = add i64 %118, 1
store i64 %119, i64* %13
%120 = load i64, i64* %8
%121 = load i64, i64* %13
%122 = udiv i64 %120, %121
store i64 %122, i64* %15
%123 = load i64, i64* %15
%124 = icmp ugt i64 %123, 1
br i1 %124, label %125, label %127
125: ; preds = %117
%126 = load i64, i64* %15
br label %128
127: ; preds = %117
br label %128
128: ; preds = %127, %125
%129 = phi i64 [ %126, %125 ], [ 1, %127 ]
store i64 %129, i64* %15
%130 = load i64, i64* %15
store i64 %130, i64* %14
br label %131
131: ; preds = %143, %128
%132 = call i64 @time(i32* null)
%133 = load i64, i64* %6
%134 = sub nsw i64 %132, %133
%135 = load i64, i64* %9
%136 = icmp slt i64 %134, %135
br i1 %136, label %137, label %141
137: ; preds = %131
%138 = load i64, i64* %14
%139 = load i64, i64* %8
%140 = icmp ult i64 %138, %139
br label %141
141: ; preds = %137, %131
%142 = phi i1 [ false, %131 ], [ %140, %137 ]
br i1 %142, label %143, label %153
143: ; preds = %141
%144 = call i32 (...) @rand()
%145 = srem i32 %144, 256
%146 = trunc i32 %145 to i8
%147 = load i8*, i8** %7
%148 = load i64, i64* %14
%149 = getelementptr inbounds i8, i8* %147, i64 %148
store i8 %146, i8* %149
%150 = load i64, i64* %15
%151 = load i64, i64* %14
%152 = add i64 %151, %150
store i64 %152, i64* %14
br label %131
153: ; preds = %141
br label %111
154: ; preds = %111
%155 = load i8*, i8** %7
%156 = call i32 @free(i8* %155)
%157 = load i32, i32* @EXIT_SUCCESS
store i32 %157, i32* %3
br label %158
158: ; preds = %154, %90, %40, %18
%159 = load i32, i32* %3
ret i32 %159
}

LLVM IR (-O2):
@.str = [56 x i8] c"Failed: wrong number of arguments (expected 3, got %d)\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [4 x i8] c"%ld\00"
@.str.2 = [36 x i8] c"Failed: usage %s <BYTES> <SECONDS>\0A\00"
@.str.3 = [8 x i8] c"%.2f GB\00"
@.str.4 = [8 x i8] c"%.2f MB\00"
@.str.5 = [8 x i8] c"%.2f KB\00"
@.str.6 = [10 x i8] c"%lu bytes\00"
@.str.7 = [23 x i8] c"Trying to allocate %s\0A\00"
@.str.8 = [31 x i8] c"Failed: could not allocate %s\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [24 x i8] c"Accessing data pages...\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca [80 x i8]
%6 = bitcast i64* %3 to i8*
%7 = bitcast i64* %4 to i8*
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%9 = icmp eq i32 %0, 3
br i1 %9, label %12, label %10
10: ; preds = %2
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %102
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @sscanf(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %3)
%16 = icmp ne i32 %15, 1
%17 = load i64, i64* %3
%18 = icmp slt i64 %17, 0
%19 = select i1 %16, i1 true, i1 %18
br i1 %19, label %28, label %20
20: ; preds = %12
%21 = getelementptr inbounds i8*, i8** %1, i64 2
%22 = load i8*, i8** %21
%23 = call i32 @sscanf(i8* %22, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %4)
%24 = icmp ne i32 %23, 1
%25 = load i64, i64* %4
%26 = icmp slt i64 %25, 0
%27 = select i1 %24, i1 true, i1 %26
br i1 %27, label %28, label %31
28: ; preds = %20, %12
%29 = load i8*, i8** %1
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* %29)
br label %102
31: ; preds = %20
%32 = load i64, i64* %3
%33 = icmp ugt i64 %32, 1073741824
br i1 %33, label %34, label %39
34: ; preds = %31
%35 = uitofp i64 %32 to double
%36 = fmul double %35, 0x3E10000000000000
%37 = fptoui double %36 to i64
%38 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i64 %37)
br label %55
39: ; preds = %31
%40 = icmp ugt i64 %32, 1048576
br i1 %40, label %41, label %46
41: ; preds = %39
%42 = uitofp i64 %32 to double
%43 = fmul double %42, 0x3EB0000000000000
%44 = fptoui double %43 to i64
%45 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i64 %44)
br label %55
46: ; preds = %39
%47 = icmp ugt i64 %32, 1024
br i1 %47, label %48, label %53
48: ; preds = %46
%49 = uitofp i64 %32 to double
%50 = fmul double %49, 0x3F50000000000000
%51 = fptoui double %50 to i64
%52 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i64 %51)
br label %55
53: ; preds = %46
%54 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i64 %32)
br label %55
55: ; preds = %41, %53, %48, %34
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %8)
%57 = call i8* @malloc(i64 %32)
%58 = icmp eq i8* %57, null
br i1 %58, label %59, label %61
59: ; preds = %55
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %8)
br label %102
61: ; preds = %55
%62 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%63 = call i32 (...) @rand()
%64 = trunc i32 %63 to i8
store i8 %64, i8* %57
%65 = call i32 (...) @rand()
%66 = trunc i32 %65 to i8
%67 = add i64 %32, -1
%68 = getelementptr inbounds i8, i8* %57, i64 %67
store i8 %66, i8* %68
%69 = call i64 @time(i32* null)
%70 = call i32 @srand(i64 %69)
%71 = call i64 @time(i32* null)
%72 = sub nsw i64 %71, %69
%73 = icmp slt i64 %72, %25
br i1 %73, label %78, label %100
74: ; preds = %89, %78
%75 = call i64 @time(i32* null)
%76 = sub nsw i64 %75, %69
%77 = icmp slt i64 %76, %25
br i1 %77, label %78, label %100
78: ; preds = %61, %74
%79 = phi i64 [ %80, %74 ], [ 1, %61 ]
%80 = add i64 %79, 1
%81 = udiv i64 %32, %80
%82 = icmp ugt i64 %81, 1
%83 = select i1 %82, i64 %81, i64 1
%84 = call i64 @time(i32* null)
%85 = sub nsw i64 %84, %69
%86 = icmp slt i64 %85, %25
%87 = icmp ult i64 %83, %32
%88 = select i1 %86, i1 %87, i1 false
br i1 %88, label %89, label %74
89: ; preds = %78, %89
%90 = phi i64 [ %94, %89 ], [ %83, %78 ]
%91 = call i32 (...) @rand()
%92 = trunc i32 %91 to i8
%93 = getelementptr inbounds i8, i8* %57, i64 %90
store i8 %92, i8* %93
%94 = add i64 %90, %83
%95 = call i64 @time(i32* null)
%96 = sub nsw i64 %95, %69
%97 = icmp slt i64 %96, %25
%98 = icmp ult i64 %94, %32
%99 = select i1 %97, i1 %98, i1 false
br i1 %99, label %89, label %74
100: ; preds = %74, %61
%101 = call i32 @free(i8* %57)
br label %102
102: ; preds = %100, %59, %28, %10
%103 = phi i32* [ @EXIT_FAILURE, %10 ], [ @EXIT_FAILURE, %28 ], [ @EXIT_SUCCESS, %100 ], [ @EXIT_FAILURE, %59 ]
%104 = load i32, i32* %103
ret i32 %104
}