void double_direct_form_1_impl2(double x[], int x_size, double b[], int b_size,
                                double a[], int a_size, double y[]) {
  int i = 0;
  int j = 0;
  double v[x_size];
  for (i = 0; i < x_size; i++) {
    v[i] = 0;
    for (j = 0; j < b_size; j++) {
      if (j > i) {
        break;
      }
      v[i] = v[i] + x[i - j] * b[j];
    }
  }
  y[0] = v[0];
  for (i = 1; i < x_size; i++) {
    y[i] = 0;
    y[i] = y[i] + v[i];
    for (j = 1; j < a_size; j++) {
      if (j > i) {
        break;
      }
      y[i] = y[i] + y[i - j] * ((-1) * a[j]);
    }
  }
}


x86 assembly (clang, -O0):
<double_direct_form_1_impl2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0xc(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x40(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11fc <double_direct_form_1_impl2+0xfc>
mov    -0x50(%rbp),%rax
movslq -0x30(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11e9 <double_direct_form_1_impl2+0xe9>
mov    -0x34(%rbp),%eax
cmp    -0x30(%rbp),%eax
jle    119e <double_direct_form_1_impl2+0x9e>
jmp    11e9 <double_direct_form_1_impl2+0xe9>
mov    -0x50(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x8(%rbp),%rcx
mov    -0x30(%rbp),%edx
sub    -0x34(%rbp),%edx
movslq %edx,%rdx
movsd  (%rcx,%rdx,8),%xmm0
mov    -0x18(%rbp),%rcx
movslq -0x34(%rbp),%rdx
movsd  (%rcx,%rdx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movslq -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1181 <double_direct_form_1_impl2+0x81>
jmp    11ee <double_direct_form_1_impl2+0xee>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    115e <double_direct_form_1_impl2+0x5e>
mov    -0x50(%rbp),%rax
movsd  (%rax),%xmm0
mov    0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12e4 <double_direct_form_1_impl2+0x1e4>
mov    -0x50(%rbp),%rax
mov    0x10(%rbp),%rcx
movslq -0x30(%rbp),%rdx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rcx,%rdx,8)
mov    0x10(%rbp),%rcx
movslq -0x30(%rbp),%rdx
movsd  (%rcx,%rdx,8),%xmm0
movslq -0x30(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x1,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    12d1 <double_direct_form_1_impl2+0x1d1>
mov    -0x34(%rbp),%eax
cmp    -0x30(%rbp),%eax
jle    127a <double_direct_form_1_impl2+0x17a>
jmp    12d1 <double_direct_form_1_impl2+0x1d1>
mov    0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    0x10(%rbp),%rax
mov    -0x30(%rbp),%ecx
sub    -0x34(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  0xd57(%rip),%xmm2
mulsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    125d <double_direct_form_1_impl2+0x15d>
jmp    12d6 <double_direct_form_1_impl2+0x1d6>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1213 <double_direct_form_1_impl2+0x113>
mov    -0x40(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<double_direct_form_1_impl2>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r10d
mov    %rsp,%r11
lea    0xf(,%r10,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r11
mov    %r11,%rsp
test   %esi,%esi
jle    121b <double_direct_form_1_impl2+0x11b>
mov    0x10(%rbp),%r14
movslq %ecx,%r15
xor    %r12d,%r12d
jmp    1153 <double_direct_form_1_impl2+0x53>
nopw   0x0(%rax,%rax,1)
movsd  %xmm0,(%r11,%r12,8)
add    $0x1,%r12
add    $0x8,%rdi
cmp    %r10,%r12
je     1199 <double_direct_form_1_impl2+0x99>
movq   $0x0,(%r11,%r12,8)
test   %ecx,%ecx
jle    1146 <double_direct_form_1_impl2+0x46>
xorpd  %xmm0,%xmm0
mov    %rdi,%rbx
xor    %r13d,%r13d
nopl   0x0(%rax)
movapd %xmm0,%xmm1
movsd  (%rbx),%xmm0
mulsd  (%rdx,%r13,8),%xmm0
addsd  %xmm1,%xmm0
lea    0x1(%r13),%rax
cmp    %r15,%rax
jge    1140 <double_direct_form_1_impl2+0x40>
add    $0xfffffffffffffff8,%rbx
cmp    %r13,%r12
mov    %rax,%r13
ja     1170 <double_direct_form_1_impl2+0x70>
jmp    1140 <double_direct_form_1_impl2+0x40>
movsd  (%r11),%xmm0
movsd  %xmm0,(%r14)
cmp    $0x2,%esi
jl     121b <double_direct_form_1_impl2+0x11b>
movslq %r9d,%rcx
mov    $0x1,%edx
xorpd  %xmm0,%xmm0
mov    %r14,%rax
jmp    11cd <double_direct_form_1_impl2+0xcd>
nopl   0x0(%rax)
add    $0x1,%rdx
add    $0x8,%rax
cmp    %r10,%rdx
je     121b <double_direct_form_1_impl2+0x11b>
movsd  (%r11,%rdx,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r14,%rdx,8)
cmp    $0x2,%r9d
jl     11c0 <double_direct_form_1_impl2+0xc0>
mov    $0x1,%edi
mov    %rax,%rsi
nopl   0x0(%rax,%rax,1)
movsd  (%rsi),%xmm2
mulsd  (%r8,%rdi,8),%xmm2
subsd  %xmm2,%xmm1
movsd  %xmm1,(%r14,%rdx,8)
lea    0x1(%rdi),%rbx
cmp    %rcx,%rbx
jge    11c0 <double_direct_form_1_impl2+0xc0>
add    $0xfffffffffffffff8,%rsi
cmp    %rdi,%rdx
mov    %rbx,%rdi
ja     11f0 <double_direct_form_1_impl2+0xf0>
jmp    11c0 <double_direct_form_1_impl2+0xc0>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @double_direct_form_1_impl2(double* %0, i32 %1, double* %2, i32 %3, double* %4, i32 %5, double* %6) {
%8 = alloca double*
%9 = alloca i32
%10 = alloca double*
%11 = alloca i32
%12 = alloca double*
%13 = alloca i32
%14 = alloca double*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8*
%18 = alloca i64
store double* %0, double** %8
store i32 %1, i32* %9
store double* %2, double** %10
store i32 %3, i32* %11
store double* %4, double** %12
store i32 %5, i32* %13
store double* %6, double** %14
store i32 0, i32* %15
store i32 0, i32* %16
%19 = load i32, i32* %9
%20 = zext i32 %19 to i64
%21 = call i8* @llvm.stacksave()
store i8* %21, i8** %17
%22 = alloca double, i64 %20
store i64 %20, i64* %18
store i32 0, i32* %15
br label %23
23: ; preds = %65, %7
%24 = load i32, i32* %15
%25 = load i32, i32* %9
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %68
27: ; preds = %23
%28 = load i32, i32* %15
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %22, i64 %29
store double 0.000000e+00, double* %30
store i32 0, i32* %16
br label %31
31: ; preds = %61, %27
%32 = load i32, i32* %16
%33 = load i32, i32* %11
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %64
35: ; preds = %31
%36 = load i32, i32* %16
%37 = load i32, i32* %15
%38 = icmp sgt i32 %36, %37
br i1 %38, label %39, label %40
39: ; preds = %35
br label %64
40: ; preds = %35
%41 = load i32, i32* %15
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %22, i64 %42
%44 = load double, double* %43
%45 = load double*, double** %8
%46 = load i32, i32* %15
%47 = load i32, i32* %16
%48 = sub nsw i32 %46, %47
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %45, i64 %49
%51 = load double, double* %50
%52 = load double*, double** %10
%53 = load i32, i32* %16
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds double, double* %52, i64 %54
%56 = load double, double* %55
%57 = call double @llvm.fmuladd.f64(double %51, double %56, double %44)
%58 = load i32, i32* %15
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds double, double* %22, i64 %59
store double %57, double* %60
br label %61
61: ; preds = %40
%62 = load i32, i32* %16
%63 = add nsw i32 %62, 1
store i32 %63, i32* %16
br label %31
64: ; preds = %39, %31
br label %65
65: ; preds = %64
%66 = load i32, i32* %15
%67 = add nsw i32 %66, 1
store i32 %67, i32* %15
br label %23
68: ; preds = %23
%69 = getelementptr inbounds double, double* %22, i64 0
%70 = load double, double* %69
%71 = load double*, double** %14
%72 = getelementptr inbounds double, double* %71, i64 0
store double %70, double* %72
store i32 1, i32* %15
br label %73
73: ; preds = %133, %68
%74 = load i32, i32* %15
%75 = load i32, i32* %9
%76 = icmp slt i32 %74, %75
br i1 %76, label %77, label %136
77: ; preds = %73
%78 = load double*, double** %14
%79 = load i32, i32* %15
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds double, double* %78, i64 %80
store double 0.000000e+00, double* %81
%82 = load double*, double** %14
%83 = load i32, i32* %15
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds double, double* %82, i64 %84
%86 = load double, double* %85
%87 = load i32, i32* %15
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds double, double* %22, i64 %88
%90 = load double, double* %89
%91 = fadd double %86, %90
%92 = load double*, double** %14
%93 = load i32, i32* %15
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds double, double* %92, i64 %94
store double %91, double* %95
store i32 1, i32* %16
br label %96
96: ; preds = %129, %77
%97 = load i32, i32* %16
%98 = load i32, i32* %13
%99 = icmp slt i32 %97, %98
br i1 %99, label %100, label %132
100: ; preds = %96
%101 = load i32, i32* %16
%102 = load i32, i32* %15
%103 = icmp sgt i32 %101, %102
br i1 %103, label %104, label %105
104: ; preds = %100
br label %132
105: ; preds = %100
%106 = load double*, double** %14
%107 = load i32, i32* %15
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds double, double* %106, i64 %108
%110 = load double, double* %109
%111 = load double*, double** %14
%112 = load i32, i32* %15
%113 = load i32, i32* %16
%114 = sub nsw i32 %112, %113
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds double, double* %111, i64 %115
%117 = load double, double* %116
%118 = load double*, double** %12
%119 = load i32, i32* %16
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds double, double* %118, i64 %120
%122 = load double, double* %121
%123 = fmul double -1.000000e+00, %122
%124 = call double @llvm.fmuladd.f64(double %117, double %123, double %110)
%125 = load double*, double** %14
%126 = load i32, i32* %15
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds double, double* %125, i64 %127
store double %124, double* %128
br label %129
129: ; preds = %105
%130 = load i32, i32* %16
%131 = add nsw i32 %130, 1
store i32 %131, i32* %16
br label %96
132: ; preds = %104, %96
br label %133
133: ; preds = %132
%134 = load i32, i32* %15
%135 = add nsw i32 %134, 1
store i32 %135, i32* %15
br label %73
136: ; preds = %73
%137 = load i8*, i8** %17
ret void
}

LLVM IR (-O2):
define void @double_direct_form_1_impl2(double* nocapture %0, i32 %1, double* nocapture %2, i32 %3, double* nocapture %4, i32 %5, double* nocapture %6) {
%8 = zext i32 %1 to i64
%9 = alloca double, i64 %8
%10 = icmp sgt i32 %1, 0
br i1 %10, label %11, label %63
11: ; preds = %7
%12 = icmp slt i32 %3, 1
%13 = sext i32 %3 to i64
br label %14
14: ; preds = %11, %31
%15 = phi i64 [ 0, %11 ], [ %32, %31 ]
%16 = getelementptr inbounds double, double* %9, i64 %15
store double 0.000000e+00, double* %16
br i1 %12, label %31, label %17
17: ; preds = %14, %17
%18 = phi i64 [ %26, %17 ], [ 0, %14 ]
%19 = phi double [ %25, %17 ], [ 0.000000e+00, %14 ]
%20 = sub nsw i64 %15, %18
%21 = getelementptr inbounds double, double* %0, i64 %20
%22 = load double, double* %21
%23 = getelementptr inbounds double, double* %2, i64 %18
%24 = load double, double* %23
%25 = tail call double @llvm.fmuladd.f64(double %22, double %24, double %19)
%26 = add nuw nsw i64 %18, 1
%27 = icmp sge i64 %26, %13
%28 = icmp ule i64 %15, %18
%29 = select i1 %27, i1 true, i1 %28
br i1 %29, label %30, label %17
30: ; preds = %17
store double %25, double* %16
br label %31
31: ; preds = %30, %14
%32 = add nuw nsw i64 %15, 1
%33 = icmp eq i64 %32, %8
br i1 %33, label %34, label %14
34: ; preds = %31
%35 = load double, double* %9
store double %35, double* %6
%36 = icmp sgt i32 %1, 1
br i1 %36, label %37, label %63
37: ; preds = %34
%38 = icmp slt i32 %5, 2
%39 = sext i32 %5 to i64
br label %40
40: ; preds = %37, %60
%41 = phi i64 [ 1, %37 ], [ %61, %60 ]
%42 = getelementptr inbounds double, double* %6, i64 %41
%43 = getelementptr inbounds double, double* %9, i64 %41
%44 = load double, double* %43
%45 = fadd double %44, 0.000000e+00
store double %45, double* %42
br i1 %38, label %60, label %46
46: ; preds = %40, %46
%47 = phi double [ %55, %46 ], [ %45, %40 ]
%48 = phi i64 [ %56, %46 ], [ 1, %40 ]
%49 = sub nsw i64 %41, %48
%50 = getelementptr inbounds double, double* %6, i64 %49
%51 = load double, double* %50
%52 = getelementptr inbounds double, double* %4, i64 %48
%53 = load double, double* %52
%54 = fneg double %53
%55 = tail call double @llvm.fmuladd.f64(double %51, double %54, double %47)
store double %55, double* %42
%56 = add nuw nsw i64 %48, 1
%57 = icmp sge i64 %56, %39
%58 = icmp ule i64 %41, %48
%59 = select i1 %57, i1 true, i1 %58
br i1 %59, label %60, label %46
60: ; preds = %46, %40
%61 = add nuw nsw i64 %41, 1
%62 = icmp eq i64 %61, %8
br i1 %62, label %63, label %40
63: ; preds = %60, %7, %34
ret void
}