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

/* Variables and functions */
double RAND_MAX;
double exp(double);
double factorial(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ floor(double);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, double);
double pow(double, int);
double rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  double H_n[100 + 1] = {0}, B[1000] = {0}, P_n[100 + 1] = {0}, soma = 0,
                   avg = 0;
  int i, k, r, j;
  FILE *graf, *graf2;
  graf = fopen("graf6.dat", "w");
  graf2 = fopen("graf7.dat", "w");
  srand(time(NULL));
  for (i = 0; i < 1000; i++) {
    for (j = 0; j < 100; j++) {
      r = (int)floor(rand() * 1.0 * 1000 / RAND_MAX);
      B[r]++;
    }
    for (k = 0; k <= 100; k++) {
      for (j = 0; j < 1000; j++) {
        if (B[j] == k) {
          H_n[k]++;
        }
      }
    }
    for (j = 0; j < 1000; j++) {
      B[j] = 0;
    }
  }
  for (j = 0; j < 100; j++) {
    soma += H_n[j];
  }
  for (j = 0; j <= 100; j++) {
    P_n[j] = H_n[j] * 1.0 / soma;
    avg += j * P_n[j];
  }
  for (j = 0; j < 100 / 10; j++) {
    fprintf(graf, "%d\t %f\n", j, P_n[j]);
    fprintf(graf2, "%d\t %f\n", j,
            pow(avg, j) * 1.0 / factorial(j) * exp(-avg));
  }
  fclose(graf);
  fclose(graf2);
  system("gnuplot -persist plot.gnu");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x25f0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x330(%rbp),%rdi
