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


x86 assembly (clang, -O0):
<L18>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeeb(%rip),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movl   $0x0,-0xa4(%rbp)
movl   $0x2,-0xa4(%rbp)
cmpl   $0x13,-0xa4(%rbp)
jge    121f <L18+0x11f>
movsd  0xeb5(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mov    -0xa4(%rbp),%eax
sub    $0x1,%eax
cltq
movsd  -0xa0(%rbp,%rax,8),%xmm2
ff ff
mov    -0xa4(%rbp),%eax
sub    $0x2,%eax
cltq
movsd  -0xa0(%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    -0xa4(%rbp),%eax
sub    $0x1,%eax
cltq
movsd  -0xa0(%rbp,%rax,8),%xmm3
ff ff
mov    -0xa4(%rbp),%eax
sub    $0x2,%eax
cltq
movsd  -0xa0(%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 -0xa4(%rbp),%xmm2
ff
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movslq -0xa4(%rbp),%rax
movsd  %xmm0,-0xa0(%rbp,%rax,8)
ff ff
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    113e <L18+0x3e>
movsd  -0x10(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<L18>:
sub    $0x18,%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    $0x13,%rax
jne    1160 <L18+0x60>
movsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @L18(double %0) {
%2 = alloca double
%3 = alloca [19 x double]
%4 = alloca i32
store double %0, double* %2
%5 = getelementptr inbounds [19 x double], [19 x double]* %3, i64 0, i64 0
store double 1.000000e+00, double* %5
%6 = load double, double* %2
%7 = getelementptr inbounds [19 x double], [19 x double]* %3, i64 0, i64 1
store double %6, double* %7
store i32 0, i32* %4
store i32 2, i32* %4
br label %8
8: ; preds = %46, %1
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 19
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 [19 x double], [19 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 [19 x double], [19 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 [19 x double], [19 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 [19 x double], [19 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 [19 x double], [19 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 [19 x double], [19 x double]* %3, i64 0, i64 18
%51 = load double, double* %50
ret double %51
}

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