#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
scalar_t__ calloc(int, int);
double *trinomial_mult(int n, double *b, double *c) {
  int i, j;
  double *a;
  a = (double *)calloc(4 * n, sizeof(double));
  if (a == NULL)
    return (NULL);
  a[2] = c[0];
  a[3] = c[1];
  a[0] = b[0];
  a[1] = b[1];
  for (i = 1; i < n; ++i) {
    a[2 * (2 * i + 1)] +=
        c[2 * i] * a[2 * (2 * i - 1)] - c[2 * i + 1] * a[2 * (2 * i - 1) + 1];
    a[2 * (2 * i + 1) + 1] +=
        c[2 * i] * a[2 * (2 * i - 1) + 1] + c[2 * i + 1] * a[2 * (2 * i - 1)];
    for (j = 2 * i; j > 1; --j) {
      a[2 * j] += b[2 * i] * a[2 * (j - 1)] -
                  b[2 * i + 1] * a[2 * (j - 1) + 1] +
                  c[2 * i] * a[2 * (j - 2)] - c[2 * i + 1] * a[2 * (j - 2) + 1];
      a[2 * j + 1] +=
          b[2 * i] * a[2 * (j - 1) + 1] + b[2 * i + 1] * a[2 * (j - 1)] +
          c[2 * i] * a[2 * (j - 2) + 1] + c[2 * i + 1] * a[2 * (j - 2)];
    }
    a[2] += b[2 * i] * a[0] - b[2 * i + 1] * a[1] + c[2 * i];
    a[3] += b[2 * i] * a[1] + b[2 * i + 1] * a[0] + c[2 * i + 1];
    a[0] += b[2 * i];
    a[1] += b[2 * i + 1];
  }
  return (a);
}


