double penalty(f1, f2, n, Q, x1, x2)
int n;
double f1, f2, Q, *x1, *x2;
{
  int i;
  double exp1, exp2, dexp, expo;
  double pnlt;
  double f, df, omega;
  double tau_epsilon, tau_sigma, a, b, Q_omega;
  exp1 = log10(f1);
  exp2 = log10(f2);
  dexp = (exp2 - exp1) / 100.0;
  pnlt = 0.0;
  for (expo = exp1; expo <= exp2; expo += dexp) {
    f = pow(10.0, expo);
    df = pow(10.0, expo + dexp) - f;
    omega = 6.28318530717958 * f;
    a = (double)(1 - n);
    b = 0.0;
    for (i = 1; i <= n; i++) {
      tau_epsilon = x1[i] + x2[i];
      tau_sigma = x2[i];
      a += (1.0 + omega * omega * tau_epsilon * tau_sigma) /
           (1.0 + omega * omega * tau_sigma * tau_sigma);
      b += omega * (tau_epsilon - tau_sigma) /
           (1.0 + omega * omega * tau_sigma * tau_sigma);
    }
    Q_omega = a / b;
    pnlt += pow(1.0 / Q - 1.0 / Q_omega, 2.0) * df;
  }
  pnlt /= (f2 - f1);
  return pnlt;
}


