double double_transposed_direct_form_2(double w[], double x, double a[],
                                       double b[], int Na, int Nb) {
  double *a_ptr, *b_ptr;
  double yout = 0;
  a_ptr = &a[1];
  b_ptr = &b[0];
  int Nw = Na > Nb ? Na : Nb;
  yout = (*b_ptr++ * x) + w[0];
  yout = yout / a[0];
  int j;
  for (j = 0; j < Nw - 1; j++) {
    w[j] = w[j + 1];
    if (j < Na - 1) {
      w[j] -= *a_ptr++ * yout;
    }
    if (j < Nb - 1) {
      w[j] += *b_ptr++ * x;
    }
  }
  return yout;
}


x86 assembly (clang, -O0):
<double_transposed_direct_form_2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8d,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jle    114f <double_transposed_direct_form_2+0x4f>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4c(%rbp)
jmp    1155 <double_transposed_direct_form_2+0x55>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x38(%rbp)
movsd  (%rax),%xmm0
movsd  -0x10(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0x18(%rbp),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1281 <double_transposed_direct_form_2+0x181>
mov    -0x8(%rbp),%rax
mov    -0x48(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x48(%rbp),%eax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    122b <double_transposed_direct_form_2+0x12b>
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x30(%rbp)
movsd  (%rax),%xmm0
movsd  -0x40(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm0,%rdx
movabs $0x8000000000000000,%rsi
xor    %rsi,%rdx
movq   %rdx,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x48(%rbp),%eax
mov    -0x28(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    126e <double_transposed_direct_form_2+0x16e>
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x38(%rbp)
movsd  (%rax),%xmm0
movsd  -0x10(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    1273 <double_transposed_direct_form_2+0x173>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    11a1 <double_transposed_direct_form_2+0xa1>
movsd  -0x40(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<double_transposed_direct_form_2>:
cmp    %r8d,%ecx
mov    %r8d,%r9d
cmovg  %ecx,%r9d
movsd  (%rdx),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rdi),%xmm1
divsd  (%rsi),%xmm1
cmp    $0x2,%r9d
jl     118d <double_transposed_direct_form_2+0x8d>
add    $0xffffffff,%r9d
add    $0x8,%rdx
add    $0x8,%rsi
add    $0xffffffff,%ecx
add    $0xffffffff,%r8d
movslq %ecx,%r10
movslq %r8d,%r8
xor    %ecx,%ecx
jmp    1148 <double_transposed_direct_form_2+0x48>
nopl   (%rax)
mov    %rax,%rcx
cmp    %rax,%r9
je     118d <double_transposed_direct_form_2+0x8d>
movsd  0x8(%rdi,%rcx,8),%xmm2
movsd  %xmm2,(%rdi,%rcx,8)
cmp    %r10,%rcx
jge    116d <double_transposed_direct_form_2+0x6d>
movsd  (%rsi),%xmm3
mulsd  %xmm1,%xmm3
add    $0x8,%rsi
subsd  %xmm3,%xmm2
movsd  %xmm2,(%rdi,%rcx,8)
lea    0x1(%rcx),%rax
cmp    %r8,%rcx
jge    1140 <double_transposed_direct_form_2+0x40>
movsd  (%rdx),%xmm3
mulsd  %xmm0,%xmm3
add    $0x8,%rdx
addsd  %xmm2,%xmm3
movsd  %xmm3,(%rdi,%rcx,8)
jmp    1140 <double_transposed_direct_form_2+0x40>
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @double_transposed_direct_form_2(double* %0, double %1, double* %2, double* %3, i32 %4, i32 %5) {
%7 = alloca double*
%8 = alloca double
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32
%12 = alloca i32
%13 = alloca double*
%14 = alloca double*
%15 = alloca double
%16 = alloca i32
%17 = alloca i32
store double* %0, double** %7
store double %1, double* %8
store double* %2, double** %9
store double* %3, double** %10
store i32 %4, i32* %11
store i32 %5, i32* %12
store double 0.000000e+00, double* %15
%18 = load double*, double** %9
%19 = getelementptr inbounds double, double* %18, i64 1
store double* %19, double** %13
%20 = load double*, double** %10
%21 = getelementptr inbounds double, double* %20, i64 0
store double* %21, double** %14
%22 = load i32, i32* %11
%23 = load i32, i32* %12
%24 = icmp sgt i32 %22, %23
br i1 %24, label %25, label %27
25: ; preds = %6
%26 = load i32, i32* %11
br label %29
27: ; preds = %6
%28 = load i32, i32* %12
br label %29
29: ; preds = %27, %25
%30 = phi i32 [ %26, %25 ], [ %28, %27 ]
store i32 %30, i32* %16
%31 = load double*, double** %14
%32 = getelementptr inbounds double, double* %31, i32 1
store double* %32, double** %14
%33 = load double, double* %31
%34 = load double, double* %8
%35 = load double*, double** %7
%36 = getelementptr inbounds double, double* %35, i64 0
%37 = load double, double* %36
%38 = call double @llvm.fmuladd.f64(double %33, double %34, double %37)
store double %38, double* %15
%39 = load double, double* %15
%40 = load double*, double** %9
%41 = getelementptr inbounds double, double* %40, i64 0
%42 = load double, double* %41
%43 = fdiv double %39, %42
store double %43, double* %15
store i32 0, i32* %17
br label %44
44: ; preds = %93, %29
%45 = load i32, i32* %17
%46 = load i32, i32* %16
%47 = sub nsw i32 %46, 1
%48 = icmp slt i32 %45, %47
br i1 %48, label %49, label %96
49: ; preds = %44
%50 = load double*, double** %7
%51 = load i32, i32* %17
%52 = add nsw i32 %51, 1
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds double, double* %50, i64 %53
%55 = load double, double* %54
%56 = load double*, double** %7
%57 = load i32, i32* %17
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %56, i64 %58
store double %55, double* %59
%60 = load i32, i32* %17
%61 = load i32, i32* %11
%62 = sub nsw i32 %61, 1
%63 = icmp slt i32 %60, %62
br i1 %63, label %64, label %76
64: ; preds = %49
%65 = load double*, double** %13
%66 = getelementptr inbounds double, double* %65, i32 1
store double* %66, double** %13
%67 = load double, double* %65
%68 = load double, double* %15
%69 = load double*, double** %7
%70 = load i32, i32* %17
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds double, double* %69, i64 %71
%73 = load double, double* %72
%74 = fneg double %67
%75 = call double @llvm.fmuladd.f64(double %74, double %68, double %73)
store double %75, double* %72
br label %76
76: ; preds = %64, %49
%77 = load i32, i32* %17
%78 = load i32, i32* %12
%79 = sub nsw i32 %78, 1
%80 = icmp slt i32 %77, %79
br i1 %80, label %81, label %92
81: ; preds = %76
%82 = load double*, double** %14
%83 = getelementptr inbounds double, double* %82, i32 1
store double* %83, double** %14
%84 = load double, double* %82
%85 = load double, double* %8
%86 = load double*, double** %7
%87 = load i32, i32* %17
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds double, double* %86, i64 %88
%90 = load double, double* %89
%91 = call double @llvm.fmuladd.f64(double %84, double %85, double %90)
store double %91, double* %89
br label %92
92: ; preds = %81, %76
br label %93
93: ; preds = %92
%94 = load i32, i32* %17
%95 = add nsw i32 %94, 1
store i32 %95, i32* %17
br label %44
96: ; preds = %44
%97 = load double, double* %15
ret double %97
}

LLVM IR (-O2):
define double @double_transposed_direct_form_2(double* nocapture %0, double %1, double* nocapture %2, double* nocapture %3, i32 %4, i32 %5) {
%7 = icmp sgt i32 %4, %5
%8 = select i1 %7, i32 %4, i32 %5
%9 = load double, double* %3
%10 = load double, double* %0
%11 = tail call double @llvm.fmuladd.f64(double %9, double %1, double %10)
%12 = load double, double* %2
%13 = fdiv double %11, %12
%14 = icmp sgt i32 %8, 1
br i1 %14, label %15, label %49
15: ; preds = %6
%16 = add nsw i32 %8, -1
%17 = getelementptr inbounds double, double* %3, i64 1
%18 = getelementptr inbounds double, double* %2, i64 1
%19 = add nsw i32 %4, -1
%20 = add nsw i32 %5, -1
%21 = sext i32 %19 to i64
%22 = sext i32 %20 to i64
%23 = zext i32 %16 to i64
br label %24
24: ; preds = %15, %46
%25 = phi i64 [ 0, %15 ], [ %28, %46 ]
%26 = phi double* [ %18, %15 ], [ %40, %46 ]
%27 = phi double* [ %17, %15 ], [ %47, %46 ]
%28 = add nuw nsw i64 %25, 1
%29 = getelementptr inbounds double, double* %0, i64 %28
%30 = load double, double* %29
%31 = getelementptr inbounds double, double* %0, i64 %25
store double %30, double* %31
%32 = icmp slt i64 %25, %21
br i1 %32, label %33, label %38
33: ; preds = %24
%34 = getelementptr inbounds double, double* %26, i64 1
%35 = load double, double* %26
%36 = fneg double %35
%37 = tail call double @llvm.fmuladd.f64(double %36, double %13, double %30)
store double %37, double* %31
br label %38
38: ; preds = %33, %24
%39 = phi double [ %37, %33 ], [ %30, %24 ]
%40 = phi double* [ %34, %33 ], [ %26, %24 ]
%41 = icmp slt i64 %25, %22
br i1 %41, label %42, label %46
42: ; preds = %38
%43 = getelementptr inbounds double, double* %27, i64 1
%44 = load double, double* %27
%45 = tail call double @llvm.fmuladd.f64(double %44, double %1, double %39)
store double %45, double* %31
br label %46
46: ; preds = %38, %42
%47 = phi double* [ %43, %42 ], [ %27, %38 ]
%48 = icmp eq i64 %28, %23
br i1 %48, label %49, label %24
49: ; preds = %46, %6
ret double %13
}