#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 */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char *fgetln(int /*<<< orphan*/ *, size_t *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
long double sqrt(long double);
int /*<<< orphan*/ sscanf(char *, char *, int *, long double *);
int main(int argc, char **argv) {
  FILE *fd, *fd_out;
  char *line;
  int nb1, previous, nb;
  long double nb2;
  long double average, dev;
  size_t len;
  long double sum;
  if (3 > argc) {
    printf("wrong nb of arguments\n");
    printf("usage: %s <data file> <output file>\n", argv[0]);
    return EXIT_FAILURE;
  }
  fd = fopen(argv[1], "r");
  if (NULL == fd) {
    perror("open data file");
    return EXIT_FAILURE;
  }
  fd_out = fopen(argv[2], "a+");
  if (NULL == fd_out) {
    perror("open output file");
    return EXIT_FAILURE;
  }
  fprintf(fd_out, "# average and standard deviations from %s\n", argv[1]);
  previous = -1;
  average = 0;
  nb = 0;
  dev = 0;
  sum = 0;
  while (NULL != (line = fgetln(fd, &len))) {
    if (('#' != line[0]) && ('\n' != line[0]) && (' ' != line[0])) {
      sscanf(line, "%d %Lf", &nb1, &nb2);
      if ((previous != nb1) && (previous != -1)) {
        if (nb != 0) {
          average /= nb;
          dev = sum / nb;
          dev -= (average * average);
          dev = sqrt(dev);
          fprintf(fd_out, "%d %Lf %Lf\n", previous, average, dev);
        }
        average = nb2;
        sum = nb2 * nb2;
        nb = 1;
        previous = nb1;
      } else {
        previous = nb1;
        average += nb2;
        sum += (nb2 * nb2);
        nb++;
      }
    }
  }
  if (nb != 0) {
    average /= nb;
    dev = sum / nb;
    dev -= (average * average);
    dev = sqrt(dev);
    fprintf(fd_out, "%d %Lf %Lf\n", previous, average, dev);
  }
  fclose(fd);
  fclose(fd_out);
  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)
