#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 */
typedef int int16_t;

/* Variables and functions */
double *calloc(int, int);
int /*<<< orphan*/ free(double *);
void expsByLengthDouble(const int16_t ns, const int16_t nc, const int16_t q0,
                        const int16_t maxlen, const int16_t *restrict tmat,
                        const double *restrict tprob,
                        const double *restrict tvec,
                        const double *restrict fprob,
                        const double *restrict fvec, double *outp,
                        double *outv) {
  double *accump = calloc(((int)ns) * (maxlen + 1), sizeof(double));
  double *accumv = calloc(((int)ns) * (maxlen + 1), sizeof(double));
  accump[q0] = 1;
  for (int n = 1; n <= maxlen; ++n)
    for (int q = 0; q < ns; ++q)
      for (int c = 0; c < nc; ++c) {
        int qprime = tmat[c * ns + q];
        double p1 = tprob[c * ns + q];
        double p2 = accump[(n - 1) * ns + q];
        double v1 = tvec[c * ns + q];
        double v2 = accumv[(n - 1) * ns + q];
        accump[n * ns + qprime] += p1 * p2;
        accumv[n * ns + qprime] += p2 * v1 + p1 * v2;
      }
  for (int n = 0; n <= maxlen; ++n) {
    outp[n] = 0;
    outv[n] = 0;
    for (int q = 0; q < ns; ++q) {
      double p1 = accump[n * ns + q];
      double p2 = fprob[q];
      double v1 = accumv[n * ns + q];
      double v2 = fvec[q];
      outp[n] += p1 * p2;
      outv[n] += p2 * v1 + p1 * v2;
    }
  }
  free(accump);
  free(accumv);
}


