#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 float clock_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ CLOCKS_PER_SEC;
int EXIT_SUCCESS;
scalar_t__ RAND_MAX;
float const asin(int /*<<< orphan*/);
float clock();
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, float);
int /*<<< orphan*/ free(float *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, float *);
float *malloc(long const);
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ puts(char *);
float rand();
int /*<<< orphan*/ sqrt(float);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/);
int main(void) {
  const long n = 2000000;
  const float pi = 3.14159265358979323846264338327950288419716939937510;
  float *rand_number = malloc(n * sizeof(float));
  clock_t t1, t2, t2a, t2b, t3, t4;
  srand(time(0));
  t1 = clock();
  long i = 0;
  while (i < n) {
    float r1 = rand() / (float)RAND_MAX;
    float r2 = rand() / (float)RAND_MAX;
    if (r2 < asin(sqrt(r1)) / (pi / 2)) {
      rand_number[i] = r1;
      i += 1;
    }
  }
  t2 = clock();
  float tsum = 0;
  const long m = n * 2;
  i = 0;
  for (i = 0; i < m; i += 1) {
    float r1 = rand() / (float)RAND_MAX;
    float r2 = rand() / (float)RAND_MAX;
    tsum += r2 < asin(sqrt(r1)) / (pi / 2) ? r1 : 0;
  }
  t2a = clock();
  FILE *f = fopen("generated_rand_numbers", "w+");
  for (i = 0; i < n; i += 1)
    fprintf(f, "%f\n", rand_number[i]);
  fclose(f);
  t3 = clock();
  f = fopen("generated_rand_numbers", "r");
  float sum = 0;
  for (i = 0; i < n; i += 1) {
    float a;
    fscanf(f, "%f", &a);
    sum += a;
  }
  fclose(f);
  t4 = clock();
  free(rand_number);
  puts("io.c");
  printf("result = %f\n", sum / n);
  printf("generation took = %f s\n", (t2 - t1) / (float)CLOCKS_PER_SEC);
  printf("\"ternary\" result = %f\n", tsum / n);
  printf("\"ternary\" generation took = %f s\n",
         (t2a - t2) / (float)CLOCKS_PER_SEC);
  printf("o time = %f s\n", (t3 - t2b) / (float)CLOCKS_PER_SEC);
  printf("i time = %f s\n", (t4 - t3) / (float)CLOCKS_PER_SEC);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x1e8480,-0x10(%rbp)
movss  0xdfe(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    $0x7a1200,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x20(%rbp)
xor    %edi,%edi
call   10b0 <time@plt>
mov    %eax,%edi
call   1090 <srand@plt>
mov    $0x0,%al
call   1050 <clock@plt>
movss  %xmm0,-0x24(%rbp)
movq   $0x0,-0x40(%rbp)
cmpq   $0x1e8480,-0x40(%rbp)
jge    12d5 <main+0xf5>
mov    $0x0,%al
call   1100 <rand@plt>
mov    0x2d8d(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x44(%rbp)
mov    $0x0,%al
call   1100 <rand@plt>
mov    0x2d71(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x48(%rbp)
movss  -0x48(%rbp),%xmm0
movss  %xmm0,-0x74(%rbp)
movss  -0x44(%rbp),%xmm0
call   10f0 <sqrt@plt>
mov    %eax,%edi
call   10c0 <asin@plt>
movss  -0x74(%rbp),%xmm1
movss  0xd63(%rip),%xmm2
divss  %xmm2,%xmm0
ucomiss %xmm1,%xmm0
jbe    12d0 <main+0xf0>
movss  -0x44(%rbp),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    1237 <main+0x57>
mov    $0x0,%al
call   1050 <clock@plt>
movss  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4c(%rbp)
movq   $0x3d0900,-0x58(%rbp)
movq   $0x0,-0x40(%rbp)
movq   $0x0,-0x40(%rbp)
cmpq   $0x3d0900,-0x40(%rbp)
jge    13b8 <main+0x1d8>
mov    $0x0,%al
call   1100 <rand@plt>
mov    0x2cc3(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x5c(%rbp)
mov    $0x0,%al
call   1100 <rand@plt>
mov    0x2ca7(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x60(%rbp)
movss  -0x60(%rbp),%xmm0
movss  %xmm0,-0x78(%rbp)
movss  -0x5c(%rbp),%xmm0
call   10f0 <sqrt@plt>
mov    %eax,%edi
call   10c0 <asin@plt>
movss  -0x78(%rbp),%xmm1
movss  0xc99(%rip),%xmm2
divss  %xmm2,%xmm0
ucomiss %xmm1,%xmm0
jbe    138b <main+0x1ab>
movss  -0x5c(%rbp),%xmm0
movss  %xmm0,-0x7c(%rbp)
jmp    1398 <main+0x1b8>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x7c(%rbp)
jmp    1398 <main+0x1b8>
movss  -0x7c(%rbp),%xmm0
addss  -0x4c(%rbp),%xmm0
movss  %xmm0,-0x4c(%rbp)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    1301 <main+0x121>
mov    $0x0,%al
call   1050 <clock@plt>
movss  %xmm0,-0x2c(%rbp)
lea    0xc41(%rip),%rdi
lea    0xc51(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x68(%rbp)
movq   $0x0,-0x40(%rbp)
cmpq   $0x1e8480,-0x40(%rbp)
jge    141f <main+0x23f>
mov    -0x68(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
lea    0xc3a(%rip),%rsi
call   10a0 <fprintf@plt>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    13e3 <main+0x203>
mov    -0x68(%rbp),%rdi
call   1060 <fclose@plt>
mov    $0x0,%al
call   1050 <clock@plt>
movss  %xmm0,-0x34(%rbp)
lea    0xbd1(%rip),%rdi
lea    0xbe4(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x68(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x6c(%rbp)
movq   $0x0,-0x40(%rbp)
cmpq   $0x1e8480,-0x40(%rbp)
jge    149d <main+0x2bd>
mov    -0x68(%rbp),%rdi
lea    0xbb4(%rip),%rsi
lea    -0x70(%rbp),%rdx
call   1080 <fscanf@plt>
movss  -0x70(%rbp),%xmm0
addss  -0x6c(%rbp),%xmm0
movss  %xmm0,-0x6c(%rbp)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    145b <main+0x27b>
mov    -0x68(%rbp),%rdi
call   1060 <fclose@plt>
mov    $0x0,%al
call   1050 <clock@plt>
movss  %xmm0,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
lea    0xb69(%rip),%rdi
call   1040 <puts@plt>
movss  -0x6c(%rbp),%xmm0
movss  0xb30(%rip),%xmm1
divss  %xmm1,%xmm0
lea    0xb5b(%rip),%rdi
call   1070 <printf@plt>
movss  -0x28(%rbp),%xmm0
subss  -0x24(%rbp),%xmm0
mov    0x2af3(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
lea    0xb4c(%rip),%rdi
call   1070 <printf@plt>
movss  -0x4c(%rbp),%xmm0
movss  0xaed(%rip),%xmm1
divss  %xmm1,%xmm0
lea    0xb0e(%rip),%rdi
call   1070 <printf@plt>
movss  -0x2c(%rbp),%xmm0
subss  -0x28(%rbp),%xmm0
mov    0x2ab0(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
lea    0xaff(%rip),%rdi
call   1070 <printf@plt>
movss  -0x34(%rbp),%xmm0
subss  -0x30(%rbp),%xmm0
mov    0x2a8a(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
lea    0xafb(%rip),%rdi
call   1070 <printf@plt>
movss  -0x38(%rbp),%xmm0
subss  -0x34(%rbp),%xmm0
mov    0x2a64(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
lea    0xae4(%rip),%rdi
call   1070 <printf@plt>
mov    0x2a30(%rip),%rax
mov    (%rax),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x60,%rsp
mov    $0x7a1200,%edi
call   10d0 <malloc@plt>
mov    %rax,%r14
xor    %edi,%edi
call   10b0 <time@plt>
mov    %eax,%edi
call   1090 <srand@plt>
xor    %eax,%eax
call   1050 <clock@plt>
movss  %xmm0,0x28(%rsp)
mov    0x2dc4(%rip),%r15
xor    %ebx,%ebx
jmp    1229 <main+0x49>
cmp    $0x1e8480,%rbx
jge    129c <main+0xbc>
xor    %eax,%eax
call   1100 <rand@plt>
xorps  %xmm1,%xmm1
cvtsi2ssq (%r15),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1100 <rand@plt>
movaps %xmm0,0x40(%rsp)
movaps 0xdab(%rip),%xmm0
cvtsi2ssq (%r15),%xmm0
movaps %xmm0,0x30(%rsp)
movss  0x10(%rsp),%xmm0
call   10f0 <sqrt@plt>
mov    %eax,%edi
call   10c0 <asin@plt>
movaps 0x40(%rsp),%xmm1
unpcklps %xmm0,%xmm1
divps  0x30(%rsp),%xmm1
movaps %xmm1,%xmm0
shufps $0x55,%xmm1,%xmm0
ucomiss %xmm1,%xmm0
jbe    1220 <main+0x40>
movss  0x10(%rsp),%xmm0
movss  %xmm0,(%r14,%rbx,4)
add    $0x1,%rbx
jmp    1220 <main+0x40>
xor    %eax,%eax
call   1050 <clock@plt>
movss  %xmm0,0xc(%rsp)
xorps  %xmm1,%xmm1
mov    $0x3d0900,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movss  %xmm1,0x40(%rsp)
xor    %eax,%eax
call   1100 <rand@plt>
xorps  %xmm1,%xmm1
cvtsi2ssq (%r15),%xmm1
divss  %xmm1,%xmm0
movaps %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1100 <rand@plt>
movaps %xmm0,0x30(%rsp)
movaps 0xd0f(%rip),%xmm0
cvtsi2ssq (%r15),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0x10(%rsp),%xmm0
call   10f0 <sqrt@plt>
mov    %eax,%edi
call   10c0 <asin@plt>
movss  0x40(%rsp),%xmm1
movaps 0x30(%rsp),%xmm2
unpcklps %xmm0,%xmm2
divps  0x50(%rsp),%xmm2
movaps %xmm2,%xmm0
shufps $0x55,%xmm2,%xmm0
cmpltss %xmm0,%xmm2
andps  0x10(%rsp),%xmm2
addss  %xmm2,%xmm1
add    $0xffffffffffffffff,%rbx
jne    12c0 <main+0xe0>
movss  %xmm1,0x40(%rsp)
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <clock@plt>
movss  %xmm0,0x30(%rsp)
lea    0xcc2(%rip),%rdi
lea    0xcd2(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,%r12
lea    0xce3(%rip),%r15
nopl   0x0(%rax)
movss  (%r14,%rbx,4),%xmm0
mov    %r12,%rdi
mov    %r15,%rsi
call   10a0 <fprintf@plt>
add    $0x1,%rbx
cmp    $0x1e8480,%rbx
jne    1370 <main+0x190>
mov    %r12,%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
call   1050 <clock@plt>
movss  %xmm0,0x50(%rsp)
lea    0xc6e(%rip),%rdi
lea    0xc81(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,%r13
xorps  %xmm0,%xmm0
movss  %xmm0,0x10(%rsp)
mov    $0x1e8480,%ebx
lea    0xc66(%rip),%r15
lea    0x2c(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r13,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1080 <fscanf@plt>
movss  0x10(%rsp),%xmm0
addss  0x2c(%rsp),%xmm0
movss  %xmm0,0x10(%rsp)
add    $0xffffffffffffffff,%rbx
jne    13e0 <main+0x200>
mov    %r13,%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
call   1050 <clock@plt>
movss  %xmm0,0x24(%rsp)
mov    %r14,%rdi
call   1030 <free@plt>
lea    0xc0d(%rip),%rdi
call   1040 <puts@plt>
movss  0x10(%rsp),%xmm0
divss  0xbd3(%rip),%xmm0
lea    0xc02(%rip),%rdi
call   1070 <printf@plt>
movss  0xc(%rsp),%xmm0
subss  0x28(%rsp),%xmm0
mov    0x2b8c(%rip),%rbx
xorps  %xmm1,%xmm1
cvtsi2ssq (%rbx),%xmm1
divss  %xmm1,%xmm0
lea    0xbee(%rip),%rdi
call   1070 <printf@plt>
movss  0x40(%rsp),%xmm0
divss  0xb8e(%rip),%xmm0
lea    0xbb3(%rip),%rdi
call   1070 <printf@plt>
movss  0x30(%rsp),%xmm0
subss  0xc(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2ssq (%rbx),%xmm1
divss  %xmm1,%xmm0
lea    0xba6(%rip),%rdi
call   1070 <printf@plt>
lea    0xbbc(%rip),%rdi
movss  0xb53(%rip),%xmm0
call   1070 <printf@plt>
movss  0x24(%rsp),%xmm1
subss  0x50(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2ssq (%rbx),%xmm0
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
lea    0xb9c(%rip),%rdi
call   1070 <printf@plt>
mov    0x2adc(%rip),%rax
mov    (%rax),%eax
add    $0x60,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
@.str = [23 x i8] c"generated_rand_numbers\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [4 x i8] c"%f\0A\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [5 x i8] c"io.c\00"
@.str.6 = [13 x i8] c"result = %f\0A\00"
@.str.7 = [24 x i8] c"generation took = %f s\0A\00"
@CLOCKS_PER_SEC = global i64 0
@.str.8 = [23 x i8] c"\22ternary\22 result = %f\0A\00"
@.str.9 = [34 x i8] c"\22ternary\22 generation took = %f s\0A\00"
@.str.10 = [15 x i8] c"o time = %f s\0A\00"
@.str.11 = [15 x i8] c"i time = %f s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca float
%4 = alloca float*
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca i64
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca i64
%16 = alloca float
%17 = alloca float
%18 = alloca i32*
%19 = alloca float
%20 = alloca float
store i32 0, i32* %1
store i64 2000000, i64* %2
store float 0x400921FB60000000, float* %3
%21 = call float* @malloc(i64 8000000)
store float* %21, float** %4
%22 = call i32 @time(i32 0)
%23 = call i32 @srand(i32 %22)
%24 = call float (...) @clock()
store float %24, float* %5
store i64 0, i64* %11
br label %25
25: ; preds = %50, %0
%26 = load i64, i64* %11
%27 = icmp slt i64 %26, 2000000
br i1 %27, label %28, label %51
28: ; preds = %25
%29 = call float (...) @rand()
%30 = load i64, i64* @RAND_MAX
%31 = sitofp i64 %30 to float
%32 = fdiv float %29, %31
store float %32, float* %12
%33 = call float (...) @rand()
%34 = load i64, i64* @RAND_MAX
%35 = sitofp i64 %34 to float
%36 = fdiv float %33, %35
store float %36, float* %13
%37 = load float, float* %13
%38 = load float, float* %12
%39 = call i32 @sqrt(float %38)
%40 = call float @asin(i32 %39)
%41 = fdiv float %40, 0x3FF921FB60000000
%42 = fcmp olt float %37, %41
br i1 %42, label %43, label %50
43: ; preds = %28
%44 = load float, float* %12
%45 = load float*, float** %4
%46 = load i64, i64* %11
%47 = getelementptr inbounds float, float* %45, i64 %46
store float %44, float* %47
%48 = load i64, i64* %11
%49 = add nsw i64 %48, 1
store i64 %49, i64* %11
br label %50
50: ; preds = %43, %28
br label %25
51: ; preds = %25
%52 = call float (...) @clock()
store float %52, float* %6
store float 0.000000e+00, float* %14
store i64 4000000, i64* %15
store i64 0, i64* %11
store i64 0, i64* %11
br label %53
53: ; preds = %78, %51
%54 = load i64, i64* %11
%55 = icmp slt i64 %54, 4000000
br i1 %55, label %56, label %81
56: ; preds = %53
%57 = call float (...) @rand()
%58 = load i64, i64* @RAND_MAX
%59 = sitofp i64 %58 to float
%60 = fdiv float %57, %59
store float %60, float* %16
%61 = call float (...) @rand()
%62 = load i64, i64* @RAND_MAX
%63 = sitofp i64 %62 to float
%64 = fdiv float %61, %63
store float %64, float* %17
%65 = load float, float* %17
%66 = load float, float* %16
%67 = call i32 @sqrt(float %66)
%68 = call float @asin(i32 %67)
%69 = fdiv float %68, 0x3FF921FB60000000
%70 = fcmp olt float %65, %69
br i1 %70, label %71, label %73
71: ; preds = %56
%72 = load float, float* %16
br label %74
73: ; preds = %56
br label %74
74: ; preds = %73, %71
%75 = phi float [ %72, %71 ], [ 0.000000e+00, %73 ]
%76 = load float, float* %14
%77 = fadd float %76, %75
store float %77, float* %14
br label %78
78: ; preds = %74
%79 = load i64, i64* %11
%80 = add nsw i64 %79, 1
store i64 %80, i64* %11
br label %53
81: ; preds = %53
%82 = call float (...) @clock()
store float %82, float* %7
%83 = call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %83, i32** %18
store i64 0, i64* %11
br label %84
84: ; preds = %94, %81
%85 = load i64, i64* %11
%86 = icmp slt i64 %85, 2000000
br i1 %86, label %87, label %97
87: ; preds = %84
%88 = load i32*, i32** %18
%89 = load float*, float** %4
%90 = load i64, i64* %11
%91 = getelementptr inbounds float, float* %89, i64 %90
%92 = load float, float* %91
%93 = call i32 @fprintf(i32* %88, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), float %92)
br label %94
94: ; preds = %87
%95 = load i64, i64* %11
%96 = add nsw i64 %95, 1
store i64 %96, i64* %11
br label %84
97: ; preds = %84
%98 = load i32*, i32** %18
%99 = call i32 @fclose(i32* %98)
%100 = call float (...) @clock()
store float %100, float* %9
%101 = call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %101, i32** %18
store float 0.000000e+00, float* %19
store i64 0, i64* %11
br label %102
102: ; preds = %111, %97
%103 = load i64, i64* %11
%104 = icmp slt i64 %103, 2000000
br i1 %104, label %105, label %114
105: ; preds = %102
%106 = load i32*, i32** %18
%107 = call i32 @fscanf(i32* %106, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %20)
%108 = load float, float* %20
%109 = load float, float* %19
%110 = fadd float %109, %108
store float %110, float* %19
br label %111
111: ; preds = %105
%112 = load i64, i64* %11
%113 = add nsw i64 %112, 1
store i64 %113, i64* %11
br label %102
114: ; preds = %102
%115 = load i32*, i32** %18
%116 = call i32 @fclose(i32* %115)
%117 = call float (...) @clock()
store float %117, float* %10
%118 = load float*, float** %4
%119 = call i32 @free(float* %118)
%120 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%121 = load float, float* %19
%122 = fdiv float %121, 2.000000e+06
%123 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), float %122)
%124 = load float, float* %6
%125 = load float, float* %5
%126 = fsub float %124, %125
%127 = load i64, i64* @CLOCKS_PER_SEC
%128 = sitofp i64 %127 to float
%129 = fdiv float %126, %128
%130 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), float %129)
%131 = load float, float* %14
%132 = fdiv float %131, 2.000000e+06
%133 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), float %132)
%134 = load float, float* %7
%135 = load float, float* %6
%136 = fsub float %134, %135
%137 = load i64, i64* @CLOCKS_PER_SEC
%138 = sitofp i64 %137 to float
%139 = fdiv float %136, %138
%140 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), float %139)
%141 = load float, float* %9
%142 = load float, float* %8
%143 = fsub float %141, %142
%144 = load i64, i64* @CLOCKS_PER_SEC
%145 = sitofp i64 %144 to float
%146 = fdiv float %143, %145
%147 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), float %146)
%148 = load float, float* %10
%149 = load float, float* %9
%150 = fsub float %148, %149
%151 = load i64, i64* @CLOCKS_PER_SEC
%152 = sitofp i64 %151 to float
%153 = fdiv float %150, %152
%154 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0), float %153)
%155 = load i32, i32* @EXIT_SUCCESS
ret i32 %155
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
@.str = [23 x i8] c"generated_rand_numbers\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [4 x i8] c"%f\0A\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [5 x i8] c"io.c\00"
@.str.6 = [13 x i8] c"result = %f\0A\00"
@.str.7 = [24 x i8] c"generation took = %f s\0A\00"
@CLOCKS_PER_SEC = global i64 0
@.str.8 = [23 x i8] c"\22ternary\22 result = %f\0A\00"
@.str.9 = [34 x i8] c"\22ternary\22 generation took = %f s\0A\00"
@.str.10 = [15 x i8] c"o time = %f s\0A\00"
@.str.11 = [15 x i8] c"i time = %f s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca float
%2 = tail call float* @malloc(i64 8000000)
%3 = tail call i32 @time(i32 0)
%4 = tail call i32 @srand(i32 %3)
%5 = tail call float (...) @clock()
br label %6
6: ; preds = %0, %27
%7 = phi i64 [ 0, %0 ], [ %28, %27 ]
%8 = tail call float (...) @rand()
%9 = load i64, i64* @RAND_MAX
%10 = sitofp i64 %9 to float
%11 = fdiv float %8, %10
%12 = tail call float (...) @rand()
%13 = load i64, i64* @RAND_MAX
%14 = sitofp i64 %13 to float
%15 = tail call i32 @sqrt(float %11)
%16 = tail call float @asin(i32 %15)
%17 = insertelement <2 x float> poison, float %12, i64 0
%18 = insertelement <2 x float> %17, float %16, i64 1
%19 = insertelement <2 x float> <float poison, float 0x3FF921FB60000000>, float %14, i64 0
%20 = fdiv <2 x float> %18, %19
%21 = extractelement <2 x float> %20, i64 0
%22 = extractelement <2 x float> %20, i64 1
%23 = fcmp olt float %21, %22
br i1 %23, label %24, label %27
24: ; preds = %6
%25 = getelementptr inbounds float, float* %2, i64 %7
store float %11, float* %25
%26 = add nsw i64 %7, 1
br label %27
27: ; preds = %24, %6
%28 = phi i64 [ %26, %24 ], [ %7, %6 ]
%29 = icmp slt i64 %28, 2000000
br i1 %29, label %6, label %30
30: ; preds = %27
%31 = tail call float (...) @clock()
br label %32
32: ; preds = %30, %32
%33 = phi i64 [ 0, %30 ], [ %53, %32 ]
%34 = phi float [ 0.000000e+00, %30 ], [ %52, %32 ]
%35 = tail call float (...) @rand()
%36 = load i64, i64* @RAND_MAX
%37 = sitofp i64 %36 to float
%38 = fdiv float %35, %37
%39 = tail call float (...) @rand()
%40 = load i64, i64* @RAND_MAX
%41 = sitofp i64 %40 to float
%42 = tail call i32 @sqrt(float %38)
%43 = tail call float @asin(i32 %42)
%44 = insertelement <2 x float> poison, float %39, i64 0
%45 = insertelement <2 x float> %44, float %43, i64 1
%46 = insertelement <2 x float> <float poison, float 0x3FF921FB60000000>, float %41, i64 0
%47 = fdiv <2 x float> %45, %46
%48 = extractelement <2 x float> %47, i64 0
%49 = extractelement <2 x float> %47, i64 1
%50 = fcmp olt float %48, %49
%51 = select i1 %50, float %38, float 0.000000e+00
%52 = fadd float %34, %51
%53 = add nuw nsw i64 %33, 1
%54 = icmp eq i64 %53, 4000000
br i1 %54, label %55, label %32
55: ; preds = %32
%56 = tail call float (...) @clock()
%57 = tail call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %58
58: ; preds = %55, %58
%59 = phi i64 [ 0, %55 ], [ %63, %58 ]
%60 = getelementptr inbounds float, float* %2, i64 %59
%61 = load float, float* %60
%62 = tail call i32 @fprintf(i32* %57, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), float %61)
%63 = add nuw nsw i64 %59, 1
%64 = icmp eq i64 %63, 2000000
br i1 %64, label %65, label %58
65: ; preds = %58
%66 = tail call i32 @fclose(i32* %57)
%67 = tail call float (...) @clock()
%68 = tail call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%69 = bitcast float* %1 to i8*
br label %70
70: ; preds = %65, %70
%71 = phi float [ 0.000000e+00, %65 ], [ %75, %70 ]
%72 = phi i64 [ 0, %65 ], [ %76, %70 ]
%73 = call i32 @fscanf(i32* %68, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %1)
%74 = load float, float* %1
%75 = fadd float %71, %74
%76 = add nuw nsw i64 %72, 1
%77 = icmp eq i64 %76, 2000000
br i1 %77, label %78, label %70
78: ; preds = %70
%79 = call i32 @fclose(i32* %68)
%80 = call float (...) @clock()
%81 = call i32 @free(float* %2)
%82 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%83 = fdiv float %75, 2.000000e+06
%84 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), float %83)
%85 = fsub float %31, %5
%86 = load i64, i64* @CLOCKS_PER_SEC
%87 = sitofp i64 %86 to float
%88 = fdiv float %85, %87
%89 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), float %88)
%90 = fdiv float %52, 2.000000e+06
%91 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), float %90)
%92 = fsub float %56, %31
%93 = load i64, i64* @CLOCKS_PER_SEC
%94 = sitofp i64 %93 to float
%95 = fdiv float %92, %94
%96 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), float %95)
%97 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), float 0x7FF8000000000000)
%98 = fsub float %80, %67
%99 = load i64, i64* @CLOCKS_PER_SEC
%100 = sitofp i64 %99 to float
%101 = fdiv float %98, %100
%102 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0), float %101)
%103 = load i32, i32* @EXIT_SUCCESS
ret i32 %103
}