#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 /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, float *);
int /*<<< orphan*/ moment(float *, int, float *, float *, float *, float *,
                          float *, float *);
int /*<<< orphan*/ printf(char *, float, float, float);
int /*<<< orphan*/ *stdin;
int main(int argc, char **argv) {
  float data[1000];
  for (int i = 0; i < 1000; i++)
    data[i] = 0;
  int n = 0;
  FILE *f = stdin;
  fscanf(f, "%f", &(data[n]));
  while (!feof(f)) {
    n++;
    fscanf(f, "%f", &(data[n]));
  }
  float ave, adev, sdev, var, min, max;
  moment(data, n, &ave, &adev, &sdev, &var, &min, &max);
  printf("%f %f %f\n", ave, min, max);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xff0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0xfb4(%rbp)
cmpl   $0x3e8,-0xfb4(%rbp)
jge    119a <main+0x5a>
movslq -0xfb4(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,-0xfb0(%rbp,%rax,4)
ff ff
mov    -0xfb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb4(%rbp)
jmp    1163 <main+0x23>
movl   $0x0,-0xfb8(%rbp)
mov    0x2e3d(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0xfc0(%rbp)
mov    -0xfc0(%rbp),%rdi
movslq -0xfb8(%rbp),%rax
lea    -0xfb0(%rbp),%rdx
shl    $0x2,%rax
add    %rax,%rdx
lea    0xe28(%rip),%rsi
call   1040 <fscanf@plt>
mov    -0xfc0(%rbp),%rdi
call   1050 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11fe <main+0xbe>
jmp    123a <main+0xfa>
mov    -0xfb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb8(%rbp)
mov    -0xfc0(%rbp),%rdi
movslq -0xfb8(%rbp),%rax
lea    -0xfb0(%rbp),%rdx
shl    $0x2,%rax
add    %rax,%rdx
lea    0xdd0(%rip),%rsi
call   1040 <fscanf@plt>
jmp    11dd <main+0x9d>
lea    -0xfb0(%rbp),%rdi
mov    -0xfb8(%rbp),%esi
lea    -0xfc4(%rbp),%rdx
lea    -0xfc8(%rbp),%rcx
lea    -0xfcc(%rbp),%r8
lea    -0xfd0(%rbp),%r9
lea    -0xfd4(%rbp),%r10
lea    -0xfd8(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1060 <moment@plt>
movss  -0xfc4(%rbp),%xmm0
ff
movss  -0xfd4(%rbp),%xmm1
ff
movss  -0xfd8(%rbp),%xmm2
ff
lea    0xd65(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xff0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0xfc8,%rsp
lea    0x20(%rsp),%rbx
xor    %ebp,%ebp
mov    $0xfa0,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    0x2e6e(%rip),%rax
mov    (%rax),%r14
lea    0xe7c(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
call   1050 <fscanf@plt>
mov    %r14,%rdi
call   1060 <feof@plt>
test   %eax,%eax
jne    11d1 <main+0x81>
lea    0x24(%rsp),%rbx
xor    %ebp,%ebp
lea    0xe57(%rip),%r15
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <fscanf@plt>
mov    %r14,%rdi
call   1060 <feof@plt>
add    $0x1,%ebp
add    $0x4,%rbx
test   %eax,%eax
je     11b0 <main+0x60>
lea    0x8(%rsp),%rax
lea    0xc(%rsp),%rbx
lea    0x20(%rsp),%rdi
lea    0x10(%rsp),%rdx
lea    0x1c(%rsp),%rcx
lea    0x18(%rsp),%r8
lea    0x14(%rsp),%r9
mov    %ebp,%esi
push   %rax
push   %rbx
call   1070 <moment@plt>
add    $0x10,%rsp
movss  0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
movss  0x8(%rsp),%xmm2
lea    0xde9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xfc8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32* null
@.str = [3 x i8] c"%f\00"
@.str.1 = [10 x i8] c"%f %f %f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1000 x float]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %16
16: ; preds = %23, %2
%17 = load i32, i32* %7
%18 = icmp slt i32 %17, 1000
br i1 %18, label %19, label %26
19: ; preds = %16
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [1000 x float], [1000 x float]* %6, i64 0, i64 %21
store float 0.000000e+00, float* %22
br label %23
23: ; preds = %19
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 1
store i32 %25, i32* %7
br label %16
26: ; preds = %16
store i32 0, i32* %8
%27 = load i32*, i32** @stdin
store i32* %27, i32** %9
%28 = load i32*, i32** %9
%29 = load i32, i32* %8
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [1000 x float], [1000 x float]* %6, i64 0, i64 %30
%32 = call i32 @fscanf(i32* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %31)
br label %33
33: ; preds = %38, %26
%34 = load i32*, i32** %9
%35 = call i32 @feof(i32* %34)
%36 = icmp ne i32 %35, 0
%37 = xor i1 %36, true
br i1 %37, label %38, label %46
38: ; preds = %33
%39 = load i32, i32* %8
%40 = add nsw i32 %39, 1
store i32 %40, i32* %8
%41 = load i32*, i32** %9
%42 = load i32, i32* %8
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [1000 x float], [1000 x float]* %6, i64 0, i64 %43
%45 = call i32 @fscanf(i32* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %44)
br label %33
46: ; preds = %33
%47 = getelementptr inbounds [1000 x float], [1000 x float]* %6, i64 0, i64 0
%48 = load i32, i32* %8
%49 = call i32 @moment(float* %47, i32 %48, float* %10, float* %11, float* %12, float* %13, float* %14, float* %15)
%50 = load float, float* %10
%51 = load float, float* %14
%52 = load float, float* %15
%53 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), float %50, float %51, float %52)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32* null
@.str = [3 x i8] c"%f\00"
@.str.1 = [10 x i8] c"%f %f %f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1000 x float]
%4 = bitcast [1000 x float]* %3 to i8*
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = load i32*, i32** @stdin
%12 = getelementptr inbounds [1000 x float], [1000 x float]* %3, i64 0, i64 0
%13 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %12)
%14 = call i32 @feof(i32* %11)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %25
16: ; preds = %2, %16
%17 = phi i64 [ %18, %16 ], [ 0, %2 ]
%18 = add nuw nsw i64 %17, 1
%19 = getelementptr inbounds [1000 x float], [1000 x float]* %3, i64 0, i64 %18
%20 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %19)
%21 = call i32 @feof(i32* %11)
%22 = icmp eq i32 %21, 0
br i1 %22, label %16, label %23
23: ; preds = %16
%24 = trunc i64 %18 to i32
br label %25
25: ; preds = %23, %2
%26 = phi i32 [ 0, %2 ], [ %24, %23 ]
%27 = bitcast float* %5 to i8*
%28 = bitcast float* %6 to i8*
%29 = bitcast float* %7 to i8*
%30 = bitcast float* %8 to i8*
%31 = bitcast float* %9 to i8*
%32 = bitcast float* %10 to i8*
%33 = call i32 @moment(float* %12, i32 %26, float* %5, float* %6, float* %7, float* %8, float* %9, float* %10)
%34 = load float, float* %5
%35 = load float, float* %9
%36 = load float, float* %10
%37 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), float %34, float %35, float %36)
ret i32 0
}