double zerodft(double x, double *b, const int m, double *d) {
  int i;
  double out;
  out = b[0] * x + d[0];
  for (i = 1; i < m; i++)
    d[i - 1] = b[i] * x + d[i];
  d[m - 1] = b[m] * x;
  return (out);
}


x86 assembly (clang, -O0):
<zerodft>:
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
movsd  -0x8(%rbp),%xmm2
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1190 <zerodft+0x90>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x8(%rbp),%xmm2
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    113d <zerodft+0x3d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mulsd  -0x8(%rbp),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x30(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<zerodft>:
movapd %xmm0,%xmm1
movsd  (%rdi),%xmm0
movsd  (%rdx),%xmm8
cmp    $0x2,%esi
jl     12a2 <zerodft+0x1a2>
mov    %esi,%r9d
lea    -0x1(%r9),%r8
mov    $0x1,%ecx
cmp    $0x4,%r8
jb     1241 <zerodft+0x141>
lea    (%rdi,%r9,8),%rax
cmp    %rdx,%rax
jbe    1146 <zerodft+0x46>
lea    (%rdx,%r9,8),%r10
lea    0x8(%rdi),%rax
cmp    %r10,%rax
jb     1241 <zerodft+0x141>
mov    %r8,%rcx
and    $0xfffffffffffffffc,%rcx
movapd %xmm1,%xmm3
unpcklpd %xmm1,%xmm3
lea    -0x4(%rcx),%rax
mov    %rax,%r10
shr    $0x2,%r10
add    $0x1,%r10
test   %rax,%rax
je     12ba <zerodft+0x1ba>
mov    %r10,%r11
and    $0xfffffffffffffffe,%r11
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
movupd 0x8(%rdi,%rax,8),%xmm4
movupd 0x18(%rdi,%rax,8),%xmm5
mulpd  %xmm3,%xmm4
movupd 0x8(%rdx,%rax,8),%xmm6
addpd  %xmm4,%xmm6
movupd 0x18(%rdx,%rax,8),%xmm4
movupd 0x28(%rdx,%rax,8),%xmm7
movupd 0x38(%rdx,%rax,8),%xmm2
mulpd  %xmm3,%xmm5
addpd  %xmm4,%xmm5
movupd %xmm6,(%rdx,%rax,8)
movupd %xmm5,0x10(%rdx,%rax,8)
movupd 0x28(%rdi,%rax,8),%xmm4
movupd 0x38(%rdi,%rax,8),%xmm5
mulpd  %xmm3,%xmm4
addpd  %xmm7,%xmm4
mulpd  %xmm3,%xmm5
addpd  %xmm2,%xmm5
movupd %xmm4,0x20(%rdx,%rax,8)
movupd %xmm5,0x30(%rdx,%rax,8)
add    $0x8,%rax
add    $0xfffffffffffffffe,%r11
jne    1180 <zerodft+0x80>
test   $0x1,%r10b
je     1238 <zerodft+0x138>
lea    0x0(,%rax,8),%r10
or     $0x8,%r10
movupd (%rdi,%r10,1),%xmm2
movupd 0x10(%rdi,%r10,1),%xmm4
movupd (%rdx,%r10,1),%xmm5
movupd 0x10(%rdx,%r10,1),%xmm6
mulpd  %xmm3,%xmm2
addpd  %xmm5,%xmm2
mulpd  %xmm3,%xmm4
addpd  %xmm6,%xmm4
movupd %xmm2,(%rdx,%rax,8)
movupd %xmm4,0x10(%rdx,%rax,8)
cmp    %rcx,%r8
je     12a2 <zerodft+0x1a2>
or     $0x1,%rcx
mov    %rcx,%rax
not    %rax
test   $0x1,%r9b
jne    1265 <zerodft+0x165>
movsd  (%rdi,%rcx,8),%xmm2
mulsd  %xmm1,%xmm2
addsd  (%rdx,%rcx,8),%xmm2
movsd  %xmm2,-0x8(%rdx,%rcx,8)
add    $0x1,%rcx
add    %r9,%rax
je     12a2 <zerodft+0x1a2>
nopw   0x0(%rax,%rax,1)
movsd  (%rdi,%rcx,8),%xmm2
mulsd  %xmm1,%xmm2
addsd  (%rdx,%rcx,8),%xmm2
movsd  %xmm2,-0x8(%rdx,%rcx,8)
movsd  0x8(%rdi,%rcx,8),%xmm2
mulsd  %xmm1,%xmm2
addsd  0x8(%rdx,%rcx,8),%xmm2
movsd  %xmm2,(%rdx,%rcx,8)
add    $0x2,%rcx
cmp    %rcx,%r9
jne    1270 <zerodft+0x170>
mulsd  %xmm1,%xmm0
addsd  %xmm8,%xmm0
movslq %esi,%rax
mulsd  (%rdi,%rax,8),%xmm1
movsd  %xmm1,-0x8(%rdx,%rax,8)
ret
xor    %eax,%eax
test   $0x1,%r10b
jne    11f7 <zerodft+0xf7>
jmp    1238 <zerodft+0x138>

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

LLVM IR (-O2):
define double @zerodft(double %0, double* nocapture %1, i32 %2, double* nocapture %3) {
%5 = load double, double* %1
%6 = load double, double* %3
%7 = icmp sgt i32 %2, 1
br i1 %7, label %8, label %139
8: ; preds = %4
%9 = zext i32 %2 to i64
%10 = add nsw i64 %9, -1
%11 = icmp ult i64 %10, 4
br i1 %11, label %103, label %12
12: ; preds = %8
%13 = getelementptr double, double* %3, i64 %9
%14 = getelementptr double, double* %1, i64 1
%15 = getelementptr double, double* %1, i64 %9
%16 = icmp ugt double* %15, %3
%17 = icmp ult double* %14, %13
%18 = and i1 %16, %17
br i1 %18, label %103, label %19
19: ; preds = %12
%20 = and i64 %10, -4
%21 = or i64 %20, 1
%22 = insertelement <2 x double> poison, double %0, i64 0
%23 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> zeroinitializer
%24 = insertelement <2 x double> poison, double %0, i64 0
%25 = shufflevector <2 x double> %24, <2 x double> poison, <2 x i32> zeroinitializer
%26 = add nsw i64 %20, -4
%27 = lshr exact i64 %26, 2
%28 = add nuw nsw i64 %27, 1
%29 = and i64 %28, 1
%30 = icmp eq i64 %26, 0
br i1 %30, label %78, label %31
31: ; preds = %19
%32 = and i64 %28, 9223372036854775806
br label %33
33: ; preds = %33, %31
%34 = phi i64 [ 0, %31 ], [ %75, %33 ]
%35 = phi i64 [ 0, %31 ], [ %76, %33 ]
%36 = or i64 %34, 1
%37 = getelementptr inbounds double, double* %1, i64 %36
%38 = bitcast double* %37 to <2 x double>*
%39 = load <2 x double>, <2 x double>* %38
%40 = getelementptr inbounds double, double* %37, i64 2
%41 = bitcast double* %40 to <2 x double>*
%42 = load <2 x double>, <2 x double>* %41
%43 = getelementptr inbounds double, double* %3, i64 %36
%44 = bitcast double* %43 to <2 x double>*
%45 = load <2 x double>, <2 x double>* %44
%46 = getelementptr inbounds double, double* %43, i64 2
%47 = bitcast double* %46 to <2 x double>*
%48 = load <2 x double>, <2 x double>* %47
%49 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %39, <2 x double> %23, <2 x double> %45)
%50 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %42, <2 x double> %25, <2 x double> %48)
%51 = getelementptr inbounds double, double* %3, i64 %34
%52 = bitcast double* %51 to <2 x double>*
store <2 x double> %49, <2 x double>* %52
%53 = getelementptr inbounds double, double* %51, i64 2
%54 = bitcast double* %53 to <2 x double>*
store <2 x double> %50, <2 x double>* %54
%55 = or i64 %34, 4
%56 = or i64 %34, 5
%57 = getelementptr inbounds double, double* %1, i64 %56
%58 = bitcast double* %57 to <2 x double>*
%59 = load <2 x double>, <2 x double>* %58
%60 = getelementptr inbounds double, double* %57, i64 2
%61 = bitcast double* %60 to <2 x double>*
%62 = load <2 x double>, <2 x double>* %61
%63 = getelementptr inbounds double, double* %3, i64 %56
%64 = bitcast double* %63 to <2 x double>*
%65 = load <2 x double>, <2 x double>* %64
%66 = getelementptr inbounds double, double* %63, i64 2
%67 = bitcast double* %66 to <2 x double>*
%68 = load <2 x double>, <2 x double>* %67
%69 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %59, <2 x double> %23, <2 x double> %65)
%70 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %62, <2 x double> %25, <2 x double> %68)
%71 = getelementptr inbounds double, double* %3, i64 %55
%72 = bitcast double* %71 to <2 x double>*
store <2 x double> %69, <2 x double>* %72
%73 = getelementptr inbounds double, double* %71, i64 2
%74 = bitcast double* %73 to <2 x double>*
store <2 x double> %70, <2 x double>* %74
%75 = add nuw i64 %34, 8
%76 = add i64 %35, 2
%77 = icmp eq i64 %76, %32
br i1 %77, label %78, label %33
78: ; preds = %33, %19
%79 = phi i64 [ 0, %19 ], [ %75, %33 ]
%80 = icmp eq i64 %29, 0
br i1 %80, label %101, label %81
81: ; preds = %78
%82 = or i64 %79, 1
%83 = getelementptr inbounds double, double* %1, i64 %82
%84 = bitcast double* %83 to <2 x double>*
%85 = load <2 x double>, <2 x double>* %84
%86 = getelementptr inbounds double, double* %83, i64 2
%87 = bitcast double* %86 to <2 x double>*
%88 = load <2 x double>, <2 x double>* %87
%89 = getelementptr inbounds double, double* %3, i64 %82
%90 = bitcast double* %89 to <2 x double>*
%91 = load <2 x double>, <2 x double>* %90
%92 = getelementptr inbounds double, double* %89, i64 2
%93 = bitcast double* %92 to <2 x double>*
%94 = load <2 x double>, <2 x double>* %93
%95 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %85, <2 x double> %23, <2 x double> %91)
%96 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %88, <2 x double> %25, <2 x double> %94)
%97 = getelementptr inbounds double, double* %3, i64 %79
%98 = bitcast double* %97 to <2 x double>*
store <2 x double> %95, <2 x double>* %98
%99 = getelementptr inbounds double, double* %97, i64 2
%100 = bitcast double* %99 to <2 x double>*
store <2 x double> %96, <2 x double>* %100
br label %101
101: ; preds = %78, %81
%102 = icmp eq i64 %10, %20
br i1 %102, label %139, label %103
103: ; preds = %12, %8, %101
%104 = phi i64 [ 1, %12 ], [ 1, %8 ], [ %21, %101 ]
%105 = xor i64 %104, -1
%106 = and i64 %9, 1
%107 = icmp eq i64 %106, 0
br i1 %107, label %108, label %117
108: ; preds = %103
%109 = getelementptr inbounds double, double* %1, i64 %104
%110 = load double, double* %109
%111 = getelementptr inbounds double, double* %3, i64 %104
%112 = load double, double* %111
%113 = tail call double @llvm.fmuladd.f64(double %110, double %0, double %112)
%114 = add nsw i64 %104, -1
%115 = getelementptr inbounds double, double* %3, i64 %114
store double %113, double* %115
%116 = add nuw nsw i64 %104, 1
br label %117
117: ; preds = %108, %103
%118 = phi i64 [ %104, %103 ], [ %116, %108 ]
%119 = sub nsw i64 0, %9
%120 = icmp eq i64 %105, %119
br i1 %120, label %139, label %121
121: ; preds = %117, %121
%122 = phi i64 [ %137, %121 ], [ %118, %117 ]
%123 = getelementptr inbounds double, double* %1, i64 %122
%124 = load double, double* %123
%125 = getelementptr inbounds double, double* %3, i64 %122
%126 = load double, double* %125
%127 = tail call double @llvm.fmuladd.f64(double %124, double %0, double %126)
%128 = add nsw i64 %122, -1
%129 = getelementptr inbounds double, double* %3, i64 %128
store double %127, double* %129
%130 = add nuw nsw i64 %122, 1
%131 = getelementptr inbounds double, double* %1, i64 %130
%132 = load double, double* %131
%133 = getelementptr inbounds double, double* %3, i64 %130
%134 = load double, double* %133
%135 = tail call double @llvm.fmuladd.f64(double %132, double %0, double %134)
%136 = getelementptr inbounds double, double* %3, i64 %122
store double %135, double* %136
%137 = add nuw nsw i64 %122, 2
%138 = icmp eq i64 %137, %9
br i1 %138, label %139, label %121
139: ; preds = %117, %121, %101, %4
%140 = tail call double @llvm.fmuladd.f64(double %5, double %0, double %6)
%141 = sext i32 %2 to i64
%142 = getelementptr inbounds double, double* %1, i64 %141
%143 = load double, double* %142
%144 = fmul double %143, %0
%145 = add nsw i32 %2, -1
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds double, double* %3, i64 %146
store double %144, double* %147
ret double %140
}