#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 */

/* Variables and functions */
double average(double *);
int /*<<< orphan*/ scanf(char *, double *);
double standard_deviation(double *);
void score(double input[100], double *score_arr) {
  int i;
  double av, sd;
  av = average(input);
  sd = standard_deviation(input);
  for (i = 0; i < 100; i++) {
    scanf("%lf", &input[i]);
    score_arr[i] = (input[i] - av) / sd;
  }
}


x86 assembly (clang, -O0):
<score>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <average@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <standard_deviation@plt>
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jge    11ba <score+0x8a>
mov    -0x8(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe7d(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x20(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1163 <score+0x33>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<score>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%r12
call   1040 <average@plt>
movsd  %xmm0,0x10(%rsp)
mov    %r12,%rdi
call   1030 <standard_deviation@plt>
movsd  %xmm0,0x8(%rsp)
xor    %ebx,%ebx
lea    0xe9d(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    (%r12,%rbx,1),%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
movsd  (%r12,%rbx,1),%xmm0
subsd  0x10(%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%r14,%rbx,1)
add    $0x8,%rbx
cmp    $0x320,%rbx
jne    1170 <score+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
define void @score(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca i32
%6 = alloca double
%7 = alloca double
store double* %0, double** %3
store double* %1, double** %4
%8 = load double*, double** %3
%9 = call double @average(double* %8)
store double %9, double* %6
%10 = load double*, double** %3
%11 = call double @standard_deviation(double* %10)
store double %11, double* %7
store i32 0, i32* %5
br label %12
12: ; preds = %34, %2
%13 = load i32, i32* %5
%14 = icmp slt i32 %13, 100
br i1 %14, label %15, label %37
15: ; preds = %12
%16 = load double*, double** %3
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %16, i64 %18
%20 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %19)
%21 = load double*, double** %3
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %21, i64 %23
%25 = load double, double* %24
%26 = load double, double* %6
%27 = fsub double %25, %26
%28 = load double, double* %7
%29 = fdiv double %27, %28
%30 = load double*, double** %4
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double, double* %30, i64 %32
store double %29, double* %33
br label %34
34: ; preds = %15
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
br label %12
37: ; preds = %12
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
define void @score(double* %0, double* nocapture writeonly %1) {
%3 = tail call double @average(double* %0)
%4 = tail call double @standard_deviation(double* %0)
br label %5
5: ; preds = %2, %5
%6 = phi i64 [ 0, %2 ], [ %13, %5 ]
%7 = getelementptr inbounds double, double* %0, i64 %6
%8 = tail call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %7)
%9 = load double, double* %7
%10 = fsub double %9, %3
%11 = fdiv double %10, %4
%12 = getelementptr inbounds double, double* %1, i64 %6
store double %11, double* %12
%13 = add nuw nsw i64 %6, 1
%14 = icmp eq i64 %13, 100
br i1 %14, label %15, label %5
15: ; preds = %5
ret void
}