double f_c(unsigned int k) {
  static const double one_over_12 = 1. / 12;
  static const double one_over_360 = 1. / 360;
  static const double one_over_1260 = 1. / 1260;
  static const double values[] = {.08106146679532726,  .04134069595540929,
                                  .02767792568499834,  .02079067210376509,
                                  .01664469118982119,  .01387612882307075,
                                  .01189670994589177,  .01041126526197209,
                                  .009255462182712733, .008330563433362871};
  if (k <= 9) {
    return values[k];
  } else {
    double recip_k_plus_1 = 1. / (k + 1);
    return (one_over_12 -
            (one_over_360 - one_over_1260 * recip_k_plus_1 * recip_k_plus_1) *
                recip_k_plus_1 * recip_k_plus_1) *
           recip_k_plus_1;
  }
}


x86 assembly (clang, -O0):
<f_c>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
ja     112c <f_c+0x2c>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
lea    0xf23(%rip),%rax
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11bc <f_c+0xbc>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %rax,%xmm1
movsd  0xed9(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xec0(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe8b(%rip),%xmm1
addsd  %xmm1,%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe52(%rip),%xmm1
addsd  %xmm1,%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_c>:
cmp    $0x9,%edi
ja     1114 <f_c+0x14>
mov    %edi,%eax
lea    0xf12(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm0
ret
add    $0x1,%edi
cvtsi2sd %rdi,%xmm0
movsd  0xedc(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0xed8(%rip),%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm1,%xmm2
addsd  0xed0(%rip),%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm1,%xmm2
movsd  0xec8(%rip),%xmm0
subsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
@f_c.one_over_12 = internal constant double 0x3FB5555555555555
@f_c.one_over_360 = internal constant double 0x3F66C16C16C16C17
@f_c.one_over_1260 = internal constant double 0x3F4A01A01A01A01A
@f_c.values = internal constant [10 x double] [double 0x3FB4C071BCDA0A5B, double 0x3FA52A9B923EA648, double 0x3F9C579A268D80B3, double 0x3F954A2662FD78A8, double 0x3F910B4E513FCBEC, double 0x3F8C6B167BEBDF37, double 0x3F885D4D612E4A86, double 0x3F8552805E7B3072, double 0x3F82F4871B12AB64, double 0x3F810F9D4C0743A7]
define double @f_c(i32 %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca double
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = icmp ule i32 %5, 9
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i32, i32* %3
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds [10 x double], [10 x double]* @f_c.values, i64 0, i64 %9
%11 = load double, double* %10
store double %11, double* %2
br label %29
12: ; preds = %1
%13 = load i32, i32* %3
%14 = add i32 %13, 1
%15 = uitofp i32 %14 to double
%16 = fdiv double 1.000000e+00, %15
store double %16, double* %4
%17 = load double, double* %4
%18 = fmul double 0x3F4A01A01A01A01A, %17
%19 = load double, double* %4
%20 = fneg double %18
%21 = call double @llvm.fmuladd.f64(double %20, double %19, double 0x3F66C16C16C16C17)
%22 = load double, double* %4
%23 = fmul double %21, %22
%24 = load double, double* %4
%25 = fneg double %23
%26 = call double @llvm.fmuladd.f64(double %25, double %24, double 0x3FB5555555555555)
%27 = load double, double* %4
%28 = fmul double %26, %27
store double %28, double* %2
br label %29
29: ; preds = %12, %7
%30 = load double, double* %2
ret double %30
}

LLVM IR (-O2):
@f_c.values = internal unnamed_addr constant [10 x double] [double 0x3FB4C071BCDA0A5B, double 0x3FA52A9B923EA648, double 0x3F9C579A268D80B3, double 0x3F954A2662FD78A8, double 0x3F910B4E513FCBEC, double 0x3F8C6B167BEBDF37, double 0x3F885D4D612E4A86, double 0x3F8552805E7B3072, double 0x3F82F4871B12AB64, double 0x3F810F9D4C0743A7]
define double @f_c(i32 %0) {
%2 = icmp ult i32 %0, 10
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = zext i32 %0 to i64
%5 = getelementptr inbounds [10 x double], [10 x double]* @f_c.values, i64 0, i64 %4
%6 = load double, double* %5
br label %17
7: ; preds = %1
%8 = add i32 %0, 1
%9 = uitofp i32 %8 to double
%10 = fdiv double 1.000000e+00, %9
%11 = fmul double %10, 0xBF4A01A01A01A01A
%12 = tail call double @llvm.fmuladd.f64(double %11, double %10, double 0x3F66C16C16C16C17)
%13 = fneg double %12
%14 = fmul double %10, %13
%15 = tail call double @llvm.fmuladd.f64(double %14, double %10, double 0x3FB5555555555555)
%16 = fmul double %10, %15
br label %17
17: ; preds = %7, %3
%18 = phi double [ %6, %3 ], [ %16, %7 ]
ret double %18
}