#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 */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef int ulong;
struct TYPE_4__ {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};
struct TYPE_3__ {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};
struct rusage {
  TYPE_2__ ru_stime;
  TYPE_1__ ru_utime;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ RUSAGE_SELF;
int /*<<< orphan*/ SYS_getrandom;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
int fwrite(char *, int, int, int /*<<< orphan*/ *);
int getrusage(int /*<<< orphan*/, struct rusage *);
char *malloc(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, int, int, double);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int strtoul(char *, int /*<<< orphan*/ *, int);
int syscall(int /*<<< orphan*/, char *, int, int /*<<< orphan*/);
int main(int argc, char **argv) {
  if (argc < 3) {
    fprintf(stderr, "Not enough arguments\n");
    return -1;
  }
  ulong iter = strtoul(argv[1], NULL, 10);
  ulong size = strtoul(argv[2], NULL, 10);
  char *data = malloc(size);
  int c;
  if (data == NULL) {
    fprintf(stderr, "malloc fail\n");
    return 1;
  }
  memset(data, 0, size);
  FILE *out = fopen("getrandom_out_16gb.txt", "wb");
  if (out == NULL) {
    fprintf(stderr, "fopen:%s\n", strerror(errno));
    return 2;
  }
  for (int i = 0; i < iter; i++) {
    c = syscall(SYS_getrandom, data, size, 0);
    if (c != 0) {
      fprintf(stderr, "getrandom: %s\n", strerror(errno));
      return 3;
    }
    c = fwrite(data, 1, size, out);
    if (c != size) {
      fprintf(stderr, "fwrite failed\n");
      return 4;
    }
    fflush(out);
  }
  struct rusage u;
  c = getrusage(RUSAGE_SELF, &u);
  if (c != 0) {
    fprintf(stderr, "getrusage:%s\n", strerror(errno));
    return 5;
  }
  double total_time = 0;
  total_time += u.ru_utime.tv_sec;
  total_time += ((double)u.ru_utime.tv_usec / (double)1000000);
  total_time += u.ru_stime.tv_sec;
  total_time += ((double)u.ru_stime.tv_usec / (double)1000000);
  printf("%lu x %lu B in %lf sec\n", iter, size, total_time);
  memset(data, 0, size);
  data[0] = 'a';
  free(data);
  fclose(out);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1213 <main+0x43>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
lea    0xe08(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14b6 <main+0x2e6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   10d0 <strtoul@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   10d0 <strtoul@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1090 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    127f <main+0xaf>
mov    0x2d75(%rip),%rax
mov    (%rax),%edi
lea    0xdb2(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14b6 <main+0x2e6>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    0xd97(%rip),%rdi
lea    0xda7(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    12e9 <main+0x119>
mov    0x2d22(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
mov    0x2d0e(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x64(%rbp),%edi
mov    %rax,%rdx
lea    0xd6f(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    14b6 <main+0x2e6>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    13b8 <main+0x1e8>
mov    0x2ce5(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%edx
xor    %ecx,%ecx
call   1080 <syscall@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     135a <main+0x18a>
mov    0x2cb1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x68(%rbp)
mov    0x2c9d(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x68(%rbp),%edi
mov    %rax,%rdx
lea    0xd08(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x3,-0x4(%rbp)
jmp    14b6 <main+0x2e6>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    $0x1,%esi
call   10e0 <fwrite@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
je     13a1 <main+0x1d1>
mov    0x2c53(%rip),%rax
mov    (%rax),%edi
lea    0xcd0(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x4,-0x4(%rbp)
jmp    14b6 <main+0x2e6>
mov    -0x30(%rbp),%rdi
call   10a0 <fflush@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12f0 <main+0x120>
mov    0x2c09(%rip),%rax
mov    (%rax),%edi
lea    -0x58(%rbp),%rsi
call   10c0 <getrusage@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1411 <main+0x241>
mov    0x2bfa(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
mov    0x2be6(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x6c(%rbp),%edi
mov    %rax,%rdx
lea    0xc6f(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x5,-0x4(%rbp)
jmp    14b6 <main+0x2e6>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
cvtsi2sdq -0x40(%rbp),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
cvtsi2sdq -0x48(%rbp),%xmm0
movsd  0xbc9(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
cvtsi2sdq -0x50(%rbp),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
cvtsi2sdq -0x58(%rbp),%xmm0
movsd  0xb9d(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
movsd  -0x60(%rbp),%xmm0
lea    0xbf8(%rip),%rdi
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%edx
xor    %esi,%esi
call   1060 <memset@plt>
mov    -0x20(%rbp),%rax
movb   $0x61,(%rax)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
cmp    $0x2,%edi
jg     1204 <main+0x34>
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
lea    0xe15(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0xffffffff,%ebp
jmp    1423 <main+0x253>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10d0 <strtoul@plt>
mov    %eax,%r15d
mov    0x10(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10d0 <strtoul@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1090 <malloc@plt>
test   %rax,%rax
je     130e <main+0x13e>
mov    %rax,%r14
mov    %rax,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   1060 <memset@plt>
lea    0xdd9(%rip),%rdi
lea    0xde9(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     132f <main+0x15f>
mov    %rax,%r12
test   %r15d,%r15d
jle    12bf <main+0xef>
mov    0x2d72(%rip),%r13
mov    %r15d,%ebp
nopl   0x0(%rax)
mov    0x0(%r13),%edi
mov    %r14,%rsi
mov    %ebx,%edx
xor    %ecx,%ecx
call   1080 <syscall@plt>
test   %eax,%eax
jne    1363 <main+0x193>
mov    %r14,%rdi
mov    $0x1,%esi
mov    %ebx,%edx
mov    %r12,%rcx
call   10e0 <fwrite@plt>
cmp    %ebx,%eax
jne    1397 <main+0x1c7>
mov    %r12,%rdi
call   10a0 <fflush@plt>
add    $0xffffffff,%ebp
jne    1280 <main+0xb0>
mov    0x2d02(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   10c0 <getrusage@plt>
test   %eax,%eax
je     13b5 <main+0x1e5>
mov    0x2cf7(%rip),%rax
mov    (%rax),%ebx
mov    0x2ce6(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
lea    0xd75(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x5,%ebp
jmp    1423 <main+0x253>
mov    0x2cc3(%rip),%rax
mov    (%rax),%edi
lea    0xd00(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%ebp
jmp    1423 <main+0x253>
mov    0x2ca2(%rip),%rax
mov    (%rax),%ebx
mov    0x2c91(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
lea    0xcf8(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x2,%ebp
jmp    1423 <main+0x253>
mov    0x2c6e(%rip),%rax
mov    (%rax),%ebx
mov    0x2c5d(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
lea    0xcce(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x3,%ebp
jmp    1423 <main+0x253>
mov    0x2c3a(%rip),%rax
mov    (%rax),%edi
lea    0xcb7(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x4,%ebp
jmp    1423 <main+0x253>
cvtsi2sdq 0x20(%rsp),%xmm0
cvtsi2sdq 0x18(%rsp),%xmm1
movsd  0xc35(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
cvtsi2sdq 0x10(%rsp),%xmm3
addsd  %xmm1,%xmm3
xorps  %xmm0,%xmm0
cvtsi2sdq 0x8(%rsp),%xmm0
divsd  %xmm2,%xmm0
addsd  %xmm3,%xmm0
lea    0xc84(%rip),%rdi
mov    %r15d,%esi
mov    %ebx,%edx
call   1050 <printf@plt>
xor    %ebp,%ebp
mov    %r14,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   1060 <memset@plt>
movb   $0x61,(%r14)
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1040 <fclose@plt>
mov    %ebp,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.rusage = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i64, i64 }
%struct.TYPE_3__ = type { i64, i64 }
@stderr = global i32 0
@.str = [22 x i8] c"Not enough arguments\0A\00"
@.str.1 = [13 x i8] c"malloc fail\0A\00"
@.str.2 = [23 x i8] c"getrandom_out_16gb.txt\00"
@.str.3 = [3 x i8] c"wb\00"
@.str.4 = [10 x i8] c"fopen:%s\0A\00"
@errno = global i32 0
@SYS_getrandom = global i32 0
@.str.5 = [15 x i8] c"getrandom: %s\0A\00"
@.str.6 = [15 x i8] c"fwrite failed\0A\00"
@RUSAGE_SELF = global i32 0
@.str.7 = [14 x i8] c"getrusage:%s\0A\00"
@.str.8 = [24 x i8] c"%lu x %lu B in %lf sec\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
%12 = alloca %struct.rusage
%13 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 3
br i1 %15, label %16, label %19
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %131
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32 @strtoul(i8* %22, i32* null, i32 10)
store i32 %23, i32* %6
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
%27 = call i32 @strtoul(i8* %26, i32* null, i32 10)
store i32 %27, i32* %7
%28 = load i32, i32* %7
%29 = call i8* @malloc(i32 %28)
store i8* %29, i8** %8
%30 = load i8*, i8** %8
%31 = icmp eq i8* %30, null
br i1 %31, label %32, label %35
32: ; preds = %19
%33 = load i32, i32* @stderr
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %131
35: ; preds = %19
%36 = load i8*, i8** %8
%37 = load i32, i32* %7
%38 = call i32 @memset(i8* %36, i32 0, i32 %37)
%39 = call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %39, i32** %10
%40 = load i32*, i32** %10
%41 = icmp eq i32* %40, null
br i1 %41, label %42, label %47
42: ; preds = %35
%43 = load i32, i32* @stderr
%44 = load i32, i32* @errno
%45 = call i8* @strerror(i32 %44)
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %45)
store i32 2, i32* %3
br label %131
47: ; preds = %35
store i32 0, i32* %11
br label %48
48: ; preds = %78, %47
%49 = load i32, i32* %11
%50 = load i32, i32* %6
%51 = icmp slt i32 %49, %50
br i1 %51, label %52, label %81
52: ; preds = %48
%53 = load i32, i32* @SYS_getrandom
%54 = load i8*, i8** %8
%55 = load i32, i32* %7
%56 = call i32 @syscall(i32 %53, i8* %54, i32 %55, i32 0)
store i32 %56, i32* %9
%57 = load i32, i32* %9
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %64
59: ; preds = %52
%60 = load i32, i32* @stderr
%61 = load i32, i32* @errno
%62 = call i8* @strerror(i32 %61)
%63 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i8* %62)
store i32 3, i32* %3
br label %131
64: ; preds = %52
%65 = load i8*, i8** %8
%66 = load i32, i32* %7
%67 = load i32*, i32** %10
%68 = call i32 @fwrite(i8* %65, i32 1, i32 %66, i32* %67)
store i32 %68, i32* %9
%69 = load i32, i32* %9
%70 = load i32, i32* %7
%71 = icmp ne i32 %69, %70
br i1 %71, label %72, label %75
72: ; preds = %64
%73 = load i32, i32* @stderr
%74 = call i32 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
store i32 4, i32* %3
br label %131
75: ; preds = %64
%76 = load i32*, i32** %10
%77 = call i32 @fflush(i32* %76)
br label %78
78: ; preds = %75
%79 = load i32, i32* %11
%80 = add nsw i32 %79, 1
store i32 %80, i32* %11
br label %48
81: ; preds = %48
%82 = load i32, i32* @RUSAGE_SELF
%83 = call i32 @getrusage(i32 %82, %struct.rusage* %12)
store i32 %83, i32* %9
%84 = load i32, i32* %9
%85 = icmp ne i32 %84, 0
br i1 %85, label %86, label %91
86: ; preds = %81
%87 = load i32, i32* @stderr
%88 = load i32, i32* @errno
%89 = call i8* @strerror(i32 %88)
%90 = call i32 (i32, i8*, ...) @fprintf(i32 %87, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* %89)
store i32 5, i32* %3
br label %131
91: ; preds = %81
store double 0.000000e+00, double* %13
%92 = getelementptr inbounds %struct.rusage, %struct.rusage* %12, i32 0, i32 1
%93 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %92, i32 0, i32 1
%94 = load i64, i64* %93
%95 = sitofp i64 %94 to double
%96 = load double, double* %13
%97 = fadd double %96, %95
store double %97, double* %13
%98 = getelementptr inbounds %struct.rusage, %struct.rusage* %12, i32 0, i32 1
%99 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %98, i32 0, i32 0
%100 = load i64, i64* %99
%101 = sitofp i64 %100 to double
%102 = fdiv double %101, 1.000000e+06
%103 = load double, double* %13
%104 = fadd double %103, %102
store double %104, double* %13
%105 = getelementptr inbounds %struct.rusage, %struct.rusage* %12, i32 0, i32 0
%106 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %105, i32 0, i32 1
%107 = load i64, i64* %106
%108 = sitofp i64 %107 to double
%109 = load double, double* %13
%110 = fadd double %109, %108
store double %110, double* %13
%111 = getelementptr inbounds %struct.rusage, %struct.rusage* %12, i32 0, i32 0
%112 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %111, i32 0, i32 0
%113 = load i64, i64* %112
%114 = sitofp i64 %113 to double
%115 = fdiv double %114, 1.000000e+06
%116 = load double, double* %13
%117 = fadd double %116, %115
store double %117, double* %13
%118 = load i32, i32* %6
%119 = load i32, i32* %7
%120 = load double, double* %13
%121 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), i32 %118, i32 %119, double %120)
%122 = load i8*, i8** %8
%123 = load i32, i32* %7
%124 = call i32 @memset(i8* %122, i32 0, i32 %123)
%125 = load i8*, i8** %8
%126 = getelementptr inbounds i8, i8* %125, i64 0
store i8 97, i8* %126
%127 = load i8*, i8** %8
%128 = call i32 @free(i8* %127)
%129 = load i32*, i32** %10
%130 = call i32 @fclose(i32* %129)
store i32 0, i32* %3
br label %131
131: ; preds = %91, %86, %72, %59, %42, %32, %16
%132 = load i32, i32* %3
ret i32 %132
}

LLVM IR (-O2):
%struct.rusage = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i64, i64 }
%struct.TYPE_3__ = type { i64, i64 }
@stderr = global i32 0
@.str = [22 x i8] c"Not enough arguments\0A\00"
@.str.1 = [13 x i8] c"malloc fail\0A\00"
@.str.2 = [23 x i8] c"getrandom_out_16gb.txt\00"
@.str.3 = [3 x i8] c"wb\00"
@.str.4 = [10 x i8] c"fopen:%s\0A\00"
@errno = global i32 0
@SYS_getrandom = global i32 0
@.str.5 = [15 x i8] c"getrandom: %s\0A\00"
@.str.6 = [15 x i8] c"fwrite failed\0A\00"
@RUSAGE_SELF = global i32 0
@.str.7 = [14 x i8] c"getrusage:%s\0A\00"
@.str.8 = [24 x i8] c"%lu x %lu B in %lf sec\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.rusage
%4 = icmp slt i32 %0, 3
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %85
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @strtoul(i8* nocapture %10, i32* null, i32 10)
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32 @strtoul(i8* nocapture %13, i32* null, i32 10)
%15 = tail call i8* @malloc(i32 %14)
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %20
17: ; preds = %8
%18 = load i32, i32* @stderr
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %85
20: ; preds = %8
%21 = tail call i32 @memset(i8* %15, i32 0, i32 %14)
%22 = tail call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i32* %22, null
br i1 %23, label %26, label %24
24: ; preds = %20
%25 = icmp sgt i32 %11, 0
br i1 %25, label %31, label %51
26: ; preds = %20
%27 = load i32, i32* @stderr
%28 = load i32, i32* @errno
%29 = tail call i8* @strerror(i32 %28)
%30 = tail call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %29)
br label %85
31: ; preds = %24, %47
%32 = phi i32 [ %49, %47 ], [ 0, %24 ]
%33 = load i32, i32* @SYS_getrandom
%34 = tail call i32 @syscall(i32 %33, i8* %15, i32 %14, i32 0)
%35 = icmp eq i32 %34, 0
br i1 %35, label %41, label %36
36: ; preds = %31
%37 = load i32, i32* @stderr
%38 = load i32, i32* @errno
%39 = tail call i8* @strerror(i32 %38)
%40 = tail call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i8* %39)
br label %85
41: ; preds = %31
%42 = tail call i32 @fwrite(i8* %15, i32 1, i32 %14, i32* %22)
%43 = icmp eq i32 %42, %14
br i1 %43, label %47, label %44
44: ; preds = %41
%45 = load i32, i32* @stderr
%46 = tail call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
br label %85
47: ; preds = %41
%48 = tail call i32 @fflush(i32* %22)
%49 = add nuw nsw i32 %32, 1
%50 = icmp eq i32 %49, %11
br i1 %50, label %51, label %31
51: ; preds = %47, %24
%52 = bitcast %struct.rusage* %3 to i8*
%53 = load i32, i32* @RUSAGE_SELF
%54 = call i32 @getrusage(i32 %53, %struct.rusage* %3)
%55 = icmp eq i32 %54, 0
br i1 %55, label %61, label %56
56: ; preds = %51
%57 = load i32, i32* @stderr
%58 = load i32, i32* @errno
%59 = call i8* @strerror(i32 %58)
%60 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* %59)
br label %83
61: ; preds = %51
%62 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i64 0, i32 1, i32 1
%63 = load i64, i64* %62
%64 = sitofp i64 %63 to double
%65 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i64 0, i32 1, i32 0
%66 = load i64, i64* %65
%67 = sitofp i64 %66 to double
%68 = fdiv double %67, 1.000000e+06
%69 = fadd double %68, %64
%70 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i64 0, i32 0, i32 1
%71 = load i64, i64* %70
%72 = sitofp i64 %71 to double
%73 = fadd double %69, %72
%74 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i64 0, i32 0, i32 0
%75 = load i64, i64* %74
%76 = sitofp i64 %75 to double
%77 = fdiv double %76, 1.000000e+06
%78 = fadd double %73, %77
%79 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), i32 %11, i32 %14, double %78)
%80 = call i32 @memset(i8* %15, i32 0, i32 %14)
store i8 97, i8* %15
%81 = call i32 @free(i8* %15)
%82 = call i32 @fclose(i32* %22)
br label %83
83: ; preds = %61, %56
%84 = phi i32 [ 5, %56 ], [ 0, %61 ]
br label %85
85: ; preds = %36, %44, %17, %83, %26, %5
%86 = phi i32 [ -1, %5 ], [ 1, %17 ], [ 2, %26 ], [ %84, %83 ], [ 3, %36 ], [ 4, %44 ]
ret i32 %86
}