double ltcdf(double x, double *k, int m, double *d) {
  x -= k[m] * d[m - 1];
  for (m--; m >= 1; m--) {
    x -= k[m] * d[m - 1];
    d[m] = d[m - 1] + k[m] * x;
  }
  d[0] = x;
  return (x);
}


x86 assembly (clang, -O0):
<ltcdf>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x8(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jl     11fe <ltcdf+0xfe>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x8(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x8(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1165 <ltcdf+0x65>
movsd  -0x8(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ltcdf>:
movslq %esi,%rax
movsd  (%rdi,%rax,8),%xmm1
mulsd  -0x8(%rdx,%rax,8),%xmm1
subsd  %xmm1,%xmm0
cmp    $0x2,%eax
jl     1171 <ltcdf+0x71>
mov    %esi,%eax
mov    $0xfffffffe,%r8d
add    %rax,%r8
add    $0xffffffffffffffff,%rax
cs nopw 0x0(%rax,%rax,1)
mov    %eax,%esi
shl    $0x3,%rsi
movsd  (%rdi,%rsi,1),%xmm1
mov    %r8d,%ecx
movsd  (%rdx,%rcx,8),%xmm2
movapd %xmm1,%xmm3
mulsd  %xmm2,%xmm3
subsd  %xmm3,%xmm0
mulsd  %xmm0,%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,(%rdx,%rsi,1)
add    $0xffffffffffffffff,%r8
lea    -0x1(%rax),%rcx
add    $0x1,%rax
cmp    $0x2,%rax
mov    %rcx,%rax
ja     1130 <ltcdf+0x30>
movsd  %xmm0,(%rdx)
ret

LLVM IR (-O0):
define double @ltcdf(double %0, double* %1, i32 %2, double* %3) {
%5 = alloca double
%6 = alloca double*
%7 = alloca i32
%8 = alloca double*
store double %0, double* %5
store double* %1, double** %6
store i32 %2, i32* %7
store double* %3, double** %8
%9 = load double*, double** %6
%10 = load i32, i32* %7
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds double, double* %9, i64 %11
%13 = load double, double* %12
%14 = load double*, double** %8
%15 = load i32, i32* %7
%16 = sub nsw i32 %15, 1
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds double, double* %14, i64 %17
%19 = load double, double* %18
%20 = load double, double* %5
%21 = fneg double %13
%22 = call double @llvm.fmuladd.f64(double %21, double %19, double %20)
store double %22, double* %5
%23 = load i32, i32* %7
%24 = add nsw i32 %23, -1
store i32 %24, i32* %7
br label %25
25: ; preds = %60, %4
%26 = load i32, i32* %7
%27 = icmp sge i32 %26, 1
br i1 %27, label %28, label %63
28: ; preds = %25
%29 = load double*, double** %6
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %29, i64 %31
%33 = load double, double* %32
%34 = load double*, double** %8
%35 = load i32, i32* %7
%36 = sub nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %34, i64 %37
%39 = load double, double* %38
%40 = load double, double* %5
%41 = fneg double %33
%42 = call double @llvm.fmuladd.f64(double %41, double %39, double %40)
store double %42, double* %5
%43 = load double*, double** %8
%44 = load i32, i32* %7
%45 = sub nsw i32 %44, 1
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %43, i64 %46
%48 = load double, double* %47
%49 = load double*, double** %6
%50 = load i32, i32* %7
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds double, double* %49, i64 %51
%53 = load double, double* %52
%54 = load double, double* %5
%55 = call double @llvm.fmuladd.f64(double %53, double %54, double %48)
%56 = load double*, double** %8
%57 = load i32, i32* %7
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %56, i64 %58
store double %55, double* %59
br label %60
60: ; preds = %28
%61 = load i32, i32* %7
%62 = add nsw i32 %61, -1
store i32 %62, i32* %7
br label %25
63: ; preds = %25
%64 = load double, double* %5
%65 = load double*, double** %8
%66 = getelementptr inbounds double, double* %65, i64 0
store double %64, double* %66
%67 = load double, double* %5
ret double %67
}

LLVM IR (-O2):
define double @ltcdf(double %0, double* nocapture %1, i32 %2, double* nocapture %3) {
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds double, double* %1, i64 %5
%7 = load double, double* %6
%8 = add nsw i32 %2, -1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds double, double* %3, i64 %9
%11 = load double, double* %10
%12 = fneg double %7
%13 = tail call double @llvm.fmuladd.f64(double %12, double %11, double %0)
%14 = icmp sgt i32 %2, 1
br i1 %14, label %15, label %33
15: ; preds = %4
%16 = zext i32 %2 to i64
br label %17
17: ; preds = %15, %17
%18 = phi i64 [ %16, %15 ], [ %20, %17 ]
%19 = phi double [ %13, %15 ], [ %29, %17 ]
%20 = add nsw i64 %18, -1
%21 = and i64 %20, 4294967295
%22 = getelementptr inbounds double, double* %1, i64 %21
%23 = load double, double* %22
%24 = add nuw i64 %18, 4294967294
%25 = and i64 %24, 4294967295
%26 = getelementptr inbounds double, double* %3, i64 %25
%27 = load double, double* %26
%28 = fneg double %23
%29 = tail call double @llvm.fmuladd.f64(double %28, double %27, double %19)
%30 = tail call double @llvm.fmuladd.f64(double %23, double %29, double %27)
%31 = getelementptr inbounds double, double* %3, i64 %21
store double %30, double* %31
%32 = icmp ugt i64 %18, 2
br i1 %32, label %17, label %33
33: ; preds = %17, %4
%34 = phi double [ %13, %4 ], [ %29, %17 ]
store double %34, double* %3
ret double %34
}