x86 assembly (clang, -O0):
<expsByLengthDouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%eax
add    $0x1,%eax
imul   %eax,%edi
mov    $0x8,%esi
call   1040 <calloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%eax
add    $0x1,%eax
imul   %eax,%edi
mov    $0x8,%esi
call   1040 <calloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  0xe69(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x1,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     12f6 <expsByLengthDouble+0x1d6>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    12e3 <expsByLengthDouble+0x1c3>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12d0 <expsByLengthDouble+0x1b0>
mov    -0x18(%rbp),%rax
mov    -0x3c(%rbp),%ecx
imul   -0x4(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x3c(%rbp),%ecx
imul   -0x4(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
imul   -0x4(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    0x10(%rbp),%rax
mov    -0x3c(%rbp),%ecx
imul   -0x4(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
imul   -0x4(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x4(%rbp),%ecx
add    -0x40(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x50(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x4(%rbp),%ecx
add    -0x40(%rbp),%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11c9 <expsByLengthDouble+0xa9>
jmp    12d5 <expsByLengthDouble+0x1b5>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11b6 <expsByLengthDouble+0x96>
jmp    12e8 <expsByLengthDouble+0x1c8>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11a3 <expsByLengthDouble+0x83>
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     140f <expsByLengthDouble+0x2ef>
mov    0x28(%rbp),%rax
movslq -0x64(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    0x30(%rbp),%rax
movslq -0x64(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    13fc <expsByLengthDouble+0x2dc>
mov    -0x28(%rbp),%rax
mov    -0x64(%rbp),%ecx
imul   -0x4(%rbp),%ecx
add    -0x68(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    0x18(%rbp),%rax
movslq -0x68(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x64(%rbp),%ecx
imul   -0x4(%rbp),%ecx
add    -0x68(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    0x20(%rbp),%rax
movslq -0x68(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
movsd  -0x78(%rbp),%xmm2
mov    0x28(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x78(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm1
mulsd  -0x88(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    0x30(%rbp),%rax
movslq -0x64(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1330 <expsByLengthDouble+0x210>
jmp    1401 <expsByLengthDouble+0x2e1>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    12fd <expsByLengthDouble+0x1dd>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expsByLengthDouble>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %r9,0x58(%rsp)
mov    %r8,0x50(%rsp)
mov    %ecx,%r14d
mov    %edx,0x18(%rsp)
mov    %esi,0x4(%rsp)
mov    %edi,%r12d
mov    0xc0(%rsp),%rax
mov    %rax,0x38(%rsp)
mov    0xb8(%rsp),%r13
mov    0xb0(%rsp),%rax
mov    %rax,0x40(%rsp)
mov    0xa8(%rsp),%rax
mov    %rax,0x30(%rsp)
mov    0xa0(%rsp),%rax
mov    %rax,0x48(%rsp)
lea    0x1(%r14),%r15d
mov    %r15d,%ebp
imul   %edi,%ebp
mov    %ebp,%edi
mov    $0x8,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
mov    %ebp,%edi
mov    $0x8,%esi
call   1040 <calloc@plt>
mov    %rax,%rbp
movslq 0x18(%rsp),%rax
movabs $0x3ff0000000000000,%rcx
mov    %rcx,(%rbx,%rax,8)
movslq %r12d,%rax
mov    %rax,0x8(%rsp)
mov    %r15d,%r11d
mov    %r12d,%r15d
mov    %r14,0x28(%rsp)
test   %r14d,%r14d
jle    12dd <expsByLengthDouble+0x1bd>
mov    0x4(%rsp),%eax
mov    %rax,0x18(%rsp)
mov    0x8(%rsp),%rax
lea    0x0(,%rax,4),%rdi
mov    $0x1,%eax
mov    %rax,0x10(%rsp)
mov    %r12d,0x24(%rsp)
mov    %r11,0x60(%rsp)
jmp    1231 <expsByLengthDouble+0x111>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x10(%rsp),%rax
add    $0x1,%rax
mov    0x60(%rsp),%r11
mov    %rax,0x10(%rsp)
cmp    %r11,%rax
mov    0x24(%rsp),%r12d
je     12dd <expsByLengthDouble+0x1bd>
test   %r12d,%r12d
jle    1210 <expsByLengthDouble+0xf0>
mov    0x10(%rsp),%rcx
lea    -0x1(%rcx),%rdx
mov    0x8(%rsp),%rax
imul   %rax,%rdx
imul   %rax,%rcx
mov    0x48(%rsp),%rsi
mov    0x58(%rsp),%r8
mov    0x50(%rsp),%r9
xor    %r10d,%r10d
jmp    1275 <expsByLengthDouble+0x155>
add    $0x1,%r10
add    $0x4,%r9
add    $0x8,%r8
add    $0x8,%rsi
cmp    %r15,%r10
je     1210 <expsByLengthDouble+0xf0>
cmpl   $0x0,0x4(%rsp)
jle    1260 <expsByLengthDouble+0x140>
lea    (%r10,%rdx,1),%r14
mov    0x18(%rsp),%r11
xor    %r12d,%r12d
nopl   0x0(%rax,%rax,1)
movslq (%r9,%r12,1),%rax
movsd  (%r8,%r12,2),%xmm0
movsd  (%rbx,%r14,8),%xmm1
add    %rcx,%rax
movapd %xmm0,%xmm2
mulsd  %xmm1,%xmm2
addsd  (%rbx,%rax,8),%xmm2
mulsd  0x0(%rbp,%r14,8),%xmm0
mulsd  (%rsi,%r12,2),%xmm1
addsd  %xmm0,%xmm1
addsd  0x0(%rbp,%rax,8),%xmm1
movsd  %xmm2,(%rbx,%rax,8)
movsd  %xmm1,0x0(%rbp,%rax,8)
add    %rdi,%r12
add    $0xffffffffffffffff,%r11
jne    1290 <expsByLengthDouble+0x170>
jmp    1260 <expsByLengthDouble+0x140>
cmpl   $0x0,0x28(%rsp)
mov    0x40(%rsp),%r8
mov    0x38(%rsp),%rdx
mov    0x30(%rsp),%r9
mov    0x8(%rsp),%r10
js     1385 <expsByLengthDouble+0x265>
shl    $0x3,%r10
xor    %eax,%eax
mov    %rbp,%rcx
mov    %rbx,%rsi
jmp    131f <expsByLengthDouble+0x1ff>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rax
add    %r10,%rsi
add    %r10,%rcx
cmp    %r11,%rax
je     1385 <expsByLengthDouble+0x265>
movq   $0x0,0x0(%r13,%rax,8)
movq   $0x0,(%rdx,%rax,8)
test   %r12d,%r12d
jle    1310 <expsByLengthDouble+0x1f0>
xor    %edi,%edi
nopw   0x0(%rax,%rax,1)
movsd  (%rsi,%rdi,8),%xmm0
movsd  (%r9,%rdi,8),%xmm1
movapd %xmm0,%xmm2
mulsd  %xmm1,%xmm2
addsd  0x0(%r13,%rax,8),%xmm2
mulsd  (%r8,%rdi,8),%xmm0
mulsd  (%rcx,%rdi,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm2,0x0(%r13,%rax,8)
addsd  (%rdx,%rax,8),%xmm1
movsd  %xmm1,(%rdx,%rax,8)
add    $0x1,%rdi
cmp    %rdi,%r15
jne    1340 <expsByLengthDouble+0x220>
jmp    1310 <expsByLengthDouble+0x1f0>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @expsByLengthDouble(i32 %0, i32 %1, i32 %2, i32 %3, i32* noalias %4, double* noalias %5, double* noalias %6, double* noalias %7, double* noalias %8, double* %9, double* %10) {
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32*
%17 = alloca double*
%18 = alloca double*
%19 = alloca double*
%20 = alloca double*
%21 = alloca double*
%22 = alloca double*
%23 = alloca double*
%24 = alloca double*
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca double
%30 = alloca double
%31 = alloca double
%32 = alloca double
%33 = alloca i32
%34 = alloca i32
%35 = alloca double
%36 = alloca double
%37 = alloca double
%38 = alloca double
store i32 %0, i32* %12
store i32 %1, i32* %13
store i32 %2, i32* %14
store i32 %3, i32* %15
store i32* %4, i32** %16
store double* %5, double** %17
store double* %6, double** %18
store double* %7, double** %19
store double* %8, double** %20
store double* %9, double** %21
store double* %10, double** %22
%39 = load i32, i32* %12
%40 = load i32, i32* %15
%41 = add nsw i32 %40, 1
%42 = mul nsw i32 %39, %41
%43 = call double* @calloc(i32 %42, i32 8)
store double* %43, double** %23
%44 = load i32, i32* %12
%45 = load i32, i32* %15
%46 = add nsw i32 %45, 1
%47 = mul nsw i32 %44, %46
%48 = call double* @calloc(i32 %47, i32 8)
store double* %48, double** %24
%49 = load double*, double** %23
%50 = load i32, i32* %14
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds double, double* %49, i64 %51
store double 1.000000e+00, double* %52
store i32 1, i32* %25
br label %53
53: ; preds = %151, %11
%54 = load i32, i32* %25
%55 = load i32, i32* %15
%56 = icmp sle i32 %54, %55
br i1 %56, label %57, label %154
57: ; preds = %53
store i32 0, i32* %26
br label %58
58: ; preds = %147, %57
%59 = load i32, i32* %26
%60 = load i32, i32* %12
%61 = icmp slt i32 %59, %60
br i1 %61, label %62, label %150
62: ; preds = %58
store i32 0, i32* %27
br label %63
63: ; preds = %143, %62
%64 = load i32, i32* %27
%65 = load i32, i32* %13
%66 = icmp slt i32 %64, %65
br i1 %66, label %67, label %146
67: ; preds = %63
%68 = load i32*, i32** %16
%69 = load i32, i32* %27
%70 = load i32, i32* %12
%71 = mul nsw i32 %69, %70
%72 = load i32, i32* %26
%73 = add nsw i32 %71, %72
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i32, i32* %68, i64 %74
%76 = load i32, i32* %75
store i32 %76, i32* %28
%77 = load double*, double** %17
%78 = load i32, i32* %27
%79 = load i32, i32* %12
%80 = mul nsw i32 %78, %79
%81 = load i32, i32* %26
%82 = add nsw i32 %80, %81
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds double, double* %77, i64 %83
%85 = load double, double* %84
store double %85, double* %29
%86 = load double*, double** %23
%87 = load i32, i32* %25
%88 = sub nsw i32 %87, 1
%89 = load i32, i32* %12
%90 = mul nsw i32 %88, %89
%91 = load i32, i32* %26
%92 = add nsw i32 %90, %91
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds double, double* %86, i64 %93
%95 = load double, double* %94
store double %95, double* %30
%96 = load double*, double** %18
%97 = load i32, i32* %27
%98 = load i32, i32* %12
%99 = mul nsw i32 %97, %98
%100 = load i32, i32* %26
%101 = add nsw i32 %99, %100
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds double, double* %96, i64 %102
%104 = load double, double* %103
store double %104, double* %31
%105 = load double*, double** %24
%106 = load i32, i32* %25
%107 = sub nsw i32 %106, 1
%108 = load i32, i32* %12
%109 = mul nsw i32 %107, %108
%110 = load i32, i32* %26
%111 = add nsw i32 %109, %110
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds double, double* %105, i64 %112
%114 = load double, double* %113
store double %114, double* %32
%115 = load double, double* %29
%116 = load double, double* %30
%117 = load double*, double** %23
%118 = load i32, i32* %25
%119 = load i32, i32* %12
%120 = mul nsw i32 %118, %119
%121 = load i32, i32* %28
%122 = add nsw i32 %120, %121
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds double, double* %117, i64 %123
%125 = load double, double* %124
%126 = call double @llvm.fmuladd.f64(double %115, double %116, double %125)
store double %126, double* %124
%127 = load double, double* %30
%128 = load double, double* %31
%129 = load double, double* %29
%130 = load double, double* %32
%131 = fmul double %129, %130
%132 = call double @llvm.fmuladd.f64(double %127, double %128, double %131)
%133 = load double*, double** %24
%134 = load i32, i32* %25
%135 = load i32, i32* %12
%136 = mul nsw i32 %134, %135
%137 = load i32, i32* %28
%138 = add nsw i32 %136, %137
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds double, double* %133, i64 %139
%141 = load double, double* %140
%142 = fadd double %141, %132
store double %142, double* %140
br label %143
143: ; preds = %67
%144 = load i32, i32* %27
%145 = add nsw i32 %144, 1
store i32 %145, i32* %27
br label %63
146: ; preds = %63
br label %147
147: ; preds = %146
%148 = load i32, i32* %26
%149 = add nsw i32 %148, 1
store i32 %149, i32* %26
br label %58
150: ; preds = %58
br label %151
151: ; preds = %150
%152 = load i32, i32* %25
%153 = add nsw i32 %152, 1
store i32 %153, i32* %25
br label %53
154: ; preds = %53
store i32 0, i32* %33
br label %155
155: ; preds = %225, %154
%156 = load i32, i32* %33
%157 = load i32, i32* %15
%158 = icmp sle i32 %156, %157
br i1 %158, label %159, label %228
159: ; preds = %155
%160 = load double*, double** %21
%161 = load i32, i32* %33
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds double, double* %160, i64 %162
store double 0.000000e+00, double* %163
%164 = load double*, double** %22
%165 = load i32, i32* %33
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds double, double* %164, i64 %166
store double 0.000000e+00, double* %167
store i32 0, i32* %34
br label %168
168: ; preds = %221, %159
%169 = load i32, i32* %34
%170 = load i32, i32* %12
%171 = icmp slt i32 %169, %170
br i1 %171, label %172, label %224
172: ; preds = %168
%173 = load double*, double** %23
%174 = load i32, i32* %33
%175 = load i32, i32* %12
%176 = mul nsw i32 %174, %175
%177 = load i32, i32* %34
%178 = add nsw i32 %176, %177
%179 = sext i32 %178 to i64
%180 = getelementptr inbounds double, double* %173, i64 %179
%181 = load double, double* %180
store double %181, double* %35
%182 = load double*, double** %19
%183 = load i32, i32* %34
%184 = sext i32 %183 to i64
%185 = getelementptr inbounds double, double* %182, i64 %184
%186 = load double, double* %185
store double %186, double* %36
%187 = load double*, double** %24
%188 = load i32, i32* %33
%189 = load i32, i32* %12
%190 = mul nsw i32 %188, %189
%191 = load i32, i32* %34
%192 = add nsw i32 %190, %191
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds double, double* %187, i64 %193
%195 = load double, double* %194
store double %195, double* %37
%196 = load double*, double** %20
%197 = load i32, i32* %34
%198 = sext i32 %197 to i64
%199 = getelementptr inbounds double, double* %196, i64 %198
%200 = load double, double* %199
store double %200, double* %38
%201 = load double, double* %35
%202 = load double, double* %36
%203 = load double*, double** %21
%204 = load i32, i32* %33
%205 = sext i32 %204 to i64
%206 = getelementptr inbounds double, double* %203, i64 %205
%207 = load double, double* %206
%208 = call double @llvm.fmuladd.f64(double %201, double %202, double %207)
store double %208, double* %206
%209 = load double, double* %36
%210 = load double, double* %37
%211 = load double, double* %35
%212 = load double, double* %38
%213 = fmul double %211, %212
%214 = call double @llvm.fmuladd.f64(double %209, double %210, double %213)
%215 = load double*, double** %22
%216 = load i32, i32* %33
%217 = sext i32 %216 to i64
%218 = getelementptr inbounds double, double* %215, i64 %217
%219 = load double, double* %218
%220 = fadd double %219, %214
store double %220, double* %218
br label %221
221: ; preds = %172
%222 = load i32, i32* %34
%223 = add nsw i32 %222, 1
store i32 %223, i32* %34
br label %168
224: ; preds = %168
br label %225
225: ; preds = %224
%226 = load i32, i32* %33
%227 = add nsw i32 %226, 1
store i32 %227, i32* %33
br label %155
228: ; preds = %155
%229 = load double*, double** %23
%230 = call i32 @free(double* %229)
%231 = load double*, double** %24
%232 = call i32 @free(double* %231)
ret void
}

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