#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 array_max(double *, int);
double array_max_abs(double *, int);
double array_min(double *, int);
double cholmod(double *, int, double *, double);
scalar_t__ fabs(double);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
double sqrt(double);
double modelhess2(double *A, int N, double *L) {
  double *U22;
  double sqrteps, maxdiag, mindiag, maxposdiag, u;
  double maxoffdiag, maxinp, maxadd;
  double maxev, minev, offrow, sdd;
  int step, i, j, k;
  sqrteps = sqrt((double)1e-15);
  U22 = (double *)malloc(sizeof(double) * N * N);
  for (i = 0; i < N; ++i) {
    U22[i] = A[i + i * N];
  }
  maxdiag = array_max(U22, N);
  mindiag = array_min(U22, N);
  maxposdiag = 0.0;
  if (maxdiag > maxposdiag) {
    maxposdiag = maxdiag;
  }
  for (i = 0; i < N; ++i) {
    U22[i] = 0.0;
  }
  u = 0.0;
  if (mindiag <= sqrteps * maxposdiag) {
    u = 2 * (maxposdiag - mindiag) * sqrteps - mindiag;
    maxdiag += u;
  }
  k = 0;
  for (i = 0; i < N; ++i) {
    for (j = 0; j < N; ++j) {
      if (j > i) {
        U22[k] = A[i * N + j];
        k++;
      }
    }
  }
  maxoffdiag = array_max_abs(U22, k);
  if (maxoffdiag * (1 + 2 * sqrteps) > maxdiag) {
    u += (maxoffdiag - maxdiag) + 2 * sqrteps * maxoffdiag;
    maxdiag = maxoffdiag * (1 + 2 * sqrteps);
  }
  if (maxdiag == 0) {
    u = 1;
    maxdiag = 1;
  }
  if (u > 0) {
    for (i = 0; i < N; ++i) {
      A[i * N + i] += u;
    }
  }
  if (maxdiag > maxoffdiag / N) {
    maxinp = sqrt(maxdiag);
  } else {
    maxinp = sqrt(maxoffdiag / N);
  }
  maxadd = cholmod(A, N, L, maxinp);
  if (maxadd > 0) {
    maxev = minev = A[0];
    for (i = 0; i < N; ++i) {
      offrow = 0.0;
      step = i * N;
      for (j = 0; j < i; ++j) {
        offrow += fabs(A[step + j]);
      }
      for (j = i + 1; j < N; ++j) {
        offrow += fabs(A[step + j]);
      }
      if (maxev < A[step + i] + offrow) {
        maxev = A[step + i] + offrow;
      }
      if (minev > A[step + i] - offrow) {
        minev = A[step + i] - offrow;
      }
    }
    sdd = (maxev - minev) * sqrteps - minev;
    if (sdd < 0) {
      sdd = 0;
    }
    if (maxadd > sdd) {
      u = sdd;
    } else {
      u = maxadd;
    }
    for (i = 0; i < N; ++i) {
      A[i * N + i] += u;
    }
  }
  maxadd = cholmod(A, N, L, 0.0);
  free(U22);
  return maxadd;
}


