#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 */
struct timeval {
  double tv_sec;
  double tv_usec;
};
typedef scalar_t__ clock_t;

/* Variables and functions */
double CLOCKS_PER_SEC;
int O_CREAT;
int O_RDWR;
scalar_t__ RAND_MAX;
scalar_t__ calloc(int, int);
scalar_t__ clock();
int getpid();
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, double);
int open(char *, int, int);
int /*<<< orphan*/ perror(char *);
double rand();
scalar_t__ remove(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ srand(unsigned int);
long long strtod(char *, int /*<<< orphan*/ *);
scalar_t__ time(int /*<<< orphan*/ *);
scalar_t__ write(int, char *, int);
int main(int charc, char *args[]) {
  clock_t start = clock();
  int iterations = 100;
  double ret = 0;
  char fileName[30];
  char *memAlloc;
  int pid = getpid();
  sprintf(fileName, "%d.txt", pid);
  int fd = open(fileName, O_CREAT | O_RDWR, 0777);
  if (fd < 0) {
    perror("opening file\n");
  }
  srand((unsigned int)time(NULL));
  double durSecs = strtod(args[1], NULL) / 1000.0;
  long long memCapacity = 100L * 1024 * 1024 * 1024;
  double memSize = memCapacity * strtod(args[2], NULL);
  double ioTime = strtod(args[3], NULL);
  if ((int)memSize > 0) {
    memAlloc = (char *)malloc((int)memSize * sizeof(char));
  }
  if (memAlloc != NULL) {
    memset(memAlloc, 0, memSize);
  }
  int blockSize = 1 * 1024;
  char *data = (char *)calloc(blockSize, sizeof(char));
  double accu_ioTime = 0.01;
  double ioelapsed = 0.0;
  clock_t end = clock();
  struct timeval st, ed;
  while (((double)(end - start) / CLOCKS_PER_SEC) < durSecs) {
    int j = 0;
    for (j = 0; j < iterations; j++) {
      double x = rand() / (double)RAND_MAX;
      ret = ret * x;
    }
    if (accu_ioTime < ioTime) {
      gettimeofday(&st, NULL);
      if (write(fd, data, blockSize) < 0) {
        perror("writing to file\n");
      }
      gettimeofday(&ed, NULL);
      ioelapsed =
          (ed.tv_sec - st.tv_sec) * 1000.0 + (ed.tv_usec - st.tv_usec) / 1000.0;
      accu_ioTime += ioelapsed;
    }
    end = clock();
  }
  if (remove(fileName) != 0) {
    perror("delete file\n");
  }
  return (int)ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1070 <clock@plt>
mov    %rax,-0x18(%rbp)
movl   $0x64,-0x1c(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    $0x0,%al
call   1060 <getpid@plt>
mov    %eax,-0x5c(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x5c(%rbp),%edx
lea    0xdd5(%rip),%rsi
call   1100 <sprintf@plt>
lea    -0x50(%rbp),%rdi
mov    0x2dad(%rip),%rax
mov    (%rax),%esi
mov    0x2d8c(%rip),%rax
or     (%rax),%esi
mov    $0x1ff,%edx
call   10e0 <open@plt>
mov    %eax,-0x60(%rbp)
cmpl   $0x0,-0x60(%rbp)
jge    1279 <main+0x89>
lea    0xda3(%rip),%rdi
call   10f0 <perror@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10c0 <time@plt>
mov    %eax,%edi
call   10a0 <srand@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <strtod@plt>
cvtsi2sd %rax,%xmm0
movsd  0xd59(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movabs $0x1900000000,%rax
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rax
mov    %rax,-0xe0(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <strtod@plt>
mov    %rax,%rcx
mov    -0xe0(%rbp),%rax
imul   %rcx,%rax
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <strtod@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x80(%rbp)
cvttsd2si -0x78(%rbp),%eax
cmp    $0x0,%eax
jle    1331 <main+0x141>
cvttsd2si -0x78(%rbp),%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
je     134c <main+0x15c>
mov    -0x58(%rbp),%rdi
movsd  -0x78(%rbp),%xmm0
xor    %esi,%esi
call   1090 <memset@plt>
movl   $0x400,-0x84(%rbp)
mov    -0x84(%rbp),%edi
mov    $0x1,%esi
call   10b0 <calloc@plt>
mov    %rax,-0x90(%rbp)
movsd  0xc93(%rip),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
mov    $0x0,%al
call   1070 <clock@plt>
mov    %rax,-0xa8(%rbp)
mov    -0xa8(%rbp),%rax
sub    -0x18(%rbp),%rax
cvtsi2sd %rax,%xmm1
mov    0x2c2b(%rip),%rax
divsd  (%rax),%xmm1
movsd  -0x68(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    14f9 <main+0x309>
movl   $0x0,-0xcc(%rbp)
movl   $0x0,-0xcc(%rbp)
mov    -0xcc(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1428 <main+0x238>
mov    $0x0,%al
call   1110 <rand@plt>
mov    0x2bdf(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
mulsd  -0xd8(%rbp),%xmm0
ff
movsd  %xmm0,-0x28(%rbp)
mov    -0xcc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcc(%rbp)
jmp    13d4 <main+0x1e4>
movsd  -0x98(%rbp),%xmm1
ff
movsd  -0x80(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    14e6 <main+0x2f6>
lea    -0xb8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1080 <gettimeofday@plt>
mov    -0x60(%rbp),%edi
mov    -0x90(%rbp),%rsi
mov    -0x84(%rbp),%edx
call   1050 <write@plt>
cmp    $0x0,%rax
jge    147a <main+0x28a>
lea    0xbb0(%rip),%rdi
call   10f0 <perror@plt>
lea    -0xc8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1080 <gettimeofday@plt>
movsd  -0xc8(%rbp),%xmm0
ff
subsd  -0xb8(%rbp),%xmm0
ff
movsd  -0xc0(%rbp),%xmm1
ff
subsd  -0xb0(%rbp),%xmm1
ff
movsd  0xb4e(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  0xb42(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
addsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
mov    $0x0,%al
call   1070 <clock@plt>
mov    %rax,-0xa8(%rbp)
jmp    1396 <main+0x1a6>
lea    -0x50(%rbp),%rdi
call   1030 <remove@plt>
cmp    $0x0,%rax
je     1518 <main+0x328>
lea    0xb23(%rip),%rdi
call   10f0 <perror@plt>
cvttsd2si -0x28(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%rbp
xor    %r14d,%r14d
xor    %eax,%eax
call   1070 <clock@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <getpid@plt>
lea    0xe04(%rip),%rsi
lea    0x40(%rsp),%r15
mov    %r15,%rdi
mov    %eax,%edx
call   10f0 <sprintf@plt>
mov    0x2dd6(%rip),%rax
mov    0x2db7(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    %r15,%rdi
mov    $0x1ff,%edx
call   10d0 <open@plt>
mov    %eax,%r15d
test   %eax,%eax
js     1436 <main+0x256>
xor    %edi,%edi
call   10c0 <time@plt>
mov    %eax,%edi
call   10a0 <srand@plt>
mov    0x8(%rbp),%rdi
xor    %esi,%esi
call   1040 <strtod@plt>
cvtsi2sd %rax,%xmm0
divsd  0xd95(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    0x10(%rbp),%rdi
xor    %esi,%esi
call   1040 <strtod@plt>
movabs $0x1900000000,%rcx
imul   %rax,%rcx
xorps  %xmm0,%xmm0
cvtsi2sd %rcx,%xmm0
movsd  %xmm0,(%rsp)
mov    0x18(%rbp),%rdi
xor    %esi,%esi
call   1040 <strtod@plt>
mov    %rax,%r13
xor    %esi,%esi
movsd  (%rsp),%xmm0
call   1090 <memset@plt>
mov    $0x400,%edi
mov    $0x1,%esi
call   10b0 <calloc@plt>
mov    %rax,%rbp
xor    %eax,%eax
call   1070 <clock@plt>
sub    %rbx,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
mov    0x2cfc(%rip),%r12
divsd  (%r12),%xmm0
movsd  0x10(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jbe    1415 <main+0x235>
xorps  %xmm0,%xmm0
cvtsi2sd %r13,%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0xd00(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
xorpd  %xmm1,%xmm1
mov    0x2cb7(%rip),%r14
jmp    1391 <main+0x1b1>
nopl   0x0(%rax,%rax,1)
lea    0x20(%rsp),%rdi
xor    %esi,%esi
call   1080 <gettimeofday@plt>
movsd  0x20(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
subsd  0x30(%rsp),%xmm0
subsd  0x38(%rsp),%xmm1
movsd  0xcb4(%rip),%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
xor    %eax,%eax
call   1070 <clock@plt>
sub    %rbx,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  (%r12),%xmm0
movsd  0x10(%rsp),%xmm1
ucomisd %xmm0,%xmm1
movsd  (%rsp),%xmm1
jbe    1410 <main+0x230>
mov    $0x64,%r13d
nopw   0x0(%rax,%rax,1)
movsd  %xmm1,(%rsp)
xor    %eax,%eax
call   1100 <rand@plt>
xorps  %xmm1,%xmm1
cvtsi2sdq (%r14),%xmm1
divsd  %xmm1,%xmm0
movsd  (%rsp),%xmm1
mulsd  %xmm0,%xmm1
add    $0xffffffff,%r13d
jne    13a0 <main+0x1c0>
movsd  %xmm1,(%rsp)
movsd  0x18(%rsp),%xmm0
ucomisd 0x8(%rsp),%xmm0
jbe    1368 <main+0x188>
lea    0x30(%rsp),%rdi
xor    %esi,%esi
call   1080 <gettimeofday@plt>
mov    %r15d,%edi
mov    %rbp,%rsi
mov    $0x400,%edx
call   1050 <write@plt>
test   %rax,%rax
jns    1320 <main+0x140>
lea    0xc1f(%rip),%rdi
call   10e0 <perror@plt>
jmp    1320 <main+0x140>
cvttsd2si %xmm1,%r14d
lea    0x40(%rsp),%rdi
call   1030 <remove@plt>
test   %rax,%rax
jne    1447 <main+0x267>
mov    %r14d,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xbda(%rip),%rdi
call   10e0 <perror@plt>
jmp    1245 <main+0x65>
lea    0xbe8(%rip),%rdi
call   10e0 <perror@plt>
jmp    1424 <main+0x244>

LLVM IR (-O0):
%struct.timeval = type { double, double }
@.str = [7 x i8] c"%d.txt\00"
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@.str.1 = [14 x i8] c"opening file\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@RAND_MAX = global i64 0
@.str.2 = [17 x i8] c"writing to file\0A\00"
@.str.3 = [13 x i8] c"delete file\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i32
%8 = alloca double
%9 = alloca [30 x i8]
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca double
%14 = alloca i64
%15 = alloca double
%16 = alloca double
%17 = alloca i32
%18 = alloca i8*
%19 = alloca double
%20 = alloca double
%21 = alloca i64
%22 = alloca %struct.timeval
%23 = alloca %struct.timeval
%24 = alloca i32
%25 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%26 = call i64 (...) @clock()
store i64 %26, i64* %6
store i32 100, i32* %7
store double 0.000000e+00, double* %8
%27 = call i32 (...) @getpid()
store i32 %27, i32* %11
%28 = getelementptr inbounds [30 x i8], [30 x i8]* %9, i64 0, i64 0
%29 = load i32, i32* %11
%30 = call i32 @sprintf(i8* %28, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %29)
%31 = getelementptr inbounds [30 x i8], [30 x i8]* %9, i64 0, i64 0
%32 = load i32, i32* @O_CREAT
%33 = load i32, i32* @O_RDWR
%34 = or i32 %32, %33
%35 = call i32 @open(i8* %31, i32 %34, i32 511)
store i32 %35, i32* %12
%36 = load i32, i32* %12
%37 = icmp slt i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %2
%39 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %40
40: ; preds = %38, %2
%41 = call i64 @time(i32* null)
%42 = trunc i64 %41 to i32
%43 = call i32 @srand(i32 %42)
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 1
%46 = load i8*, i8** %45
%47 = call i64 @strtod(i8* %46, i32* null)
%48 = sitofp i64 %47 to double
%49 = fdiv double %48, 1.000000e+03
store double %49, double* %13
store i64 107374182400, i64* %14
%50 = load i64, i64* %14
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 2
%53 = load i8*, i8** %52
%54 = call i64 @strtod(i8* %53, i32* null)
%55 = mul nsw i64 %50, %54
%56 = sitofp i64 %55 to double
store double %56, double* %15
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 3
%59 = load i8*, i8** %58
%60 = call i64 @strtod(i8* %59, i32* null)
%61 = sitofp i64 %60 to double
store double %61, double* %16
%62 = load double, double* %15
%63 = fptosi double %62 to i32
%64 = icmp sgt i32 %63, 0
br i1 %64, label %65, label %73
65: ; preds = %40
%66 = load double, double* %15
%67 = fptosi double %66 to i32
%68 = sext i32 %67 to i64
%69 = mul i64 %68, 1
%70 = trunc i64 %69 to i32
%71 = call i64 @malloc(i32 %70)
%72 = inttoptr i64 %71 to i8*
store i8* %72, i8** %10
br label %73
73: ; preds = %65, %40
%74 = load i8*, i8** %10
%75 = icmp ne i8* %74, null
br i1 %75, label %76, label %80
76: ; preds = %73
%77 = load i8*, i8** %10
%78 = load double, double* %15
%79 = call i32 @memset(i8* %77, i32 0, double %78)
br label %80
80: ; preds = %76, %73
store i32 1024, i32* %17
%81 = load i32, i32* %17
%82 = call i64 @calloc(i32 %81, i32 1)
%83 = inttoptr i64 %82 to i8*
store i8* %83, i8** %18
store double 1.000000e-02, double* %19
store double 0.000000e+00, double* %20
%84 = call i64 (...) @clock()
store i64 %84, i64* %21
br label %85
85: ; preds = %140, %80
%86 = load i64, i64* %21
%87 = load i64, i64* %6
%88 = sub nsw i64 %86, %87
%89 = sitofp i64 %88 to double
%90 = load double, double* @CLOCKS_PER_SEC
%91 = fdiv double %89, %90
%92 = load double, double* %13
%93 = fcmp olt double %91, %92
br i1 %93, label %94, label %142
94: ; preds = %85
store i32 0, i32* %24
store i32 0, i32* %24
br label %95
95: ; preds = %107, %94
%96 = load i32, i32* %24
%97 = load i32, i32* %7
%98 = icmp slt i32 %96, %97
br i1 %98, label %99, label %110
99: ; preds = %95
%100 = call double (...) @rand()
%101 = load i64, i64* @RAND_MAX
%102 = sitofp i64 %101 to double
%103 = fdiv double %100, %102
store double %103, double* %25
%104 = load double, double* %8
%105 = load double, double* %25
%106 = fmul double %104, %105
store double %106, double* %8
br label %107
107: ; preds = %99
%108 = load i32, i32* %24
%109 = add nsw i32 %108, 1
store i32 %109, i32* %24
br label %95
110: ; preds = %95
%111 = load double, double* %19
%112 = load double, double* %16
%113 = fcmp olt double %111, %112
br i1 %113, label %114, label %140
114: ; preds = %110
%115 = call i32 @gettimeofday(%struct.timeval* %22, i32* null)
%116 = load i32, i32* %12
%117 = load i8*, i8** %18
%118 = load i32, i32* %17
%119 = call i64 @write(i32 %116, i8* %117, i32 %118)
%120 = icmp slt i64 %119, 0
br i1 %120, label %121, label %123
121: ; preds = %114
%122 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %123
123: ; preds = %121, %114
%124 = call i32 @gettimeofday(%struct.timeval* %23, i32* null)
%125 = getelementptr inbounds %struct.timeval, %struct.timeval* %23, i32 0, i32 0
%126 = load double, double* %125
%127 = getelementptr inbounds %struct.timeval, %struct.timeval* %22, i32 0, i32 0
%128 = load double, double* %127
%129 = fsub double %126, %128
%130 = getelementptr inbounds %struct.timeval, %struct.timeval* %23, i32 0, i32 1
%131 = load double, double* %130
%132 = getelementptr inbounds %struct.timeval, %struct.timeval* %22, i32 0, i32 1
%133 = load double, double* %132
%134 = fsub double %131, %133
%135 = fdiv double %134, 1.000000e+03
%136 = call double @llvm.fmuladd.f64(double %129, double 1.000000e+03, double %135)
store double %136, double* %20
%137 = load double, double* %20
%138 = load double, double* %19
%139 = fadd double %138, %137
store double %139, double* %19
br label %140
140: ; preds = %123, %110
%141 = call i64 (...) @clock()
store i64 %141, i64* %21
br label %85
142: ; preds = %85
%143 = getelementptr inbounds [30 x i8], [30 x i8]* %9, i64 0, i64 0
%144 = call i64 @remove(i8* %143)
%145 = icmp ne i64 %144, 0
br i1 %145, label %146, label %148
146: ; preds = %142
%147 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %148
148: ; preds = %146, %142
%149 = load double, double* %8
%150 = fptosi double %149 to i32
ret i32 %150
}

LLVM IR (-O2):
%struct.timeval = type { double, double }
@.str = [7 x i8] c"%d.txt\00"
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@.str.1 = [14 x i8] c"opening file\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@RAND_MAX = global i64 0
@.str.2 = [17 x i8] c"writing to file\0A\00"
@.str.3 = [13 x i8] c"delete file\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [30 x i8]
%4 = alloca %struct.timeval
%5 = alloca %struct.timeval
%6 = tail call i64 (...) @clock()
%7 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%8 = tail call i32 (...) @getpid()
%9 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32, i32* @O_CREAT
%11 = load i32, i32* @O_RDWR
%12 = or i32 %11, %10
%13 = call i32 @open(i8* %7, i32 %12, i32 511)
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %15, %2
%18 = tail call i64 @time(i32* null)
%19 = trunc i64 %18 to i32
%20 = tail call i32 @srand(i32 %19)
%21 = getelementptr inbounds i8*, i8** %1, i64 1
%22 = load i8*, i8** %21
%23 = tail call i64 @strtod(i8* nocapture %22, i32* null)
%24 = sitofp i64 %23 to double
%25 = fdiv double %24, 1.000000e+03
%26 = getelementptr inbounds i8*, i8** %1, i64 2
%27 = load i8*, i8** %26
%28 = tail call i64 @strtod(i8* nocapture %27, i32* null)
%29 = mul nsw i64 %28, 107374182400
%30 = sitofp i64 %29 to double
%31 = getelementptr inbounds i8*, i8** %1, i64 3
%32 = load i8*, i8** %31
%33 = tail call i64 @strtod(i8* nocapture %32, i32* null)
%34 = sitofp i64 %33 to double
%35 = tail call i32 @memset(i8* undef, i32 0, double %30)
%36 = tail call i64 @calloc(i32 1024, i32 1)
%37 = inttoptr i64 %36 to i8*
%38 = tail call i64 (...) @clock()
%39 = bitcast %struct.timeval* %4 to i8*
%40 = bitcast %struct.timeval* %5 to i8*
%41 = sub nsw i64 %38, %6
%42 = sitofp i64 %41 to double
%43 = load double, double* @CLOCKS_PER_SEC
%44 = fdiv double %42, %43
%45 = fcmp olt double %44, %25
br i1 %45, label %46, label %93
46: ; preds = %17
%47 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 0
%48 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
%49 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 1
%50 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 1
br label %51
51: ; preds = %46, %83
%52 = phi double [ 0.000000e+00, %46 ], [ %61, %83 ]
%53 = phi double [ 1.000000e-02, %46 ], [ %84, %83 ]
br label %54
54: ; preds = %51, %54
%55 = phi double [ %52, %51 ], [ %61, %54 ]
%56 = phi i32 [ 0, %51 ], [ %62, %54 ]
%57 = tail call double (...) @rand()
%58 = load i64, i64* @RAND_MAX
%59 = sitofp i64 %58 to double
%60 = fdiv double %57, %59
%61 = fmul double %55, %60
%62 = add nuw nsw i32 %56, 1
%63 = icmp eq i32 %62, 100
br i1 %63, label %64, label %54
64: ; preds = %54
%65 = fcmp olt double %53, %34
br i1 %65, label %66, label %83
66: ; preds = %64
%67 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%68 = tail call i64 @write(i32 %13, i8* %37, i32 1024)
%69 = icmp slt i64 %68, 0
br i1 %69, label %70, label %72
70: ; preds = %66
%71 = tail call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %72
72: ; preds = %70, %66
%73 = call i32 @gettimeofday(%struct.timeval* %5, i32* null)
%74 = load double, double* %47
%75 = load double, double* %48
%76 = fsub double %74, %75
%77 = load double, double* %49
%78 = load double, double* %50
%79 = fsub double %77, %78
%80 = fdiv double %79, 1.000000e+03
%81 = tail call double @llvm.fmuladd.f64(double %76, double 1.000000e+03, double %80)
%82 = fadd double %53, %81
br label %83
83: ; preds = %72, %64
%84 = phi double [ %82, %72 ], [ %53, %64 ]
%85 = tail call i64 (...) @clock()
%86 = sub nsw i64 %85, %6
%87 = sitofp i64 %86 to double
%88 = load double, double* @CLOCKS_PER_SEC
%89 = fdiv double %87, %88
%90 = fcmp olt double %89, %25
br i1 %90, label %51, label %91
91: ; preds = %83
%92 = fptosi double %61 to i32
br label %93
93: ; preds = %91, %17
%94 = phi i32 [ 0, %17 ], [ %92, %91 ]
%95 = call i64 @remove(i8* %7)
%96 = icmp eq i64 %95, 0
br i1 %96, label %99, label %97
97: ; preds = %93
%98 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %99
99: ; preds = %97, %93
ret i32 %94
}