x86 assembly (clang, -O0):
<trinomial_mult>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0xc(%rbp),%edi
shl    $0x2,%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    114f <trinomial_mult+0x3f>
movq   $0x0,-0x8(%rbp)
jmp    15f0 <trinomial_mult+0x4e0>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x18(%rax)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    15e8 <trinomial_mult+0x4d8>
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x30(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x30(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x1,-0x28(%rbp)
jle    14bf <trinomial_mult+0x3af>
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%ecx
sub    $0x1,%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%ecx
sub    $0x1,%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%ecx
sub    $0x2,%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%ecx
sub    $0x2,%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%ecx
sub    $0x1,%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%ecx
sub    $0x1,%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%ecx
sub    $0x2,%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%ecx
sub    $0x2,%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    12c8 <trinomial_mult+0x1b8>
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x30(%rbp),%rax
mulsd  0x8(%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
addsd  0x10(%rax),%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x30(%rbp),%rax
mulsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
addsd  0x18(%rax),%xmm0
movsd  %xmm0,0x18(%rax)
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
addsd  0x8(%rax),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    119b <trinomial_mult+0x8b>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trinomial_mult>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r12
mov    %edi,%r15d
lea    0x0(,%r15,4),%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
test   %rax,%rax
je     1347 <trinomial_mult+0x237>
movsd  (%r14),%xmm0
movsd  %xmm0,0x10(%rax)
movsd  0x8(%r14),%xmm0
movsd  %xmm0,0x18(%rax)
movsd  (%r12),%xmm0
movsd  %xmm0,(%rax)
movsd  0x8(%r12),%xmm0
movsd  %xmm0,0x8(%rax)
cmp    $0x2,%r15d
jl     1349 <trinomial_mult+0x239>
mov    %r15d,%r8d
mov    $0x1,%r11d
mov    $0x3,%r10d
xor    %r9d,%r9d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    (%r11,%r11,1),%rcx
mov    %r11,%rdx
shl    $0x4,%rdx
lea    (%r11,%r11,1),%rdi
add    $0x1,%rdi
mov    %r11,%rsi
shl    $0x5,%rsi
movsd  -0x10(%rsi,%rax,1),%xmm0
movsd  -0x8(%rsi,%rax,1),%xmm1
movsd  0x8(%r14,%rcx,8),%xmm2
mulsd  %xmm1,%xmm2
movsd  (%r14,%rdx,1),%xmm3
mulsd  %xmm0,%xmm3
subsd  %xmm2,%xmm3
mov    %rdi,%rsi
shl    $0x4,%rsi
addsd  (%rax,%rsi,1),%xmm3
movsd  %xmm3,(%rax,%rsi,1)
mulsd  0x8(%r14,%rcx,8),%xmm0
mulsd  (%r14,%rdx,1),%xmm1
addsd  %xmm0,%xmm1
addsd  0x8(%rax,%rsi,1),%xmm1
movsd  %xmm1,0x8(%rax,%rsi,1)
mov    %r9d,%esi
mov    %r10,%rdx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x4(%rsi),%ebp
lea    0x2(%rsi),%ebx
movslq %ebx,%rbx
movsd  (%rax,%rbx,8),%xmm0
lea    0x3(%rsi),%ebx
movslq %ebx,%rbx
movsd  (%rax,%rbx,8),%xmm1
movsd  (%r12,%rdi,8),%xmm3
mulsd  %xmm1,%xmm3
movsd  (%r12,%rcx,8),%xmm4
mulsd  %xmm0,%xmm4
movslq %esi,%rsi
movsd  (%rax,%rsi,8),%xmm2
movsd  (%r14,%rcx,8),%xmm5
subsd  %xmm3,%xmm4
mulsd  %xmm2,%xmm5
lea    0x1(%rsi),%ebx
movslq %ebx,%rbx
addsd  %xmm4,%xmm5
movsd  (%rax,%rbx,8),%xmm3
movsd  (%r14,%rdi,8),%xmm4
mulsd  %xmm3,%xmm4
subsd  %xmm4,%xmm5
movslq %ebp,%rbx
addsd  (%rax,%rbx,8),%xmm5
movsd  %xmm5,(%rax,%rbx,8)
mulsd  (%r12,%rdi,8),%xmm0
mulsd  (%r12,%rcx,8),%xmm1
mulsd  (%r14,%rcx,8),%xmm3
addsd  %xmm0,%xmm1
addsd  %xmm1,%xmm3
mulsd  (%r14,%rdi,8),%xmm2
addsd  %xmm3,%xmm2
lea    0x5(%rsi),%ebx
movslq %ebx,%rbx
addsd  (%rax,%rbx,8),%xmm2
movsd  %xmm2,(%rax,%rbx,8)
add    $0xffffffffffffffff,%rdx
add    $0xfffffffe,%esi
cmp    $0x2,%rdx
jg     1210 <trinomial_mult+0x100>
movsd  (%rax),%xmm0
movsd  0x8(%rax),%xmm1
movsd  (%r12,%rdi,8),%xmm2
mulsd  %xmm1,%xmm2
movsd  (%r12,%rcx,8),%xmm3
mulsd  %xmm0,%xmm3
subsd  %xmm2,%xmm3
addsd  (%r14,%rcx,8),%xmm3
addsd  0x10(%rax),%xmm3
movsd  %xmm3,0x10(%rax)
movsd  (%r12,%rdi,8),%xmm2
mulsd  %xmm0,%xmm2
movsd  (%r12,%rcx,8),%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm2,%xmm3
addsd  (%r14,%rdi,8),%xmm3
addsd  0x18(%rax),%xmm3
movsd  %xmm3,0x18(%rax)
addsd  (%r12,%rcx,8),%xmm0
movsd  %xmm0,(%rax)
addsd  (%r12,%rdi,8),%xmm1
movsd  %xmm1,0x8(%rax)
add    $0x1,%r11
add    $0x2,%r10
add    $0x4,%r9d
cmp    %r8,%r11
jne    1190 <trinomial_mult+0x80>
jmp    1349 <trinomial_mult+0x239>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double* @trinomial_mult(i32 %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32
%9 = alloca i32
%10 = alloca double*
store i32 %0, i32* %5
store double* %1, double** %6
store double* %2, double** %7
%11 = load i32, i32* %5
%12 = mul nsw i32 4, %11
%13 = call i64 @calloc(i32 %12, i32 8)
%14 = inttoptr i64 %13 to double*
store double* %14, double** %10
%15 = load double*, double** %10
%16 = icmp eq double* %15, null
br i1 %16, label %17, label %18
17: ; preds = %3
store double* null, double** %4
br label %367
18: ; preds = %3
%19 = load double*, double** %7
%20 = getelementptr inbounds double, double* %19, i64 0
%21 = load double, double* %20
%22 = load double*, double** %10
%23 = getelementptr inbounds double, double* %22, i64 2
store double %21, double* %23
%24 = load double*, double** %7
%25 = getelementptr inbounds double, double* %24, i64 1
%26 = load double, double* %25
%27 = load double*, double** %10
%28 = getelementptr inbounds double, double* %27, i64 3
store double %26, double* %28
%29 = load double*, double** %6
%30 = getelementptr inbounds double, double* %29, i64 0
%31 = load double, double* %30
%32 = load double*, double** %10
%33 = getelementptr inbounds double, double* %32, i64 0
store double %31, double* %33
%34 = load double*, double** %6
%35 = getelementptr inbounds double, double* %34, i64 1
%36 = load double, double* %35
%37 = load double*, double** %10
%38 = getelementptr inbounds double, double* %37, i64 1
store double %36, double* %38
store i32 1, i32* %8
br label %39
39: ; preds = %362, %18
%40 = load i32, i32* %8
%41 = load i32, i32* %5
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %365
43: ; preds = %39
%44 = load double*, double** %7
%45 = load i32, i32* %8
%46 = mul nsw i32 2, %45
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds double, double* %44, i64 %47
%49 = load double, double* %48
%50 = load double*, double** %10
%51 = load i32, i32* %8
%52 = mul nsw i32 2, %51
%53 = sub nsw i32 %52, 1
%54 = mul nsw i32 2, %53
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds double, double* %50, i64 %55
%57 = load double, double* %56
%58 = load double*, double** %7
%59 = load i32, i32* %8
%60 = mul nsw i32 2, %59
%61 = add nsw i32 %60, 1
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds double, double* %58, i64 %62
%64 = load double, double* %63
%65 = load double*, double** %10
%66 = load i32, i32* %8
%67 = mul nsw i32 2, %66
%68 = sub nsw i32 %67, 1
%69 = mul nsw i32 2, %68
%70 = add nsw i32 %69, 1
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds double, double* %65, i64 %71
%73 = load double, double* %72
%74 = fmul double %64, %73
%75 = fneg double %74
%76 = call double @llvm.fmuladd.f64(double %49, double %57, double %75)
%77 = load double*, double** %10
%78 = load i32, i32* %8
%79 = mul nsw i32 2, %78
%80 = add nsw i32 %79, 1
%81 = mul nsw i32 2, %80
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds double, double* %77, i64 %82
%84 = load double, double* %83
%85 = fadd double %84, %76
store double %85, double* %83
%86 = load double*, double** %7
%87 = load i32, i32* %8
%88 = mul nsw i32 2, %87
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds double, double* %86, i64 %89
%91 = load double, double* %90
%92 = load double*, double** %10
%93 = load i32, i32* %8
%94 = mul nsw i32 2, %93
%95 = sub nsw i32 %94, 1
%96 = mul nsw i32 2, %95
%97 = add nsw i32 %96, 1
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds double, double* %92, i64 %98
%100 = load double, double* %99
%101 = load double*, double** %7
%102 = load i32, i32* %8
%103 = mul nsw i32 2, %102
%104 = add nsw i32 %103, 1
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds double, double* %101, i64 %105
%107 = load double, double* %106
%108 = load double*, double** %10
%109 = load i32, i32* %8
%110 = mul nsw i32 2, %109
%111 = sub nsw i32 %110, 1
%112 = mul nsw i32 2, %111
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds double, double* %108, i64 %113
%115 = load double, double* %114
%116 = fmul double %107, %115
%117 = call double @llvm.fmuladd.f64(double %91, double %100, double %116)
%118 = load double*, double** %10
%119 = load i32, i32* %8
%120 = mul nsw i32 2, %119
%121 = add nsw i32 %120, 1
%122 = mul nsw i32 2, %121
%123 = add nsw i32 %122, 1
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds double, double* %118, i64 %124
%126 = load double, double* %125
%127 = fadd double %126, %117
store double %127, double* %125
%128 = load i32, i32* %8
%129 = mul nsw i32 2, %128
store i32 %129, i32* %9
br label %130
130: ; preds = %271, %43
%131 = load i32, i32* %9
%132 = icmp sgt i32 %131, 1
br i1 %132, label %133, label %274
133: ; preds = %130
%134 = load double*, double** %6
%135 = load i32, i32* %8
%136 = mul nsw i32 2, %135
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds double, double* %134, i64 %137
%139 = load double, double* %138
%140 = load double*, double** %10
%141 = load i32, i32* %9
%142 = sub nsw i32 %141, 1
%143 = mul nsw i32 2, %142
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds double, double* %140, i64 %144
%146 = load double, double* %145
%147 = load double*, double** %6
%148 = load i32, i32* %8
%149 = mul nsw i32 2, %148
%150 = add nsw i32 %149, 1
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds double, double* %147, i64 %151
%153 = load double, double* %152
%154 = load double*, double** %10
%155 = load i32, i32* %9
%156 = sub nsw i32 %155, 1
%157 = mul nsw i32 2, %156
%158 = add nsw i32 %157, 1
%159 = sext i32 %158 to i64
%160 = getelementptr inbounds double, double* %154, i64 %159
%161 = load double, double* %160
%162 = fmul double %153, %161
%163 = fneg double %162
%164 = call double @llvm.fmuladd.f64(double %139, double %146, double %163)
%165 = load double*, double** %7
%166 = load i32, i32* %8
%167 = mul nsw i32 2, %166
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds double, double* %165, i64 %168
%170 = load double, double* %169
%171 = load double*, double** %10
%172 = load i32, i32* %9
%173 = sub nsw i32 %172, 2
%174 = mul nsw i32 2, %173
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds double, double* %171, i64 %175
%177 = load double, double* %176
%178 = call double @llvm.fmuladd.f64(double %170, double %177, double %164)
%179 = load double*, double** %7
%180 = load i32, i32* %8
%181 = mul nsw i32 2, %180
%182 = add nsw i32 %181, 1
%183 = sext i32 %182 to i64
%184 = getelementptr inbounds double, double* %179, i64 %183
%185 = load double, double* %184
%186 = load double*, double** %10
%187 = load i32, i32* %9
%188 = sub nsw i32 %187, 2
%189 = mul nsw i32 2, %188
%190 = add nsw i32 %189, 1
%191 = sext i32 %190 to i64
%192 = getelementptr inbounds double, double* %186, i64 %191
%193 = load double, double* %192
%194 = fneg double %185
%195 = call double @llvm.fmuladd.f64(double %194, double %193, double %178)
%196 = load double*, double** %10
%197 = load i32, i32* %9
%198 = mul nsw i32 2, %197
%199 = sext i32 %198 to i64
%200 = getelementptr inbounds double, double* %196, i64 %199
%201 = load double, double* %200
%202 = fadd double %201, %195
store double %202, double* %200
%203 = load double*, double** %6
%204 = load i32, i32* %8
%205 = mul nsw i32 2, %204
%206 = sext i32 %205 to i64
%207 = getelementptr inbounds double, double* %203, i64 %206
%208 = load double, double* %207
%209 = load double*, double** %10
%210 = load i32, i32* %9
%211 = sub nsw i32 %210, 1
%212 = mul nsw i32 2, %211
%213 = add nsw i32 %212, 1
%214 = sext i32 %213 to i64
%215 = getelementptr inbounds double, double* %209, i64 %214
%216 = load double, double* %215
%217 = load double*, double** %6
%218 = load i32, i32* %8
%219 = mul nsw i32 2, %218
%220 = add nsw i32 %219, 1
%221 = sext i32 %220 to i64
%222 = getelementptr inbounds double, double* %217, i64 %221
%223 = load double, double* %222
%224 = load double*, double** %10
%225 = load i32, i32* %9
%226 = sub nsw i32 %225, 1
%227 = mul nsw i32 2, %226
%228 = sext i32 %227 to i64
%229 = getelementptr inbounds double, double* %224, i64 %228
%230 = load double, double* %229
%231 = fmul double %223, %230
%232 = call double @llvm.fmuladd.f64(double %208, double %216, double %231)
%233 = load double*, double** %7
%234 = load i32, i32* %8
%235 = mul nsw i32 2, %234
%236 = sext i32 %235 to i64
%237 = getelementptr inbounds double, double* %233, i64 %236
%238 = load double, double* %237
%239 = load double*, double** %10
%240 = load i32, i32* %9
%241 = sub nsw i32 %240, 2
%242 = mul nsw i32 2, %241
%243 = add nsw i32 %242, 1
%244 = sext i32 %243 to i64
%245 = getelementptr inbounds double, double* %239, i64 %244
%246 = load double, double* %245
%247 = call double @llvm.fmuladd.f64(double %238, double %246, double %232)
%248 = load double*, double** %7
%249 = load i32, i32* %8
%250 = mul nsw i32 2, %249
%251 = add nsw i32 %250, 1
%252 = sext i32 %251 to i64
%253 = getelementptr inbounds double, double* %248, i64 %252
%254 = load double, double* %253
%255 = load double*, double** %10
%256 = load i32, i32* %9
%257 = sub nsw i32 %256, 2
%258 = mul nsw i32 2, %257
%259 = sext i32 %258 to i64
%260 = getelementptr inbounds double, double* %255, i64 %259
%261 = load double, double* %260
%262 = call double @llvm.fmuladd.f64(double %254, double %261, double %247)
%263 = load double*, double** %10
%264 = load i32, i32* %9
%265 = mul nsw i32 2, %264
%266 = add nsw i32 %265, 1
%267 = sext i32 %266 to i64
%268 = getelementptr inbounds double, double* %263, i64 %267
%269 = load double, double* %268
%270 = fadd double %269, %262
store double %270, double* %268
br label %271
271: ; preds = %133
%272 = load i32, i32* %9
%273 = add nsw i32 %272, -1
store i32 %273, i32* %9
br label %130
274: ; preds = %130
%275 = load double*, double** %6
%276 = load i32, i32* %8
%277 = mul nsw i32 2, %276
%278 = sext i32 %277 to i64
%279 = getelementptr inbounds double, double* %275, i64 %278
%280 = load double, double* %279
%281 = load double*, double** %10
%282 = getelementptr inbounds double, double* %281, i64 0
%283 = load double, double* %282
%284 = load double*, double** %6
%285 = load i32, i32* %8
%286 = mul nsw i32 2, %285
%287 = add nsw i32 %286, 1
%288 = sext i32 %287 to i64
%289 = getelementptr inbounds double, double* %284, i64 %288
%290 = load double, double* %289
%291 = load double*, double** %10
%292 = getelementptr inbounds double, double* %291, i64 1
%293 = load double, double* %292
%294 = fmul double %290, %293
%295 = fneg double %294
%296 = call double @llvm.fmuladd.f64(double %280, double %283, double %295)
%297 = load double*, double** %7
%298 = load i32, i32* %8
%299 = mul nsw i32 2, %298
%300 = sext i32 %299 to i64
%301 = getelementptr inbounds double, double* %297, i64 %300
%302 = load double, double* %301
%303 = fadd double %296, %302
%304 = load double*, double** %10
%305 = getelementptr inbounds double, double* %304, i64 2
%306 = load double, double* %305
%307 = fadd double %306, %303
store double %307, double* %305
%308 = load double*, double** %6
%309 = load i32, i32* %8
%310 = mul nsw i32 2, %309
%311 = sext i32 %310 to i64
%312 = getelementptr inbounds double, double* %308, i64 %311
%313 = load double, double* %312
%314 = load double*, double** %10
%315 = getelementptr inbounds double, double* %314, i64 1
%316 = load double, double* %315
%317 = load double*, double** %6
%318 = load i32, i32* %8
%319 = mul nsw i32 2, %318
%320 = add nsw i32 %319, 1
%321 = sext i32 %320 to i64
%322 = getelementptr inbounds double, double* %317, i64 %321
%323 = load double, double* %322
%324 = load double*, double** %10
%325 = getelementptr inbounds double, double* %324, i64 0
%326 = load double, double* %325
%327 = fmul double %323, %326
%328 = call double @llvm.fmuladd.f64(double %313, double %316, double %327)
%329 = load double*, double** %7
%330 = load i32, i32* %8
%331 = mul nsw i32 2, %330
%332 = add nsw i32 %331, 1
%333 = sext i32 %332 to i64
%334 = getelementptr inbounds double, double* %329, i64 %333
%335 = load double, double* %334
%336 = fadd double %328, %335
%337 = load double*, double** %10
%338 = getelementptr inbounds double, double* %337, i64 3
%339 = load double, double* %338
%340 = fadd double %339, %336
store double %340, double* %338
%341 = load double*, double** %6
%342 = load i32, i32* %8
%343 = mul nsw i32 2, %342
%344 = sext i32 %343 to i64
%345 = getelementptr inbounds double, double* %341, i64 %344
%346 = load double, double* %345
%347 = load double*, double** %10
%348 = getelementptr inbounds double, double* %347, i64 0
%349 = load double, double* %348
%350 = fadd double %349, %346
store double %350, double* %348
%351 = load double*, double** %6
%352 = load i32, i32* %8
%353 = mul nsw i32 2, %352
%354 = add nsw i32 %353, 1
%355 = sext i32 %354 to i64
%356 = getelementptr inbounds double, double* %351, i64 %355
%357 = load double, double* %356
%358 = load double*, double** %10
%359 = getelementptr inbounds double, double* %358, i64 1
%360 = load double, double* %359
%361 = fadd double %360, %357
store double %361, double* %359
br label %362
362: ; preds = %274
%363 = load i32, i32* %8
%364 = add nsw i32 %363, 1
store i32 %364, i32* %8
br label %39
365: ; preds = %39
%366 = load double*, double** %10
store double* %366, double** %4
br label %367
367: ; preds = %365, %17
%368 = load double*, double** %4
ret double* %368
}

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