x86 assembly (clang, -O0):
<modelhess2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  0xe62(%rip),%xmm0
call   1090 <sqrt@plt>
movsd  %xmm0,-0x28(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
movslq -0xc(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x88(%rbp)
mov    -0x88(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    121e <modelhess2+0x9e>
mov    -0x8(%rbp),%rax
mov    -0x88(%rbp),%ecx
mov    -0x88(%rbp),%edx
imul   -0xc(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x88(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    11cd <modelhess2+0x4d>
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1070 <array_max@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <array_min@plt>
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    1262 <modelhess2+0xe2>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0x88(%rbp)
mov    -0x88(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12a2 <modelhess2+0x122>
mov    -0x20(%rbp),%rax
movslq -0x88(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    126c <modelhess2+0xec>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1316 <modelhess2+0x196>
movsd  -0x40(%rbp),%xmm1
subsd  -0x38(%rbp),%xmm1
movsd  0xd33(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x90(%rbp)
movl   $0x0,-0x88(%rbp)
mov    -0x88(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    13d1 <modelhess2+0x251>
movl   $0x0,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    13b8 <modelhess2+0x238>
mov    -0x8c(%rbp),%eax
cmp    -0x88(%rbp),%eax
jle    139f <modelhess2+0x21f>
mov    -0x8(%rbp),%rax
mov    -0x88(%rbp),%ecx
imul   -0xc(%rbp),%ecx
add    -0x8c(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x90(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x90(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x90(%rbp)
jmp    13a4 <modelhess2+0x224>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    1343 <modelhess2+0x1c3>
jmp    13bd <modelhess2+0x23d>
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    132a <modelhess2+0x1aa>
mov    -0x20(%rbp),%rdi
mov    -0x90(%rbp),%esi
call   10a0 <array_max_abs@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xc15(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
ucomisd -0x30(%rbp),%xmm0
jbe    145f <modelhess2+0x2df>
movsd  -0x50(%rbp),%xmm1
subsd  -0x30(%rbp),%xmm1
movsd  0xbe8(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xbbe(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1491 <modelhess2+0x311>
jp     1491 <modelhess2+0x311>
movsd  0xb91(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xb84(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    14fb <modelhess2+0x37b>
movl   $0x0,-0x88(%rbp)
mov    -0x88(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    14f6 <modelhess2+0x376>
movsd  -0x48(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x88(%rbp),%ecx
imul   -0xc(%rbp),%ecx
add    -0x88(%rbp),%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    14ad <modelhess2+0x32d>
jmp    14fb <modelhess2+0x37b>
movsd  -0x30(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
cvtsi2sdl -0xc(%rbp),%xmm2
divsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    152c <modelhess2+0x3ac>
movsd  -0x30(%rbp),%xmm0
call   1090 <sqrt@plt>
movsd  %xmm0,-0x58(%rbp)
jmp    1544 <modelhess2+0x3c4>
movsd  -0x50(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1090 <sqrt@plt>
movsd  %xmm0,-0x58(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
movsd  -0x58(%rbp),%xmm0
call   1040 <cholmod@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    17f1 <modelhess2+0x671>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  %xmm0,-0x68(%rbp)
movl   $0x0,-0x88(%rbp)
mov    -0x88(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1722 <modelhess2+0x5a2>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x88(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x84(%rbp)
movl   $0x0,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0x88(%rbp),%eax
jge    160f <modelhess2+0x48f>
mov    -0x8(%rbp),%rax
mov    -0x84(%rbp),%ecx
add    -0x8c(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1060 <fabs@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    15bd <modelhess2+0x43d>
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    166d <modelhess2+0x4ed>
mov    -0x8(%rbp),%rax
mov    -0x84(%rbp),%ecx
add    -0x8c(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1060 <fabs@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    161e <modelhess2+0x49e>
movsd  -0x68(%rbp),%xmm1
mov    -0x8(%rbp),%rax
mov    -0x84(%rbp),%ecx
add    -0x88(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x78(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    16bb <modelhess2+0x53b>
mov    -0x8(%rbp),%rax
mov    -0x84(%rbp),%ecx
add    -0x88(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x70(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x84(%rbp),%ecx
add    -0x88(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
subsd  -0x78(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    1709 <modelhess2+0x589>
mov    -0x8(%rbp),%rax
mov    -0x84(%rbp),%ecx
add    -0x88(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    170e <modelhess2+0x58e>
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    158c <modelhess2+0x40c>
movsd  -0x68(%rbp),%xmm0
subsd  -0x70(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x80(%rbp),%xmm0
jbe    1770 <modelhess2+0x5f0>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x60(%rbp),%xmm0
ucomisd -0x80(%rbp),%xmm0
jbe    178f <modelhess2+0x60f>
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1799 <modelhess2+0x619>
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x0,-0x88(%rbp)
mov    -0x88(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    17ec <modelhess2+0x66c>
movsd  -0x48(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x88(%rbp),%ecx
imul   -0xc(%rbp),%ecx
add    -0x88(%rbp),%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    17a3 <modelhess2+0x623>
jmp    17f1 <modelhess2+0x671>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
xorps  %xmm0,%xmm0
call   1040 <cholmod@plt>
movsd  %xmm0,-0x60(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movsd  -0x60(%rbp),%xmm0
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modelhess2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rdx,%r14
mov    %esi,%r13d
mov    %rdi,%r12
mov    %esi,%edi
imul   %esi,%edi
shl    $0x3,%edi
call   1090 <malloc@plt>
mov    %rax,%r15
mov    %r13d,%r9d
test   %r13d,%r13d
jle    1246 <modelhess2+0xb6>
xor    %ecx,%ecx
cmp    $0x1,%r13d
jne    11cf <modelhess2+0x3f>
xor    %eax,%eax
jmp    1228 <modelhess2+0x98>
mov    %r9d,%r8d
and    $0xfffffffe,%r8d
lea    0x0(%r13,%r13,1),%esi
mov    $0x1,%edi
mov    %r13d,%ebp
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nop
movslq %ebp,%rbp
lea    (%rdi,%rbp,1),%rbx
movslq %ecx,%rcx
lea    (%rax,%rcx,1),%rdx
movsd  (%r12,%rdx,8),%xmm0
movsd  %xmm0,(%r15,%rax,8)
movsd  (%r12,%rbx,8),%xmm0
movsd  %xmm0,0x8(%r15,%rax,8)
add    $0x2,%rax
add    %esi,%ecx
add    $0x2,%rdi
add    %esi,%ebp
cmp    %rax,%r8
jne    11f0 <modelhess2+0x60>
test   $0x1,%r9b
je     1246 <modelhess2+0xb6>
mov    %eax,%ecx
imul   %r13d,%ecx
movslq %ecx,%rcx
add    %rax,%rcx
movsd  (%r12,%rcx,8),%xmm0
movsd  %xmm0,(%r15,%rax,8)
mov    %r9,0x10(%rsp)
mov    %r15,%rdi
mov    %r13d,%esi
call   1080 <array_max@plt>
movsd  %xmm0,(%rsp)
mov    %r15,%rdi
mov    %r13d,%esi
call   1060 <array_min@plt>
xorpd  %xmm1,%xmm1
movsd  (%rsp),%xmm3
maxsd  %xmm1,%xmm3
test   %r13d,%r13d
jle    12ab <modelhess2+0x11b>
mov    0x10(%rsp),%rax
lea    0x0(,%rax,8),%rdx
mov    %r15,%rdi
xor    %esi,%esi
movsd  %xmm0,0x8(%rsp)
movsd  %xmm3,0x18(%rsp)
call   1040 <memset@plt>
movsd  0x18(%rsp),%xmm3
movsd  0x8(%rsp),%xmm0
xorpd  %xmm1,%xmm1
movsd  0xd4d(%rip),%xmm2
mulsd  %xmm3,%xmm2
ucomisd %xmm0,%xmm2
jb     12e3 <modelhess2+0x153>
subsd  %xmm0,%xmm3
addsd  %xmm3,%xmm3
mulsd  0xd33(%rip),%xmm3
subsd  %xmm0,%xmm3
movsd  (%rsp),%xmm0
addsd  %xmm3,%xmm0
movsd  %xmm0,(%rsp)
movapd %xmm3,%xmm1
test   %r13d,%r13d
mov    0x10(%rsp),%rdx
movsd  %xmm1,0x8(%rsp)
jle    1388 <modelhess2+0x1f8>
mov    %edx,%eax
and    $0xfffffffe,%eax
lea    0x8(%r12),%rcx
lea    0x0(,%rdx,8),%r8
xor    %ebx,%ebx
xor    %esi,%esi
jmp    131c <modelhess2+0x18c>
nop
add    $0x1,%rbx
add    %r8,%rcx
cmp    %rdx,%rbx
je     138a <modelhess2+0x1fa>
xor    %ebp,%ebp
cmp    $0x1,%r13d
jne    1359 <modelhess2+0x1c9>
test   $0x1,%dl
je     1310 <modelhess2+0x180>
cmp    %rbx,%rbp
jbe    1310 <modelhess2+0x180>
mov    %rbx,%rdi
imul   %rdx,%rdi
add    %rdi,%rbp
movsd  (%r12,%rbp,8),%xmm0
movslq %esi,%rsi
movsd  %xmm0,(%r15,%rsi,8)
add    $0x1,%esi
jmp    1310 <modelhess2+0x180>
nopl   0x0(%rax)
add    $0x2,%rbp
cmp    %rbp,%rax
je     1324 <modelhess2+0x194>
cmp    %rbx,%rbp
jbe    1370 <modelhess2+0x1e0>
movsd  -0x8(%rcx,%rbp,8),%xmm0
movslq %esi,%rsi
movsd  %xmm0,(%r15,%rsi,8)
add    $0x1,%esi
cmp    %rbx,%rbp
jb     1350 <modelhess2+0x1c0>
movsd  (%rcx,%rbp,8),%xmm0
movslq %esi,%rsi
movsd  %xmm0,(%r15,%rsi,8)
add    $0x1,%esi
jmp    1350 <modelhess2+0x1c0>
xor    %esi,%esi
mov    %r15,%rdi
call   10b0 <array_max_abs@plt>
movapd %xmm0,%xmm1
movsd  0xc6a(%rip),%xmm0
mulsd  %xmm1,%xmm0
movapd %xmm1,%xmm2
movsd  (%rsp),%xmm5
subsd  %xmm5,%xmm2
movsd  0xc59(%rip),%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm2,%xmm3
movapd %xmm5,%xmm2
cmpltsd %xmm0,%xmm2
andpd  %xmm2,%xmm3
movsd  0xc44(%rip),%xmm4
andnpd %xmm4,%xmm2
orpd   %xmm3,%xmm2
movsd  0x8(%rsp),%xmm4
addsd  %xmm2,%xmm4
maxsd  %xmm5,%xmm0
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
movsd  0xc26(%rip),%xmm3
jne    1409 <modelhess2+0x279>
mov    0x10(%rsp),%r10
jp     140e <modelhess2+0x27e>
movapd %xmm3,%xmm4
jmp    140e <modelhess2+0x27e>
mov    0x10(%rsp),%r10
jne    1416 <modelhess2+0x286>
jp     1416 <modelhess2+0x286>
movapd %xmm3,%xmm0
ucomisd %xmm2,%xmm4
jbe    14b8 <modelhess2+0x328>
test   %r13d,%r13d
jle    14b8 <modelhess2+0x328>
xor    %eax,%eax
cmp    $0x1,%r13d
je     149a <modelhess2+0x30a>
lea    0x0(%r13,%r13,1),%r9d
mov    %r10d,%r8d
and    $0xfffffffe,%r8d
neg    %r8
mov    $0x1,%edi
xor    %esi,%esi
mov    %r13d,%ebp
xor    %ebx,%ebx
nopl   0x0(%rax)
movslq %ebp,%rbp
lea    (%rdi,%rbp,1),%rdx
cltq
lea    (%rbx,%rax,1),%rcx
movsd  (%r12,%rcx,8),%xmm2
addsd  %xmm4,%xmm2
movsd  %xmm2,(%r12,%rcx,8)
movsd  (%r12,%rdx,8),%xmm2
addsd  %xmm4,%xmm2
movsd  %xmm2,(%r12,%rdx,8)
add    $0x2,%rbx
add    %r9d,%eax
add    $0x2,%rdi
add    %r9d,%ebp
add    $0xfffffffffffffffe,%rsi
cmp    %rsi,%r8
jne    1450 <modelhess2+0x2c0>
neg    %rsi
mov    %rsi,%rax
test   $0x1,%r10b
je     14b8 <modelhess2+0x328>
mov    %eax,%ecx
imul   %r13d,%ecx
movslq %ecx,%rcx
add    %rax,%rcx
addsd  (%r12,%rcx,8),%xmm4
movsd  %xmm4,(%r12,%rcx,8)
xorps  %xmm2,%xmm2
cvtsi2sd %r13d,%xmm2
divsd  %xmm2,%xmm1
maxsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     14d8 <modelhess2+0x348>
sqrtsd %xmm0,%xmm0
jmp    14dd <modelhess2+0x34d>
call   10a0 <sqrt@plt>
mov    %r12,%rdi
mov    %r13d,%esi
mov    %r14,%rdx
call   1050 <cholmod@plt>
movsd  %xmm0,0x48(%rsp)
ucomisd 0xb2f(%rip),%xmm0
mov    0x10(%rsp),%r10
jbe    1818 <modelhess2+0x688>
mov    %r15,0x38(%rsp)
mov    %r14,0x40(%rsp)
movsd  (%r12),%xmm2
test   %r13d,%r13d
mov    %r12,0x20(%rsp)
jle    174f <modelhess2+0x5bf>
lea    0x18(%r12),%r15
lea    0x0(,%r10,8),%rax
mov    %rax,0x58(%rsp)
lea    0x8(,%r10,8),%rax
mov    %rax,0x50(%rsp)
xor    %ebp,%ebp
mov    %r10,%rbx
mov    %r12,%rax
mov    %r12,0x28(%rsp)
movapd %xmm2,%xmm3
mov    %r13,0x60(%rsp)
jmp    15c3 <modelhess2+0x433>
nopl   0x0(%rax)
mov    0x30(%rsp),%rbx
movslq 0x8(%rsp),%rax
mov    0x18(%rsp),%rcx
add    %rax,%rcx
mov    0x20(%rsp),%rax
movsd  (%rax,%rcx,8),%xmm0
movapd %xmm2,%xmm1
addsd  %xmm0,%xmm1
maxsd  0x68(%rsp),%xmm1
subsd  %xmm2,%xmm0
minsd  0x70(%rsp),%xmm0
mov    0x58(%rsp),%rax
add    %rax,%r15
add    %rax,0x28(%rsp)
add    0x50(%rsp),%r12
add    $0xffffffffffffffff,%rbx
mov    %r14,%rbp
movapd %xmm0,%xmm2
movapd %xmm1,%xmm3
mov    0x10(%rsp),%r10
cmp    %r10,%r14
je     1757 <modelhess2+0x5c7>
mov    %ebp,%eax
mov    %ebp,0x8(%rsp)
test   %rbp,%rbp
mov    %rbp,0x18(%rsp)
mov    %rbx,0x30(%rsp)
movsd  %xmm2,0x70(%rsp)
movsd  %xmm3,0x68(%rsp)
je     1600 <modelhess2+0x470>
lea    -0x1(%rbp),%rax
cmp    $0x3,%rax
jae    1610 <modelhess2+0x480>
xorpd  %xmm2,%xmm2
xor    %r14d,%r14d
jmp    16a0 <modelhess2+0x510>
nopw   0x0(%rax,%rax,1)
xorpd  %xmm2,%xmm2
jmp    16ea <modelhess2+0x55a>
nopl   0x0(%rax)
mov    %rbp,%rbx
and    $0xfffffffffffffffc,%rbx
xorpd  %xmm2,%xmm2
xor    %r14d,%r14d
xchg   %ax,%ax
movsd  %xmm2,(%rsp)
movsd  -0x18(%r15,%r14,8),%xmm0
call   1070 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  -0x10(%r15,%r14,8),%xmm0
call   1070 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  -0x8(%r15,%r14,8),%xmm0
call   1070 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  (%r15,%r14,8),%xmm0
call   1070 <fabs@plt>
xorps  %xmm2,%xmm2
cvtsi2sd %rax,%xmm2
addsd  (%rsp),%xmm2
add    $0x4,%r14
cmp    %r14,%rbx
jne    1620 <modelhess2+0x490>
test   $0x3,%bpl
je     16ea <modelhess2+0x55a>
mov    0x8(%rsp),%eax
mov    %eax,%r13d
and    $0x3,%r13d
mov    0x28(%rsp),%rax
lea    (%rax,%r14,8),%rbp
xor    %ebx,%ebx
nopl   0x0(%rax)
movsd  %xmm2,(%rsp)
movsd  0x0(%rbp,%rbx,8),%xmm0
call   1070 <fabs@plt>
movsd  (%rsp),%xmm2
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  %xmm0,%xmm2
add    $0x1,%rbx
cmp    %rbx,%r13
jne    16c0 <modelhess2+0x530>
mov    0x60(%rsp),%r13
mov    0x8(%rsp),%eax
imul   %r13d,%eax
mov    %eax,0x8(%rsp)
mov    0x18(%rsp),%rax
lea    0x1(%rax),%r14
cmp    0x10(%rsp),%r14
jae    1560 <modelhess2+0x3d0>
mov    $0x1,%ebp
mov    0x30(%rsp),%rbx
nopl   0x0(%rax)
movsd  %xmm2,(%rsp)
movsd  (%r12,%rbp,8),%xmm0
call   1070 <fabs@plt>
movsd  (%rsp),%xmm2
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  %xmm0,%xmm2
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1720 <modelhess2+0x590>
jmp    1565 <modelhess2+0x3d5>
movapd %xmm2,%xmm1
movapd %xmm2,%xmm0
test   %r13d,%r13d
mov    0x40(%rsp),%r14
mov    0x20(%rsp),%r12
mov    0x38(%rsp),%r15
jle    1818 <modelhess2+0x688>
subsd  %xmm0,%xmm1
mulsd  0x885(%rip),%xmm1
subsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
maxsd  %xmm1,%xmm0
minsd  0x48(%rsp),%xmm0
xor    %eax,%eax
cmp    $0x1,%r13d
je     17fa <modelhess2+0x66a>
lea    0x0(%r13,%r13,1),%r9d
mov    %r10d,%r8d
and    $0xfffffffe,%r8d
neg    %r8
mov    $0x1,%edi
xor    %esi,%esi
mov    %r13d,%ebp
xor    %ebx,%ebx
movslq %ebp,%rbp
lea    (%rdi,%rbp,1),%rdx
cltq
lea    (%rbx,%rax,1),%rcx
movsd  (%r12,%rcx,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r12,%rcx,8)
movsd  (%r12,%rdx,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r12,%rdx,8)
add    $0x2,%rbx
add    %r9d,%eax
add    $0x2,%rdi
add    %r9d,%ebp
add    $0xfffffffffffffffe,%rsi
cmp    %rsi,%r8
jne    17b0 <modelhess2+0x620>
neg    %rsi
mov    %rsi,%rax
test   $0x1,%r10b
je     1818 <modelhess2+0x688>
mov    %eax,%ecx
imul   %r13d,%ecx
movslq %ecx,%rcx
add    %rax,%rcx
addsd  (%r12,%rcx,8),%xmm0
movsd  %xmm0,(%r12,%rcx,8)
xorpd  %xmm0,%xmm0
mov    %r12,%rdi
mov    %r13d,%esi
mov    %r14,%rdx
call   1050 <cholmod@plt>
movsd  %xmm0,(%rsp)
mov    %r15,%rdi
call   1030 <free@plt>
movsd  (%rsp),%xmm0
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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