double L21(double x) {
  double L[21 + 1];
  L[0] = 1.;
  L[1] = x;
  {
    for (int i = 2; i < 21 + 1; i++)
      L[i] = 2. * (x)*L[i - 1] - L[i - 2] -
             ((x)*L[i - 1] - L[i - 2]) / ((double)i);
  };
  return L[21];
}


x86 assembly (clang, -O0):
<L21>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeeb(%rip),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movl   $0x2,-0xc4(%rbp)
cmpl   $0x16,-0xc4(%rbp)
jge    1215 <L21+0x115>
movsd  0xebf(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mov    -0xc4(%rbp),%eax
sub    $0x1,%eax
cltq
movsd  -0xc0(%rbp,%rax,8),%xmm2
ff ff
mov    -0xc4(%rbp),%eax
sub    $0x2,%eax
cltq
movsd  -0xc0(%rbp,%rax,8),%xmm1
ff ff
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm1
mov    -0xc4(%rbp),%eax
sub    $0x1,%eax
cltq
movsd  -0xc0(%rbp,%rax,8),%xmm3
ff ff
mov    -0xc4(%rbp),%eax
sub    $0x2,%eax
cltq
movsd  -0xc0(%rbp,%rax,8),%xmm2
ff ff
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
cvtsi2sdl -0xc4(%rbp),%xmm2
ff
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movslq -0xc4(%rbp),%rax
movsd  %xmm0,-0xc0(%rbp,%rax,8)
ff ff
mov    -0xc4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc4(%rbp)
jmp    1134 <L21+0x34>
movsd  -0x18(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<L21>:
sub    $0x38,%rsp
movabs $0x3ff0000000000000,%rax
mov    %rax,-0x80(%rsp)
movsd  %xmm0,-0x78(%rsp)
movapd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm3
mulsd  %xmm0,%xmm3
movsd  0xecf(%rip),%xmm4
movapd %xmm0,%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm4,%xmm2
mulsd  0xec3(%rip),%xmm2
addsd  %xmm4,%xmm3
addsd  %xmm3,%xmm2
movsd  %xmm2,-0x70(%rsp)
mov    $0x3,%eax
nopl   0x0(%rax,%rax,1)
movsd  -0x90(%rsp,%rax,8),%xmm3
ff ff
movapd %xmm1,%xmm4
mulsd  %xmm2,%xmm4
subsd  %xmm3,%xmm4
mulsd  %xmm0,%xmm2
subsd  %xmm3,%xmm2
xorps  %xmm3,%xmm3
cvtsi2sd %eax,%xmm3
divsd  %xmm3,%xmm2
subsd  %xmm2,%xmm4
movsd  %xmm4,-0x80(%rsp,%rax,8)
add    $0x1,%rax
movapd %xmm4,%xmm2
cmp    $0x16,%rax
jne    1160 <L21+0x60>
movsd  0x28(%rsp),%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @L21(double %0) {
%2 = alloca double
%3 = alloca [22 x double]
%4 = alloca i32
store double %0, double* %2
%5 = getelementptr inbounds [22 x double], [22 x double]* %3, i64 0, i64 0
store double 1.000000e+00, double* %5
%6 = load double, double* %2
%7 = getelementptr inbounds [22 x double], [22 x double]* %3, i64 0, i64 1
store double %6, double* %7
store i32 2, i32* %4
br label %8
8: ; preds = %46, %1
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 22
br i1 %10, label %11, label %49
11: ; preds = %8
%12 = load double, double* %2
%13 = fmul double 2.000000e+00, %12
%14 = load i32, i32* %4
%15 = sub nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [22 x double], [22 x double]* %3, i64 0, i64 %16
%18 = load double, double* %17
%19 = load i32, i32* %4
%20 = sub nsw i32 %19, 2
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [22 x double], [22 x double]* %3, i64 0, i64 %21
%23 = load double, double* %22
%24 = fneg double %23
%25 = call double @llvm.fmuladd.f64(double %13, double %18, double %24)
%26 = load double, double* %2
%27 = load i32, i32* %4
%28 = sub nsw i32 %27, 1
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [22 x double], [22 x double]* %3, i64 0, i64 %29
%31 = load double, double* %30
%32 = load i32, i32* %4
%33 = sub nsw i32 %32, 2
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [22 x double], [22 x double]* %3, i64 0, i64 %34
%36 = load double, double* %35
%37 = fneg double %36
%38 = call double @llvm.fmuladd.f64(double %26, double %31, double %37)
%39 = load i32, i32* %4
%40 = sitofp i32 %39 to double
%41 = fdiv double %38, %40
%42 = fsub double %25, %41
%43 = load i32, i32* %4
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [22 x double], [22 x double]* %3, i64 0, i64 %44
store double %42, double* %45
br label %46
46: ; preds = %11
%47 = load i32, i32* %4
%48 = add nsw i32 %47, 1
store i32 %48, i32* %4
br label %8
49: ; preds = %8
%50 = getelementptr inbounds [22 x double], [22 x double]* %3, i64 0, i64 21
%51 = load double, double* %50
ret double %51
}

LLVM IR (-O2):
define double @L21(double %0) {
%2 = alloca [22 x double]
%3 = bitcast [22 x double]* %2 to i8*
%4 = getelementptr inbounds [22 x double], [22 x double]* %2, i64 0, i64 0
store double 1.000000e+00, double* %4
%5 = getelementptr inbounds [22 x double], [22 x double]* %2, i64 0, i64 1
store double %0, double* %5
%6 = fmul double %0, 2.000000e+00
%7 = tail call double @llvm.fmuladd.f64(double %6, double %0, double -1.000000e+00)
%8 = tail call double @llvm.fmuladd.f64(double %0, double %0, double -1.000000e+00)
%9 = fmul double %8, 5.000000e-01
%10 = fsub double %7, %9
%11 = getelementptr inbounds [22 x double], [22 x double]* %2, i64 0, i64 2
store double %10, double* %11
br label %15
12: ; preds = %15
%13 = getelementptr inbounds [22 x double], [22 x double]* %2, i64 0, i64 21
%14 = load double, double* %13
ret double %14
15: ; preds = %1, %15
%16 = phi i64 [ 3, %1 ], [ %30, %15 ]
%17 = phi double [ %10, %1 ], [ %28, %15 ]
%18 = phi i64 [ 2, %1 ], [ %16, %15 ]
%19 = add nsw i64 %18, -1
%20 = getelementptr inbounds [22 x double], [22 x double]* %2, i64 0, i64 %19
%21 = load double, double* %20
%22 = fneg double %21
%23 = tail call double @llvm.fmuladd.f64(double %6, double %17, double %22)
%24 = tail call double @llvm.fmuladd.f64(double %0, double %17, double %22)
%25 = trunc i64 %16 to i32
%26 = sitofp i32 %25 to double
%27 = fdiv double %24, %26
%28 = fsub double %23, %27
%29 = getelementptr inbounds [22 x double], [22 x double]* %2, i64 0, i64 %16
store double %28, double* %29
%30 = add nuw nsw i64 %16, 1
%31 = icmp eq i64 %30, 22
br i1 %31, label %12, label %15
}