#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 */
int /*<<< orphan*/ calcResid(double *, int, int, double *, double *, double *);
double *calloc(int, int);
double dasum(int, double *, int);
double dt_log(double *, int, double, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
double fabs(double);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(double *);
double *malloc(int);
int /*<<< orphan*/ sqrt(double);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ wls(double *, int, int, double *, double *, char, double *,
                       double *, double *, double *, double *);
int lmT(double *X, int n, int p, double *y, double nu, int maxIter, double tol,
        char method, double *logLikelihood, double *coef, double *tau) {
  int iter, i;
  double logLikelihood_tm1, delta;
  double *sqwX, *XTX;
  sqwX = malloc(n * p * sizeof(double));
  if (sqwX == NULL) {
    fprintf(stderr, "Error -- out of memory\n");
    exit(1);
  }
  XTX = malloc(p * p * sizeof(double));
  if (XTX == NULL) {
    fprintf(stderr, "Error -- out of memory\n");
    exit(1);
  }
  double *w, *sqw, *sqwy, *resid;
  w = calloc(n, sizeof(double));
  if (w == NULL) {
    fprintf(stderr, "Error -- out of memory\n");
    exit(1);
  }
  sqw = calloc(n, sizeof(double));
  if (sqw == NULL) {
    fprintf(stderr, "Error -- out of memory\n");
    exit(1);
  }
  sqwy = calloc(n, sizeof(double));
  if (sqwy == NULL) {
    fprintf(stderr, "Error -- out of memory\n");
    exit(1);
  }
  resid = calloc(n, sizeof(double));
  if (resid == NULL) {
    fprintf(stderr, "Error -- out of memory\n");
    exit(1);
  }
  for (i = 0; i < n; i++) {
    w[i] = 1;
  }
  wls(X, n, p, y, w, method, XTX, sqw, sqwX, sqwy, coef);
  calcResid(X, n, p, y, coef, resid);
  (*tau) = 0;
  for (i = 0; i < n; i++) {
    (*tau) += resid[i] * resid[i] * w[i];
  }
  (*tau) /= dasum(n, w, 1);
  (*logLikelihood) = dt_log(resid, n, nu, 0, sqrt(*tau));
  logLikelihood_tm1 = (*logLikelihood);
  for (iter = 0; iter < maxIter; iter++) {
    for (i = 0; i < n; i++) {
      w[i] = (nu + 1) / (nu + resid[i] * resid[i] / (*tau));
    }
    wls(X, n, p, y, w, method, XTX, sqw, sqwX, sqwy, coef);
    calcResid(X, n, p, y, coef, resid);
    (*tau) = 0;
    for (i = 0; i < n; i++) {
      (*tau) += resid[i] * resid[i] * w[i];
    }
    (*tau) /= dasum(n, w, 1);
    (*logLikelihood) = dt_log(resid, n, nu, 0, sqrt(*tau));
    delta = ((*logLikelihood) - logLikelihood_tm1) /
            fabs((*logLikelihood) + logLikelihood_tm1) * 2;
    if (delta < tol) {
      logLikelihood_tm1 = (*logLikelihood);
      break;
    }
    logLikelihood_tm1 = (*logLikelihood);
  }
  free(sqwX);
  sqwX = NULL;
  free(XTX);
  XTX = NULL;
  free(w);
  w = NULL;
  free(sqw);
  sqw = NULL;
  free(sqwy);
  sqw = NULL;
  free(resid);
  resid = NULL;
  return iter;
}


x86 assembly (clang, -O0):
<lmT>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0xe0,%rsp
mov    %r9b,%al
mov    0x20(%rbp),%r9
mov    0x18(%rbp),%r9
mov    0x10(%rbp),%r9
mov    %rdi,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
mov    %edx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
mov    %r8d,-0x34(%rbp)
movsd  %xmm1,-0x40(%rbp)
mov    %al,-0x41(%rbp)
mov    -0x1c(%rbp),%eax
imul   -0x20(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x68(%rbp)
jne    121e <lmT+0x7e>
mov    0x2dda(%rip),%rax
mov    (%rax),%edi
lea    0xe11(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x20(%rbp),%eax
imul   -0x20(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x70(%rbp)
cmpq   $0x0,-0x70(%rbp)
jne    1260 <lmT+0xc0>
mov    0x2d98(%rip),%rax
mov    (%rax),%edi
lea    0xdcf(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x1c(%rbp),%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
jne    129b <lmT+0xfb>
mov    0x2d5d(%rip),%rax
mov    (%rax),%edi
lea    0xd94(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x1c(%rbp),%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,-0x80(%rbp)
cmpq   $0x0,-0x80(%rbp)
jne    12d6 <lmT+0x136>
mov    0x2d22(%rip),%rax
mov    (%rax),%edi
lea    0xd59(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x1c(%rbp),%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,-0x88(%rbp)
cmpq   $0x0,-0x88(%rbp)
jne    1317 <lmT+0x177>
mov    0x2ce1(%rip),%rax
mov    (%rax),%edi
lea    0xd18(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x1c(%rbp),%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,-0x90(%rbp)
cmpq   $0x0,-0x90(%rbp)
jne    1358 <lmT+0x1b8>
mov    0x2ca0(%rip),%rax
mov    (%rax),%edi
lea    0xcd7(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    138e <lmT+0x1ee>
mov    -0x78(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  0xc8d(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    135f <lmT+0x1bf>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    -0x78(%rbp),%r8
mov    -0x41(%rbp),%r9b
mov    -0x70(%rbp),%r14
mov    -0x80(%rbp),%rbx
mov    -0x68(%rbp),%r11
mov    -0x88(%rbp),%r10
mov    0x18(%rbp),%rax
movsbl %r9b,%r9d
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1050 <wls@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    0x18(%rbp),%r8
mov    -0x90(%rbp),%r9
call   1040 <calcResid@plt>
mov    0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1467 <lmT+0x2c7>
mov    -0x90(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x90(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x78(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    0x20(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    140c <lmT+0x26c>
mov    -0x1c(%rbp),%edi
mov    -0x78(%rbp),%rsi
mov    $0x1,%edx
call   1080 <dasum@plt>
movaps %xmm0,%xmm1
mov    0x20(%rbp),%rax
movsd  (%rax),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0x90(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x9c(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    0x20(%rbp),%rax
movsd  (%rax),%xmm0
call   10b0 <sqrt@plt>
mov    -0xa8(%rbp),%rdi
mov    -0x9c(%rbp),%esi
movsd  -0x98(%rbp),%xmm0
ff
mov    %eax,%ecx
xor    %edx,%edx
call   1060 <dt_log@plt>
mov    0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1741 <lmT+0x5a1>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1572 <lmT+0x3d2>
movsd  0xaeb(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
mov    -0x90(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x90(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm2
mov    0x20(%rbp),%rax
divsd  (%rax),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    -0x78(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1509 <lmT+0x369>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    -0x78(%rbp),%r8
mov    -0x41(%rbp),%r9b
mov    -0x70(%rbp),%r14
mov    -0x80(%rbp),%rbx
mov    -0x68(%rbp),%r11
mov    -0x88(%rbp),%r10
mov    0x18(%rbp),%rax
movsbl %r9b,%r9d
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1050 <wls@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    0x18(%rbp),%r8
mov    -0x90(%rbp),%r9
call   1040 <calcResid@plt>
mov    0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    164b <lmT+0x4ab>
mov    -0x90(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x90(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x78(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    0x20(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    15f0 <lmT+0x450>
mov    -0x1c(%rbp),%edi
mov    -0x78(%rbp),%rsi
mov    $0x1,%edx
call   1080 <dasum@plt>
movaps %xmm0,%xmm1
mov    0x20(%rbp),%rax
movsd  (%rax),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0x90(%rbp),%rax
mov    %rax,-0xc0(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0xb4(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
mov    0x20(%rbp),%rax
movsd  (%rax),%xmm0
call   10b0 <sqrt@plt>
mov    -0xc0(%rbp),%rdi
mov    -0xb4(%rbp),%esi
movsd  -0xb0(%rbp),%xmm0
ff
mov    %eax,%ecx
xor    %edx,%edx
call   1060 <dt_log@plt>
mov    0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    0x10(%rbp),%rax
movsd  (%rax),%xmm0
subsd  -0x58(%rbp),%xmm0
mov    0x10(%rbp),%rax
movsd  (%rax),%xmm1
addsd  -0x58(%rbp),%xmm1
movaps 0x929(%rip),%xmm2
pand   %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  0x909(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1726 <lmT+0x586>
mov    0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    1741 <lmT+0x5a1>
mov    0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    14f6 <lmT+0x356>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x68(%rbp)
mov    -0x70(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x70(%rbp)
mov    -0x78(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x78(%rbp)
mov    -0x80(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x80(%rbp)
mov    -0x88(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x80(%rbp)
mov    -0x90(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x90(%rbp)
mov    -0x48(%rbp),%eax
add    $0xe0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<lmT>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xf8,%rsp
mov    %r9d,%r15d
movsd  %xmm1,0xa8(%rsp)
mov    %r8d,0x10(%rsp)
movapd %xmm0,0x60(%rsp)
mov    %rcx,0x18(%rsp)
mov    %edx,%ebx
mov    %rdi,0x50(%rsp)
mov    %esi,0x14(%rsp)
mov    %esi,%edi
imul   %edx,%edi
shl    $0x3,%edi
call   10a0 <malloc@plt>
mov    %rax,0x38(%rsp)
test   %rax,%rax
je     1a6e <lmT+0x8ce>
mov    %ebx,%edi
imul   %ebx,%edi
shl    $0x3,%edi
call   10a0 <malloc@plt>
mov    %rax,0x30(%rsp)
test   %rax,%rax
je     1a6e <lmT+0x8ce>
mov    0x14(%rsp),%ebp
mov    %ebp,%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
test   %rax,%rax
je     1a6e <lmT+0x8ce>
mov    %rax,%r13
mov    %ebp,%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,0x28(%rsp)
test   %rax,%rax
je     1a6e <lmT+0x8ce>
mov    %ebp,%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,0x20(%rsp)
test   %rax,%rax
je     1a6e <lmT+0x8ce>
mov    %ebp,%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
test   %rax,%rax
je     1a6e <lmT+0x8ce>
mov    %rax,%r14
mov    0x138(%rsp),%rax
movsbl %r15b,%r9d
mov    %ebp,%r12d
test   %ebp,%ebp
mov    %ebx,0xc(%rsp)
mov    %ebp,%esi
mov    %r9d,0x4c(%rsp)
jle    12a0 <lmT+0x100>
cmp    $0x4,%esi
jae    1307 <lmT+0x167>
xor    %eax,%eax
jmp    1419 <lmT+0x279>
sub    $0x8,%rsp
mov    0x58(%rsp),%rbp
mov    %rbp,%rdi
mov    %ebx,%edx
mov    0x20(%rsp),%rbx
mov    %rbx,%rcx
mov    %esi,%r15d
mov    %r13,%r8
push   %rax
push   0x30(%rsp)
push   0x50(%rsp)
push   0x48(%rsp)
push   0x58(%rsp)
call   1050 <wls@plt>
add    $0x30,%rsp
mov    %rbp,%rdi
mov    %r15d,%esi
mov    0xc(%rsp),%edx
mov    %rbx,%rcx
mov    0x138(%rsp),%r8
mov    %r15d,%ebp
mov    %r14,%r9
call   1040 <calcResid@plt>
xorpd  %xmm0,%xmm0
mov    0x140(%rsp),%rbx
jmp    156b <lmT+0x3cb>
mov    %r12d,%eax
and    $0xfffffffc,%eax
lea    -0x4(%rax),%rdi
mov    %rdi,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
mov    %edx,%ecx
and    $0x7,%ecx
cmp    $0x1c,%rdi
jae    132e <lmT+0x18e>
xor    %edi,%edi
jmp    13d6 <lmT+0x236>
and    $0xfffffffffffffff8,%rdx
xor    %edi,%edi
movapd 0xcc4(%rip),%xmm0
nopl   0x0(%rax)
movupd %xmm0,0x0(%r13,%rdi,8)
movupd %xmm0,0x10(%r13,%rdi,8)
movupd %xmm0,0x20(%r13,%rdi,8)
movupd %xmm0,0x30(%r13,%rdi,8)
movupd %xmm0,0x40(%r13,%rdi,8)
movupd %xmm0,0x50(%r13,%rdi,8)
movupd %xmm0,0x60(%r13,%rdi,8)
movupd %xmm0,0x70(%r13,%rdi,8)
movupd %xmm0,0x80(%r13,%rdi,8)
movupd %xmm0,0x90(%r13,%rdi,8)
movupd %xmm0,0xa0(%r13,%rdi,8)
movupd %xmm0,0xb0(%r13,%rdi,8)
movupd %xmm0,0xc0(%r13,%rdi,8)
movupd %xmm0,0xd0(%r13,%rdi,8)
movupd %xmm0,0xe0(%r13,%rdi,8)
movupd %xmm0,0xf0(%r13,%rdi,8)
add    $0x20,%rdi
add    $0xfffffffffffffff8,%rdx
jne    1340 <lmT+0x1a0>
test   %rcx,%rcx
je     1414 <lmT+0x274>
lea    0x10(,%rdi,8),%rdx
add    %r13,%rdx
shl    $0x5,%rcx
xor    %edi,%edi
movapd 0xc0c(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movupd %xmm0,-0x10(%rdx,%rdi,1)
movupd %xmm0,(%rdx,%rdi,1)
add    $0x20,%rdi
cmp    %rdi,%rcx
jne    1400 <lmT+0x260>
cmp    %r12,%rax
je     143e <lmT+0x29e>
movabs $0x3ff0000000000000,%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rcx,0x0(%r13,%rax,8)
add    $0x1,%rax
cmp    %rax,%r12
jne    1430 <lmT+0x290>
sub    $0x8,%rsp
mov    0x58(%rsp),%rbp
mov    %rbp,%rdi
mov    %ebx,%edx
mov    0x20(%rsp),%rcx
mov    %r13,%r8
mov    %esi,%ebx
mov    0x140(%rsp),%r15
push   %r15
push   0x30(%rsp)
push   0x50(%rsp)
push   0x48(%rsp)
push   0x58(%rsp)
call   1050 <wls@plt>
add    $0x30,%rsp
mov    %rbp,%rdi
mov    %ebx,%esi
mov    0xc(%rsp),%edx
mov    0x18(%rsp),%rcx
mov    %r15,%r8
mov    %ebx,%ebp
mov    %r14,%r9
call   1040 <calcResid@plt>
mov    0x140(%rsp),%rbx
movq   $0x0,(%rbx)
test   %ebp,%ebp
jle    156f <lmT+0x3cf>
lea    -0x1(%r12),%rcx
mov    %r12d,%eax
and    $0x3,%eax
cmp    $0x3,%rcx
jae    14c4 <lmT+0x324>
xorpd  %xmm0,%xmm0
xor    %ecx,%ecx
jmp    1530 <lmT+0x390>
mov    %r12d,%edx
and    $0xfffffffc,%edx
xorpd  %xmm0,%xmm0
xor    %ecx,%ecx
movsd  (%r14,%rcx,8),%xmm1
movsd  0x8(%r14,%rcx,8),%xmm2
mulsd  %xmm1,%xmm1
mulsd  0x0(%r13,%rcx,8),%xmm1
addsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm2
mulsd  0x8(%r13,%rcx,8),%xmm2
addsd  %xmm1,%xmm2
movsd  0x10(%r14,%rcx,8),%xmm1
mulsd  %xmm1,%xmm1
mulsd  0x10(%r13,%rcx,8),%xmm1
movsd  0x18(%r14,%rcx,8),%xmm0
mulsd  %xmm0,%xmm0
mulsd  0x18(%r13,%rcx,8),%xmm0
addsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x4,%rcx
cmp    %rcx,%rdx
jne    14d0 <lmT+0x330>
test   %rax,%rax
je     156b <lmT+0x3cb>
lea    0x0(,%rcx,8),%rdx
add    %r13,%rdx
lea    (%r14,%rcx,8),%rcx
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
movsd  (%rcx,%rsi,8),%xmm1
mulsd  %xmm1,%xmm1
mulsd  (%rdx,%rsi,8),%xmm1
addsd  %xmm1,%xmm0
add    $0x1,%rsi
cmp    %rsi,%rax
jne    1550 <lmT+0x3b0>
movsd  %xmm0,(%rbx)
mov    %ebp,%edi
mov    %r13,%rsi
mov    $0x1,%edx
call   1080 <dasum@plt>
movsd  (%rbx),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx)
movapd %xmm1,%xmm0
call   10b0 <sqrt@plt>
xor    %ecx,%ecx
mov    %rcx,0x40(%rsp)
mov    %r14,%rdi
mov    %ebp,%esi
movapd 0x60(%rsp),%xmm0
xor    %edx,%edx
mov    %eax,%ecx
call   1060 <dt_log@plt>
mov    0x130(%rsp),%rax
movsd  %xmm0,(%rax)
cmpl   $0x0,0x10(%rsp)
jle    1a1f <lmT+0x87f>
movsd  0xa53(%rip),%xmm5
movapd 0x60(%rsp),%xmm4
addsd  %xmm4,%xmm5
mov    %r12d,%eax
and    $0xfffffffe,%eax
mov    %rax,0x98(%rsp)
add    $0xfffffffffffffffe,%rax
mov    %rax,0x90(%rsp)
mov    %rax,%rcx
shr    %rcx
add    $0x1,%rcx
lea    -0x1(%r12),%rax
mov    %rax,0xa0(%rsp)
movapd %xmm4,%xmm6
unpcklpd %xmm4,%xmm6
movapd %xmm5,%xmm7
unpcklpd %xmm5,%xmm7
mov    %rcx,%rax
mov    %rcx,0x88(%rsp)
and    $0xfffffffffffffffe,%rcx
mov    %rcx,0x80(%rsp)
mov    %r12d,%eax
and    $0x3,%eax
mov    %rax,0x58(%rsp)
mov    %r12d,%eax
and    $0xfffffffc,%eax
mov    %rax,0x78(%rsp)
xor    %eax,%eax
mov    %rax,0x40(%rsp)
movapd %xmm5,0xd0(%rsp)
movapd %xmm6,0xc0(%rsp)
movapd %xmm7,0xb0(%rsp)
nopw   0x0(%rax,%rax,1)
movapd %xmm0,0xe0(%rsp)
test   %ebp,%ebp
jle    16a0 <lmT+0x500>
movsd  (%rbx),%xmm0
cmp    $0x1,%ebp
mov    0x4c(%rsp),%r9d
jne    1720 <lmT+0x580>
xor    %eax,%eax
jmp    17e0 <lmT+0x640>
cs nopw 0x0(%rax,%rax,1)
sub    $0x8,%rsp
mov    0x58(%rsp),%r15
mov    %r15,%rdi
mov    %ebp,%esi
mov    0x14(%rsp),%edx
mov    0x20(%rsp),%rbx
mov    %rbx,%rcx
mov    %r13,%r8
mov    0x54(%rsp),%r9d
mov    0x140(%rsp),%rax
push   %rax
push   0x30(%rsp)
push   0x50(%rsp)
push   0x48(%rsp)
push   0x58(%rsp)
call   1050 <wls@plt>
add    $0x30,%rsp
mov    %r15,%rdi
mov    %ebp,%esi
mov    0xc(%rsp),%edx
mov    %rbx,%rcx
mov    0x140(%rsp),%rbx
mov    0x138(%rsp),%r8
mov    %r14,%r9
call   1040 <calcResid@plt>
xorpd  %xmm0,%xmm0
jmp    194b <lmT+0x7ab>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
cmpq   $0x0,0x90(%rsp)
je     1a01 <lmT+0x861>
mov    0x80(%rsp),%rcx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movupd (%r14,%rax,8),%xmm2
mulpd  %xmm2,%xmm2
divpd  %xmm1,%xmm2
addpd  %xmm6,%xmm2
movapd %xmm7,%xmm3
divpd  %xmm2,%xmm3
movupd %xmm3,0x0(%r13,%rax,8)
movupd 0x10(%r14,%rax,8),%xmm2
mulpd  %xmm2,%xmm2
divpd  %xmm1,%xmm2
addpd  %xmm6,%xmm2
movapd %xmm7,%xmm3
divpd  %xmm2,%xmm3
movupd %xmm3,0x10(%r13,%rax,8)
add    $0x4,%rax
add    $0xfffffffffffffffe,%rcx
jne    1750 <lmT+0x5b0>
testb  $0x1,0x88(%rsp)
01
je     17c8 <lmT+0x628>
movupd (%r14,%rax,8),%xmm2
mulpd  %xmm2,%xmm2
divpd  %xmm1,%xmm2
addpd  %xmm6,%xmm2
movapd %xmm7,%xmm1
divpd  %xmm2,%xmm1
movupd %xmm1,0x0(%r13,%rax,8)
mov    0x98(%rsp),%rcx
mov    %rcx,%rax
cmp    %r12,%rcx
je     180a <lmT+0x66a>
nopl   0x0(%rax,%rax,1)
movsd  (%r14,%rax,8),%xmm1
mulsd  %xmm1,%xmm1
divsd  %xmm0,%xmm1
addsd  %xmm4,%xmm1
movapd %xmm5,%xmm2
divsd  %xmm1,%xmm2
movsd  %xmm2,0x0(%r13,%rax,8)
add    $0x1,%rax
cmp    %rax,%r12
jne    17e0 <lmT+0x640>
sub    $0x8,%rsp
mov    0x58(%rsp),%rbx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    0x14(%rsp),%ebp
mov    %ebp,%edx
mov    0x20(%rsp),%r15
mov    %r15,%rcx
mov    %r13,%r8
mov    0x140(%rsp),%rax
push   %rax
push   0x30(%rsp)
push   0x50(%rsp)
push   0x48(%rsp)
push   0x58(%rsp)
call   1050 <wls@plt>
add    $0x30,%rsp
mov    %rbx,%rdi
mov    0x14(%rsp),%esi
mov    %ebp,%edx
mov    %r15,%rcx
mov    0x14(%rsp),%ebp
mov    0x138(%rsp),%r8
mov    %r14,%r9
call   1040 <calcResid@plt>
mov    0x140(%rsp),%rbx
movq   $0x0,(%rbx)
test   %ebp,%ebp
jle    194f <lmT+0x7af>
cmpq   $0x3,0xa0(%rsp)
jae    189a <lmT+0x6fa>
xorpd  %xmm0,%xmm0
xor    %eax,%eax
mov    0x58(%rsp),%rsi
jmp    1910 <lmT+0x770>
xorpd  %xmm0,%xmm0
xor    %eax,%eax
mov    0x58(%rsp),%rsi
mov    0x78(%rsp),%rcx
nopw   0x0(%rax,%rax,1)
movsd  (%r14,%rax,8),%xmm1
movsd  0x8(%r14,%rax,8),%xmm2
mulsd  %xmm1,%xmm1
mulsd  0x0(%r13,%rax,8),%xmm1
addsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm2
mulsd  0x8(%r13,%rax,8),%xmm2
addsd  %xmm1,%xmm2
movsd  0x10(%r14,%rax,8),%xmm1
mulsd  %xmm1,%xmm1
mulsd  0x10(%r13,%rax,8),%xmm1
movsd  0x18(%r14,%rax,8),%xmm0
mulsd  %xmm0,%xmm0
mulsd  0x18(%r13,%rax,8),%xmm0
addsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x4,%rax
cmp    %rax,%rcx
jne    18b0 <lmT+0x710>
test   %rsi,%rsi
je     194b <lmT+0x7ab>
lea    0x0(,%rax,8),%rcx
add    %r13,%rcx
lea    (%r14,%rax,8),%rax
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
movsd  (%rax,%rdx,8),%xmm1
mulsd  %xmm1,%xmm1
mulsd  (%rcx,%rdx,8),%xmm1
addsd  %xmm1,%xmm0
add    $0x1,%rdx
cmp    %rdx,%rsi
jne    1930 <lmT+0x790>
movsd  %xmm0,(%rbx)
mov    %ebp,%edi
mov    %r13,%rsi
mov    $0x1,%edx
call   1080 <dasum@plt>
movsd  (%rbx),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx)
movapd %xmm1,%xmm0
call   10b0 <sqrt@plt>
mov    %r14,%rdi
mov    %ebp,%esi
movapd 0x60(%rsp),%xmm0
xor    %edx,%edx
mov    %eax,%ecx
call   1060 <dt_log@plt>
mov    0x130(%rsp),%rax
movsd  %xmm0,(%rax)
movapd %xmm0,%xmm1
movapd 0xe0(%rsp),%xmm2
subsd  %xmm2,%xmm1
addsd  %xmm0,%xmm2
andpd  0x660(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm1
movsd  0xa8(%rsp),%xmm2
ucomisd %xmm1,%xmm2
ja     1a1f <lmT+0x87f>
mov    0x40(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x40(%rsp)
cmp    0x10(%rsp),%eax
movapd 0x60(%rsp),%xmm4
movapd 0xd0(%rsp),%xmm5
movapd 0xc0(%rsp),%xmm6
movapd 0xb0(%rsp),%xmm7
jne    1670 <lmT+0x4d0>
jmp    1a16 <lmT+0x876>
xor    %eax,%eax
testb  $0x1,0x88(%rsp)
01
jne    17a7 <lmT+0x607>
jmp    17c8 <lmT+0x628>
mov    0x10(%rsp),%eax
mov    %rax,0x40(%rsp)
mov    0x38(%rsp),%rdi
call   1030 <free@plt>
mov    0x30(%rsp),%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    0x28(%rsp),%rdi
call   1030 <free@plt>
mov    0x20(%rsp),%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x40(%rsp),%rax
add    $0xf8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x256b(%rip),%rax
mov    (%rax),%edi
lea    0x5aa(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>

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

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