mov    $0x3,%eax
cmp    -0x8(%rbp),%eax
jle    11db <main+0x5b>
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e0f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1494 <main+0x314>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe52(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
jne    121c <main+0x9c>
lea    0xe38(%rip),%rdi
call   1090 <perror@plt>
mov    0x2dce(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1494 <main+0x314>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe22(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
cmp    -0x20(%rbp),%rax
jne    125d <main+0xdd>
lea    0xe09(%rip),%rdi
call   1090 <perror@plt>
mov    0x2d8d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1494 <main+0x314>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xdf1(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x30(%rbp)
fldz
fld    %st(0)
fstpt  -0x60(%rbp)
movl   $0x0,-0x34(%rbp)
fld    %st(0)
fstpt  -0x70(%rbp)
fstpt  -0x90(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x78(%rbp),%rsi
call   1070 <fgetln@plt>
mov    %rax,%rcx
mov    %rcx,-0x28(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
je     13f9 <main+0x279>
mov    -0x28(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x23,%eax
cmp    %ecx,%eax
je     13f4 <main+0x274>
mov    -0x28(%rbp),%rax
movsbl (%rax),%ecx
mov    $0xa,%eax
cmp    %ecx,%eax
je     13f4 <main+0x274>
mov    -0x28(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x20,%eax
cmp    %ecx,%eax
je     13f4 <main+0x274>
mov    -0x28(%rbp),%rdi
lea    0xd8f(%rip),%rsi
lea    -0x2c(%rbp),%rdx
lea    -0x50(%rbp),%rcx
call   1060 <sscanf@plt>
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
je     13c0 <main+0x240>
cmpl   $0xffffffff,-0x30(%rbp)
je     13c0 <main+0x240>
cmpl   $0x0,-0x34(%rbp)
je     139d <main+0x21d>
mov    -0x34(%rbp),%eax
mov    %eax,-0xa0(%rbp)
fildl  -0xa0(%rbp)
fldt   -0x60(%rbp)
fdivp  %st,%st(1)
fstpt  -0x60(%rbp)
fldt   -0x90(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x9c(%rbp)
fildl  -0x9c(%rbp)
fdivrp %st,%st(1)
fstpt  -0x70(%rbp)
fldt   -0x60(%rbp)
fldt   -0x70(%rbp)
fxch   %st(1)
fmul   %st,%st(0)
fsubrp %st,%st(1)
fstpt  -0x70(%rbp)
fldt   -0x70(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   10a0 <sqrt@plt>
fstpt  -0x70(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%edx
fldt   -0x60(%rbp)
fldt   -0x70(%rbp)
mov    %rsp,%rax
fstpt  0x10(%rax)
fstpt  (%rax)
lea    0xcfd(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
fldt   -0x50(%rbp)
fstpt  -0x60(%rbp)
fldt   -0x50(%rbp)
fmul   %st,%st(0)
fstpt  -0x90(%rbp)
movl   $0x1,-0x34(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    13ef <main+0x26f>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
fldt   -0x50(%rbp)
fldt   -0x60(%rbp)
faddp  %st,%st(1)
fstpt  -0x60(%rbp)
fldt   -0x50(%rbp)
fldt   -0x90(%rbp)
fxch   %st(1)
fmul   %st,%st(0)
faddp  %st,%st(1)
fstpt  -0x90(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    13f4 <main+0x274>
jmp    1297 <main+0x117>
cmpl   $0x0,-0x34(%rbp)
je     1476 <main+0x2f6>
mov    -0x34(%rbp),%eax
mov    %eax,-0x98(%rbp)
fildl  -0x98(%rbp)
fldt   -0x60(%rbp)
fdivp  %st,%st(1)
fstpt  -0x60(%rbp)
fldt   -0x90(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x94(%rbp)
fildl  -0x94(%rbp)
fdivrp %st,%st(1)
fstpt  -0x70(%rbp)
fldt   -0x60(%rbp)
fldt   -0x70(%rbp)
fxch   %st(1)
fmul   %st,%st(0)
fsubrp %st,%st(1)
fstpt  -0x70(%rbp)
fldt   -0x70(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   10a0 <sqrt@plt>
fstpt  -0x70(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%edx
fldt   -0x60(%rbp)
fldt   -0x70(%rbp)
mov    %rsp,%rax
fstpt  0x10(%rax)
fstpt  (%rax)
lea    0xc24(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    0x2b49(%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
mov    %rsi,%rbp
cmp    $0x2,%edi
jg     11d0 <main+0x40>
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
mov    0x0(%rbp),%rsi
lea    0xe43(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2e15(%rip),%rax
jmp    13c7 <main+0x237>
mov    0x8(%rbp),%rdi
lea    0xe4a(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     13d8 <main+0x248>
mov    %rax,%rbx
mov    0x10(%rbp),%rdi
lea    0xe3f(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     13e1 <main+0x251>
mov    %rax,%r14
mov    0x8(%rbp),%rdx
lea    0xe37(%rip),%rsi
mov    %rax,%rdi
xor    %eax,%eax
call   1060 <fprintf@plt>
lea    0x48(%rsp),%rsi
mov    %rbx,%rdi
call   1080 <fgetln@plt>
test   %rax,%rax
je     13b0 <main+0x220>
mov    $0xffffffff,%ebp
fldz
lea    0x48(%rsp),%r15
movabs $0x900000400,%r12
fld    %st(0)
fstpt  0x24(%rsp)
fld    %st(0)
fstpt  0x54(%rsp)
fstpt  0x34(%rsp)
xor    %r13d,%r13d
jmp    1292 <main+0x102>
fldt   0x60(%rsp)
fldt   0x34(%rsp)
fadd   %st(1),%st
fstpt  0x34(%rsp)
fmul   %st,%st(0)
fldt   0x24(%rsp)
faddp  %st,%st(1)
fstpt  0x24(%rsp)
add    $0x1,%r13d
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <fgetln@plt>
test   %rax,%rax
je     134c <main+0x1bc>
movzbl (%rax),%ecx
cmp    $0x23,%rcx
ja     12a1 <main+0x111>
bt     %rcx,%r12
jb     127e <main+0xee>
mov    %rax,%rdi
lea    0xdca(%rip),%rsi
lea    0x30(%rsp),%rdx
lea    0x60(%rsp),%rcx
call   1070 <sscanf@plt>
mov    0x30(%rsp),%eax
cmp    $0xffffffff,%ebp
je     125e <main+0xce>
cmp    %eax,%ebp
je     125e <main+0xce>
test   %r13d,%r13d
je     1331 <main+0x1a1>
mov    %r13d,0x44(%rsp)
fildl  0x44(%rsp)
fldt   0x34(%rsp)
fdiv   %st(1),%st
fldt   0x24(%rsp)
fdivp  %st,%st(2)
fld    %st(0)
fmul   %st(1),%st
fsubrp %st,%st(2)
fld    %st(1)
fsqrt
fldt   0x54(%rsp)
fxch   %st(3)
fucomi %st(3),%st
fstp   %st(3)
jae    130f <main+0x17f>
fstp   %st(0)
fxch   %st(1)
fstpt  (%rsp)
fstpt  0x24(%rsp)
call   10b0 <sqrt@plt>
fldt   0x24(%rsp)
fldz
fxch   %st(2)
fstp   %st(2)
fxch   %st(1)
fstpt  0x10(%rsp)
fstpt  (%rsp)
mov    %r14,%rdi
lea    0xd58(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x30(%rsp),%eax
fldt   0x60(%rsp)
fld    %st(0)
fstpt  0x34(%rsp)
fmul   %st,%st(0)
fstpt  0x24(%rsp)
mov    $0x1,%r13d
jmp    127c <main+0xec>
test   %r13d,%r13d
je     13b0 <main+0x220>
mov    %r13d,0x40(%rsp)
fildl  0x40(%rsp)
fldt   0x34(%rsp)
fdiv   %st(1),%st
fldt   0x24(%rsp)
fdivp  %st,%st(2)
fld    %st(0)
fmul   %st(1),%st
fsubrp %st,%st(2)
fld    %st(1)
fsqrt
fldz
fxch   %st(3)
fucomi %st(3),%st
fstp   %st(3)
jae    1392 <main+0x202>
fstp   %st(0)
fxch   %st(1)
fstpt  (%rsp)
fstpt  0x24(%rsp)
call   10b0 <sqrt@plt>
fldt   0x24(%rsp)
fldz
fxch   %st(2)
fstp   %st(2)
fxch   %st(1)
fstpt  0x10(%rsp)
fstpt  (%rsp)
lea    0xcd8(%rip),%rsi
mov    %r14,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    0x2c11(%rip),%rax
mov    (%rax),%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc48(%rip),%rdi
jmp    13e8 <main+0x258>
lea    0xc51(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2bec(%rip),%rax
jmp    13c7 <main+0x237>

LLVM IR (-O0):
@.str = [23 x i8] c"wrong nb of arguments\0A\00"
@.str.1 = [37 x i8] c"usage: %s <data file> <output file>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [15 x i8] c"open data file\00"
@.str.4 = [3 x i8] c"a+\00"
@.str.5 = [17 x i8] c"open output file\00"
@.str.6 = [43 x i8] c"# average and standard deviations from %s\0A\00"
@.str.7 = [7 x i8] c"%d %Lf\00"
@.str.8 = [12 x i8] c"%d %Lf %Lf\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 i32*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca x86_fp80
%13 = alloca x86_fp80
%14 = alloca x86_fp80
%15 = alloca i64
%16 = alloca x86_fp80
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* %4
%18 = icmp sgt i32 3, %17
br i1 %18, label %19, label %26
19: ; preds = %2
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %23)
%25 = load i32, i32* @EXIT_FAILURE
store i32 %25, i32* %3
br label %156
26: ; preds = %2
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32* @fopen(i8* %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %30, i32** %6
%31 = load i32*, i32** %6
%32 = icmp eq i32* null, %31
br i1 %32, label %33, label %36
33: ; preds = %26
%34 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%35 = load i32, i32* @EXIT_FAILURE
store i32 %35, i32* %3
br label %156
36: ; preds = %26
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 2
%39 = load i8*, i8** %38
%40 = call i32* @fopen(i8* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %40, i32** %7
%41 = load i32*, i32** %7
%42 = icmp eq i32* null, %41
br i1 %42, label %43, label %46
43: ; preds = %36
%44 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%45 = load i32, i32* @EXIT_FAILURE
store i32 %45, i32* %3
br label %156
46: ; preds = %36
%47 = load i32*, i32** %7
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 1
%50 = load i8*, i8** %49
%51 = call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i8* %50)
store i32 -1, i32* %10
store x86_fp80 0xK00000000000000000000, x86_fp80* %13
store i32 0, i32* %11
store x86_fp80 0xK00000000000000000000, x86_fp80* %14
store x86_fp80 0xK00000000000000000000, x86_fp80* %16
br label %52
52: ; preds = %125, %46
%53 = load i32*, i32** %6
%54 = call i8* @fgetln(i32* %53, i64* %15)
store i8* %54, i8** %8
%55 = icmp ne i8* null, %54
br i1 %55, label %56, label %126
56: ; preds = %52
%57 = load i8*, i8** %8
%58 = getelementptr inbounds i8, i8* %57, i64 0
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = icmp ne i32 35, %60
br i1 %61, label %62, label %125
62: ; preds = %56
%63 = load i8*, i8** %8
%64 = getelementptr inbounds i8, i8* %63, i64 0
%65 = load i8, i8* %64
%66 = sext i8 %65 to i32
%67 = icmp ne i32 10, %66
br i1 %67, label %68, label %125
68: ; preds = %62
%69 = load i8*, i8** %8
%70 = getelementptr inbounds i8, i8* %69, i64 0
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = icmp ne i32 32, %72
br i1 %73, label %74, label %125
74: ; preds = %68
%75 = load i8*, i8** %8
%76 = call i32 @sscanf(i8* %75, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32* %9, x86_fp80* %12)
%77 = load i32, i32* %10
%78 = load i32, i32* %9
%79 = icmp ne i32 %77, %78
br i1 %79, label %80, label %113
80: ; preds = %74
%81 = load i32, i32* %10
%82 = icmp ne i32 %81, -1
br i1 %82, label %83, label %113
83: ; preds = %80
%84 = load i32, i32* %11
%85 = icmp ne i32 %84, 0
br i1 %85, label %86, label %107
86: ; preds = %83
%87 = load i32, i32* %11
%88 = sitofp i32 %87 to x86_fp80
%89 = load x86_fp80, x86_fp80* %13
%90 = fdiv x86_fp80 %89, %88
store x86_fp80 %90, x86_fp80* %13
%91 = load x86_fp80, x86_fp80* %16
%92 = load i32, i32* %11
%93 = sitofp i32 %92 to x86_fp80
%94 = fdiv x86_fp80 %91, %93
store x86_fp80 %94, x86_fp80* %14
%95 = load x86_fp80, x86_fp80* %13
%96 = load x86_fp80, x86_fp80* %13
%97 = load x86_fp80, x86_fp80* %14
%98 = fneg x86_fp80 %95
%99 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %98, x86_fp80 %96, x86_fp80 %97)
store x86_fp80 %99, x86_fp80* %14
%100 = load x86_fp80, x86_fp80* %14
%101 = call x86_fp80 @sqrt(x86_fp80 %100)
store x86_fp80 %101, x86_fp80* %14
%102 = load i32*, i32** %7
%103 = load i32, i32* %10
%104 = load x86_fp80, x86_fp80* %13
%105 = load x86_fp80, x86_fp80* %14
%106 = call i32 (i32*, i8*, ...) @fprintf(i32* %102, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i32 %103, x86_fp80 %104, x86_fp80 %105)
br label %107
107: ; preds = %86, %83
%108 = load x86_fp80, x86_fp80* %12
store x86_fp80 %108, x86_fp80* %13
%109 = load x86_fp80, x86_fp80* %12
%110 = load x86_fp80, x86_fp80* %12
%111 = fmul x86_fp80 %109, %110
store x86_fp80 %111, x86_fp80* %16
store i32 1, i32* %11
%112 = load i32, i32* %9
store i32 %112, i32* %10
br label %124
113: ; preds = %80, %74
%114 = load i32, i32* %9
store i32 %114, i32* %10
%115 = load x86_fp80, x86_fp80* %12
%116 = load x86_fp80, x86_fp80* %13
%117 = fadd x86_fp80 %116, %115
store x86_fp80 %117, x86_fp80* %13
%118 = load x86_fp80, x86_fp80* %12
%119 = load x86_fp80, x86_fp80* %12
%120 = load x86_fp80, x86_fp80* %16
%121 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %118, x86_fp80 %119, x86_fp80 %120)
store x86_fp80 %121, x86_fp80* %16
%122 = load i32, i32* %11
%123 = add nsw i32 %122, 1
store i32 %123, i32* %11
br label %124
124: ; preds = %113, %107
br label %125
125: ; preds = %124, %68, %62, %56
br label %52
126: ; preds = %52
%127 = load i32, i32* %11
%128 = icmp ne i32 %127, 0
br i1 %128, label %129, label %150
129: ; preds = %126
%130 = load i32, i32* %11
%131 = sitofp i32 %130 to x86_fp80
%132 = load x86_fp80, x86_fp80* %13
%133 = fdiv x86_fp80 %132, %131
store x86_fp80 %133, x86_fp80* %13
%134 = load x86_fp80, x86_fp80* %16
%135 = load i32, i32* %11
%136 = sitofp i32 %135 to x86_fp80
%137 = fdiv x86_fp80 %134, %136
store x86_fp80 %137, x86_fp80* %14
%138 = load x86_fp80, x86_fp80* %13
%139 = load x86_fp80, x86_fp80* %13
%140 = load x86_fp80, x86_fp80* %14
%141 = fneg x86_fp80 %138
%142 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %141, x86_fp80 %139, x86_fp80 %140)
store x86_fp80 %142, x86_fp80* %14
%143 = load x86_fp80, x86_fp80* %14
%144 = call x86_fp80 @sqrt(x86_fp80 %143)
store x86_fp80 %144, x86_fp80* %14
%145 = load i32*, i32** %7
%146 = load i32, i32* %10
%147 = load x86_fp80, x86_fp80* %13
%148 = load x86_fp80, x86_fp80* %14
%149 = call i32 (i32*, i8*, ...) @fprintf(i32* %145, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i32 %146, x86_fp80 %147, x86_fp80 %148)
br label %150
150: ; preds = %129, %126
%151 = load i32*, i32** %6
%152 = call i32 @fclose(i32* %151)
%153 = load i32*, i32** %7
%154 = call i32 @fclose(i32* %153)
%155 = load i32, i32* @EXIT_SUCCESS
store i32 %155, i32* %3
br label %156
156: ; preds = %150, %43, %33, %19
%157 = load i32, i32* %3
ret i32 %157
}

LLVM IR (-O2):
@.str.1 = [37 x i8] c"usage: %s <data file> <output file>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [15 x i8] c"open data file\00"
@.str.4 = [3 x i8] c"a+\00"
@.str.5 = [17 x i8] c"open output file\00"
@.str.6 = [43 x i8] c"# average and standard deviations from %s\0A\00"
@.str.7 = [7 x i8] c"%d %Lf\00"
@.str.8 = [12 x i8] c"%d %Lf %Lf\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [22 x i8] c"wrong nb of arguments\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca x86_fp80
%5 = alloca i64
%6 = bitcast i32* %3 to i8*
%7 = bitcast x86_fp80* %4 to i8*
%8 = bitcast i64* %5 to i8*
%9 = icmp slt i32 %0, 3
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%12 = load i8*, i8** %1
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %12)
br label %86
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = tail call i32* @fopen(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %21
19: ; preds = %14
%20 = tail call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %86
21: ; preds = %14
%22 = getelementptr inbounds i8*, i8** %1, i64 2
%23 = load i8*, i8** %22
%24 = tail call i32* @fopen(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %28
26: ; preds = %21
%27 = tail call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
br label %86
28: ; preds = %21
%29 = load i8*, i8** %15
%30 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i8* %29)
%31 = call i8* @fgetln(i32* %17, i64* %5)
%32 = icmp eq i8* %31, null
br i1 %32, label %83, label %33
33: ; preds = %28, %66
%34 = phi i8* [ %71, %66 ], [ %31, %28 ]
%35 = phi x86_fp80 [ %70, %66 ], [ 0xK00000000000000000000, %28 ]
%36 = phi i32 [ %69, %66 ], [ -1, %28 ]
%37 = phi x86_fp80 [ %68, %66 ], [ 0xK00000000000000000000, %28 ]
%38 = phi i32 [ %67, %66 ], [ 0, %28 ]
%39 = load i8, i8* %34
switch i8 %39, label %40 [
i8 35, label %66
i8 10, label %66
i8 32, label %66
]
40: ; preds = %33
%41 = call i32 @sscanf(i8* %34, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32* %3, x86_fp80* %4)
%42 = load i32, i32* %3
%43 = icmp ne i32 %36, %42
%44 = icmp ne i32 %36, -1
%45 = and i1 %44, %43
br i1 %45, label %46, label %61
46: ; preds = %40
%47 = icmp eq i32 %38, 0
br i1 %47, label %57, label %48
48: ; preds = %46
%49 = sitofp i32 %38 to x86_fp80
%50 = fdiv x86_fp80 %37, %49
%51 = fdiv x86_fp80 %35, %49
%52 = fneg x86_fp80 %50
%53 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %52, x86_fp80 %50, x86_fp80 %51)
%54 = call x86_fp80 @sqrt(x86_fp80 %53)
%55 = call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i32 %36, x86_fp80 %50, x86_fp80 %54)
%56 = load i32, i32* %3
br label %57
57: ; preds = %48, %46
%58 = phi i32 [ %56, %48 ], [ %42, %46 ]
%59 = load x86_fp80, x86_fp80* %4
%60 = fmul x86_fp80 %59, %59
br label %66
61: ; preds = %40
%62 = load x86_fp80, x86_fp80* %4
%63 = fadd x86_fp80 %37, %62
%64 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %62, x86_fp80 %62, x86_fp80 %35)
%65 = add nsw i32 %38, 1
br label %66
66: ; preds = %33, %33, %33, %57, %61
%67 = phi i32 [ 1, %57 ], [ %65, %61 ], [ %38, %33 ], [ %38, %33 ], [ %38, %33 ]
%68 = phi x86_fp80 [ %59, %57 ], [ %63, %61 ], [ %37, %33 ], [ %37, %33 ], [ %37, %33 ]
%69 = phi i32 [ %58, %57 ], [ %42, %61 ], [ %36, %33 ], [ %36, %33 ], [ %36, %33 ]
%70 = phi x86_fp80 [ %60, %57 ], [ %64, %61 ], [ %35, %33 ], [ %35, %33 ], [ %35, %33 ]
%71 = call i8* @fgetln(i32* %17, i64* %5)
%72 = icmp eq i8* %71, null
br i1 %72, label %73, label %33
73: ; preds = %66
%74 = icmp eq i32 %67, 0
br i1 %74, label %83, label %75
75: ; preds = %73
%76 = sitofp i32 %67 to x86_fp80
%77 = fdiv x86_fp80 %68, %76
%78 = fdiv x86_fp80 %70, %76
%79 = fneg x86_fp80 %77
%80 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %79, x86_fp80 %77, x86_fp80 %78)
%81 = call x86_fp80 @sqrt(x86_fp80 %80)
%82 = call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i32 %69, x86_fp80 %77, x86_fp80 %81)
br label %83
83: ; preds = %28, %75, %73
%84 = call i32 @fclose(i32* %17)
%85 = call i32 @fclose(i32* %24)
br label %86
86: ; preds = %83, %26, %19, %10
%87 = phi i32* [ @EXIT_FAILURE, %10 ], [ @EXIT_FAILURE, %19 ], [ @EXIT_FAILURE, %26 ], [ @EXIT_SUCCESS, %83 ]
%88 = load i32, i32* %87
ret i32 %88
}