#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 */
double const DBL_EPSILON;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ Matrix_MatrixT_Mult(double *, int const, int const,
                                       double const *, int const, int const,
                                       double *);
int /*<<< orphan*/ err(int /*<<< orphan*/, char *, double const, double const,
                       double const);
double exp(double const);
double *malloc(int const);
double *MakeP_From_FactQ(const double *v, const double *ev,
                         const double *inv_ev, const double length,
                         const double rate, const double scale, double *p,
                         const int n, double *space, const double *pi,
                         const double *q) {
  int i, j;
  double *expl, *tmp;
  if (NULL == v || NULL == ev || NULL == inv_ev || n < 1 || length < 0.)
    return NULL;
  if (NULL == p) {
    p = malloc(n * n * sizeof(double));
    if (NULL == p)
      return NULL;
  }
  if (length * rate * scale < -DBL_EPSILON) {
    err(EXIT_FAILURE, "Error. lrs less than zero. len=%e, rate=%e scale=%e\n",
        length, rate, scale);
  }
  expl = space;
  space += n;
  tmp = space;
  space += n;
  for (i = 0; i < n; i++) {
    expl[i] = exp(length * rate * scale * v[i]);
  }
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++)
      p[i * n + j] = ev[i * n + j] * expl[j];
  Matrix_MatrixT_Mult(p, n, n, inv_ev, n, n, tmp);
  for (i = 0; i < n * n; i++)
    p[i] = tmp[i];
  return p;
}


