double exactMass(int intFormula[10]) {
  int i;
  double exactMass = 0;
  double proton = 1.007276466879;
  double monoisotopicMassAtoms[10] = {
      12,       1.007825037, 78.9183,     34.9689,   18.9984,
      126.9045, 14.003074,   15.99491464, 30.973763, 31.9721};
  for (i = 0; i < 10; i++) {
    exactMass = exactMass + (double)intFormula[i] * monoisotopicMassAtoms[i];
  }
  return exactMass;
}


x86 assembly (clang, -O0):
<exactMass>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xed4(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xed4(%rip),%rsi
mov    $0x50,%edx
call   1030 <memcpy@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    118e <exactMass+0x7e>
movsd  -0x18(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm0
movslq -0xc(%rbp),%rax
movsd  -0x70(%rbp,%rax,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114d <exactMass+0x3d>
movsd  -0x18(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exactMass>:
cvtsi2sdl (%rdi),%xmm0
mulsd  0xef4(%rip),%xmm0
xorpd  %xmm1,%xmm1
cvtsi2sdl 0x4(%rdi),%xmm2
addsd  %xmm0,%xmm1
mulsd  0xee7(%rip),%xmm2
addsd  %xmm1,%xmm2
xorps  %xmm0,%xmm0
cvtsi2sdl 0x8(%rdi),%xmm0
mulsd  0xedb(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl 0xc(%rdi),%xmm1
mulsd  0xed3(%rip),%xmm1
addsd  %xmm2,%xmm0
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sdl 0x10(%rdi),%xmm0
mulsd  0xec3(%rip),%xmm0
xorps  %xmm2,%xmm2
cvtsi2sdl 0x14(%rdi),%xmm2
addsd  %xmm1,%xmm0
mulsd  0xeb7(%rip),%xmm2
addsd  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtsi2sdl 0x18(%rdi),%xmm0
mulsd  0xeab(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl 0x1c(%rdi),%xmm1
mulsd  0xea3(%rip),%xmm1
addsd  %xmm2,%xmm0
addsd  %xmm0,%xmm1
xorps  %xmm2,%xmm2
cvtsi2sdl 0x20(%rdi),%xmm2
mulsd  0xe93(%rip),%xmm2
xorps  %xmm0,%xmm0
cvtsi2sdl 0x24(%rdi),%xmm0
addsd  %xmm1,%xmm2
mulsd  0xe87(%rip),%xmm0
addsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
@__const.exactMass.monoisotopicMassAtoms = [10 x double] [double 1.200000e+01, double 0x3FF0200D25601470, double 7.891830e+01, double 3.496890e+01, double 1.899840e+01, double 0x405FB9E353F7CED9, double 0x402C0192EA52EF91, double 0x402FFD6573A23925, double 0x403EF948882F0E0B, double 3.197210e+01]
define double @exactMass(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca [10 x double]
store i32* %0, i32** %2
store double 0.000000e+00, double* %4
store double 0x3FF01DCDEDB46966, double* %5
%7 = bitcast [10 x double]* %6 to i8*
store i32 0, i32* %3
br label %8
8: ; preds = %24, %1
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 10
br i1 %10, label %11, label %27
11: ; preds = %8
%12 = load double, double* %4
%13 = load i32*, i32** %2
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = sitofp i32 %17 to double
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [10 x double], [10 x double]* %6, i64 0, i64 %20
%22 = load double, double* %21
%23 = call double @llvm.fmuladd.f64(double %18, double %22, double %12)
store double %23, double* %4
br label %24
24: ; preds = %11
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %8
27: ; preds = %8
%28 = load double, double* %4
ret double %28
}

LLVM IR (-O2):
define double @exactMass(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = sitofp i32 %2 to double
%4 = tail call double @llvm.fmuladd.f64(double %3, double 1.200000e+01, double 0.000000e+00)
%5 = getelementptr inbounds i32, i32* %0, i64 1
%6 = load i32, i32* %5
%7 = sitofp i32 %6 to double
%8 = tail call double @llvm.fmuladd.f64(double %7, double 0x3FF0200D25601470, double %4)
%9 = getelementptr inbounds i32, i32* %0, i64 2
%10 = load i32, i32* %9
%11 = sitofp i32 %10 to double
%12 = tail call double @llvm.fmuladd.f64(double %11, double 7.891830e+01, double %8)
%13 = getelementptr inbounds i32, i32* %0, i64 3
%14 = load i32, i32* %13
%15 = sitofp i32 %14 to double
%16 = tail call double @llvm.fmuladd.f64(double %15, double 3.496890e+01, double %12)
%17 = getelementptr inbounds i32, i32* %0, i64 4
%18 = load i32, i32* %17
%19 = sitofp i32 %18 to double
%20 = tail call double @llvm.fmuladd.f64(double %19, double 1.899840e+01, double %16)
%21 = getelementptr inbounds i32, i32* %0, i64 5
%22 = load i32, i32* %21
%23 = sitofp i32 %22 to double
%24 = tail call double @llvm.fmuladd.f64(double %23, double 0x405FB9E353F7CED9, double %20)
%25 = getelementptr inbounds i32, i32* %0, i64 6
%26 = load i32, i32* %25
%27 = sitofp i32 %26 to double
%28 = tail call double @llvm.fmuladd.f64(double %27, double 0x402C0192EA52EF91, double %24)
%29 = getelementptr inbounds i32, i32* %0, i64 7
%30 = load i32, i32* %29
%31 = sitofp i32 %30 to double
%32 = tail call double @llvm.fmuladd.f64(double %31, double 0x402FFD6573A23925, double %28)
%33 = getelementptr inbounds i32, i32* %0, i64 8
%34 = load i32, i32* %33
%35 = sitofp i32 %34 to double
%36 = tail call double @llvm.fmuladd.f64(double %35, double 0x403EF948882F0E0B, double %32)
%37 = getelementptr inbounds i32, i32* %0, i64 9
%38 = load i32, i32* %37
%39 = sitofp i32 %38 to double
%40 = tail call double @llvm.fmuladd.f64(double %39, double 3.197210e+01, double %36)
ret double %40
}