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


x86 assembly (clang, -O0):
<zerodf>:
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
movsd  (%rax),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1197 <zerodf+0x97>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%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    112f <zerodf+0x2f>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<zerodf>:
movsd  (%rdi),%xmm2
mulsd  %xmm0,%xmm2
cmp    $0x2,%esi
jl     1155 <zerodf+0x55>
mov    %esi,%eax
mov    $0xfffffffe,%ecx
add    %rax,%rcx
add    $0xffffffffffffffff,%rax
nopl   0x0(%rax,%rax,1)
movsd  0x8(%rdi,%rax,8),%xmm1
mov    %eax,%r8d
mulsd  (%rdx,%r8,8),%xmm1
addsd  %xmm1,%xmm2
mov    %ecx,%esi
movsd  (%rdx,%rsi,8),%xmm1
movsd  %xmm1,(%rdx,%r8,8)
add    $0xffffffffffffffff,%rcx
lea    -0x1(%rax),%rsi
add    $0x1,%rax
cmp    $0x2,%rax
mov    %rsi,%rax
ja     1120 <zerodf+0x20>
movsd  0x8(%rdi),%xmm1
mulsd  (%rdx),%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm0,(%rdx)
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @zerodf(double %0, double* %1, i32 %2, double* %3) {
%5 = alloca double
%6 = alloca double*
%7 = alloca i32
%8 = alloca double*
%9 = alloca double
store double %0, double* %5
store double* %1, double** %6
store i32 %2, i32* %7
store double* %3, double** %8
%10 = load double*, double** %6
%11 = getelementptr inbounds double, double* %10, i64 0
%12 = load double, double* %11
%13 = load double, double* %5
%14 = fmul double %12, %13
store double %14, double* %9
%15 = load i32, i32* %7
%16 = add nsw i32 %15, -1
store i32 %16, i32* %7
br label %17
17: ; preds = %44, %4
%18 = load i32, i32* %7
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %47
20: ; preds = %17
%21 = load double*, double** %6
%22 = load i32, i32* %7
%23 = add nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds double, double* %21, i64 %24
%26 = load double, double* %25
%27 = load double*, double** %8
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %27, i64 %29
%31 = load double, double* %30
%32 = load double, double* %9
%33 = call double @llvm.fmuladd.f64(double %26, double %31, double %32)
store double %33, double* %9
%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** %8
%41 = load i32, i32* %7
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %40, i64 %42
store double %39, double* %43
br label %44
44: ; preds = %20
%45 = load i32, i32* %7
%46 = add nsw i32 %45, -1
store i32 %46, i32* %7
br label %17
47: ; preds = %17
%48 = load double*, double** %6
%49 = getelementptr inbounds double, double* %48, i64 1
%50 = load double, double* %49
%51 = load double*, double** %8
%52 = getelementptr inbounds double, double* %51, i64 0
%53 = load double, double* %52
%54 = load double, double* %9
%55 = call double @llvm.fmuladd.f64(double %50, double %53, double %54)
store double %55, double* %9
%56 = load double, double* %5
%57 = load double*, double** %8
%58 = getelementptr inbounds double, double* %57, i64 0
store double %56, double* %58
%59 = load double, double* %9
ret double %59
}

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