double protDiff(double *P) {
  int i;
  double sum = 0.0;
  for (i = 0; i < 26; i++)
    sum += P[i] * P[i];
  return (1 - sum);
}


x86 assembly (clang, -O0):
<protDiff>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x1a,-0xc(%rbp)
jge    115b <protDiff+0x5b>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1117 <protDiff+0x17>
movsd  0xe9d(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<protDiff>:
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
mulsd  %xmm0,%xmm0
xorpd  %xmm2,%xmm2
addsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
movsd  0x10(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0x18(%rdi),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x20(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0x28(%rdi),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x30(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0x38(%rdi),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x40(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0x48(%rdi),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x50(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0x58(%rdi),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x60(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0x68(%rdi),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x70(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0x78(%rdi),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x80(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0x88(%rdi),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x90(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0x98(%rdi),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0xa0(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xa8(%rdi),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0xb0(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xb8(%rdi),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0xc0(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xc8(%rdi),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0xd85(%rip),%xmm0
subsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @protDiff(double* nocapture %0) {
%2 = load double, double* %0
%3 = tail call double @llvm.fmuladd.f64(double %2, double %2, double 0.000000e+00)
%4 = getelementptr inbounds double, double* %0, i64 1
%5 = load double, double* %4
%6 = tail call double @llvm.fmuladd.f64(double %5, double %5, double %3)
%7 = getelementptr inbounds double, double* %0, i64 2
%8 = load double, double* %7
%9 = tail call double @llvm.fmuladd.f64(double %8, double %8, double %6)
%10 = getelementptr inbounds double, double* %0, i64 3
%11 = load double, double* %10
%12 = tail call double @llvm.fmuladd.f64(double %11, double %11, double %9)
%13 = getelementptr inbounds double, double* %0, i64 4
%14 = load double, double* %13
%15 = tail call double @llvm.fmuladd.f64(double %14, double %14, double %12)
%16 = getelementptr inbounds double, double* %0, i64 5
%17 = load double, double* %16
%18 = tail call double @llvm.fmuladd.f64(double %17, double %17, double %15)
%19 = getelementptr inbounds double, double* %0, i64 6
%20 = load double, double* %19
%21 = tail call double @llvm.fmuladd.f64(double %20, double %20, double %18)
%22 = getelementptr inbounds double, double* %0, i64 7
%23 = load double, double* %22
%24 = tail call double @llvm.fmuladd.f64(double %23, double %23, double %21)
%25 = getelementptr inbounds double, double* %0, i64 8
%26 = load double, double* %25
%27 = tail call double @llvm.fmuladd.f64(double %26, double %26, double %24)
%28 = getelementptr inbounds double, double* %0, i64 9
%29 = load double, double* %28
%30 = tail call double @llvm.fmuladd.f64(double %29, double %29, double %27)
%31 = getelementptr inbounds double, double* %0, i64 10
%32 = load double, double* %31
%33 = tail call double @llvm.fmuladd.f64(double %32, double %32, double %30)
%34 = getelementptr inbounds double, double* %0, i64 11
%35 = load double, double* %34
%36 = tail call double @llvm.fmuladd.f64(double %35, double %35, double %33)
%37 = getelementptr inbounds double, double* %0, i64 12
%38 = load double, double* %37
%39 = tail call double @llvm.fmuladd.f64(double %38, double %38, double %36)
%40 = getelementptr inbounds double, double* %0, i64 13
%41 = load double, double* %40
%42 = tail call double @llvm.fmuladd.f64(double %41, double %41, double %39)
%43 = getelementptr inbounds double, double* %0, i64 14
%44 = load double, double* %43
%45 = tail call double @llvm.fmuladd.f64(double %44, double %44, double %42)
%46 = getelementptr inbounds double, double* %0, i64 15
%47 = load double, double* %46
%48 = tail call double @llvm.fmuladd.f64(double %47, double %47, double %45)
%49 = getelementptr inbounds double, double* %0, i64 16
%50 = load double, double* %49
%51 = tail call double @llvm.fmuladd.f64(double %50, double %50, double %48)
%52 = getelementptr inbounds double, double* %0, i64 17
%53 = load double, double* %52
%54 = tail call double @llvm.fmuladd.f64(double %53, double %53, double %51)
%55 = getelementptr inbounds double, double* %0, i64 18
%56 = load double, double* %55
%57 = tail call double @llvm.fmuladd.f64(double %56, double %56, double %54)
%58 = getelementptr inbounds double, double* %0, i64 19
%59 = load double, double* %58
%60 = tail call double @llvm.fmuladd.f64(double %59, double %59, double %57)
%61 = getelementptr inbounds double, double* %0, i64 20
%62 = load double, double* %61
%63 = tail call double @llvm.fmuladd.f64(double %62, double %62, double %60)
%64 = getelementptr inbounds double, double* %0, i64 21
%65 = load double, double* %64
%66 = tail call double @llvm.fmuladd.f64(double %65, double %65, double %63)
%67 = getelementptr inbounds double, double* %0, i64 22
%68 = load double, double* %67
%69 = tail call double @llvm.fmuladd.f64(double %68, double %68, double %66)
%70 = getelementptr inbounds double, double* %0, i64 23
%71 = load double, double* %70
%72 = tail call double @llvm.fmuladd.f64(double %71, double %71, double %69)
%73 = getelementptr inbounds double, double* %0, i64 24
%74 = load double, double* %73
%75 = tail call double @llvm.fmuladd.f64(double %74, double %74, double %72)
%76 = getelementptr inbounds double, double* %0, i64 25
%77 = load double, double* %76
%78 = tail call double @llvm.fmuladd.f64(double %77, double %77, double %75)
%79 = fsub double 1.000000e+00, %78
ret double %79
}