void Calc_Sum_Mean(Array, Sum, Mean) double Array[], *Sum;
double *Mean;
{
  int i;
  *Sum = 0;
  for (i = 0; i < 1000; i++)
    *Sum += Array[i];
  *Mean = *Sum / 1000;
}


x86 assembly (clang, -O0):
<Calc_Sum_Mean>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3e8,-0x1c(%rbp)
jge    1156 <Calc_Sum_Mean+0x56>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1122 <Calc_Sum_Mean+0x22>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xe9a(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Calc_Sum_Mean>:
movq   $0x0,(%rsi)
xorpd  %xmm0,%xmm0
mov    $0x4,%eax
addsd  -0x20(%rdi,%rax,8),%xmm0
movsd  %xmm0,(%rsi)
addsd  -0x18(%rdi,%rax,8),%xmm0
movsd  %xmm0,(%rsi)
addsd  -0x10(%rdi,%rax,8),%xmm0
movsd  %xmm0,(%rsi)
addsd  -0x8(%rdi,%rax,8),%xmm0
movsd  %xmm0,(%rsi)
addsd  (%rdi,%rax,8),%xmm0
movsd  %xmm0,(%rsi)
add    $0x5,%rax
cmp    $0x3ec,%rax
jne    1110 <Calc_Sum_Mean+0x10>
divsd  0xeab(%rip),%xmm0
movsd  %xmm0,(%rdx)
ret

LLVM IR (-O0):
define void @Calc_Sum_Mean(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%8 = load double*, double** %5
store double 0.000000e+00, double* %8
store i32 0, i32* %7
br label %9
9: ; preds = %21, %3
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 1000
br i1 %11, label %12, label %24
12: ; preds = %9
%13 = load double*, double** %4
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds double, double* %13, i64 %15
%17 = load double, double* %16
%18 = load double*, double** %5
%19 = load double, double* %18
%20 = fadd double %19, %17
store double %20, double* %18
br label %21
21: ; preds = %12
%22 = load i32, i32* %7
%23 = add nsw i32 %22, 1
store i32 %23, i32* %7
br label %9
24: ; preds = %9
%25 = load double*, double** %5
%26 = load double, double* %25
%27 = fdiv double %26, 1.000000e+03
%28 = load double*, double** %6
store double %27, double* %28
ret void
}

LLVM IR (-O2):
define void @Calc_Sum_Mean(double* nocapture %0, double* nocapture %1, double* nocapture writeonly %2) {
store double 0.000000e+00, double* %1
br label %4
4: ; preds = %4, %3
%5 = phi double [ 0.000000e+00, %3 ], [ %25, %4 ]
%6 = phi i64 [ 0, %3 ], [ %26, %4 ]
%7 = getelementptr inbounds double, double* %0, i64 %6
%8 = load double, double* %7
%9 = fadd double %8, %5
store double %9, double* %1
%10 = add nuw nsw i64 %6, 1
%11 = getelementptr inbounds double, double* %0, i64 %10
%12 = load double, double* %11
%13 = fadd double %12, %9
store double %13, double* %1
%14 = add nuw nsw i64 %6, 2
%15 = getelementptr inbounds double, double* %0, i64 %14
%16 = load double, double* %15
%17 = fadd double %16, %13
store double %17, double* %1
%18 = add nuw nsw i64 %6, 3
%19 = getelementptr inbounds double, double* %0, i64 %18
%20 = load double, double* %19
%21 = fadd double %20, %17
store double %21, double* %1
%22 = add nuw nsw i64 %6, 4
%23 = getelementptr inbounds double, double* %0, i64 %22
%24 = load double, double* %23
%25 = fadd double %24, %21
store double %25, double* %1
%26 = add nuw nsw i64 %6, 5
%27 = icmp eq i64 %26, 1000
br i1 %27, label %28, label %4
28: ; preds = %4
%29 = fdiv double %25, 1.000000e+03
store double %29, double* %2
ret void
}