x86 assembly (clang, -O0):
<MakeP_From_FactQ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movsd  %xmm0,-0x28(%rbp)
movsd  %xmm1,-0x30(%rbp)
movsd  %xmm2,-0x38(%rbp)
mov    %rcx,-0x40(%rbp)
mov    %r8d,-0x44(%rbp)
mov    %r9,-0x50(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
je     11b3 <MakeP_From_FactQ+0x73>
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
je     11b3 <MakeP_From_FactQ+0x73>
xor    %eax,%eax
cmp    -0x20(%rbp),%rax
je     11b3 <MakeP_From_FactQ+0x73>
cmpl   $0x1,-0x44(%rbp)
jl     11b3 <MakeP_From_FactQ+0x73>
xorps  %xmm0,%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    11c0 <MakeP_From_FactQ+0x80>
movq   $0x0,-0x8(%rbp)
jmp    13d6 <MakeP_From_FactQ+0x296>
xor    %eax,%eax
cmp    -0x40(%rbp),%rax
jne    1202 <MakeP_From_FactQ+0xc2>
mov    -0x44(%rbp),%eax
imul   -0x44(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x40(%rbp)
xor    %eax,%eax
cmp    -0x40(%rbp),%rax
jne    11fd <MakeP_From_FactQ+0xbd>
movq   $0x0,-0x8(%rbp)
jmp    13d6 <MakeP_From_FactQ+0x296>
jmp    1202 <MakeP_From_FactQ+0xc2>
movsd  -0x28(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
mov    0x2dd0(%rip),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
ucomisd %xmm1,%xmm0
jbe    1261 <MakeP_From_FactQ+0x121>
mov    0x2d94(%rip),%rax
mov    (%rax),%edi
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
lea    0xdac(%rip),%rsi
call   1040 <err@plt>
mov    -0x50(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x44(%rbp),%ecx
mov    -0x50(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x44(%rbp),%ecx
mov    -0x50(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    12ea <MakeP_From_FactQ+0x1aa>
movsd  -0x28(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
call   1060 <exp@plt>
mov    -0x60(%rbp),%rax
movslq -0x54(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    12a2 <MakeP_From_FactQ+0x162>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    136a <MakeP_From_FactQ+0x22a>
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    1357 <MakeP_From_FactQ+0x217>
mov    -0x18(%rbp),%rax
mov    -0x54(%rbp),%ecx
imul   -0x44(%rbp),%ecx
add    -0x58(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x60(%rbp),%rax
movslq -0x58(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
mov    -0x54(%rbp),%ecx
imul   -0x44(%rbp),%ecx
add    -0x58(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1304 <MakeP_From_FactQ+0x1c4>
jmp    135c <MakeP_From_FactQ+0x21c>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    12f1 <MakeP_From_FactQ+0x1b1>
mov    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%esi
mov    -0x44(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x44(%rbp),%r8d
mov    -0x44(%rbp),%r9d
mov    -0x68(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <Matrix_MatrixT_Mult@plt>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
mov    -0x44(%rbp),%ecx
imul   -0x44(%rbp),%ecx
cmp    %ecx,%eax
jge    13ce <MakeP_From_FactQ+0x28e>
mov    -0x68(%rbp),%rax
movslq -0x54(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x54(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1394 <MakeP_From_FactQ+0x254>
mov    -0x40(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MakeP_From_FactQ>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %r8d,0x14(%rsp)
mov    %rsi,0x28(%rsp)
xor    %eax,%eax
xorpd  %xmm3,%xmm3
ucomisd %xmm0,%xmm3
ja     16b7 <MakeP_From_FactQ+0x577>
mov    %rdi,%r12
test   %rdi,%rdi
je     16b7 <MakeP_From_FactQ+0x577>
cmpq   $0x0,0x28(%rsp)
je     16b7 <MakeP_From_FactQ+0x577>
mov    %rdx,%rbp
test   %rdx,%rdx
je     16b7 <MakeP_From_FactQ+0x577>
mov    0x14(%rsp),%edi
test   %edi,%edi
jle    16b7 <MakeP_From_FactQ+0x577>
mov    %r9,%rbx
test   %rcx,%rcx
jne    11df <MakeP_From_FactQ+0x9f>
imul   %edi,%edi
shl    $0x3,%edi
movsd  %xmm2,0x20(%rsp)
movsd  %xmm1,0x18(%rsp)
movsd  %xmm0,0x30(%rsp)
call   1050 <malloc@plt>
movsd  0x30(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
mov    0x14(%rsp),%edi
mov    %rax,%rcx
test   %rax,%rax
je     1543 <MakeP_From_FactQ+0x403>
mov    %rcx,0x18(%rsp)
movapd %xmm0,%xmm4
mulsd  %xmm1,%xmm4
mulsd  %xmm2,%xmm4
xorpd  %xmm3,%xmm3
ucomisd %xmm4,%xmm3
movsd  %xmm4,0x20(%rsp)
jbe    121f <MakeP_From_FactQ+0xdf>
mov    0x2dd9(%rip),%rax
mov    (%rax),%edi
lea    0xdf8(%rip),%rsi
call   1040 <err@plt>
movsd  0x20(%rsp),%xmm4
mov    0x14(%rsp),%edi
mov    %rbp,0x40(%rsp)
mov    %edi,%r15d
lea    (%rbx,%r15,8),%rax
mov    %rax,0x38(%rsp)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%r12,%rbp,8),%xmm0
mulsd  %xmm4,%xmm0
call   1060 <exp@plt>
movsd  0x20(%rsp),%xmm4
movsd  %xmm0,(%rbx,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1240 <MakeP_From_FactQ+0x100>
movabs $0x7ffffffffffffffc,%rax
ff ff 7f
mov    0x14(%rsp),%edx
movslq %edx,%rcx
mov    %r15d,%esi
and    $0xfffffffc,%esi
mov    %rsi,0x60(%rsp)
add    $0xfffffffffffffffc,%rsi
mov    %rsi,0x58(%rsp)
shr    $0x2,%rsi
add    $0x1,%rsi
lea    0x2(%rax),%rdi
mov    %rsi,%rax
mov    %rsi,0x50(%rsp)
and    %rsi,%rdi
mov    %rdi,0x48(%rsp)
mov    %r15,%rax
neg    %rax
mov    %rax,0x30(%rsp)
mov    0x18(%rsp),%rdi
lea    0x30(%rdi),%r13
mov    %rcx,0x20(%rsp)
lea    0x0(,%rcx,8),%rsi
mov    0x28(%rsp),%rax
lea    0x30(%rax),%r14
lea    0x8(%rax),%rcx
lea    0x8(%rdi),%r8
xor    %r10d,%r10d
jmp    12f9 <MakeP_From_FactQ+0x1b9>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r10
add    %rsi,%r13
add    %rsi,%r14
add    %rsi,%rcx
add    %rsi,%r8
cmp    %r15,%r10
je     14d4 <MakeP_From_FactQ+0x394>
mov    %r10,%r9
imul   0x20(%rsp),%r9
cmp    $0x4,%edx
jae    1310 <MakeP_From_FactQ+0x1d0>
xor    %eax,%eax
jmp    1450 <MakeP_From_FactQ+0x310>
xchg   %ax,%ax
lea    (%r9,%r15,1),%rax
lea    (%rdi,%r9,8),%rdx
lea    (%rdi,%rax,8),%rbp
mov    0x28(%rsp),%rdi
lea    (%rdi,%rax,8),%rax
lea    (%rdi,%r9,8),%r11
cmp    %rax,%rdx
setb   %r12b
cmp    %rbp,%r11
setb   %al
cmp    0x38(%rsp),%rdx
setb   %dl
cmp    %rbx,%rbp
seta   %r11b
test   %al,%r12b
jne    1444 <MakeP_From_FactQ+0x304>
mov    $0x0,%eax
and    %r11b,%dl
mov    0x14(%rsp),%edx
mov    0x18(%rsp),%rdi
jne    1450 <MakeP_From_FactQ+0x310>
cmpq   $0x0,0x58(%rsp)
je     14c1 <MakeP_From_FactQ+0x381>
mov    0x48(%rsp),%r12
xor    %r11d,%r11d
nopl   0x0(%rax)
movupd -0x30(%r14,%r11,8),%xmm0
movupd -0x20(%r14,%r11,8),%xmm1
movupd (%rbx,%r11,8),%xmm2
mulpd  %xmm0,%xmm2
movupd 0x10(%rbx,%r11,8),%xmm0
mulpd  %xmm1,%xmm0
movupd %xmm2,-0x30(%r13,%r11,8)
movupd %xmm0,-0x20(%r13,%r11,8)
movupd -0x10(%r14,%r11,8),%xmm0
movupd (%r14,%r11,8),%xmm1
movupd 0x20(%rbx,%r11,8),%xmm2
mulpd  %xmm0,%xmm2
movupd 0x30(%rbx,%r11,8),%xmm0
mulpd  %xmm1,%xmm0
movupd %xmm2,-0x10(%r13,%r11,8)
movupd %xmm0,0x0(%r13,%r11,8)
add    $0x8,%r11
add    $0xfffffffffffffffe,%r12
jne    1380 <MakeP_From_FactQ+0x240>
testb  $0x1,0x50(%rsp)
je     142c <MakeP_From_FactQ+0x2ec>
lea    (%r11,%r9,1),%rax
mov    0x28(%rsp),%rdi
movupd (%rdi,%rax,8),%xmm0
movupd 0x10(%rdi,%rax,8),%xmm1
movupd (%rbx,%r11,8),%xmm2
mulpd  %xmm0,%xmm2
movupd 0x10(%rbx,%r11,8),%xmm0
mulpd  %xmm1,%xmm0
mov    0x18(%rsp),%rdi
movupd %xmm2,(%rdi,%rax,8)
movupd %xmm0,0x10(%rdi,%rax,8)
mov    0x60(%rsp),%rdi
mov    %rdi,%rax
cmp    %r15,%rdi
mov    0x18(%rsp),%rdi
je     12e0 <MakeP_From_FactQ+0x1a0>
jmp    1450 <MakeP_From_FactQ+0x310>
xor    %eax,%eax
mov    0x14(%rsp),%edx
mov    0x18(%rsp),%rdi
nop
mov    %rax,%rbp
test   $0x1,%r15b
je     147a <MakeP_From_FactQ+0x33a>
add    %rax,%r9
mov    0x28(%rsp),%rbp
movsd  0x0(%rbp,%r9,8),%xmm0
mulsd  (%rbx,%rax,8),%xmm0
movsd  %xmm0,(%rdi,%r9,8)
mov    %rax,%rbp
or     $0x1,%rbp
not    %rax
cmp    0x30(%rsp),%rax
je     12e0 <MakeP_From_FactQ+0x1a0>
nopl   0x0(%rax,%rax,1)
movsd  -0x8(%rcx,%rbp,8),%xmm0
mulsd  (%rbx,%rbp,8),%xmm0
movsd  %xmm0,-0x8(%r8,%rbp,8)
movsd  (%rcx,%rbp,8),%xmm0
mulsd  0x8(%rbx,%rbp,8),%xmm0
movsd  %xmm0,(%r8,%rbp,8)
add    $0x2,%rbp
cmp    %rbp,%r15
jne    1490 <MakeP_From_FactQ+0x350>
jmp    12e0 <MakeP_From_FactQ+0x1a0>
xor    %r11d,%r11d
testb  $0x1,0x50(%rsp)
jne    13f3 <MakeP_From_FactQ+0x2b3>
jmp    142c <MakeP_From_FactQ+0x2ec>
mov    0x38(%rsp),%r12
mov    %r12,(%rsp)
mov    %edx,%esi
mov    0x14(%rsp),%edx
mov    0x40(%rsp),%rcx
mov    0x14(%rsp),%r8d
mov    0x14(%rsp),%r9d
mov    %rdi,%rbp
call   1030 <Matrix_MatrixT_Mult@plt>
mov    0x14(%rsp),%ecx
imul   %ecx,%ecx
test   %ecx,%ecx
je     1519 <MakeP_From_FactQ+0x3d9>
mov    %ecx,%r8d
cmp    $0x4,%ecx
jae    1521 <MakeP_From_FactQ+0x3e1>
xor    %ecx,%ecx
mov    0x18(%rsp),%rax
jmp    1638 <MakeP_From_FactQ+0x4f8>
mov    %rbp,%rax
jmp    16b7 <MakeP_From_FactQ+0x577>
lea    (%r15,%r8,1),%rcx
lea    (%rbx,%rcx,8),%rcx
mov    0x18(%rsp),%rax
cmp    %rcx,%rax
jae    154a <MakeP_From_FactQ+0x40a>
lea    (%rax,%r8,8),%rcx
cmp    %rcx,%r12
jae    154a <MakeP_From_FactQ+0x40a>
xor    %ecx,%ecx
jmp    1638 <MakeP_From_FactQ+0x4f8>
xor    %eax,%eax
jmp    16b7 <MakeP_From_FactQ+0x577>
mov    %r8d,%ecx
and    $0xfffffffc,%ecx
lea    -0x4(%rcx),%rdi
mov    %rdi,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
mov    %esi,%edx
and    $0x3,%edx
cmp    $0xc,%rdi
jae    156e <MakeP_From_FactQ+0x42e>
xor    %edi,%edi
jmp    15ed <MakeP_From_FactQ+0x4ad>
movabs $0x7ffffffffffffffc,%rdi
ff ff 7f
and    %rdi,%rsi
lea    (%rbx,%r15,8),%rbp
add    $0x70,%rbp
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
nop
movups -0x70(%rbp,%rdi,8),%xmm0
movups -0x60(%rbp,%rdi,8),%xmm1
movups %xmm0,(%rax,%rdi,8)
movups %xmm1,0x10(%rax,%rdi,8)
movups -0x50(%rbp,%rdi,8),%xmm0
movups -0x40(%rbp,%rdi,8),%xmm1
movups %xmm0,0x20(%rax,%rdi,8)
movups %xmm1,0x30(%rax,%rdi,8)
movups -0x30(%rbp,%rdi,8),%xmm0
movups -0x20(%rbp,%rdi,8),%xmm1
movups %xmm0,0x40(%rax,%rdi,8)
movups %xmm1,0x50(%rax,%rdi,8)
movupd -0x10(%rbp,%rdi,8),%xmm0
movupd 0x0(%rbp,%rdi,8),%xmm1
movupd %xmm0,0x60(%rax,%rdi,8)
movupd %xmm1,0x70(%rax,%rdi,8)
add    $0x10,%rdi
add    $0xfffffffffffffffc,%rsi
jne    1590 <MakeP_From_FactQ+0x450>
test   %rdx,%rdx
je     162f <MakeP_From_FactQ+0x4ef>
lea    (%rax,%rdi,8),%rsi
add    $0x10,%rsi
add    %r15,%rdi
lea    (%rbx,%rdi,8),%rdi
add    $0x10,%rdi
shl    $0x5,%rdx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movupd -0x10(%rdi,%rbp,1),%xmm0
movupd (%rdi,%rbp,1),%xmm1
movupd %xmm0,-0x10(%rsi,%rbp,1)
movupd %xmm1,(%rsi,%rbp,1)
add    $0x20,%rbp
cmp    %rbp,%rdx
jne    1610 <MakeP_From_FactQ+0x4d0>
cmp    %r8,%rcx
je     16b7 <MakeP_From_FactQ+0x577>
mov    %rcx,%rdx
not    %rdx
add    %r8,%rdx
mov    %r8,%rsi
and    $0x3,%rsi
je     1665 <MakeP_From_FactQ+0x525>
nopw   0x0(%rax,%rax,1)
movsd  (%r12,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
add    $0x1,%rcx
add    $0xffffffffffffffff,%rsi
jne    1650 <MakeP_From_FactQ+0x510>
cmp    $0x3,%rdx
jb     16b7 <MakeP_From_FactQ+0x577>
lea    (%rbx,%r15,8),%rdx
add    $0x18,%rdx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  -0x18(%rdx,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x10(%rdx,%rcx,8),%xmm0
movsd  %xmm0,0x8(%rax,%rcx,8)
movsd  -0x8(%rdx,%rcx,8),%xmm0
movsd  %xmm0,0x10(%rax,%rcx,8)
movsd  (%rdx,%rcx,8),%xmm0
movsd  %xmm0,0x18(%rax,%rcx,8)
add    $0x4,%rcx
cmp    %rcx,%r8
jne    1680 <MakeP_From_FactQ+0x540>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@DBL_EPSILON = constant double 0.000000e+00
@EXIT_FAILURE = global i32 0
@.str = [53 x i8] c"Error. lrs less than zero. len=%e, rate=%e scale=%e\0A\00"
define double* @MakeP_From_FactQ(double* %0, double* %1, double* %2, double %3, double %4, double %5, double* %6, i32 %7, double* %8, double* %9, double* %10) {
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca double*
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double*
%20 = alloca i32
%21 = alloca double*
%22 = alloca double*
%23 = alloca double*
%24 = alloca i32
%25 = alloca i32
%26 = alloca double*
%27 = alloca double*
store double* %0, double** %13
store double* %1, double** %14
store double* %2, double** %15
store double %3, double* %16
store double %4, double* %17
store double %5, double* %18
store double* %6, double** %19
store i32 %7, i32* %20
store double* %8, double** %21
store double* %9, double** %22
store double* %10, double** %23
%28 = load double*, double** %13
%29 = icmp eq double* null, %28
br i1 %29, label %42, label %30
30: ; preds = %11
%31 = load double*, double** %14
%32 = icmp eq double* null, %31
br i1 %32, label %42, label %33
33: ; preds = %30
%34 = load double*, double** %15
%35 = icmp eq double* null, %34
br i1 %35, label %42, label %36
36: ; preds = %33
%37 = load i32, i32* %20
%38 = icmp slt i32 %37, 1
br i1 %38, label %42, label %39
39: ; preds = %36
%40 = load double, double* %16
%41 = fcmp olt double %40, 0.000000e+00
br i1 %41, label %42, label %43
42: ; preds = %39, %36, %33, %30, %11
store double* null, double** %12
br label %179
43: ; preds = %39
%44 = load double*, double** %19
%45 = icmp eq double* null, %44
br i1 %45, label %46, label %58
46: ; preds = %43
%47 = load i32, i32* %20
%48 = load i32, i32* %20
%49 = mul nsw i32 %47, %48
%50 = sext i32 %49 to i64
%51 = mul i64 %50, 8
%52 = trunc i64 %51 to i32
%53 = call double* @malloc(i32 %52)
store double* %53, double** %19
%54 = load double*, double** %19
%55 = icmp eq double* null, %54
br i1 %55, label %56, label %57
56: ; preds = %46
store double* null, double** %12
br label %179
57: ; preds = %46
br label %58
58: ; preds = %57, %43
%59 = load double, double* %16
%60 = load double, double* %17
%61 = fmul double %59, %60
%62 = load double, double* %18
%63 = fmul double %61, %62
%64 = load double, double* @DBL_EPSILON
%65 = fneg double %64
%66 = fcmp olt double %63, %65
br i1 %66, label %67, label %73
67: ; preds = %58
%68 = load i32, i32* @EXIT_FAILURE
%69 = load double, double* %16
%70 = load double, double* %17
%71 = load double, double* %18
%72 = call i32 @err(i32 %68, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), double %69, double %70, double %71)
br label %73
73: ; preds = %67, %58
%74 = load double*, double** %21
store double* %74, double** %26
%75 = load i32, i32* %20
%76 = load double*, double** %21
%77 = sext i32 %75 to i64
%78 = getelementptr inbounds double, double* %76, i64 %77
store double* %78, double** %21
%79 = load double*, double** %21
store double* %79, double** %27
%80 = load i32, i32* %20
%81 = load double*, double** %21
%82 = sext i32 %80 to i64
%83 = getelementptr inbounds double, double* %81, i64 %82
store double* %83, double** %21
store i32 0, i32* %24
br label %84
84: ; preds = %105, %73
%85 = load i32, i32* %24
%86 = load i32, i32* %20
%87 = icmp slt i32 %85, %86
br i1 %87, label %88, label %108
88: ; preds = %84
%89 = load double, double* %16
%90 = load double, double* %17
%91 = fmul double %89, %90
%92 = load double, double* %18
%93 = fmul double %91, %92
%94 = load double*, double** %13
%95 = load i32, i32* %24
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds double, double* %94, i64 %96
%98 = load double, double* %97
%99 = fmul double %93, %98
%100 = call double @exp(double %99)
%101 = load double*, double** %26
%102 = load i32, i32* %24
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds double, double* %101, i64 %103
store double %100, double* %104
br label %105
105: ; preds = %88
%106 = load i32, i32* %24
%107 = add nsw i32 %106, 1
store i32 %107, i32* %24
br label %84
108: ; preds = %84
store i32 0, i32* %24
br label %109
109: ; preds = %146, %108
%110 = load i32, i32* %24
%111 = load i32, i32* %20
%112 = icmp slt i32 %110, %111
br i1 %112, label %113, label %149
113: ; preds = %109
store i32 0, i32* %25
br label %114
114: ; preds = %142, %113
%115 = load i32, i32* %25
%116 = load i32, i32* %20
%117 = icmp slt i32 %115, %116
br i1 %117, label %118, label %145
118: ; preds = %114
%119 = load double*, double** %14
%120 = load i32, i32* %24
%121 = load i32, i32* %20
%122 = mul nsw i32 %120, %121
%123 = load i32, i32* %25
%124 = add nsw i32 %122, %123
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds double, double* %119, i64 %125
%127 = load double, double* %126
%128 = load double*, double** %26
%129 = load i32, i32* %25
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds double, double* %128, i64 %130
%132 = load double, double* %131
%133 = fmul double %127, %132
%134 = load double*, double** %19
%135 = load i32, i32* %24
%136 = load i32, i32* %20
%137 = mul nsw i32 %135, %136
%138 = load i32, i32* %25
%139 = add nsw i32 %137, %138
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds double, double* %134, i64 %140
store double %133, double* %141
br label %142
142: ; preds = %118
%143 = load i32, i32* %25
%144 = add nsw i32 %143, 1
store i32 %144, i32* %25
br label %114
145: ; preds = %114
br label %146
146: ; preds = %145
%147 = load i32, i32* %24
%148 = add nsw i32 %147, 1
store i32 %148, i32* %24
br label %109
149: ; preds = %109
%150 = load double*, double** %19
%151 = load i32, i32* %20
%152 = load i32, i32* %20
%153 = load double*, double** %15
%154 = load i32, i32* %20
%155 = load i32, i32* %20
%156 = load double*, double** %27
%157 = call i32 @Matrix_MatrixT_Mult(double* %150, i32 %151, i32 %152, double* %153, i32 %154, i32 %155, double* %156)
store i32 0, i32* %24
br label %158
158: ; preds = %174, %149
%159 = load i32, i32* %24
%160 = load i32, i32* %20
%161 = load i32, i32* %20
%162 = mul nsw i32 %160, %161
%163 = icmp slt i32 %159, %162
br i1 %163, label %164, label %177
164: ; preds = %158
%165 = load double*, double** %27
%166 = load i32, i32* %24
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds double, double* %165, i64 %167
%169 = load double, double* %168
%170 = load double*, double** %19
%171 = load i32, i32* %24
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds double, double* %170, i64 %172
store double %169, double* %173
br label %174
174: ; preds = %164
%175 = load i32, i32* %24
%176 = add nsw i32 %175, 1
store i32 %176, i32* %24
br label %158
177: ; preds = %158
%178 = load double*, double** %19
store double* %178, double** %12
br label %179
179: ; preds = %177, %56, %42
%180 = load double*, double** %12
ret double* %180
}

LLVM IR (-O2):
@DBL_EPSILON = constant double 0.000000e+00
@EXIT_FAILURE = global i32 0
@.str = [53 x i8] c"Error. lrs less than zero. len=%e, rate=%e scale=%e\0A\00"
define double* @MakeP_From_FactQ(double* %0, double* %1, double* %2, double %3, double %4, double %5, double* %6, i32 %7, double* %8, double* nocapture readnone %9, double* nocapture readnone %10) {
%12 = icmp eq double* %0, null
%13 = icmp eq double* %1, null
%14 = or i1 %12, %13
%15 = icmp eq double* %2, null
%16 = or i1 %14, %15
%17 = icmp slt i32 %7, 1
%18 = or i1 %16, %17
%19 = fcmp olt double %3, 0.000000e+00
%20 = or i1 %19, %18
br i1 %20, label %318, label %21
21: ; preds = %11
%22 = icmp eq double* %6, null
br i1 %22, label %23, label %28
23: ; preds = %21
%24 = mul nsw i32 %7, %7
%25 = shl i32 %24, 3
%26 = tail call double* @malloc(i32 %25)
%27 = icmp eq double* %26, null
br i1 %27, label %318, label %28
28: ; preds = %23, %21
%29 = phi double* [ %26, %23 ], [ %6, %21 ]
%30 = fmul double %3, %4
%31 = fmul double %30, %5
%32 = fcmp olt double %31, 0.000000e+00
br i1 %32, label %33, label %36
33: ; preds = %28
%34 = load i32, i32* @EXIT_FAILURE
%35 = tail call i32 @err(i32 %34, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), double %3, double %4, double %5)
br label %36
36: ; preds = %28, %33
%37 = zext i32 %7 to i64
%38 = getelementptr double, double* %8, i64 %37
br label %56
39: ; preds = %56
%40 = sext i32 %7 to i64
%41 = getelementptr double, double* %8, i64 %37
%42 = and i64 %37, 4294967292
%43 = add nsw i64 %42, -4
%44 = lshr exact i64 %43, 2
%45 = add nuw nsw i64 %44, 1
%46 = icmp ult i32 %7, 4
%47 = and i64 %37, 4294967292
%48 = and i64 %45, 1
%49 = icmp eq i64 %43, 0
%50 = and i64 %45, 9223372036854775806
%51 = icmp eq i64 %48, 0
%52 = icmp eq i64 %47, %37
%53 = and i64 %37, 1
%54 = icmp eq i64 %53, 0
%55 = sub nsw i64 0, %37
br label %65
56: ; preds = %36, %56
%57 = phi i64 [ 0, %36 ], [ %63, %56 ]
%58 = getelementptr inbounds double, double* %0, i64 %57
%59 = load double, double* %58
%60 = fmul double %31, %59
%61 = tail call double @exp(double %60)
%62 = getelementptr inbounds double, double* %8, i64 %57
store double %61, double* %62
%63 = add nuw nsw i64 %57, 1
%64 = icmp eq i64 %63, %37
br i1 %64, label %39, label %56
65: ; preds = %185, %39
%66 = phi i64 [ 0, %39 ], [ %186, %185 ]
%67 = mul i64 %66, %40
%68 = getelementptr double, double* %29, i64 %67
%69 = add i64 %67, %37
%70 = getelementptr double, double* %29, i64 %69
%71 = mul nsw i64 %66, %40
br i1 %46, label %151, label %72
72: ; preds = %65
%73 = getelementptr double, double* %1, i64 %69
%74 = getelementptr double, double* %1, i64 %67
%75 = icmp ult double* %68, %73
%76 = icmp ult double* %74, %70
%77 = and i1 %75, %76
%78 = icmp ult double* %68, %41
%79 = icmp ugt double* %70, %8
%80 = and i1 %78, %79
%81 = or i1 %77, %80
br i1 %81, label %151, label %82
82: ; preds = %72
br i1 %49, label %128, label %83
83: ; preds = %82, %83
%84 = phi i64 [ %125, %83 ], [ 0, %82 ]
%85 = phi i64 [ %126, %83 ], [ 0, %82 ]
%86 = add nsw i64 %84, %71
%87 = getelementptr inbounds double, double* %1, i64 %86
%88 = bitcast double* %87 to <2 x double>*
%89 = load <2 x double>, <2 x double>* %88
%90 = getelementptr inbounds double, double* %87, i64 2
%91 = bitcast double* %90 to <2 x double>*
%92 = load <2 x double>, <2 x double>* %91
%93 = getelementptr inbounds double, double* %8, i64 %84
%94 = bitcast double* %93 to <2 x double>*
%95 = load <2 x double>, <2 x double>* %94
%96 = getelementptr inbounds double, double* %93, i64 2
%97 = bitcast double* %96 to <2 x double>*
%98 = load <2 x double>, <2 x double>* %97
%99 = fmul <2 x double> %89, %95
%100 = fmul <2 x double> %92, %98
%101 = getelementptr inbounds double, double* %29, i64 %86
%102 = bitcast double* %101 to <2 x double>*
store <2 x double> %99, <2 x double>* %102
%103 = getelementptr inbounds double, double* %101, i64 2
%104 = bitcast double* %103 to <2 x double>*
store <2 x double> %100, <2 x double>* %104
%105 = or i64 %84, 4
%106 = add nsw i64 %105, %71
%107 = getelementptr inbounds double, double* %1, i64 %106
%108 = bitcast double* %107 to <2 x double>*
%109 = load <2 x double>, <2 x double>* %108
%110 = getelementptr inbounds double, double* %107, i64 2
%111 = bitcast double* %110 to <2 x double>*
%112 = load <2 x double>, <2 x double>* %111
%113 = getelementptr inbounds double, double* %8, i64 %105
%114 = bitcast double* %113 to <2 x double>*
%115 = load <2 x double>, <2 x double>* %114
%116 = getelementptr inbounds double, double* %113, i64 2
%117 = bitcast double* %116 to <2 x double>*
%118 = load <2 x double>, <2 x double>* %117
%119 = fmul <2 x double> %109, %115
%120 = fmul <2 x double> %112, %118
%121 = getelementptr inbounds double, double* %29, i64 %106
%122 = bitcast double* %121 to <2 x double>*
store <2 x double> %119, <2 x double>* %122
%123 = getelementptr inbounds double, double* %121, i64 2
%124 = bitcast double* %123 to <2 x double>*
store <2 x double> %120, <2 x double>* %124
%125 = add nuw i64 %84, 8
%126 = add i64 %85, 2
%127 = icmp eq i64 %126, %50
br i1 %127, label %128, label %83
128: ; preds = %83, %82
%129 = phi i64 [ 0, %82 ], [ %125, %83 ]
br i1 %51, label %150, label %130
130: ; preds = %128
%131 = add nsw i64 %129, %71
%132 = getelementptr inbounds double, double* %1, i64 %131
%133 = bitcast double* %132 to <2 x double>*
%134 = load <2 x double>, <2 x double>* %133
%135 = getelementptr inbounds double, double* %132, i64 2
%136 = bitcast double* %135 to <2 x double>*
%137 = load <2 x double>, <2 x double>* %136
%138 = getelementptr inbounds double, double* %8, i64 %129
%139 = bitcast double* %138 to <2 x double>*
%140 = load <2 x double>, <2 x double>* %139
%141 = getelementptr inbounds double, double* %138, i64 2
%142 = bitcast double* %141 to <2 x double>*
%143 = load <2 x double>, <2 x double>* %142
%144 = fmul <2 x double> %134, %140
%145 = fmul <2 x double> %137, %143
%146 = getelementptr inbounds double, double* %29, i64 %131
%147 = bitcast double* %146 to <2 x double>*
store <2 x double> %144, <2 x double>* %147
%148 = getelementptr inbounds double, double* %146, i64 2
%149 = bitcast double* %148 to <2 x double>*
store <2 x double> %145, <2 x double>* %149
br label %150
150: ; preds = %128, %130
br i1 %52, label %185, label %151
151: ; preds = %72, %65, %150
%152 = phi i64 [ 0, %72 ], [ 0, %65 ], [ %47, %150 ]
%153 = xor i64 %152, -1
br i1 %54, label %163, label %154
154: ; preds = %151
%155 = add nsw i64 %152, %71
%156 = getelementptr inbounds double, double* %1, i64 %155
%157 = load double, double* %156
%158 = getelementptr inbounds double, double* %8, i64 %152
%159 = load double, double* %158
%160 = fmul double %157, %159
%161 = getelementptr inbounds double, double* %29, i64 %155
store double %160, double* %161
%162 = or i64 %152, 1
br label %163
163: ; preds = %154, %151
%164 = phi i64 [ %152, %151 ], [ %162, %154 ]
%165 = icmp eq i64 %153, %55
br i1 %165, label %185, label %166
166: ; preds = %163, %166
%167 = phi i64 [ %183, %166 ], [ %164, %163 ]
%168 = add nsw i64 %167, %71
%169 = getelementptr inbounds double, double* %1, i64 %168
%170 = load double, double* %169
%171 = getelementptr inbounds double, double* %8, i64 %167
%172 = load double, double* %171
%173 = fmul double %170, %172
%174 = getelementptr inbounds double, double* %29, i64 %168
store double %173, double* %174
%175 = add nuw nsw i64 %167, 1
%176 = add nsw i64 %175, %71
%177 = getelementptr inbounds double, double* %1, i64 %176
%178 = load double, double* %177
%179 = getelementptr inbounds double, double* %8, i64 %175
%180 = load double, double* %179
%181 = fmul double %178, %180
%182 = getelementptr inbounds double, double* %29, i64 %176
store double %181, double* %182
%183 = add nuw nsw i64 %167, 2
%184 = icmp eq i64 %183, %37
br i1 %184, label %185, label %166
185: ; preds = %163, %166, %150
%186 = add nuw nsw i64 %66, 1
%187 = icmp eq i64 %186, %37
br i1 %187, label %188, label %65
188: ; preds = %185
%189 = tail call i32 @Matrix_MatrixT_Mult(double* %29, i32 %7, i32 %7, double* %2, i32 %7, i32 %7, double* %38)
%190 = mul i32 %7, %7
%191 = icmp eq i32 %190, 0
br i1 %191, label %318, label %192
192: ; preds = %188
%193 = zext i32 %190 to i64
%194 = icmp ult i32 %190, 4
br i1 %194, label %281, label %195
195: ; preds = %192
%196 = getelementptr double, double* %29, i64 %193
%197 = add nuw nsw i64 %37, %193
%198 = getelementptr double, double* %8, i64 %197
%199 = icmp ult double* %29, %198
%200 = icmp ult double* %38, %196
%201 = and i1 %199, %200
br i1 %201, label %281, label %202
202: ; preds = %195
%203 = and i64 %193, 4294967292
%204 = add nsw i64 %203, -4
%205 = lshr exact i64 %204, 2
%206 = add nuw nsw i64 %205, 1
%207 = and i64 %206, 3
%208 = icmp ult i64 %204, 12
br i1 %208, label %260, label %209
209: ; preds = %202
%210 = and i64 %206, 9223372036854775804
br label %211
211: ; preds = %211, %209
%212 = phi i64 [ 0, %209 ], [ %257, %211 ]
%213 = phi i64 [ 0, %209 ], [ %258, %211 ]
%214 = getelementptr inbounds double, double* %38, i64 %212
%215 = bitcast double* %214 to <2 x double>*
%216 = load <2 x double>, <2 x double>* %215
%217 = getelementptr inbounds double, double* %214, i64 2
%218 = bitcast double* %217 to <2 x double>*
%219 = load <2 x double>, <2 x double>* %218
%220 = getelementptr inbounds double, double* %29, i64 %212
%221 = bitcast double* %220 to <2 x double>*
store <2 x double> %216, <2 x double>* %221
%222 = getelementptr inbounds double, double* %220, i64 2
%223 = bitcast double* %222 to <2 x double>*
store <2 x double> %219, <2 x double>* %223
%224 = or i64 %212, 4
%225 = getelementptr inbounds double, double* %38, i64 %224
%226 = bitcast double* %225 to <2 x double>*
%227 = load <2 x double>, <2 x double>* %226
%228 = getelementptr inbounds double, double* %225, i64 2
%229 = bitcast double* %228 to <2 x double>*
%230 = load <2 x double>, <2 x double>* %229
%231 = getelementptr inbounds double, double* %29, i64 %224
%232 = bitcast double* %231 to <2 x double>*
store <2 x double> %227, <2 x double>* %232
%233 = getelementptr inbounds double, double* %231, i64 2
%234 = bitcast double* %233 to <2 x double>*
store <2 x double> %230, <2 x double>* %234
%235 = or i64 %212, 8
%236 = getelementptr inbounds double, double* %38, i64 %235
%237 = bitcast double* %236 to <2 x double>*
%238 = load <2 x double>, <2 x double>* %237
%239 = getelementptr inbounds double, double* %236, i64 2
%240 = bitcast double* %239 to <2 x double>*
%241 = load <2 x double>, <2 x double>* %240
%242 = getelementptr inbounds double, double* %29, i64 %235
%243 = bitcast double* %242 to <2 x double>*
store <2 x double> %238, <2 x double>* %243
%244 = getelementptr inbounds double, double* %242, i64 2
%245 = bitcast double* %244 to <2 x double>*
store <2 x double> %241, <2 x double>* %245
%246 = or i64 %212, 12
%247 = getelementptr inbounds double, double* %38, i64 %246
%248 = bitcast double* %247 to <2 x double>*
%249 = load <2 x double>, <2 x double>* %248
%250 = getelementptr inbounds double, double* %247, i64 2
%251 = bitcast double* %250 to <2 x double>*
%252 = load <2 x double>, <2 x double>* %251
%253 = getelementptr inbounds double, double* %29, i64 %246
%254 = bitcast double* %253 to <2 x double>*
store <2 x double> %249, <2 x double>* %254
%255 = getelementptr inbounds double, double* %253, i64 2
%256 = bitcast double* %255 to <2 x double>*
store <2 x double> %252, <2 x double>* %256
%257 = add nuw i64 %212, 16
%258 = add nuw i64 %213, 4
%259 = icmp eq i64 %258, %210
br i1 %259, label %260, label %211
260: ; preds = %211, %202
%261 = phi i64 [ 0, %202 ], [ %257, %211 ]
%262 = icmp eq i64 %207, 0
br i1 %262, label %279, label %263
263: ; preds = %260, %263
%264 = phi i64 [ %276, %263 ], [ %261, %260 ]
%265 = phi i64 [ %277, %263 ], [ 0, %260 ]
%266 = getelementptr inbounds double, double* %38, i64 %264
%267 = bitcast double* %266 to <2 x double>*
%268 = load <2 x double>, <2 x double>* %267
%269 = getelementptr inbounds double, double* %266, i64 2
%270 = bitcast double* %269 to <2 x double>*
%271 = load <2 x double>, <2 x double>* %270
%272 = getelementptr inbounds double, double* %29, i64 %264
%273 = bitcast double* %272 to <2 x double>*
store <2 x double> %268, <2 x double>* %273
%274 = getelementptr inbounds double, double* %272, i64 2
%275 = bitcast double* %274 to <2 x double>*
store <2 x double> %271, <2 x double>* %275
%276 = add nuw i64 %264, 4
%277 = add i64 %265, 1
%278 = icmp eq i64 %277, %207
br i1 %278, label %279, label %263
279: ; preds = %263, %260
%280 = icmp eq i64 %203, %193
br i1 %280, label %318, label %281
281: ; preds = %195, %192, %279
%282 = phi i64 [ 0, %195 ], [ 0, %192 ], [ %203, %279 ]
%283 = xor i64 %282, -1
%284 = add nsw i64 %283, %193
%285 = and i64 %193, 3
%286 = icmp eq i64 %285, 0
br i1 %286, label %296, label %287
287: ; preds = %281, %287
%288 = phi i64 [ %293, %287 ], [ %282, %281 ]
%289 = phi i64 [ %294, %287 ], [ 0, %281 ]
%290 = getelementptr inbounds double, double* %38, i64 %288
%291 = load double, double* %290
%292 = getelementptr inbounds double, double* %29, i64 %288
store double %291, double* %292
%293 = add nuw nsw i64 %288, 1
%294 = add i64 %289, 1
%295 = icmp eq i64 %294, %285
br i1 %295, label %296, label %287
296: ; preds = %287, %281
%297 = phi i64 [ %282, %281 ], [ %293, %287 ]
%298 = icmp ult i64 %284, 3
br i1 %298, label %318, label %299
299: ; preds = %296, %299
%300 = phi i64 [ %316, %299 ], [ %297, %296 ]
%301 = getelementptr inbounds double, double* %38, i64 %300
%302 = load double, double* %301
%303 = getelementptr inbounds double, double* %29, i64 %300
store double %302, double* %303
%304 = add nuw nsw i64 %300, 1
%305 = getelementptr inbounds double, double* %38, i64 %304
%306 = load double, double* %305
%307 = getelementptr inbounds double, double* %29, i64 %304
store double %306, double* %307
%308 = add nuw nsw i64 %300, 2
%309 = getelementptr inbounds double, double* %38, i64 %308
%310 = load double, double* %309
%311 = getelementptr inbounds double, double* %29, i64 %308
store double %310, double* %311
%312 = add nuw nsw i64 %300, 3
%313 = getelementptr inbounds double, double* %38, i64 %312
%314 = load double, double* %313
%315 = getelementptr inbounds double, double* %29, i64 %312
store double %314, double* %315
%316 = add nuw nsw i64 %300, 4
%317 = icmp eq i64 %316, %193
br i1 %317, label %318, label %299
318: ; preds = %296, %299, %279, %188, %23, %11
%319 = phi double* [ null, %11 ], [ null, %23 ], [ %29, %188 ], [ %29, %279 ], [ %29, %299 ], [ %29, %296 ]
ret double* %319
}