#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_abs(double *, int);
double fabs(double);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ hessian_fd(double (*)(double *, int), double *, int,
                              double *);
int /*<<< orphan*/ jacobian_fd(double (*)(double *, int), double *, int,
                               double *);
int /*<<< orphan*/ linsolve_lower(double *, int, double *, double *);
int lnsrch(double (*)(double *, int), double *, double *, double *, int, double,
           double *, double, double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ modelhess(double *, int, double *, double *);
double pow(double, double);
int /*<<< orphan*/ scale(double *, int, int, double);
int stopcheck(double, int, double *, double *, double *, double *, double,
              double, double, int);
int newton_min_func(double (*funcpt)(double *, int), double *xi, int N,
                    double *dx, double fsval, double *xf) {
  int rcode, iter;
  int i, siter, retval;
  double gtol, stol;
  double fx, num, den, stop0, maxstep, fxf;
  double *jac, *hess, *scheck, *xc, *L, *step;
  jac = (double *)malloc(sizeof(double) * N);
  scheck = (double *)malloc(sizeof(double) * N);
  xc = (double *)malloc(sizeof(double) * N);
  step = (double *)malloc(sizeof(double) * N);
  hess = (double *)malloc(sizeof(double) * N * N);
  L = (double *)malloc(sizeof(double) * N * N);
  rcode = 0;
  iter = 0;
  siter = (int)100;
  gtol = pow((double)1e-15, 1.0 / 3.0);
  stol = gtol * gtol;
  fx = funcpt(xi, N);
  jacobian_fd(funcpt, xi, N, jac);
  maxstep = 1.0;
  for (i = 0; i < N; ++i) {
    dx[i] = 1.0 / dx[i];
  }
  if (fabs(fx) > fabs(fsval)) {
    den = fabs(fx);
  } else {
    den = fabs(fsval);
  }
  for (i = 0; i < N; ++i) {
    if (fabs(xi[i]) > 1.0 / fabs(dx[i])) {
      num = fabs(xi[i]);
    } else {
      num = 1.0 / fabs(dx[i]);
    }
    scheck[i] = fabs(jac[i]) * num / den;
  }
  stop0 = array_max_abs(scheck, N);
  if (stop0 <= gtol * 1e-03) {
    rcode = 1;
    for (i = 0; i < N; ++i) {
      xf[i] = xi[i];
    }
    return rcode;
  }
  hessian_fd(funcpt, xi, N, hess);
  for (i = 0; i < N; ++i) {
    xc[i] = xi[i];
  }
  while (rcode == 0 && iter < siter) {
    modelhess(hess, N, dx, L);
    scale(jac, 1, N, -1.0);
    linsolve_lower(L, N, jac, step);
    scale(jac, 1, N, -1.0);
    retval = lnsrch(funcpt, xc, jac, step, N, maxstep, dx, stol, xf);
    fxf = funcpt(xf, N);
    jacobian_fd(funcpt, xf, N, jac);
    rcode = stopcheck(fxf, N, xc, xf, jac, dx, fsval, gtol, stol, retval);
    hessian_fd(funcpt, xf, N, hess);
    for (i = 0; i < N; ++i) {
      xc[i] = xf[i];
    }
  }
  free(jac);
  free(hess);
  free(scheck);
  free(xc);
  free(L);
  free(step);
  return rcode;
}


x86 assembly (clang, -O0):
<newton_min_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x98(%rbp)
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0xa8(%rbp)
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0xb0(%rbp)
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0xc0(%rbp)
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
movslq -0x1c(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0xa0(%rbp)
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
movslq -0x1c(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0xb8(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
movl   $0x64,-0x48(%rbp)
movsd  0xd84(%rip),%xmm0
movsd  0xd84(%rip),%xmm1
call   10a0 <pow@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   *%rax
movsd  %xmm0,-0x68(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x98(%rbp),%rcx
call   1070 <jacobian_fd@plt>
movsd  0xd2a(%rip),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1321 <newton_min_func+0x171>
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  0xcff(%rip),%xmm0
divsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    12e5 <newton_min_func+0x135>
movsd  -0x68(%rbp),%xmm0
movaps 0xd03(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  -0x30(%rbp),%xmm1
movaps 0xcf3(%rip),%xmm2
pand   %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    1365 <newton_min_func+0x1b5>
movsd  -0x68(%rbp),%xmm0
movaps 0xcd9(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
jmp    137a <newton_min_func+0x1ca>
movsd  -0x30(%rbp),%xmm0
movaps 0xcbf(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1461 <newton_min_func+0x2b1>
mov    -0x18(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movaps 0xc8f(%rip),%xmm1
pand   %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movaps 0xc77(%rip),%xmm1
pand   %xmm1,%xmm2
movsd  0xc3b(%rip),%xmm1
divsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    13f5 <newton_min_func+0x245>
mov    -0x18(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movaps 0xc49(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    141e <newton_min_func+0x26e>
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movaps 0xc27(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xbeb(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x98(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movaps 0xbfb(%rip),%xmm1
pand   %xmm1,%xmm0
mulsd  -0x70(%rbp),%xmm0
divsd  -0x78(%rbp),%xmm0
mov    -0xa8(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1381 <newton_min_func+0x1d1>
mov    -0xa8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   10d0 <array_max_abs@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm1
movsd  0xb96(%rip),%xmm0
mulsd  -0x58(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     14de <newton_min_func+0x32e>
movl   $0x1,-0x3c(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    14d3 <newton_min_func+0x323>
mov    -0x18(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    149f <newton_min_func+0x2ef>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1729 <newton_min_func+0x579>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0xa0(%rbp),%rcx
call   1090 <hessian_fd@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1533 <newton_min_func+0x383>
mov    -0x18(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0xb0(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    14fc <newton_min_func+0x34c>
jmp    1538 <newton_min_func+0x388>
xor    %eax,%eax
cmpl   $0x0,-0x3c(%rbp)
mov    %al,-0xc1(%rbp)
jne    1559 <newton_min_func+0x3a9>
mov    -0x40(%rbp),%eax
cmp    -0x48(%rbp),%eax
setl   %al
mov    %al,-0xc1(%rbp)
mov    -0xc1(%rbp),%al
test   $0x1,%al
jne    156c <newton_min_func+0x3bc>
jmp    16db <newton_min_func+0x52b>
mov    -0xa0(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0xb8(%rbp),%rcx
call   10c0 <modelhess@plt>
mov    -0x98(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    $0x1,%esi
movsd  0xa83(%rip),%xmm0
call   1080 <scale@plt>
mov    -0xb8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x98(%rbp),%rdx
mov    -0xc0(%rbp),%rcx
call   1050 <linsolve_lower@plt>
mov    -0x98(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    $0x1,%esi
movsd  0xa4a(%rip),%xmm0
call   1080 <scale@plt>
mov    -0x10(%rbp),%rdi
mov    -0xb0(%rbp),%rsi
mov    -0x98(%rbp),%rdx
mov    -0xc0(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
movsd  -0x88(%rbp),%xmm0
ff
mov    -0x28(%rbp),%r9
movsd  -0x60(%rbp),%xmm1
mov    -0x38(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <lnsrch@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   *%rax
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x98(%rbp),%rcx
call   1070 <jacobian_fd@plt>
movsd  -0x90(%rbp),%xmm0
ff
mov    -0x1c(%rbp),%edi
mov    -0xb0(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x98(%rbp),%rcx
mov    -0x28(%rbp),%r8
movsd  -0x30(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm3
mov    -0x4c(%rbp),%r9d
call   10b0 <stopcheck@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0xa0(%rbp),%rcx
call   1090 <hessian_fd@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    16d6 <newton_min_func+0x526>
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0xb0(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    169f <newton_min_func+0x4ef>
jmp    1538 <newton_min_func+0x388>
mov    -0x98(%rbp),%rdi
call   1040 <free@plt>
mov    -0xa0(%rbp),%rdi
call   1040 <free@plt>
mov    -0xa8(%rbp),%rdi
call   1040 <free@plt>
mov    -0xb0(%rbp),%rdi
call   1040 <free@plt>
mov    -0xb8(%rbp),%rdi
call   1040 <free@plt>
mov    -0xc0(%rbp),%rdi
call   1040 <free@plt>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<newton_min_func>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    %r8,%rbx
movapd %xmm0,0xb0(%rsp)
mov    %rcx,%r15
mov    %edx,%r14d
mov    %rsi,0x18(%rsp)
mov    %rdi,%r12
lea    0x0(,%r14,8),%ebp
mov    %ebp,%edi
call   1060 <malloc@plt>
mov    %rax,0x30(%rsp)
mov    %ebp,%edi
call   1060 <malloc@plt>
mov    %rax,%r13
mov    %ebp,%edi
call   1060 <malloc@plt>
mov    %rax,0x20(%rsp)
mov    %ebp,%edi
call   1060 <malloc@plt>
mov    %rax,0x40(%rsp)
imul   %r14d,%ebp
mov    %ebp,%edi
call   1060 <malloc@plt>
mov    %rax,0x28(%rsp)
mov    %ebp,%edi
call   1060 <malloc@plt>
mov    %rax,0x38(%rsp)
mov    0x18(%rsp),%rbp
mov    %rbp,%rdi
mov    %r14d,%esi
call   *%r12
movapd %xmm0,0x50(%rsp)
mov    %r12,0x48(%rsp)
mov    %r12,%rdi
mov    0x30(%rsp),%r12
mov    %rbp,%rsi
mov    %r14d,%edx
mov    %r12,%rcx
call   1070 <jacobian_fd@plt>
movapd 0x50(%rsp),%xmm7
test   %r14d,%r14d
jle    1492 <newton_min_func+0x2f2>
mov    %r14d,%eax
cmp    $0x1,%r14d
jne    126b <newton_min_func+0xcb>
xor    %ecx,%ecx
jmp    12f6 <newton_min_func+0x156>
mov    %eax,%ecx
and    $0xfffffffe,%ecx
lea    -0x2(%rcx),%rsi
mov    %rsi,%rdx
shr    %rdx
add    $0x1,%rdx
test   %rsi,%rsi
je     1429 <newton_min_func+0x289>
mov    %rdx,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %esi,%esi
movapd 0xd68(%rip),%xmm0
nopl   0x0(%rax,%rax,1)
movupd (%r15,%rsi,8),%xmm1
movupd 0x10(%r15,%rsi,8),%xmm2
movapd %xmm0,%xmm3
divpd  %xmm1,%xmm3
movupd %xmm3,(%r15,%rsi,8)
movapd %xmm0,%xmm1
divpd  %xmm2,%xmm1
movupd %xmm1,0x10(%r15,%rsi,8)
add    $0x4,%rsi
add    $0xfffffffffffffffe,%rdi
jne    12a0 <newton_min_func+0x100>
test   $0x1,%dl
je     12f1 <newton_min_func+0x151>
movupd (%r15,%rsi,8),%xmm0
movapd 0xd19(%rip),%xmm1
divpd  %xmm0,%xmm1
movupd %xmm1,(%r15,%rsi,8)
cmp    %rax,%rcx
je     1319 <newton_min_func+0x179>
movsd  0xd22(%rip),%xmm0
xchg   %ax,%ax
movapd %xmm0,%xmm1
divsd  (%r15,%rcx,8),%xmm1
movsd  %xmm1,(%r15,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1300 <newton_min_func+0x160>
test   %r14d,%r14d
jle    1492 <newton_min_func+0x2f2>
movapd 0xce6(%rip),%xmm0
andpd  %xmm0,%xmm7
movapd 0xb0(%rsp),%xmm1
andpd  %xmm0,%xmm1
maxsd  %xmm1,%xmm7
cmp    $0x1,%r14d
jne    134c <newton_min_func+0x1ac>
xor    %ecx,%ecx
jmp    143e <newton_min_func+0x29e>
lea    0x0(,%rax,8),%rcx
add    %r13,%rcx
lea    0x0(,%rax,8),%rdx
add    %rbp,%rdx
lea    (%r15,%rax,8),%rsi
cmp    %rdx,%r13
setb   %r9b
cmp    %rbp,%rcx
seta   %r10b
lea    (%r12,%rax,8),%rdi
cmp    %rsi,%r13
setb   %dl
cmp    %r15,%rcx
seta   %r11b
cmp    %rdi,%r13
setb   %sil
cmp    %rcx,%r12
setb   %r8b
xor    %ecx,%ecx
test   %r10b,%r9b
jne    1439 <newton_min_func+0x299>
and    %r11b,%dl
jne    1439 <newton_min_func+0x299>
and    %r8b,%sil
mov    0x18(%rsp),%rbp
jne    143e <newton_min_func+0x29e>
mov    %eax,%ecx
and    $0xfffffffe,%ecx
movapd %xmm7,%xmm1
unpcklpd %xmm7,%xmm1
xor    %edx,%edx
movapd 0xc44(%rip),%xmm2
movapd 0xc2c(%rip),%xmm3
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movupd 0x0(%rbp,%rdx,8),%xmm4
andpd  %xmm2,%xmm4
movupd (%r15,%rdx,8),%xmm5
andpd  %xmm2,%xmm5
movapd %xmm3,%xmm6
divpd  %xmm5,%xmm6
maxpd  %xmm6,%xmm4
movupd (%r12,%rdx,8),%xmm5
andpd  %xmm2,%xmm5
mulpd  %xmm4,%xmm5
divpd  %xmm1,%xmm5
movupd %xmm5,0x0(%r13,%rdx,8)
add    $0x2,%rdx
cmp    %rdx,%rcx
jne    13e0 <newton_min_func+0x240>
cmp    %rax,%rcx
jne    143e <newton_min_func+0x29e>
jmp    1492 <newton_min_func+0x2f2>
xor    %esi,%esi
test   $0x1,%dl
jne    12d9 <newton_min_func+0x139>
jmp    12f1 <newton_min_func+0x151>
mov    0x18(%rsp),%rbp
movsd  0xbda(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
movsd  0x0(%rbp,%rcx,8),%xmm2
andpd  %xmm0,%xmm2
movsd  (%r15,%rcx,8),%xmm3
andpd  %xmm0,%xmm3
movapd %xmm1,%xmm4
divsd  %xmm3,%xmm4
maxsd  %xmm4,%xmm2
movsd  (%r12,%rcx,8),%xmm3
andpd  %xmm0,%xmm3
mulsd  %xmm2,%xmm3
divsd  %xmm7,%xmm3
movsd  %xmm3,0x0(%r13,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1450 <newton_min_func+0x2b0>
mov    %r13,%rdi
mov    %r14d,%esi
call   10c0 <array_max_abs@plt>
movsd  0xb83(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    1590 <newton_min_func+0x3f0>
mov    %r13,0x60(%rsp)
mov    0x20(%rsp),%r12
mov    0x48(%rsp),%rdi
mov    0x18(%rsp),%rbp
mov    %rbp,%rsi
mov    %r14d,%edx
mov    0x28(%rsp),%rcx
call   1090 <hessian_fd@plt>
movabs $0x7ffffffffffffffc,%r8
ff ff 7f
test   %r14d,%r14d
jle    16e9 <newton_min_func+0x549>
mov    %rbp,%rsi
mov    %r14d,%ecx
cmp    $0x4,%r14d
jb     1511 <newton_min_func+0x371>
lea    (%rsi,%rcx,8),%rax
mov    0x20(%rsp),%rdx
cmp    %rax,%rdx
jae    15d2 <newton_min_func+0x432>
lea    (%rdx,%rcx,8),%rax
cmp    %rsi,%rax
jbe    15d2 <newton_min_func+0x432>
xor    %edx,%edx
mov    %rdx,%rax
not    %rax
add    %rcx,%rax
mov    %rcx,%rdi
and    $0x3,%rdi
je     1545 <newton_min_func+0x3a5>
cs nopw 0x0(%rax,%rax,1)
nop
movsd  (%rsi,%rdx,8),%xmm0
movsd  %xmm0,(%r12,%rdx,8)
add    $0x1,%rdx
add    $0xffffffffffffffff,%rdi
jne    1530 <newton_min_func+0x390>
cmp    $0x3,%rax
jb     16e9 <newton_min_func+0x549>
nop
movsd  (%rsi,%rdx,8),%xmm0
movsd  %xmm0,(%r12,%rdx,8)
movsd  0x8(%rsi,%rdx,8),%xmm0
movsd  %xmm0,0x8(%r12,%rdx,8)
movsd  0x10(%rsi,%rdx,8),%xmm0
movsd  %xmm0,0x10(%r12,%rdx,8)
movsd  0x18(%rsi,%rdx,8),%xmm0
movsd  %xmm0,0x18(%r12,%rdx,8)
add    $0x4,%rdx
cmp    %rdx,%rcx
jne    1550 <newton_min_func+0x3b0>
jmp    16e9 <newton_min_func+0x549>
mov    $0x1,%r15d
test   %r14d,%r14d
jle    1b87 <newton_min_func+0x9e7>
mov    %r14d,%eax
cmp    $0x4,%r14d
jae    15b4 <newton_min_func+0x414>
xor    %ecx,%ecx
mov    0x18(%rsp),%rdx
jmp    1b14 <newton_min_func+0x974>
mov    0x18(%rsp),%rdx
lea    (%rdx,%rax,8),%rcx
cmp    %rbx,%rcx
jbe    15fa <newton_min_func+0x45a>
lea    (%rbx,%rax,8),%rcx
cmp    %rdx,%rcx
jbe    15fa <newton_min_func+0x45a>
xor    %ecx,%ecx
jmp    1b14 <newton_min_func+0x974>
mov    %ecx,%edx
and    $0xfffffffc,%edx
lea    -0x4(%rdx),%rax
mov    %rax,%rdi
shr    $0x2,%rdi
add    $0x1,%rdi
mov    %edi,%r9d
and    $0x3,%r9d
cmp    $0xc,%rax
jae    1626 <newton_min_func+0x486>
xor    %ebp,%ebp
jmp    1694 <newton_min_func+0x4f4>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
lea    -0x4(%rcx),%rdi
mov    %rdi,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
mov    %esi,%r8d
and    $0x3,%r8d
cmp    $0xc,%rdi
jae    1a5f <newton_min_func+0x8bf>
xor    %edi,%edi
jmp    1acc <newton_min_func+0x92c>
and    %r8,%rdi
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movups (%rsi,%rbp,8),%xmm0
movups 0x10(%rsi,%rbp,8),%xmm1
movups %xmm0,(%r12,%rbp,8)
movups %xmm1,0x10(%r12,%rbp,8)
movups 0x20(%rsi,%rbp,8),%xmm0
movups 0x30(%rsi,%rbp,8),%xmm1
movups %xmm0,0x20(%r12,%rbp,8)
movups %xmm1,0x30(%r12,%rbp,8)
movups 0x40(%rsi,%rbp,8),%xmm0
movups 0x50(%rsi,%rbp,8),%xmm1
movups %xmm0,0x40(%r12,%rbp,8)
movups %xmm1,0x50(%r12,%rbp,8)
movupd 0x60(%rsi,%rbp,8),%xmm0
movupd 0x70(%rsi,%rbp,8),%xmm1
movupd %xmm0,0x60(%r12,%rbp,8)
movupd %xmm1,0x70(%r12,%rbp,8)
add    $0x10,%rbp
add    $0xfffffffffffffffc,%rdi
jne    1630 <newton_min_func+0x490>
test   %r9,%r9
je     16e0 <newton_min_func+0x540>
mov    0x20(%rsp),%rax
lea    (%rax,%rbp,8),%rdi
add    $0x10,%rdi
lea    (%rsi,%rbp,8),%rbp
add    $0x10,%rbp
shl    $0x5,%r9
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movupd -0x10(%rbp,%rax,1),%xmm0
movupd 0x0(%rbp,%rax,1),%xmm1
movupd %xmm0,-0x10(%rdi,%rax,1)
movupd %xmm1,(%rdi,%rax,1)
add    $0x20,%rax
cmp    %rax,%r9
jne    16c0 <newton_min_func+0x520>
cmp    %rcx,%rdx
jne    1513 <newton_min_func+0x373>
mov    %r15,0x18(%rsp)
mov    %r14d,%esi
mov    0x20(%rsp),%rdx
lea    (%rdx,%rsi,8),%rax
lea    (%rbx,%rsi,8),%rcx
mov    %esi,%edi
and    $0xfffffffc,%edi
mov    %rdi,0x88(%rsp)
add    $0xfffffffffffffffc,%rdi
mov    %rdi,0x80(%rsp)
shr    $0x2,%rdi
add    $0x1,%rdi
cmp    %rcx,%rdx
setb   %cl
cmp    %rbx,%rax
seta   %al
and    %cl,%al
mov    %al,0x17(%rsp)
mov    %edi,%eax
and    $0x3,%eax
and    %r8,%rdi
mov    %rdi,0x68(%rsp)
mov    %esi,%ecx
and    $0x3,%ecx
mov    %rcx,0x90(%rsp)
add    $0x10,%rdx
mov    %rdx,0x20(%rsp)
lea    0x10(%rbx),%rcx
mov    %rcx,0x70(%rsp)
mov    %rax,0x78(%rsp)
mov    %rax,%rdi
shl    $0x5,%rdi
mov    %rsi,0xa0(%rsp)
mov    %rdi,0x98(%rsp)
mov    0x48(%rsp),%r13
jmp    1789 <newton_min_func+0x5e9>
test   %r15d,%r15d
jne    1a20 <newton_min_func+0x880>
mov    0x28(%rsp),%rdi
mov    %r14d,%esi
mov    0x18(%rsp),%rdx
mov    0x38(%rsp),%rbp
mov    %rbp,%rcx
call   10b0 <modelhess@plt>
mov    0x30(%rsp),%r15
mov    %r15,%rdi
mov    $0x1,%esi
mov    %r14d,%edx
movsd  0x875(%rip),%xmm0
call   1080 <scale@plt>
mov    %rbp,%rdi
mov    %r14d,%esi
mov    %r15,%rdx
mov    0x40(%rsp),%rbp
mov    %rbp,%rcx
call   1050 <linsolve_lower@plt>
mov    %r15,%rdi
mov    $0x1,%esi
mov    %r14d,%edx
movsd  0x847(%rip),%xmm0
call   1080 <scale@plt>
mov    %rbx,(%rsp)
mov    %r13,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %rbp,%rcx
mov    %r14d,%r8d
movsd  0x817(%rip),%xmm0
mov    0x18(%rsp),%rbp
mov    %rbp,%r9
movsd  0x81f(%rip),%xmm1
call   1030 <lnsrch@plt>
mov    %eax,0x50(%rsp)
mov    %rbx,%rdi
mov    %r14d,%esi
call   *%r13
movsd  %xmm0,0xa8(%rsp)
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
mov    %r15,%rcx
call   1070 <jacobian_fd@plt>
movsd  0xa8(%rsp),%xmm0
mov    %r14d,%edi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r15,%rcx
mov    %rbp,%r8
movapd 0xb0(%rsp),%xmm1
movsd  0x7d2(%rip),%xmm2
movsd  0x7c2(%rip),%xmm3
mov    0x50(%rsp),%r9d
call   10a0 <stopcheck@plt>
mov    %eax,%r15d
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
mov    0x28(%rsp),%rcx
call   1090 <hessian_fd@plt>
mov    0x98(%rsp),%rdi
mov    0xa0(%rsp),%rsi
test   %r14d,%r14d
jle    1780 <newton_min_func+0x5e0>
cmp    $0x4,%r14d
setb   %al
or     0x17(%rsp),%al
je     18d0 <newton_min_func+0x730>
xor    %eax,%eax
jmp    19a3 <newton_min_func+0x803>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmpq   $0xc,0x80(%rsp)
jae    18df <newton_min_func+0x73f>
xor    %eax,%eax
jmp    1954 <newton_min_func+0x7b4>
mov    0x68(%rsp),%rcx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
movups (%rbx,%rax,8),%xmm0
movups 0x10(%rbx,%rax,8),%xmm1
movups %xmm0,(%r12,%rax,8)
movups %xmm1,0x10(%r12,%rax,8)
movups 0x20(%rbx,%rax,8),%xmm0
movups 0x30(%rbx,%rax,8),%xmm1
movups %xmm0,0x20(%r12,%rax,8)
movups %xmm1,0x30(%r12,%rax,8)
movups 0x40(%rbx,%rax,8),%xmm0
movups 0x50(%rbx,%rax,8),%xmm1
movups %xmm0,0x40(%r12,%rax,8)
movups %xmm1,0x50(%r12,%rax,8)
movupd 0x60(%rbx,%rax,8),%xmm0
movupd 0x70(%rbx,%rax,8),%xmm1
movupd %xmm0,0x60(%r12,%rax,8)
movupd %xmm1,0x70(%r12,%rax,8)
add    $0x10,%rax
add    $0xfffffffffffffffc,%rcx
jne    18f0 <newton_min_func+0x750>
cmpq   $0x0,0x78(%rsp)
je     198f <newton_min_func+0x7ef>
mov    0x20(%rsp),%rcx
lea    (%rcx,%rax,8),%rcx
mov    0x70(%rsp),%rdx
lea    (%rdx,%rax,8),%rax
xor    %edx,%edx
movupd -0x10(%rax,%rdx,1),%xmm0
movupd (%rax,%rdx,1),%xmm1
movupd %xmm0,-0x10(%rcx,%rdx,1)
movupd %xmm1,(%rcx,%rdx,1)
add    $0x20,%rdx
cmp    %rdx,%rdi
jne    1970 <newton_min_func+0x7d0>
mov    0x88(%rsp),%rcx
mov    %rcx,%rax
cmp    %rsi,%rcx
je     1780 <newton_min_func+0x5e0>
mov    %rax,%rcx
not    %rcx
add    %rsi,%rcx
mov    0x90(%rsp),%rdx
test   %rdx,%rdx
je     19d5 <newton_min_func+0x835>
nopl   0x0(%rax)
movsd  (%rbx,%rax,8),%xmm0
movsd  %xmm0,(%r12,%rax,8)
add    $0x1,%rax
add    $0xffffffffffffffff,%rdx
jne    19c0 <newton_min_func+0x820>
cmp    $0x3,%rcx
jb     1780 <newton_min_func+0x5e0>
nop
movsd  (%rbx,%rax,8),%xmm0
movsd  %xmm0,(%r12,%rax,8)
movsd  0x8(%rbx,%rax,8),%xmm0
movsd  %xmm0,0x8(%r12,%rax,8)
movsd  0x10(%rbx,%rax,8),%xmm0
movsd  %xmm0,0x10(%r12,%rax,8)
movsd  0x18(%rbx,%rax,8),%xmm0
movsd  %xmm0,0x18(%r12,%rax,8)
add    $0x4,%rax
cmp    %rax,%rsi
jne    19e0 <newton_min_func+0x840>
jmp    1780 <newton_min_func+0x5e0>
mov    0x30(%rsp),%rdi
call   1040 <free@plt>
mov    0x28(%rsp),%rdi
call   1040 <free@plt>
mov    0x60(%rsp),%rdi
call   1040 <free@plt>
mov    %r12,%rdi
call   1040 <free@plt>
mov    0x38(%rsp),%rdi
call   1040 <free@plt>
mov    0x40(%rsp),%rdi
call   1040 <free@plt>
jmp    1b87 <newton_min_func+0x9e7>
and    $0xfffffffffffffffc,%rsi
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
nop
movups (%rdx,%rdi,8),%xmm0
movups 0x10(%rdx,%rdi,8),%xmm1
movups %xmm0,(%rbx,%rdi,8)
movups %xmm1,0x10(%rbx,%rdi,8)
movups 0x20(%rdx,%rdi,8),%xmm0
movups 0x30(%rdx,%rdi,8),%xmm1
movups %xmm0,0x20(%rbx,%rdi,8)
movups %xmm1,0x30(%rbx,%rdi,8)
movups 0x40(%rdx,%rdi,8),%xmm0
movups 0x50(%rdx,%rdi,8),%xmm1
movups %xmm0,0x40(%rbx,%rdi,8)
movups %xmm1,0x50(%rbx,%rdi,8)
movupd 0x60(%rdx,%rdi,8),%xmm0
movupd 0x70(%rdx,%rdi,8),%xmm1
movupd %xmm0,0x60(%rbx,%rdi,8)
movupd %xmm1,0x70(%rbx,%rdi,8)
add    $0x10,%rdi
add    $0xfffffffffffffffc,%rsi
jne    1a70 <newton_min_func+0x8d0>
test   %r8,%r8
je     1b0f <newton_min_func+0x96f>
lea    (%rbx,%rdi,8),%rsi
add    $0x10,%rsi
lea    (%rdx,%rdi,8),%rdi
add    $0x10,%rdi
shl    $0x5,%r8
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
movupd -0x10(%rdi,%rbp,1),%xmm0
movupd (%rdi,%rbp,1),%xmm1
movupd %xmm0,-0x10(%rsi,%rbp,1)
movupd %xmm1,(%rsi,%rbp,1)
add    $0x20,%rbp
cmp    %rbp,%r8
jne    1af0 <newton_min_func+0x950>
cmp    %rax,%rcx
je     1b87 <newton_min_func+0x9e7>
mov    %rcx,%rdi
not    %rdi
add    %rax,%rdi
mov    %rax,%rsi
and    $0x3,%rsi
je     1b44 <newton_min_func+0x9a4>
cs nopw 0x0(%rax,%rax,1)
movsd  (%rdx,%rcx,8),%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
add    $0x1,%rcx
add    $0xffffffffffffffff,%rsi
jne    1b30 <newton_min_func+0x990>
cmp    $0x3,%rdi
jb     1b87 <newton_min_func+0x9e7>
nopw   0x0(%rax,%rax,1)
movsd  (%rdx,%rcx,8),%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
movsd  0x8(%rdx,%rcx,8),%xmm0
movsd  %xmm0,0x8(%rbx,%rcx,8)
movsd  0x10(%rdx,%rcx,8),%xmm0
movsd  %xmm0,0x10(%rbx,%rcx,8)
movsd  0x18(%rdx,%rcx,8),%xmm0
movsd  %xmm0,0x18(%rbx,%rcx,8)
add    $0x4,%rcx
cmp    %rcx,%rax
jne    1b50 <newton_min_func+0x9b0>
mov    %r15d,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @newton_min_func(double (double*, i32)* %0, double* %1, i32 %2, double* %3, double %4, double* %5) {
%7 = shl i32 %2, 3
%8 = tail call i64 @malloc(i32 %7)
%9 = inttoptr i64 %8 to double*
%10 = inttoptr i64 %8 to i8*
%11 = tail call i64 @malloc(i32 %7)
%12 = inttoptr i64 %11 to double*
%13 = inttoptr i64 %11 to i8*
%14 = tail call i64 @malloc(i32 %7)
%15 = inttoptr i64 %14 to double*
%16 = inttoptr i64 %14 to i8*
%17 = tail call i64 @malloc(i32 %7)
%18 = inttoptr i64 %17 to double*
%19 = mul i32 %7, %2
%20 = tail call i64 @malloc(i32 %19)
%21 = inttoptr i64 %20 to double*
%22 = tail call i64 @malloc(i32 %19)
%23 = inttoptr i64 %22 to double*
%24 = tail call double %0(double* %1, i32 %2)
%25 = tail call i32 @jacobian_fd(double (double*, i32)* %0, double* %1, i32 %2, double* %9)
%26 = icmp sgt i32 %2, 0
br i1 %26, label %27, label %154
27: ; preds = %6
%28 = zext i32 %2 to i64
%29 = icmp eq i32 %2, 1
br i1 %29, label %67, label %30
30: ; preds = %27
%31 = and i64 %28, 4294967294
%32 = add nsw i64 %31, -2
%33 = lshr exact i64 %32, 1
%34 = add nuw i64 %33, 1
%35 = and i64 %34, 1
%36 = icmp eq i64 %32, 0
br i1 %36, label %56, label %37
37: ; preds = %30
%38 = and i64 %34, -2
br label %39
39: ; preds = %39, %37
%40 = phi i64 [ 0, %37 ], [ %53, %39 ]
%41 = phi i64 [ 0, %37 ], [ %54, %39 ]
%42 = getelementptr inbounds double, double* %3, i64 %40
%43 = bitcast double* %42 to <2 x double>*
%44 = load <2 x double>, <2 x double>* %43
%45 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %44
%46 = bitcast double* %42 to <2 x double>*
store <2 x double> %45, <2 x double>* %46
%47 = or i64 %40, 2
%48 = getelementptr inbounds double, double* %3, i64 %47
%49 = bitcast double* %48 to <2 x double>*
%50 = load <2 x double>, <2 x double>* %49
%51 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %50
%52 = bitcast double* %48 to <2 x double>*
store <2 x double> %51, <2 x double>* %52
%53 = add nuw i64 %40, 4
%54 = add nuw i64 %41, 2
%55 = icmp eq i64 %54, %38
br i1 %55, label %56, label %39
56: ; preds = %39, %30
%57 = phi i64 [ 0, %30 ], [ %53, %39 ]
%58 = icmp eq i64 %35, 0
br i1 %58, label %65, label %59
59: ; preds = %56
%60 = getelementptr inbounds double, double* %3, i64 %57
%61 = bitcast double* %60 to <2 x double>*
%62 = load <2 x double>, <2 x double>* %61
%63 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %62
%64 = bitcast double* %60 to <2 x double>*
store <2 x double> %63, <2 x double>* %64
br label %65
65: ; preds = %56, %59
%66 = icmp eq i64 %31, %28
br i1 %66, label %76, label %67
67: ; preds = %27, %65
%68 = phi i64 [ 0, %27 ], [ %31, %65 ]
br label %69
69: ; preds = %67, %69
%70 = phi i64 [ %74, %69 ], [ %68, %67 ]
%71 = getelementptr inbounds double, double* %3, i64 %70
%72 = load double, double* %71
%73 = fdiv double 1.000000e+00, %72
store double %73, double* %71
%74 = add nuw nsw i64 %70, 1
%75 = icmp eq i64 %74, %28
br i1 %75, label %76, label %69
76: ; preds = %69, %65
%77 = tail call double @llvm.fabs.f64(double %24)
%78 = tail call double @llvm.fabs.f64(double %4)
%79 = fcmp ogt double %77, %78
%80 = select i1 %79, double %77, double %78
br i1 %26, label %81, label %154
81: ; preds = %76
%82 = zext i32 %2 to i64
%83 = icmp eq i32 %2, 1
br i1 %83, label %133, label %84
84: ; preds = %81
%85 = getelementptr double, double* %12, i64 %28
%86 = bitcast double* %85 to i8*
%87 = getelementptr double, double* %1, i64 %28
%88 = bitcast double* %87 to i8*
%89 = getelementptr double, double* %3, i64 %28
%90 = bitcast double* %89 to i8*
%91 = getelementptr double, double* %9, i64 %28
%92 = bitcast double* %91 to i8*
%93 = icmp ult i8* %13, %88
%94 = icmp ugt double* %85, %1
%95 = and i1 %93, %94
%96 = icmp ult i8* %13, %90
%97 = icmp ugt double* %85, %3
%98 = and i1 %96, %97
%99 = or i1 %95, %98
%100 = icmp ult i8* %13, %92
%101 = icmp ult i8* %10, %86
%102 = and i1 %100, %101
%103 = or i1 %99, %102
br i1 %103, label %133, label %104
104: ; preds = %84
%105 = and i64 %28, 4294967294
%106 = insertelement <2 x double> poison, double %80, i64 0
%107 = shufflevector <2 x double> %106, <2 x double> poison, <2 x i32> zeroinitializer
br label %108
108: ; preds = %108, %104
%109 = phi i64 [ 0, %104 ], [ %129, %108 ]
%110 = getelementptr inbounds double, double* %1, i64 %109
%111 = bitcast double* %110 to <2 x double>*
%112 = load <2 x double>, <2 x double>* %111
%113 = call <2 x double> @llvm.fabs.v2f64(<2 x double> %112)
%114 = getelementptr inbounds double, double* %3, i64 %109
%115 = bitcast double* %114 to <2 x double>*
%116 = load <2 x double>, <2 x double>* %115
%117 = call <2 x double> @llvm.fabs.v2f64(<2 x double> %116)
%118 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %117
%119 = fcmp ogt <2 x double> %113, %118
%120 = select <2 x i1> %119, <2 x double> %113, <2 x double> %118
%121 = getelementptr inbounds double, double* %9, i64 %109
%122 = bitcast double* %121 to <2 x double>*
%123 = load <2 x double>, <2 x double>* %122
%124 = call <2 x double> @llvm.fabs.v2f64(<2 x double> %123)
%125 = fmul <2 x double> %124, %120
%126 = fdiv <2 x double> %125, %107
%127 = getelementptr inbounds double, double* %12, i64 %109
%128 = bitcast double* %127 to <2 x double>*
store <2 x double> %126, <2 x double>* %128
%129 = add nuw i64 %109, 2
%130 = icmp eq i64 %129, %105
br i1 %130, label %131, label %108
131: ; preds = %108
%132 = icmp eq i64 %105, %28
br i1 %132, label %154, label %133
133: ; preds = %84, %81, %131
%134 = phi i64 [ 0, %84 ], [ 0, %81 ], [ %105, %131 ]
br label %135
135: ; preds = %133, %135
%136 = phi i64 [ %152, %135 ], [ %134, %133 ]
%137 = getelementptr inbounds double, double* %1, i64 %136
%138 = load double, double* %137
%139 = tail call double @llvm.fabs.f64(double %138)
%140 = getelementptr inbounds double, double* %3, i64 %136
%141 = load double, double* %140
%142 = tail call double @llvm.fabs.f64(double %141)
%143 = fdiv double 1.000000e+00, %142
%144 = fcmp ogt double %139, %143
%145 = select i1 %144, double %139, double %143
%146 = getelementptr inbounds double, double* %9, i64 %136
%147 = load double, double* %146
%148 = tail call double @llvm.fabs.f64(double %147)
%149 = fmul double %148, %145
%150 = fdiv double %149, %80
%151 = getelementptr inbounds double, double* %12, i64 %136
store double %150, double* %151
%152 = add nuw nsw i64 %136, 1
%153 = icmp eq i64 %152, %82
br i1 %153, label %154, label %135
154: ; preds = %135, %131, %6, %76
%155 = tail call double @array_max_abs(double* %12, i32 %2)
%156 = fcmp ugt double %155, 0x3E45798EE2308C3E
br i1 %156, label %283, label %157
157: ; preds = %154
br i1 %26, label %158, label %557
158: ; preds = %157
%159 = zext i32 %2 to i64
%160 = icmp ult i32 %2, 4
br i1 %160, label %246, label %161
161: ; preds = %158
%162 = getelementptr double, double* %5, i64 %159
%163 = getelementptr double, double* %1, i64 %159
%164 = icmp ugt double* %163, %5
%165 = icmp ugt double* %162, %1
%166 = and i1 %164, %165
br i1 %166, label %246, label %167
167: ; preds = %161
%168 = and i64 %159, 4294967292
%169 = add nsw i64 %168, -4
%170 = lshr exact i64 %169, 2
%171 = add nuw nsw i64 %170, 1
%172 = and i64 %171, 3
%173 = icmp ult i64 %169, 12
br i1 %173, label %225, label %174
174: ; preds = %167
%175 = and i64 %171, 9223372036854775804
br label %176
176: ; preds = %176, %174
%177 = phi i64 [ 0, %174 ], [ %222, %176 ]
%178 = phi i64 [ 0, %174 ], [ %223, %176 ]
%179 = getelementptr inbounds double, double* %1, i64 %177
%180 = bitcast double* %179 to <2 x double>*
%181 = load <2 x double>, <2 x double>* %180
%182 = getelementptr inbounds double, double* %179, i64 2
%183 = bitcast double* %182 to <2 x double>*
%184 = load <2 x double>, <2 x double>* %183
%185 = getelementptr inbounds double, double* %5, i64 %177
%186 = bitcast double* %185 to <2 x double>*
store <2 x double> %181, <2 x double>* %186
%187 = getelementptr inbounds double, double* %185, i64 2
%188 = bitcast double* %187 to <2 x double>*
store <2 x double> %184, <2 x double>* %188
%189 = or i64 %177, 4
%190 = getelementptr inbounds double, double* %1, i64 %189
%191 = bitcast double* %190 to <2 x double>*
%192 = load <2 x double>, <2 x double>* %191
%193 = getelementptr inbounds double, double* %190, i64 2
%194 = bitcast double* %193 to <2 x double>*
%195 = load <2 x double>, <2 x double>* %194
%196 = getelementptr inbounds double, double* %5, i64 %189
%197 = bitcast double* %196 to <2 x double>*
store <2 x double> %192, <2 x double>* %197
%198 = getelementptr inbounds double, double* %196, i64 2
%199 = bitcast double* %198 to <2 x double>*
store <2 x double> %195, <2 x double>* %199
%200 = or i64 %177, 8
%201 = getelementptr inbounds double, double* %1, i64 %200
%202 = bitcast double* %201 to <2 x double>*
%203 = load <2 x double>, <2 x double>* %202
%204 = getelementptr inbounds double, double* %201, i64 2
%205 = bitcast double* %204 to <2 x double>*
%206 = load <2 x double>, <2 x double>* %205
%207 = getelementptr inbounds double, double* %5, i64 %200
%208 = bitcast double* %207 to <2 x double>*
store <2 x double> %203, <2 x double>* %208
%209 = getelementptr inbounds double, double* %207, i64 2
%210 = bitcast double* %209 to <2 x double>*
store <2 x double> %206, <2 x double>* %210
%211 = or i64 %177, 12
%212 = getelementptr inbounds double, double* %1, i64 %211
%213 = bitcast double* %212 to <2 x double>*
%214 = load <2 x double>, <2 x double>* %213
%215 = getelementptr inbounds double, double* %212, i64 2
%216 = bitcast double* %215 to <2 x double>*
%217 = load <2 x double>, <2 x double>* %216
%218 = getelementptr inbounds double, double* %5, i64 %211
%219 = bitcast double* %218 to <2 x double>*
store <2 x double> %214, <2 x double>* %219
%220 = getelementptr inbounds double, double* %218, i64 2
%221 = bitcast double* %220 to <2 x double>*
store <2 x double> %217, <2 x double>* %221
%222 = add nuw i64 %177, 16
%223 = add nuw i64 %178, 4
%224 = icmp eq i64 %223, %175
br i1 %224, label %225, label %176
225: ; preds = %176, %167
%226 = phi i64 [ 0, %167 ], [ %222, %176 ]
%227 = icmp eq i64 %172, 0
br i1 %227, label %244, label %228
228: ; preds = %225, %228
%229 = phi i64 [ %241, %228 ], [ %226, %225 ]
%230 = phi i64 [ %242, %228 ], [ 0, %225 ]
%231 = getelementptr inbounds double, double* %1, i64 %229
%232 = bitcast double* %231 to <2 x double>*
%233 = load <2 x double>, <2 x double>* %232
%234 = getelementptr inbounds double, double* %231, i64 2
%235 = bitcast double* %234 to <2 x double>*
%236 = load <2 x double>, <2 x double>* %235
%237 = getelementptr inbounds double, double* %5, i64 %229
%238 = bitcast double* %237 to <2 x double>*
store <2 x double> %233, <2 x double>* %238
%239 = getelementptr inbounds double, double* %237, i64 2
%240 = bitcast double* %239 to <2 x double>*
store <2 x double> %236, <2 x double>* %240
%241 = add nuw i64 %229, 4
%242 = add i64 %230, 1
%243 = icmp eq i64 %242, %172
br i1 %243, label %244, label %228
244: ; preds = %228, %225
%245 = icmp eq i64 %168, %159
br i1 %245, label %557, label %246
246: ; preds = %161, %158, %244
%247 = phi i64 [ 0, %161 ], [ 0, %158 ], [ %168, %244 ]
%248 = xor i64 %247, -1
%249 = add nsw i64 %248, %159
%250 = and i64 %159, 3
%251 = icmp eq i64 %250, 0
br i1 %251, label %261, label %252
252: ; preds = %246, %252
%253 = phi i64 [ %258, %252 ], [ %247, %246 ]
%254 = phi i64 [ %259, %252 ], [ 0, %246 ]
%255 = getelementptr inbounds double, double* %1, i64 %253
%256 = load double, double* %255
%257 = getelementptr inbounds double, double* %5, i64 %253
store double %256, double* %257
%258 = add nuw nsw i64 %253, 1
%259 = add i64 %254, 1
%260 = icmp eq i64 %259, %250
br i1 %260, label %261, label %252
261: ; preds = %252, %246
%262 = phi i64 [ %247, %246 ], [ %258, %252 ]
%263 = icmp ult i64 %249, 3
br i1 %263, label %557, label %264
264: ; preds = %261, %264
%265 = phi i64 [ %281, %264 ], [ %262, %261 ]
%266 = getelementptr inbounds double, double* %1, i64 %265
%267 = load double, double* %266
%268 = getelementptr inbounds double, double* %5, i64 %265
store double %267, double* %268
%269 = add nuw nsw i64 %265, 1
%270 = getelementptr inbounds double, double* %1, i64 %269
%271 = load double, double* %270
%272 = getelementptr inbounds double, double* %5, i64 %269
store double %271, double* %272
%273 = add nuw nsw i64 %265, 2
%274 = getelementptr inbounds double, double* %1, i64 %273
%275 = load double, double* %274
%276 = getelementptr inbounds double, double* %5, i64 %273
store double %275, double* %276
%277 = add nuw nsw i64 %265, 3
%278 = getelementptr inbounds double, double* %1, i64 %277
%279 = load double, double* %278
%280 = getelementptr inbounds double, double* %5, i64 %277
store double %279, double* %280
%281 = add nuw nsw i64 %265, 4
%282 = icmp eq i64 %281, %159
br i1 %282, label %557, label %264
283: ; preds = %154
%284 = tail call i32 @hessian_fd(double (double*, i32)* %0, double* %1, i32 %2, double* %21)
br i1 %26, label %285, label %392
285: ; preds = %283
%286 = zext i32 %2 to i64
%287 = icmp ult i32 %2, 4
br i1 %287, label %374, label %288
288: ; preds = %285
%289 = getelementptr double, double* %15, i64 %286
%290 = getelementptr double, double* %1, i64 %286
%291 = bitcast double* %290 to i8*
%292 = icmp ult i8* %16, %291
%293 = icmp ugt double* %289, %1
%294 = and i1 %292, %293
br i1 %294, label %374, label %295
295: ; preds = %288
%296 = and i64 %286, 4294967292
%297 = add nsw i64 %296, -4
%298 = lshr exact i64 %297, 2
%299 = add nuw nsw i64 %298, 1
%300 = and i64 %299, 3
%301 = icmp ult i64 %297, 12
br i1 %301, label %353, label %302
302: ; preds = %295
%303 = and i64 %299, 9223372036854775804
br label %304
304: ; preds = %304, %302
%305 = phi i64 [ 0, %302 ], [ %350, %304 ]
%306 = phi i64 [ 0, %302 ], [ %351, %304 ]
%307 = getelementptr inbounds double, double* %1, i64 %305
%308 = bitcast double* %307 to <2 x double>*
%309 = load <2 x double>, <2 x double>* %308
%310 = getelementptr inbounds double, double* %307, i64 2
%311 = bitcast double* %310 to <2 x double>*
%312 = load <2 x double>, <2 x double>* %311
%313 = getelementptr inbounds double, double* %15, i64 %305
%314 = bitcast double* %313 to <2 x double>*
store <2 x double> %309, <2 x double>* %314
%315 = getelementptr inbounds double, double* %313, i64 2
%316 = bitcast double* %315 to <2 x double>*
store <2 x double> %312, <2 x double>* %316
%317 = or i64 %305, 4
%318 = getelementptr inbounds double, double* %1, i64 %317
%319 = bitcast double* %318 to <2 x double>*
%320 = load <2 x double>, <2 x double>* %319
%321 = getelementptr inbounds double, double* %318, i64 2
%322 = bitcast double* %321 to <2 x double>*
%323 = load <2 x double>, <2 x double>* %322
%324 = getelementptr inbounds double, double* %15, i64 %317
%325 = bitcast double* %324 to <2 x double>*
store <2 x double> %320, <2 x double>* %325
%326 = getelementptr inbounds double, double* %324, i64 2
%327 = bitcast double* %326 to <2 x double>*
store <2 x double> %323, <2 x double>* %327
%328 = or i64 %305, 8
%329 = getelementptr inbounds double, double* %1, i64 %328
%330 = bitcast double* %329 to <2 x double>*
%331 = load <2 x double>, <2 x double>* %330
%332 = getelementptr inbounds double, double* %329, i64 2
%333 = bitcast double* %332 to <2 x double>*
%334 = load <2 x double>, <2 x double>* %333
%335 = getelementptr inbounds double, double* %15, i64 %328
%336 = bitcast double* %335 to <2 x double>*
store <2 x double> %331, <2 x double>* %336
%337 = getelementptr inbounds double, double* %335, i64 2
%338 = bitcast double* %337 to <2 x double>*
store <2 x double> %334, <2 x double>* %338
%339 = or i64 %305, 12
%340 = getelementptr inbounds double, double* %1, i64 %339
%341 = bitcast double* %340 to <2 x double>*
%342 = load <2 x double>, <2 x double>* %341
%343 = getelementptr inbounds double, double* %340, i64 2
%344 = bitcast double* %343 to <2 x double>*
%345 = load <2 x double>, <2 x double>* %344
%346 = getelementptr inbounds double, double* %15, i64 %339
%347 = bitcast double* %346 to <2 x double>*
store <2 x double> %342, <2 x double>* %347
%348 = getelementptr inbounds double, double* %346, i64 2
%349 = bitcast double* %348 to <2 x double>*
store <2 x double> %345, <2 x double>* %349
%350 = add nuw i64 %305, 16
%351 = add nuw i64 %306, 4
%352 = icmp eq i64 %351, %303
br i1 %352, label %353, label %304
353: ; preds = %304, %295
%354 = phi i64 [ 0, %295 ], [ %350, %304 ]
%355 = icmp eq i64 %300, 0
br i1 %355, label %372, label %356
356: ; preds = %353, %356
%357 = phi i64 [ %369, %356 ], [ %354, %353 ]
%358 = phi i64 [ %370, %356 ], [ 0, %353 ]
%359 = getelementptr inbounds double, double* %1, i64 %357
%360 = bitcast double* %359 to <2 x double>*
%361 = load <2 x double>, <2 x double>* %360
%362 = getelementptr inbounds double, double* %359, i64 2
%363 = bitcast double* %362 to <2 x double>*
%364 = load <2 x double>, <2 x double>* %363
%365 = getelementptr inbounds double, double* %15, i64 %357
%366 = bitcast double* %365 to <2 x double>*
store <2 x double> %361, <2 x double>* %366
%367 = getelementptr inbounds double, double* %365, i64 2
%368 = bitcast double* %367 to <2 x double>*
store <2 x double> %364, <2 x double>* %368
%369 = add nuw i64 %357, 4
%370 = add i64 %358, 1
%371 = icmp eq i64 %370, %300
br i1 %371, label %372, label %356
372: ; preds = %356, %353
%373 = icmp eq i64 %296, %286
br i1 %373, label %392, label %374
374: ; preds = %288, %285, %372
%375 = phi i64 [ 0, %288 ], [ 0, %285 ], [ %296, %372 ]
%376 = xor i64 %375, -1
%377 = add nsw i64 %376, %286
%378 = and i64 %286, 3
%379 = icmp eq i64 %378, 0
br i1 %379, label %389, label %380
380: ; preds = %374, %380
%381 = phi i64 [ %386, %380 ], [ %375, %374 ]
%382 = phi i64 [ %387, %380 ], [ 0, %374 ]
%383 = getelementptr inbounds double, double* %1, i64 %381
%384 = load double, double* %383
%385 = getelementptr inbounds double, double* %15, i64 %381
store double %384, double* %385
%386 = add nuw nsw i64 %381, 1
%387 = add i64 %382, 1
%388 = icmp eq i64 %387, %378
br i1 %388, label %389, label %380
389: ; preds = %380, %374
%390 = phi i64 [ %375, %374 ], [ %386, %380 ]
%391 = icmp ult i64 %377, 3
br i1 %391, label %392, label %413
392: ; preds = %389, %413, %372, %283
%393 = zext i32 %2 to i64
%394 = getelementptr double, double* %15, i64 %393
%395 = getelementptr double, double* %5, i64 %393
%396 = bitcast double* %395 to i8*
%397 = and i64 %393, 4294967292
%398 = add nsw i64 %397, -4
%399 = lshr exact i64 %398, 2
%400 = add nuw nsw i64 %399, 1
%401 = icmp ult i32 %2, 4
%402 = icmp ult i8* %16, %396
%403 = icmp ugt double* %394, %5
%404 = and i1 %402, %403
%405 = and i64 %393, 4294967292
%406 = and i64 %400, 3
%407 = icmp ult i64 %398, 12
%408 = and i64 %400, 9223372036854775804
%409 = icmp eq i64 %406, 0
%410 = icmp eq i64 %405, %393
%411 = and i64 %393, 3
%412 = icmp eq i64 %411, 0
br label %434
413: ; preds = %389, %413
%414 = phi i64 [ %430, %413 ], [ %390, %389 ]
%415 = getelementptr inbounds double, double* %1, i64 %414
%416 = load double, double* %415
%417 = getelementptr inbounds double, double* %15, i64 %414
store double %416, double* %417
%418 = add nuw nsw i64 %414, 1
%419 = getelementptr inbounds double, double* %1, i64 %418
%420 = load double, double* %419
%421 = getelementptr inbounds double, double* %15, i64 %418
store double %420, double* %421
%422 = add nuw nsw i64 %414, 2
%423 = getelementptr inbounds double, double* %1, i64 %422
%424 = load double, double* %423
%425 = getelementptr inbounds double, double* %15, i64 %422
store double %424, double* %425
%426 = add nuw nsw i64 %414, 3
%427 = getelementptr inbounds double, double* %1, i64 %426
%428 = load double, double* %427
%429 = getelementptr inbounds double, double* %15, i64 %426
store double %428, double* %429
%430 = add nuw nsw i64 %414, 4
%431 = icmp eq i64 %430, %286
br i1 %431, label %392, label %413
432: ; preds = %528, %531, %514, %434
%433 = icmp eq i32 %442, 0
br i1 %433, label %434, label %550
434: ; preds = %392, %432
%435 = tail call i32 @modelhess(double* %21, i32 %2, double* %3, double* %23)
%436 = tail call i32 @scale(double* %9, i32 1, i32 %2, double -1.000000e+00)
%437 = tail call i32 @linsolve_lower(double* %23, i32 %2, double* %9, double* %18)
%438 = tail call i32 @scale(double* %9, i32 1, i32 %2, double -1.000000e+00)
%439 = tail call i32 @lnsrch(double (double*, i32)* %0, double* %15, double* %9, double* %18, i32 %2, double 1.000000e+00, double* %3, double 0x3DDB7CDFD9D7BDC4, double* %5)
%440 = tail call double %0(double* %5, i32 %2)
%441 = tail call i32 @jacobian_fd(double (double*, i32)* %0, double* %5, i32 %2, double* %9)
%442 = tail call i32 @stopcheck(double %440, i32 %2, double* %15, double* %5, double* %9, double* %3, double %4, double 0x3EE4F8B588E368F4, double 0x3DDB7CDFD9D7BDC4, i32 %439)
%443 = tail call i32 @hessian_fd(double (double*, i32)* %0, double* %5, i32 %2, double* %21)
br i1 %26, label %444, label %432
444: ; preds = %434
%445 = select i1 %401, i1 true, i1 %404
br i1 %445, label %515, label %446
446: ; preds = %444
br i1 %407, label %496, label %447
447: ; preds = %446, %447
%448 = phi i64 [ %493, %447 ], [ 0, %446 ]
%449 = phi i64 [ %494, %447 ], [ 0, %446 ]
%450 = getelementptr inbounds double, double* %5, i64 %448
%451 = bitcast double* %450 to <2 x double>*
%452 = load <2 x double>, <2 x double>* %451
%453 = getelementptr inbounds double, double* %450, i64 2
%454 = bitcast double* %453 to <2 x double>*
%455 = load <2 x double>, <2 x double>* %454
%456 = getelementptr inbounds double, double* %15, i64 %448
%457 = bitcast double* %456 to <2 x double>*
store <2 x double> %452, <2 x double>* %457
%458 = getelementptr inbounds double, double* %456, i64 2
%459 = bitcast double* %458 to <2 x double>*
store <2 x double> %455, <2 x double>* %459
%460 = or i64 %448, 4
%461 = getelementptr inbounds double, double* %5, i64 %460
%462 = bitcast double* %461 to <2 x double>*
%463 = load <2 x double>, <2 x double>* %462
%464 = getelementptr inbounds double, double* %461, i64 2
%465 = bitcast double* %464 to <2 x double>*
%466 = load <2 x double>, <2 x double>* %465
%467 = getelementptr inbounds double, double* %15, i64 %460
%468 = bitcast double* %467 to <2 x double>*
store <2 x double> %463, <2 x double>* %468
%469 = getelementptr inbounds double, double* %467, i64 2
%470 = bitcast double* %469 to <2 x double>*
store <2 x double> %466, <2 x double>* %470
%471 = or i64 %448, 8
%472 = getelementptr inbounds double, double* %5, i64 %471
%473 = bitcast double* %472 to <2 x double>*
%474 = load <2 x double>, <2 x double>* %473
%475 = getelementptr inbounds double, double* %472, i64 2
%476 = bitcast double* %475 to <2 x double>*
%477 = load <2 x double>, <2 x double>* %476
%478 = getelementptr inbounds double, double* %15, i64 %471
%479 = bitcast double* %478 to <2 x double>*
store <2 x double> %474, <2 x double>* %479
%480 = getelementptr inbounds double, double* %478, i64 2
%481 = bitcast double* %480 to <2 x double>*
store <2 x double> %477, <2 x double>* %481
%482 = or i64 %448, 12
%483 = getelementptr inbounds double, double* %5, i64 %482
%484 = bitcast double* %483 to <2 x double>*
%485 = load <2 x double>, <2 x double>* %484
%486 = getelementptr inbounds double, double* %483, i64 2
%487 = bitcast double* %486 to <2 x double>*
%488 = load <2 x double>, <2 x double>* %487
%489 = getelementptr inbounds double, double* %15, i64 %482
%490 = bitcast double* %489 to <2 x double>*
store <2 x double> %485, <2 x double>* %490
%491 = getelementptr inbounds double, double* %489, i64 2
%492 = bitcast double* %491 to <2 x double>*
store <2 x double> %488, <2 x double>* %492
%493 = add nuw i64 %448, 16
%494 = add nuw i64 %449, 4
%495 = icmp eq i64 %494, %408
br i1 %495, label %496, label %447
496: ; preds = %447, %446
%497 = phi i64 [ 0, %446 ], [ %493, %447 ]
br i1 %409, label %514, label %498
498: ; preds = %496, %498
%499 = phi i64 [ %511, %498 ], [ %497, %496 ]
%500 = phi i64 [ %512, %498 ], [ 0, %496 ]
%501 = getelementptr inbounds double, double* %5, i64 %499
%502 = bitcast double* %501 to <2 x double>*
%503 = load <2 x double>, <2 x double>* %502
%504 = getelementptr inbounds double, double* %501, i64 2
%505 = bitcast double* %504 to <2 x double>*
%506 = load <2 x double>, <2 x double>* %505
%507 = getelementptr inbounds double, double* %15, i64 %499
%508 = bitcast double* %507 to <2 x double>*
store <2 x double> %503, <2 x double>* %508
%509 = getelementptr inbounds double, double* %507, i64 2
%510 = bitcast double* %509 to <2 x double>*
store <2 x double> %506, <2 x double>* %510
%511 = add nuw i64 %499, 4
%512 = add i64 %500, 1
%513 = icmp eq i64 %512, %406
br i1 %513, label %514, label %498
514: ; preds = %498, %496
br i1 %410, label %432, label %515
515: ; preds = %444, %514
%516 = phi i64 [ 0, %444 ], [ %405, %514 ]
%517 = xor i64 %516, -1
%518 = add nsw i64 %517, %393
br i1 %412, label %528, label %519
519: ; preds = %515, %519
%520 = phi i64 [ %525, %519 ], [ %516, %515 ]
%521 = phi i64 [ %526, %519 ], [ 0, %515 ]
%522 = getelementptr inbounds double, double* %5, i64 %520
%523 = load double, double* %522
%524 = getelementptr inbounds double, double* %15, i64 %520
store double %523, double* %524
%525 = add nuw nsw i64 %520, 1
%526 = add i64 %521, 1
%527 = icmp eq i64 %526, %411
br i1 %527, label %528, label %519
528: ; preds = %519, %515
%529 = phi i64 [ %516, %515 ], [ %525, %519 ]
%530 = icmp ult i64 %518, 3
br i1 %530, label %432, label %531
531: ; preds = %528, %531
%532 = phi i64 [ %548, %531 ], [ %529, %528 ]
%533 = getelementptr inbounds double, double* %5, i64 %532
%534 = load double, double* %533
%535 = getelementptr inbounds double, double* %15, i64 %532
store double %534, double* %535
%536 = add nuw nsw i64 %532, 1
%537 = getelementptr inbounds double, double* %5, i64 %536
%538 = load double, double* %537
%539 = getelementptr inbounds double, double* %15, i64 %536
store double %538, double* %539
%540 = add nuw nsw i64 %532, 2
%541 = getelementptr inbounds double, double* %5, i64 %540
%542 = load double, double* %541
%543 = getelementptr inbounds double, double* %15, i64 %540
store double %542, double* %543
%544 = add nuw nsw i64 %532, 3
%545 = getelementptr inbounds double, double* %5, i64 %544
%546 = load double, double* %545
%547 = getelementptr inbounds double, double* %15, i64 %544
store double %546, double* %547
%548 = add nuw nsw i64 %532, 4
%549 = icmp eq i64 %548, %393
br i1 %549, label %432, label %531
550: ; preds = %432
%551 = tail call i32 @free(double* %9)
%552 = tail call i32 @free(double* %21)
%553 = tail call i32 @free(double* %12)
%554 = tail call i32 @free(double* %15)
%555 = tail call i32 @free(double* %23)
%556 = tail call i32 @free(double* %18)
br label %557
557: ; preds = %261, %264, %244, %157, %550
%558 = phi i32 [ %442, %550 ], [ 1, %157 ], [ 1, %244 ], [ 1, %264 ], [ 1, %261 ]
ret i32 %558
}