x86 assembly (clang, -O0):
<penalty>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <log10@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <log10@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
movsd  0xe8b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     138c <penalty+0x26c>
movsd  -0x58(%rbp),%xmm1
movsd  0xe5f(%rip),%xmm0
call   1030 <pow@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x58(%rbp),%xmm1
addsd  -0x50(%rbp),%xmm1
movsd  0xe43(%rip),%xmm0
call   1030 <pow@plt>
subsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xe24(%rip),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    $0x1,%eax
sub    -0x14(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movl   $0x1,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     131b <penalty+0x1fb>
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
mulsd  -0x80(%rbp),%xmm0
movsd  -0x88(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
movsd  0xda9(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x78(%rbp),%xmm1
mulsd  -0x78(%rbp),%xmm1
mulsd  -0x88(%rbp),%xmm1
ff
movsd  -0x88(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm1
movsd  0xd7f(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
addsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm1
subsd  -0x88(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
movsd  -0x78(%rbp),%xmm1
mulsd  -0x78(%rbp),%xmm1
mulsd  -0x88(%rbp),%xmm1
ff
movsd  -0x88(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm1
movsd  0xd2b(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
addsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1214 <penalty+0xf4>
movsd  -0x90(%rbp),%xmm0
ff
divsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  0xce5(%rip),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  0xcd8(%rip),%xmm1
divsd  -0xa0(%rbp),%xmm1
ff
subsd  %xmm1,%xmm0
movsd  0xcbc(%rip),%xmm1
call   1030 <pow@plt>
movsd  -0x70(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x50(%rbp),%xmm0
addsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    1190 <penalty+0x70>
movsd  -0x10(%rbp),%xmm1
subsd  -0x8(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<penalty>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rdx,%r14
mov    %rsi,%r12
movsd  %xmm2,0x8(%rsp)
mov    %edi,%r15d
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x20(%rsp)
call   1040 <log10@plt>
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <log10@plt>
movsd  (%rsp),%xmm1
xorpd  %xmm2,%xmm2
movsd  %xmm0,0x18(%rsp)
ucomisd %xmm1,%xmm0
jae    1190 <penalty+0x70>
movsd  0x10(%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
divsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
movsd  0x18(%rsp),%xmm0
subsd  %xmm1,%xmm0
divsd  0xe5e(%rip),%xmm0
movsd  %xmm0,0x30(%rsp)
mov    $0x1,%eax
sub    %r15d,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0xe49(%rip),%xmm2
divsd  0x8(%rsp),%xmm2
movsd  %xmm2,0x28(%rsp)
lea    0x1(%r15),%ebx
movq   %xmm0,%xmm0
movdqa %xmm0,0x40(%rsp)
xorpd  %xmm2,%xmm2
jmp    122e <penalty+0x10e>
nop
subsd  %xmm9,%xmm0
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
divsd  %xmm2,%xmm1
movsd  0xe27(%rip),%xmm2
divsd  %xmm1,%xmm2
addsd  0x28(%rsp),%xmm2
mulsd  %xmm2,%xmm2
mulsd  %xmm0,%xmm2
movsd  0x8(%rsp),%xmm0
addsd  %xmm2,%xmm0
movapd %xmm0,%xmm2
movsd  (%rsp),%xmm1
movsd  0x18(%rsp),%xmm0
ucomisd %xmm1,%xmm0
jb     1170 <penalty+0x50>
movsd  %xmm2,0x8(%rsp)
movsd  0xdd4(%rip),%xmm0
movsd  %xmm1,(%rsp)
call   1030 <pow@plt>
movsd  %xmm0,0x38(%rsp)
movsd  (%rsp),%xmm1
addsd  0x30(%rsp),%xmm1
movsd  0xdb1(%rip),%xmm0
movsd  %xmm1,(%rsp)
call   1030 <pow@plt>
movsd  0x38(%rsp),%xmm9
movsd  0xd8f(%rip),%xmm8
movapd %xmm9,%xmm2
mulsd  0xd92(%rip),%xmm2
movapd 0x40(%rsp),%xmm1
test   %r15d,%r15d
jle    11e0 <penalty+0xc0>
movapd %xmm2,%xmm3
mulsd  %xmm2,%xmm3
mov    $0x1,%eax
movapd 0x40(%rsp),%xmm1
nopl   0x0(%rax,%rax,1)
movsd  (%r14,%rax,8),%xmm4
movsd  (%r12,%rax,8),%xmm5
addsd  %xmm4,%xmm5
movapd %xmm3,%xmm6
mulsd  %xmm5,%xmm6
movapd %xmm3,%xmm7
mulsd  %xmm4,%xmm6
mulsd  %xmm4,%xmm7
mulsd  %xmm4,%xmm7
addsd  %xmm8,%xmm7
addsd  %xmm8,%xmm6
subsd  %xmm4,%xmm5
mulsd  %xmm2,%xmm5
unpcklpd %xmm7,%xmm7
unpcklpd %xmm5,%xmm6
divpd  %xmm7,%xmm6
addpd  %xmm6,%xmm1
add    $0x1,%rax
cmp    %rax,%rbx
jne    12b0 <penalty+0x190>
jmp    11e0 <penalty+0xc0>

LLVM IR (-O0):
define double @penalty(double %0, double %1, i32 %2, double %3, double* %4, double* %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca double
%11 = alloca double*
%12 = alloca double*
%13 = alloca i32
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
store double %0, double* %7
store double %1, double* %8
store i32 %2, i32* %9
store double %3, double* %10
store double* %4, double** %11
store double* %5, double** %12
%27 = load double, double* %7
%28 = call double @log10(double %27)
store double %28, double* %14
%29 = load double, double* %8
%30 = call double @log10(double %29)
store double %30, double* %15
%31 = load double, double* %15
%32 = load double, double* %14
%33 = fsub double %31, %32
%34 = fdiv double %33, 1.000000e+02
store double %34, double* %16
store double 0.000000e+00, double* %18
%35 = load double, double* %14
store double %35, double* %17
br label %36
36: ; preds = %123, %6
%37 = load double, double* %17
%38 = load double, double* %15
%39 = fcmp ole double %37, %38
br i1 %39, label %40, label %127
40: ; preds = %36
%41 = load double, double* %17
%42 = call double @pow(double 1.000000e+01, double %41)
store double %42, double* %19
%43 = load double, double* %17
%44 = load double, double* %16
%45 = fadd double %43, %44
%46 = call double @pow(double 1.000000e+01, double %45)
%47 = load double, double* %19
%48 = fsub double %46, %47
store double %48, double* %20
%49 = load double, double* %19
%50 = fmul double 0x401921FB54442D11, %49
store double %50, double* %21
%51 = load i32, i32* %9
%52 = sub nsw i32 1, %51
%53 = sitofp i32 %52 to double
store double %53, double* %24
store double 0.000000e+00, double* %25
store i32 1, i32* %13
br label %54
54: ; preds = %107, %40
%55 = load i32, i32* %13
%56 = load i32, i32* %9
%57 = icmp sle i32 %55, %56
br i1 %57, label %58, label %110
58: ; preds = %54
%59 = load double*, double** %11
%60 = load i32, i32* %13
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds double, double* %59, i64 %61
%63 = load double, double* %62
%64 = load double*, double** %12
%65 = load i32, i32* %13
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double, double* %64, i64 %66
%68 = load double, double* %67
%69 = fadd double %63, %68
store double %69, double* %22
%70 = load double*, double** %12
%71 = load i32, i32* %13
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds double, double* %70, i64 %72
%74 = load double, double* %73
store double %74, double* %23
%75 = load double, double* %21
%76 = load double, double* %21
%77 = fmul double %75, %76
%78 = load double, double* %22
%79 = fmul double %77, %78
%80 = load double, double* %23
%81 = call double @llvm.fmuladd.f64(double %79, double %80, double 1.000000e+00)
%82 = load double, double* %21
%83 = load double, double* %21
%84 = fmul double %82, %83
%85 = load double, double* %23
%86 = fmul double %84, %85
%87 = load double, double* %23
%88 = call double @llvm.fmuladd.f64(double %86, double %87, double 1.000000e+00)
%89 = fdiv double %81, %88
%90 = load double, double* %24
%91 = fadd double %90, %89
store double %91, double* %24
%92 = load double, double* %21
%93 = load double, double* %22
%94 = load double, double* %23
%95 = fsub double %93, %94
%96 = fmul double %92, %95
%97 = load double, double* %21
%98 = load double, double* %21
%99 = fmul double %97, %98
%100 = load double, double* %23
%101 = fmul double %99, %100
%102 = load double, double* %23
%103 = call double @llvm.fmuladd.f64(double %101, double %102, double 1.000000e+00)
%104 = fdiv double %96, %103
%105 = load double, double* %25
%106 = fadd double %105, %104
store double %106, double* %25
br label %107
107: ; preds = %58
%108 = load i32, i32* %13
%109 = add nsw i32 %108, 1
store i32 %109, i32* %13
br label %54
110: ; preds = %54
%111 = load double, double* %24
%112 = load double, double* %25
%113 = fdiv double %111, %112
store double %113, double* %26
%114 = load double, double* %10
%115 = fdiv double 1.000000e+00, %114
%116 = load double, double* %26
%117 = fdiv double 1.000000e+00, %116
%118 = fsub double %115, %117
%119 = call double @pow(double %118, double 2.000000e+00)
%120 = load double, double* %20
%121 = load double, double* %18
%122 = call double @llvm.fmuladd.f64(double %119, double %120, double %121)
store double %122, double* %18
br label %123
123: ; preds = %110
%124 = load double, double* %16
%125 = load double, double* %17
%126 = fadd double %125, %124
store double %126, double* %17
br label %36
127: ; preds = %36
%128 = load double, double* %8
%129 = load double, double* %7
%130 = fsub double %128, %129
%131 = load double, double* %18
%132 = fdiv double %131, %130
store double %132, double* %18
%133 = load double, double* %18
ret double %133
}

LLVM IR (-O2):
define double @penalty(double %0, double %1, i32 %2, double %3, double* nocapture %4, double* nocapture %5) {
%7 = tail call double @log10(double %0)
%8 = tail call double @log10(double %1)
%9 = fsub double %8, %7
%10 = fdiv double %9, 1.000000e+02
%11 = fcmp ugt double %7, %8
br i1 %11, label %63, label %12
12: ; preds = %6
%13 = sub nsw i32 1, %2
%14 = sitofp i32 %13 to double
%15 = icmp slt i32 %2, 1
%16 = fdiv double 1.000000e+00, %3
%17 = add i32 %2, 1
%18 = zext i32 %17 to i64
%19 = insertelement <2 x double> <double poison, double 0.000000e+00>, double %14, i64 0
%20 = insertelement <2 x double> <double poison, double 0.000000e+00>, double %14, i64 0
br label %21
21: ; preds = %12, %53
%22 = phi double [ %7, %12 ], [ %25, %53 ]
%23 = phi double [ 0.000000e+00, %12 ], [ %61, %53 ]
%24 = tail call double @pow(double 1.000000e+01, double %22)
%25 = fadd double %10, %22
%26 = tail call double @pow(double 1.000000e+01, double %25)
%27 = fsub double %26, %24
%28 = fmul double %24, 0x401921FB54442D11
br i1 %15, label %53, label %29
29: ; preds = %21
%30 = fmul double %28, %28
br label %31
31: ; preds = %29, %31
%32 = phi i64 [ 1, %29 ], [ %51, %31 ]
%33 = phi <2 x double> [ %20, %29 ], [ %50, %31 ]
%34 = getelementptr inbounds double, double* %4, i64 %32
%35 = load double, double* %34
%36 = getelementptr inbounds double, double* %5, i64 %32
%37 = load double, double* %36
%38 = fadd double %35, %37
%39 = fmul double %30, %38
%40 = tail call double @llvm.fmuladd.f64(double %39, double %37, double 1.000000e+00)
%41 = fmul double %30, %37
%42 = tail call double @llvm.fmuladd.f64(double %41, double %37, double 1.000000e+00)
%43 = fsub double %38, %37
%44 = fmul double %28, %43
%45 = insertelement <2 x double> poison, double %40, i64 0
%46 = insertelement <2 x double> %45, double %44, i64 1
%47 = insertelement <2 x double> poison, double %42, i64 0
%48 = shufflevector <2 x double> %47, <2 x double> poison, <2 x i32> zeroinitializer
%49 = fdiv <2 x double> %46, %48
%50 = fadd <2 x double> %33, %49
%51 = add nuw nsw i64 %32, 1
%52 = icmp eq i64 %51, %18
br i1 %52, label %53, label %31
53: ; preds = %31, %21
%54 = phi <2 x double> [ %19, %21 ], [ %50, %31 ]
%55 = extractelement <2 x double> %54, i64 0
%56 = extractelement <2 x double> %54, i64 1
%57 = fdiv double %55, %56
%58 = fdiv double 1.000000e+00, %57
%59 = fsub double %16, %58
%60 = fmul double %59, %59
%61 = tail call double @llvm.fmuladd.f64(double %60, double %27, double %23)
%62 = fcmp ugt double %25, %8
br i1 %62, label %63, label %21
63: ; preds = %53, %6
%64 = phi double [ 0.000000e+00, %6 ], [ %61, %53 ]
%65 = fsub double %1, %0
%66 = fdiv double %64, %65
ret double %66
}