double P_LC(int i, int j, int k, const double *P) {
  const double f1 = 1.57542E9, f2 = 1.22760E9, f5 = 1.17645E9;
  double P1, P2, P5;
  if ((i && !P[0]) || (j && !P[1]) || (k && !P[2])) {
    return 0.0;
  }
  P1 = P[0];
  P2 = P[1];
  P5 = P[2];
  return (i * f1 * P1 + j * f2 * P2 + k * f5 * P5) / (i * f1 + j * f2 + k * f5);
}


x86 assembly (clang, -O0):
<P_LC>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
movsd  0xef7(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xee2(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xecd(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1162 <P_LC+0x62>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1162 <P_LC+0x62>
jp     1162 <P_LC+0x62>
jmp    11b3 <P_LC+0xb3>
cmpl   $0x0,-0x10(%rbp)
je     118d <P_LC+0x8d>
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    118d <P_LC+0x8d>
jp     118d <P_LC+0x8d>
jmp    11b3 <P_LC+0xb3>
cmpl   $0x0,-0x14(%rbp)
je     11c0 <P_LC+0xc0>
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11c0 <P_LC+0xc0>
jp     11c0 <P_LC+0xc0>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    127f <P_LC+0x17f>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xe1a(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm2
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  0xdfc(%rip),%xmm3
mulsd  %xmm3,%xmm0
mulsd  -0x48(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  0xdd6(%rip),%xmm2
mulsd  %xmm2,%xmm0
movsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm2
cvtsi2sdl -0x10(%rbp),%xmm1
movsd  0xdbb(%rip),%xmm3
mulsd  %xmm3,%xmm1
movsd  0xdb7(%rip),%xmm3
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xd92(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<P_LC>:
test   %edi,%edi
je     1114 <P_LC+0x14>
movsd  (%rcx),%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    1114 <P_LC+0x14>
jnp    1142 <P_LC+0x42>
test   %esi,%esi
je     1129 <P_LC+0x29>
movsd  0x8(%rcx),%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    1129 <P_LC+0x29>
jnp    1142 <P_LC+0x42>
movsd  0x10(%rcx),%xmm1
test   %edx,%edx
je     1143 <P_LC+0x43>
xorpd  %xmm0,%xmm0
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm1
jne    1143 <P_LC+0x43>
jp     1143 <P_LC+0x43>
ret
xorps  %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
movsd  0xeae(%rip),%xmm2
mulsd  %xmm0,%xmm2
cvtsi2sd %esi,%xmm3
mulsd  0xea6(%rip),%xmm3
movsd  0x8(%rcx),%xmm4
mulsd  %xmm3,%xmm4
cvtsi2sd %edx,%xmm5
movsd  0xe99(%rip),%xmm6
mulsd  %xmm5,%xmm6
unpcklpd %xmm0,%xmm2
movapd 0xe99(%rip),%xmm0
movlpd (%rcx),%xmm0
mulpd  %xmm2,%xmm0
unpcklpd %xmm3,%xmm4
addpd  %xmm0,%xmm4
unpcklpd %xmm5,%xmm6
shufpd $0x2,0xe8c(%rip),%xmm1
mulpd  %xmm6,%xmm1
addpd  %xmm4,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @P_LC(i32 %0, i32 %1, i32 %2, double* %3) {
%5 = alloca double
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double*
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store double* %3, double** %9
store double 1.575420e+09, double* %10
store double 1.227600e+09, double* %11
store double 1.176450e+09, double* %12
%16 = load i32, i32* %6
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %4
%19 = load double*, double** %9
%20 = getelementptr inbounds double, double* %19, i64 0
%21 = load double, double* %20
%22 = fcmp une double %21, 0.000000e+00
br i1 %22, label %23, label %39
23: ; preds = %18, %4
%24 = load i32, i32* %7
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %31
26: ; preds = %23
%27 = load double*, double** %9
%28 = getelementptr inbounds double, double* %27, i64 1
%29 = load double, double* %28
%30 = fcmp une double %29, 0.000000e+00
br i1 %30, label %31, label %39
31: ; preds = %26, %23
%32 = load i32, i32* %8
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %40
34: ; preds = %31
%35 = load double*, double** %9
%36 = getelementptr inbounds double, double* %35, i64 2
%37 = load double, double* %36
%38 = fcmp une double %37, 0.000000e+00
br i1 %38, label %40, label %39
39: ; preds = %34, %26, %18
store double 0.000000e+00, double* %5
br label %75
40: ; preds = %34, %31
%41 = load double*, double** %9
%42 = getelementptr inbounds double, double* %41, i64 0
%43 = load double, double* %42
store double %43, double* %13
%44 = load double*, double** %9
%45 = getelementptr inbounds double, double* %44, i64 1
%46 = load double, double* %45
store double %46, double* %14
%47 = load double*, double** %9
%48 = getelementptr inbounds double, double* %47, i64 2
%49 = load double, double* %48
store double %49, double* %15
%50 = load i32, i32* %6
%51 = sitofp i32 %50 to double
%52 = fmul double %51, 1.575420e+09
%53 = load double, double* %13
%54 = load i32, i32* %7
%55 = sitofp i32 %54 to double
%56 = fmul double %55, 1.227600e+09
%57 = load double, double* %14
%58 = fmul double %56, %57
%59 = call double @llvm.fmuladd.f64(double %52, double %53, double %58)
%60 = load i32, i32* %8
%61 = sitofp i32 %60 to double
%62 = fmul double %61, 1.176450e+09
%63 = load double, double* %15
%64 = call double @llvm.fmuladd.f64(double %62, double %63, double %59)
%65 = load i32, i32* %6
%66 = sitofp i32 %65 to double
%67 = load i32, i32* %7
%68 = sitofp i32 %67 to double
%69 = fmul double %68, 1.227600e+09
%70 = call double @llvm.fmuladd.f64(double %66, double 1.575420e+09, double %69)
%71 = load i32, i32* %8
%72 = sitofp i32 %71 to double
%73 = call double @llvm.fmuladd.f64(double %72, double 1.176450e+09, double %70)
%74 = fdiv double %64, %73
store double %74, double* %5
br label %75
75: ; preds = %40, %39
%76 = load double, double* %5
ret double %76
}

LLVM IR (-O2):
define double @P_LC(i32 %0, i32 %1, i32 %2, double* nocapture %3) {
%5 = icmp eq i32 %0, 0
br i1 %5, label %9, label %6
6: ; preds = %4
%7 = load double, double* %3
%8 = fcmp une double %7, 0.000000e+00
br i1 %8, label %9, label %45
9: ; preds = %6, %4
%10 = icmp eq i32 %1, 0
br i1 %10, label %15, label %11
11: ; preds = %9
%12 = getelementptr inbounds double, double* %3, i64 1
%13 = load double, double* %12
%14 = fcmp une double %13, 0.000000e+00
br i1 %14, label %15, label %45
15: ; preds = %11, %9
%16 = icmp eq i32 %2, 0
%17 = getelementptr inbounds double, double* %3, i64 2
%18 = load double, double* %17
%19 = fcmp une double %18, 0.000000e+00
%20 = select i1 %16, i1 true, i1 %19
br i1 %20, label %21, label %45
21: ; preds = %15
%22 = load double, double* %3
%23 = getelementptr inbounds double, double* %3, i64 1
%24 = load double, double* %23
%25 = sitofp i32 %0 to double
%26 = fmul double %25, 1.575420e+09
%27 = sitofp i32 %1 to double
%28 = fmul double %27, 1.227600e+09
%29 = fmul double %28, %24
%30 = sitofp i32 %2 to double
%31 = fmul double %30, 1.176450e+09
%32 = insertelement <2 x double> poison, double %26, i64 0
%33 = insertelement <2 x double> %32, double %25, i64 1
%34 = insertelement <2 x double> <double poison, double 1.575420e+09>, double %22, i64 0
%35 = insertelement <2 x double> poison, double %29, i64 0
%36 = insertelement <2 x double> %35, double %28, i64 1
%37 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %33, <2 x double> %34, <2 x double> %36)
%38 = insertelement <2 x double> poison, double %31, i64 0
%39 = insertelement <2 x double> %38, double %30, i64 1
%40 = insertelement <2 x double> <double poison, double 1.176450e+09>, double %18, i64 0
%41 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %39, <2 x double> %40, <2 x double> %37)
%42 = extractelement <2 x double> %41, i64 0
%43 = extractelement <2 x double> %41, i64 1
%44 = fdiv double %42, %43
br label %45
45: ; preds = %15, %6, %11, %21
%46 = phi double [ %44, %21 ], [ 0.000000e+00, %11 ], [ 0.000000e+00, %6 ], [ 0.000000e+00, %15 ]
ret double %46
}