xor    %esi,%esi
mov    $0x328,%edx
call   1060 <memset@plt>
lea    -0x2270(%rbp),%rdi
xor    %esi,%esi
mov    $0x1f40,%edx
call   1060 <memset@plt>
lea    -0x25a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x328,%edx
call   1060 <memset@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x25a8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x25b0(%rbp)
ff
lea    0xde8(%rip),%rdi
lea    0xdeb(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x25c8(%rbp)
lea    0xdda(%rip),%rdi
lea    0xdd1(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x25d0(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
movl   $0x0,-0x25b4(%rbp)
cmpl   $0x3e8,-0x25b4(%rbp)
jge    1406 <main+0x246>
movl   $0x0,-0x25c0(%rbp)
cmpl   $0x64,-0x25c0(%rbp)
jge    1300 <main+0x140>
mov    $0x0,%al
call   10e0 <rand@plt>
movsd  0xd5b(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd57(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    0x2d2c(%rip),%rax
divsd  (%rax),%xmm0
call   10d0 <floor@plt>
mov    %eax,-0x25bc(%rbp)
movslq -0x25bc(%rbp),%rax
movsd  0xd26(%rip),%xmm0
addsd  -0x2270(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x2270(%rbp,%rax,8)
ff ff
mov    -0x25c0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x25c0(%rbp)
jmp    1289 <main+0xc9>
movl   $0x0,-0x25b8(%rbp)
cmpl   $0x64,-0x25b8(%rbp)
jg     13ac <main+0x1ec>
movl   $0x0,-0x25c0(%rbp)
cmpl   $0x3e8,-0x25c0(%rbp)
jge    1393 <main+0x1d3>
movslq -0x25c0(%rbp),%rax
movsd  -0x2270(%rbp,%rax,8),%xmm0
ff ff
cvtsi2sdl -0x25b8(%rbp),%xmm1
ff
ucomisd %xmm1,%xmm0
jne    137a <main+0x1ba>
jp     137a <main+0x1ba>
movslq -0x25b8(%rbp),%rax
movsd  0xc98(%rip),%xmm0
addsd  -0x330(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x330(%rbp,%rax,8)
ff ff
jmp    137f <main+0x1bf>
mov    -0x25c0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x25c0(%rbp)
jmp    1321 <main+0x161>
jmp    1398 <main+0x1d8>
mov    -0x25b8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x25b8(%rbp)
jmp    130a <main+0x14a>
movl   $0x0,-0x25c0(%rbp)
cmpl   $0x3e8,-0x25c0(%rbp)
jge    13ed <main+0x22d>
movslq -0x25c0(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x2270(%rbp,%rax,8)
ff ff
mov    -0x25c0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x25c0(%rbp)
jmp    13b6 <main+0x1f6>
jmp    13f2 <main+0x232>
mov    -0x25b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x25b4(%rbp)
jmp    126f <main+0xaf>
movl   $0x0,-0x25c0(%rbp)
cmpl   $0x64,-0x25c0(%rbp)
jge    1451 <main+0x291>
movslq -0x25c0(%rbp),%rax
movsd  -0x330(%rbp,%rax,8),%xmm0
ff ff
addsd  -0x25a8(%rbp),%xmm0
ff
movsd  %xmm0,-0x25a8(%rbp)
ff
mov    -0x25c0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x25c0(%rbp)
jmp    1410 <main+0x250>
movl   $0x0,-0x25c0(%rbp)
cmpl   $0x64,-0x25c0(%rbp)
jg     14dc <main+0x31c>
movslq -0x25c0(%rbp),%rax
movsd  0xb89(%rip),%xmm0
mulsd  -0x330(%rbp,%rax,8),%xmm0
ff ff
divsd  -0x25a8(%rbp),%xmm0
ff
movslq -0x25c0(%rbp),%rax
movsd  %xmm0,-0x25a0(%rbp,%rax,8)
ff ff
cvtsi2sdl -0x25c0(%rbp),%xmm0
ff
movslq -0x25c0(%rbp),%rax
movsd  -0x25a0(%rbp,%rax,8),%xmm2
ff ff
movsd  -0x25b0(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x25b0(%rbp)
ff
mov    -0x25c0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x25c0(%rbp)
jmp    145b <main+0x29b>
movl   $0x0,-0x25c0(%rbp)
cmpl   $0xa,-0x25c0(%rbp)
jge    15df <main+0x41f>
mov    -0x25c8(%rbp),%rdi
mov    -0x25c0(%rbp),%edx
movslq -0x25c0(%rbp),%rax
movsd  -0x25a0(%rbp,%rax,8),%xmm0
ff ff
lea    0xb0f(%rip),%rsi
call   1080 <fprintf@plt>
mov    -0x25d0(%rbp),%rax
mov    %rax,-0x25e8(%rbp)
mov    -0x25c0(%rbp),%eax
mov    %eax,-0x25dc(%rbp)
movsd  -0x25b0(%rbp),%xmm0
ff
mov    -0x25c0(%rbp),%edi
call   10c0 <pow@plt>
movsd  0xaaf(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x25f0(%rbp)
ff
mov    -0x25c0(%rbp),%edi
call   1030 <factorial@plt>
movaps %xmm0,%xmm1
movsd  -0x25f0(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x25d8(%rbp)
ff
movsd  -0x25b0(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   10a0 <exp@plt>
mov    -0x25e8(%rbp),%rdi
mov    -0x25dc(%rbp),%edx
movaps %xmm0,%xmm1
movsd  -0x25d8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
lea    0xa60(%rip),%rsi
call   1080 <fprintf@plt>
mov    -0x25c0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x25c0(%rbp)
jmp    14e6 <main+0x326>
mov    -0x25c8(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x25d0(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xa30(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
add    $0x25f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x25d8,%rsp
lea    0x30(%rsp),%rdi
mov    $0x328,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    0x690(%rsp),%r15
mov    $0x1f40,%edx
mov    %r15,%rdi
xor    %esi,%esi
call   1060 <memset@plt>
lea    0x360(%rsp),%rdi
mov    $0x328,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    0xe0c(%rip),%rdi
lea    0xe0f(%rip),%rbx
mov    %rbx,%rsi
call   10b0 <fopen@plt>
mov    %rax,%r14
lea    0xdff(%rip),%rdi
mov    %rbx,%rsi
call   10b0 <fopen@plt>
mov    %rax,%r12
xor    %edi,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
mov    0x2d9b(%rip),%rbx
xor    %r13d,%r13d
jmp    1280 <main+0xc0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x1f40,%edx
mov    %r15,%rdi
xor    %esi,%esi
call   1060 <memset@plt>
add    $0x1,%r13d
cmp    $0x3e8,%r13d
je     1351 <main+0x191>
mov    $0x64,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   10e0 <rand@plt>
mulsd  0xd61(%rip),%xmm0
divsd  (%rbx),%xmm0
call   10d0 <floor@plt>
cltq
movsd  0x690(%rsp,%rax,8),%xmm0
addsd  0xd4d(%rip),%xmm0
movsd  %xmm0,0x690(%rsp,%rax,8)
add    $0xffffffff,%ebp
jne    1290 <main+0xd0>
xor    %eax,%eax
movsd  0xd35(%rip),%xmm2
jmp    12ee <main+0x12e>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rax
cmp    $0x65,%rax
je     1260 <main+0xa0>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mov    $0x1,%ecx
jmp    130d <main+0x14d>
nopl   0x0(%rax)
add    $0x2,%rcx
cmp    $0x3e9,%rcx
je     12e0 <main+0x120>
movsd  0x688(%rsp,%rcx,8),%xmm1
ucomisd %xmm0,%xmm1
jne    132e <main+0x16e>
jp     132e <main+0x16e>
movsd  0x30(%rsp,%rax,8),%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,0x30(%rsp,%rax,8)
movsd  0x690(%rsp,%rcx,8),%xmm1
ucomisd %xmm0,%xmm1
jne    1300 <main+0x140>
jp     1300 <main+0x140>
movsd  0x30(%rsp,%rax,8),%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,0x30(%rsp,%rax,8)
jmp    1300 <main+0x140>
xorpd  %xmm0,%xmm0
mov    $0x4,%eax
nopw   0x0(%rax,%rax,1)
addsd  0x10(%rsp,%rax,8),%xmm0
addsd  0x18(%rsp,%rax,8),%xmm0
addsd  0x20(%rsp,%rax,8),%xmm0
addsd  0x28(%rsp,%rax,8),%xmm0
addsd  0x30(%rsp,%rax,8),%xmm0
add    $0x5,%rax
cmp    $0x68,%rax
jne    1360 <main+0x1a0>
xorpd  %xmm1,%xmm1
xor    %eax,%eax
xchg   %ax,%ax
movsd  0x30(%rsp,%rax,8),%xmm2
divsd  %xmm0,%xmm2
movsd  %xmm2,0x360(%rsp,%rax,8)
xorps  %xmm3,%xmm3
cvtsi2sd %eax,%xmm3
mulsd  %xmm2,%xmm3
addsd  %xmm1,%xmm3
lea    0x1(%rax),%rcx
cmp    $0x65,%rcx
je     13e7 <main+0x227>
movsd  0x38(%rsp,%rax,8),%xmm2
divsd  %xmm0,%xmm2
xorps  %xmm1,%xmm1
cvtsi2sd %ecx,%xmm1
movsd  %xmm2,0x368(%rsp,%rax,8)
mulsd  %xmm2,%xmm1
addsd  %xmm3,%xmm1
add    $0x1,%rcx
mov    %rcx,%rax
jmp    1390 <main+0x1d0>
movapd 0xc21(%rip),%xmm0
movapd %xmm3,0x20(%rsp)
xorpd  %xmm3,%xmm0
movapd %xmm0,0x10(%rsp)
xor    %ebx,%ebx
lea    0xc2e(%rip),%r15
nopl   0x0(%rax,%rax,1)
movsd  0x360(%rsp,%rbx,8),%xmm0
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1080 <fprintf@plt>
movapd 0x20(%rsp),%xmm0
mov    %ebx,%edi
call   10c0 <pow@plt>
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%edi
call   1030 <factorial@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movapd 0x10(%rsp),%xmm0
call   10a0 <exp@plt>
mulsd  0x8(%rsp),%xmm0
mov    %r12,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1080 <fprintf@plt>
add    $0x1,%rbx
cmp    $0xa,%rbx
jne    1410 <main+0x250>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    %r12,%rdi
call   1040 <fclose@plt>
lea    0xbaf(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
add    $0x25d8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"graf6.dat\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [10 x i8] c"graf7.dat\00"
@RAND_MAX = global double 0.000000e+00
@.str.3 = [8 x i8] c"%d\09 %f\0A\00"
@.str.4 = [26 x i8] c"gnuplot -persist plot.gnu\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [101 x double]
%3 = alloca [1000 x double]
%4 = alloca [101 x double]
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32*
store i32 0, i32* %1
%13 = bitcast [101 x double]* %2 to i8*
%14 = bitcast [1000 x double]* %3 to i8*
%15 = bitcast [101 x double]* %4 to i8*
store double 0.000000e+00, double* %5
store double 0.000000e+00, double* %6
%16 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %16, i32** %11
%17 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %17, i32** %12
%18 = call i32 @time(i32* null)
%19 = call i32 @srand(i32 %18)
store i32 0, i32* %7
br label %20
20: ; preds = %85, %0
%21 = load i32, i32* %7
%22 = icmp slt i32 %21, 1000
br i1 %22, label %23, label %88
23: ; preds = %20
store i32 0, i32* %10
br label %24
24: ; preds = %40, %23
%25 = load i32, i32* %10
%26 = icmp slt i32 %25, 100
br i1 %26, label %27, label %43
27: ; preds = %24
%28 = call double (...) @rand()
%29 = fmul double %28, 1.000000e+00
%30 = fmul double %29, 1.000000e+03
%31 = load double, double* @RAND_MAX
%32 = fdiv double %30, %31
%33 = call i64 @floor(double %32)
%34 = trunc i64 %33 to i32
store i32 %34, i32* %9
%35 = load i32, i32* %9
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [1000 x double], [1000 x double]* %3, i64 0, i64 %36
%38 = load double, double* %37
%39 = fadd double %38, 1.000000e+00
store double %39, double* %37
br label %40
40: ; preds = %27
%41 = load i32, i32* %10
%42 = add nsw i32 %41, 1
store i32 %42, i32* %10
br label %24
43: ; preds = %24
store i32 0, i32* %8
br label %44
44: ; preds = %70, %43
%45 = load i32, i32* %8
%46 = icmp sle i32 %45, 100
br i1 %46, label %47, label %73
47: ; preds = %44
store i32 0, i32* %10
br label %48
48: ; preds = %66, %47
%49 = load i32, i32* %10
%50 = icmp slt i32 %49, 1000
br i1 %50, label %51, label %69
51: ; preds = %48
%52 = load i32, i32* %10
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [1000 x double], [1000 x double]* %3, i64 0, i64 %53
%55 = load double, double* %54
%56 = load i32, i32* %8
%57 = sitofp i32 %56 to double
%58 = fcmp oeq double %55, %57
br i1 %58, label %59, label %65
59: ; preds = %51
%60 = load i32, i32* %8
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [101 x double], [101 x double]* %2, i64 0, i64 %61
%63 = load double, double* %62
%64 = fadd double %63, 1.000000e+00
store double %64, double* %62
br label %65
65: ; preds = %59, %51
br label %66
66: ; preds = %65
%67 = load i32, i32* %10
%68 = add nsw i32 %67, 1
store i32 %68, i32* %10
br label %48
69: ; preds = %48
br label %70
70: ; preds = %69
%71 = load i32, i32* %8
%72 = add nsw i32 %71, 1
store i32 %72, i32* %8
br label %44
73: ; preds = %44
store i32 0, i32* %10
br label %74
74: ; preds = %81, %73
%75 = load i32, i32* %10
%76 = icmp slt i32 %75, 1000
br i1 %76, label %77, label %84
77: ; preds = %74
%78 = load i32, i32* %10
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [1000 x double], [1000 x double]* %3, i64 0, i64 %79
store double 0.000000e+00, double* %80
br label %81
81: ; preds = %77
%82 = load i32, i32* %10
%83 = add nsw i32 %82, 1
store i32 %83, i32* %10
br label %74
84: ; preds = %74
br label %85
85: ; preds = %84
%86 = load i32, i32* %7
%87 = add nsw i32 %86, 1
store i32 %87, i32* %7
br label %20
88: ; preds = %20
store i32 0, i32* %10
br label %89
89: ; preds = %99, %88
%90 = load i32, i32* %10
%91 = icmp slt i32 %90, 100
br i1 %91, label %92, label %102
92: ; preds = %89
%93 = load i32, i32* %10
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [101 x double], [101 x double]* %2, i64 0, i64 %94
%96 = load double, double* %95
%97 = load double, double* %5
%98 = fadd double %97, %96
store double %98, double* %5
br label %99
99: ; preds = %92
%100 = load i32, i32* %10
%101 = add nsw i32 %100, 1
store i32 %101, i32* %10
br label %89
102: ; preds = %89
store i32 0, i32* %10
br label %103
103: ; preds = %125, %102
%104 = load i32, i32* %10
%105 = icmp sle i32 %104, 100
br i1 %105, label %106, label %128
106: ; preds = %103
%107 = load i32, i32* %10
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds [101 x double], [101 x double]* %2, i64 0, i64 %108
%110 = load double, double* %109
%111 = fmul double %110, 1.000000e+00
%112 = load double, double* %5
%113 = fdiv double %111, %112
%114 = load i32, i32* %10
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds [101 x double], [101 x double]* %4, i64 0, i64 %115
store double %113, double* %116
%117 = load i32, i32* %10
%118 = sitofp i32 %117 to double
%119 = load i32, i32* %10
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [101 x double], [101 x double]* %4, i64 0, i64 %120
%122 = load double, double* %121
%123 = load double, double* %6
%124 = call double @llvm.fmuladd.f64(double %118, double %122, double %123)
store double %124, double* %6
br label %125
125: ; preds = %106
%126 = load i32, i32* %10
%127 = add nsw i32 %126, 1
store i32 %127, i32* %10
br label %103
128: ; preds = %103
store i32 0, i32* %10
br label %129
129: ; preds = %154, %128
%130 = load i32, i32* %10
%131 = icmp slt i32 %130, 10
br i1 %131, label %132, label %157
132: ; preds = %129
%133 = load i32*, i32** %11
%134 = load i32, i32* %10
%135 = load i32, i32* %10
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds [101 x double], [101 x double]* %4, i64 0, i64 %136
%138 = load double, double* %137
%139 = call i32 @fprintf(i32* %133, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %134, double %138)
%140 = load i32*, i32** %12
%141 = load i32, i32* %10
%142 = load double, double* %6
%143 = load i32, i32* %10
%144 = call double @pow(double %142, i32 %143)
%145 = fmul double %144, 1.000000e+00
%146 = load i32, i32* %10
%147 = call double @factorial(i32 %146)
%148 = fdiv double %145, %147
%149 = load double, double* %6
%150 = fneg double %149
%151 = call double @exp(double %150)
%152 = fmul double %148, %151
%153 = call i32 @fprintf(i32* %140, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %141, double %152)
br label %154
154: ; preds = %132
%155 = load i32, i32* %10
%156 = add nsw i32 %155, 1
store i32 %156, i32* %10
br label %129
157: ; preds = %129
%158 = load i32*, i32** %11
%159 = call i32 @fclose(i32* %158)
%160 = load i32*, i32** %12
%161 = call i32 @fclose(i32* %160)
%162 = call i32 @system(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"graf6.dat\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [10 x i8] c"graf7.dat\00"
@RAND_MAX = global double 0.000000e+00
@.str.3 = [8 x i8] c"%d\09 %f\0A\00"
@.str.4 = [26 x i8] c"gnuplot -persist plot.gnu\00"
define i32 @main() {
%1 = alloca [101 x double]
%2 = alloca [1000 x double]
%3 = bitcast [1000 x double]* %2 to i8*
%4 = alloca [101 x double]
%5 = bitcast [101 x double]* %1 to i8*
%6 = bitcast [101 x double]* %4 to i8*
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @time(i32* null)
%10 = tail call i32 @srand(i32 %9)
br label %11
11: ; preds = %0, %54
%12 = phi i32 [ 0, %0 ], [ %55, %54 ]
br label %13
13: ; preds = %11, %13
%14 = phi i32 [ 0, %11 ], [ %25, %13 ]
%15 = tail call double (...) @rand()
%16 = fmul double %15, 1.000000e+03
%17 = load double, double* @RAND_MAX
%18 = fdiv double %16, %17
%19 = tail call i64 @floor(double %18)
%20 = shl i64 %19, 32
%21 = ashr exact i64 %20, 32
%22 = getelementptr inbounds [1000 x double], [1000 x double]* %2, i64 0, i64 %21
%23 = load double, double* %22
%24 = fadd double %23, 1.000000e+00
store double %24, double* %22
%25 = add nuw nsw i32 %14, 1
%26 = icmp eq i32 %25, 100
br i1 %26, label %27, label %13
27: ; preds = %13, %51
%28 = phi i64 [ %52, %51 ], [ 0, %13 ]
%29 = trunc i64 %28 to i32
%30 = sitofp i32 %29 to double
%31 = getelementptr inbounds [101 x double], [101 x double]* %1, i64 0, i64 %28
br label %32
32: ; preds = %48, %27
%33 = phi i64 [ 0, %27 ], [ %49, %48 ]
%34 = getelementptr inbounds [1000 x double], [1000 x double]* %2, i64 0, i64 %33
%35 = load double, double* %34
%36 = fcmp oeq double %35, %30
br i1 %36, label %37, label %40
37: ; preds = %32
%38 = load double, double* %31
%39 = fadd double %38, 1.000000e+00
store double %39, double* %31
br label %40
40: ; preds = %32, %37
%41 = or i64 %33, 1
%42 = getelementptr inbounds [1000 x double], [1000 x double]* %2, i64 0, i64 %41
%43 = load double, double* %42
%44 = fcmp oeq double %43, %30
br i1 %44, label %45, label %48
45: ; preds = %40
%46 = load double, double* %31
%47 = fadd double %46, 1.000000e+00
store double %47, double* %31
br label %48
48: ; preds = %45, %40
%49 = add nuw nsw i64 %33, 2
%50 = icmp eq i64 %49, 1000
br i1 %50, label %51, label %32
51: ; preds = %48
%52 = add nuw nsw i64 %28, 1
%53 = icmp eq i64 %52, 101
br i1 %53, label %54, label %27
54: ; preds = %51
%55 = add nuw nsw i32 %12, 1
%56 = icmp eq i32 %55, 1000
br i1 %56, label %57, label %11
57: ; preds = %54, %57
%58 = phi i64 [ %79, %57 ], [ 0, %54 ]
%59 = phi double [ %78, %57 ], [ 0.000000e+00, %54 ]
%60 = getelementptr inbounds [101 x double], [101 x double]* %1, i64 0, i64 %58
%61 = load double, double* %60
%62 = fadd double %59, %61
%63 = add nuw nsw i64 %58, 1
%64 = getelementptr inbounds [101 x double], [101 x double]* %1, i64 0, i64 %63
%65 = load double, double* %64
%66 = fadd double %62, %65
%67 = add nuw nsw i64 %58, 2
%68 = getelementptr inbounds [101 x double], [101 x double]* %1, i64 0, i64 %67
%69 = load double, double* %68
%70 = fadd double %66, %69
%71 = add nuw nsw i64 %58, 3
%72 = getelementptr inbounds [101 x double], [101 x double]* %1, i64 0, i64 %71
%73 = load double, double* %72
%74 = fadd double %70, %73
%75 = add nuw nsw i64 %58, 4
%76 = getelementptr inbounds [101 x double], [101 x double]* %1, i64 0, i64 %75
%77 = load double, double* %76
%78 = fadd double %74, %77
%79 = add nuw nsw i64 %58, 5
%80 = icmp eq i64 %79, 100
br i1 %80, label %83, label %57
81: ; preds = %83
%82 = fneg double %92
br label %104
83: ; preds = %57, %95
%84 = phi i64 [ %103, %95 ], [ 0, %57 ]
%85 = phi double [ %102, %95 ], [ 0.000000e+00, %57 ]
%86 = getelementptr inbounds [101 x double], [101 x double]* %1, i64 0, i64 %84
%87 = load double, double* %86
%88 = fdiv double %87, %78
%89 = getelementptr inbounds [101 x double], [101 x double]* %4, i64 0, i64 %84
store double %88, double* %89
%90 = trunc i64 %84 to i32
%91 = sitofp i32 %90 to double
%92 = tail call double @llvm.fmuladd.f64(double %91, double %88, double %85)
%93 = or i64 %84, 1
%94 = icmp eq i64 %93, 101
br i1 %94, label %81, label %95
95: ; preds = %83
%96 = getelementptr inbounds [101 x double], [101 x double]* %1, i64 0, i64 %93
%97 = load double, double* %96
%98 = fdiv double %97, %78
%99 = getelementptr inbounds [101 x double], [101 x double]* %4, i64 0, i64 %93
store double %98, double* %99
%100 = trunc i64 %93 to i32
%101 = sitofp i32 %100 to double
%102 = tail call double @llvm.fmuladd.f64(double %101, double %98, double %92)
%103 = add nuw nsw i64 %84, 2
br label %83
104: ; preds = %81, %104
%105 = phi i64 [ 0, %81 ], [ %116, %104 ]
%106 = getelementptr inbounds [101 x double], [101 x double]* %4, i64 0, i64 %105
%107 = load double, double* %106
%108 = trunc i64 %105 to i32
%109 = tail call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %108, double %107)
%110 = tail call double @pow(double %92, i32 %108)
%111 = tail call double @factorial(i32 %108)
%112 = fdiv double %110, %111
%113 = tail call double @exp(double %82)
%114 = fmul double %112, %113
%115 = tail call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %108, double %114)
%116 = add nuw nsw i64 %105, 1
%117 = icmp eq i64 %116, 10
br i1 %117, label %118, label %104
118: ; preds = %104
%119 = tail call i32 @fclose(i32* %7)
%120 = tail call i32 @fclose(i32* %8)
%121 = tail call i32 @system(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}