#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ free(double *);
double l2norm(double *, int);
scalar_t__ malloc(int);
double sqrt(double);
int /*<<< orphan*/ trstep(double *, double *, int, double *, double *, double *,
                          double, double *, double, double *);
int trupdate(double (*)(double *, int), double *, double *, double *, int,
             double *, double, int, double *, double *, double, int, double *,
             double *, double *, double *);
int trsrch(double (*funcpt)(double *, int), double *xi, double *jac, double *sN,
           int N, double *dx, double maxstep, int iter, double *L, double *hess,
           double stol, double *ioval, double eps, double *x) {
  int retval, i, j, method;
  double alpha, beta;
  double nlen, t1, funcprev;
  double *temp, *step, *xprev;
  retval = 4;
  nlen = 0.0;
  ioval[7] = 1.0;
  method = 0;
  temp = (double *)malloc(sizeof(double) * N);
  step = (double *)malloc(sizeof(double) * N);
  xprev = (double *)malloc(sizeof(double) * N);
  funcprev = 0.0;
  for (i = 0; i < N; ++i) {
    nlen += dx[i] * sN[i] * dx[i] * sN[i];
  }
  nlen = sqrt(nlen);
  if (iter == 1 || ioval[0] == -1) {
    ioval[1] = 0.;
    for (i = 0; i < N; ++i) {
      temp[i] = jac[i] / dx[i];
    }
    alpha = l2norm(temp, N);
    alpha = alpha * alpha;
    beta = 0;
    for (i = 0; i < N; ++i) {
      t1 = 0.;
      for (j = i; j < N; ++j) {
        t1 += L[j * N + i] * jac[j] / (dx[j] * dx[j]);
      }
      beta += t1 * t1;
    }
    ioval[0] = alpha * sqrt(alpha) / beta;
    if (ioval[0] > maxstep) {
      ioval[0] = maxstep;
    }
  }
  while (retval >= 2 && retval != 15) {
    trstep(jac, sN, N, dx, L, hess, nlen, ioval, eps, step);
    ioval[2] = ioval[0];
    retval = trupdate(funcpt, xi, jac, step, N, dx, maxstep, retval, L, hess,
                      stol, method, ioval, xprev, &funcprev, x);
  }
  free(temp);
  free(step);
  free(xprev);
  return retval;
}


x86 assembly (clang, -O0):
<trsrch>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %rdi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x48(%rbp)
mov    %r8d,-0x4c(%rbp)
mov    %r9,-0x58(%rbp)
movsd  %xmm0,-0x60(%rbp)
movsd  %xmm1,-0x68(%rbp)
movsd  %xmm2,-0x70(%rbp)
movl   $0x4,-0x74(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    0x28(%rbp),%rax
movsd  0xe34(%rip),%xmm0
movsd  %xmm0,0x38(%rax)
movl   $0x0,-0x80(%rbp)
movslq -0x4c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0xb0(%rbp)
movslq -0x4c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0xb8(%rbp)
movslq -0x4c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0xc0(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jge    1292 <trsrch+0x132>
mov    -0x58(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x48(%rbp),%rax
movslq -0x78(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x58(%rbp),%rax
movslq -0x78(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x48(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x98(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    122c <trsrch+0xcc>
movsd  -0x98(%rbp),%xmm0
ff
call   1070 <sqrt@plt>
movsd  %xmm0,-0x98(%rbp)
ff
cmpl   $0x1,0x10(%rbp)
je     12d1 <trsrch+0x171>
mov    0x28(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xd47(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1488 <trsrch+0x328>
jp     1488 <trsrch+0x328>
mov    0x28(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jge    1328 <trsrch+0x1c8>
mov    -0x40(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x58(%rbp),%rax
movslq -0x78(%rbp),%rcx
divsd  (%rax,%rcx,8),%xmm0
mov    -0xb0(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    12e4 <trsrch+0x184>
mov    -0xb0(%rbp),%rdi
mov    -0x4c(%rbp),%esi
call   1040 <l2norm@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
mulsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jge    1427 <trsrch+0x2c7>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x78(%rbp),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jge    13f1 <trsrch+0x291>
mov    0x18(%rbp),%rax
mov    -0x7c(%rbp),%ecx
imul   -0x4c(%rbp),%ecx
add    -0x78(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x7c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x58(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x58(%rbp),%rax
movslq -0x7c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
divsd  %xmm1,%xmm0
addsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1386 <trsrch+0x226>
movsd  -0xa0(%rbp),%xmm0
ff
movsd  -0xa0(%rbp),%xmm2
movsd  -0x90(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    1369 <trsrch+0x209>
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0xc8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
divsd  -0x90(%rbp),%xmm0
ff
mov    0x28(%rbp),%rax
movsd  %xmm0,(%rax)
mov    0x28(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd -0x60(%rbp),%xmm0
jbe    1483 <trsrch+0x323>
movsd  -0x60(%rbp),%xmm0
mov    0x28(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1488 <trsrch+0x328>
jmp    148d <trsrch+0x32d>
xor    %eax,%eax
cmpl   $0x2,-0x74(%rbp)
mov    %al,-0xc9(%rbp)
jl     14ac <trsrch+0x34c>
cmpl   $0xf,-0x74(%rbp)
setne  %al
mov    %al,-0xc9(%rbp)
mov    -0xc9(%rbp),%al
test   $0x1,%al
jne    14bf <trsrch+0x35f>
jmp    158c <trsrch+0x42c>
mov    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x4c(%rbp),%edx
mov    -0x58(%rbp),%rcx
mov    0x18(%rbp),%r8
mov    0x20(%rbp),%r9
movsd  -0x98(%rbp),%xmm0
ff
mov    0x28(%rbp),%r10
movsd  -0x70(%rbp),%xmm1
mov    -0xb8(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1050 <trstep@plt>
mov    0x28(%rbp),%rax
movsd  (%rax),%xmm0
mov    0x28(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0xb8(%rbp),%rcx
mov    -0x4c(%rbp),%r8d
mov    -0x58(%rbp),%r9
movsd  -0x60(%rbp),%xmm0
mov    -0x74(%rbp),%r13d
mov    0x18(%rbp),%r12
mov    0x20(%rbp),%r15
movsd  -0x68(%rbp),%xmm1
mov    -0x80(%rbp),%r14d
mov    0x28(%rbp),%rbx
mov    -0xc0(%rbp),%r11
mov    0x30(%rbp),%rax
lea    -0xa8(%rbp),%r10
mov    %r13d,(%rsp)
mov    %r12,0x8(%rsp)
mov    %r15,0x10(%rsp)
mov    %r14d,0x18(%rsp)
mov    %rbx,0x20(%rsp)
mov    %r11,0x28(%rsp)
mov    %r10,0x30(%rsp)
mov    %rax,0x38(%rsp)
call   1080 <trupdate@plt>
mov    %eax,-0x74(%rbp)
jmp    148d <trsrch+0x32d>
mov    -0xb0(%rbp),%rdi
call   1030 <free@plt>
mov    -0xb8(%rbp),%rdi
call   1030 <free@plt>
mov    -0xc0(%rbp),%rdi
call   1030 <free@plt>
mov    -0x74(%rbp),%eax
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<trsrch>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
movsd  %xmm2,0x68(%rsp)
movsd  %xmm1,0x60(%rsp)
movsd  %xmm0,0x20(%rsp)
mov    %r9,%rbx
mov    %r8d,%r13d
mov    %rcx,%r12
mov    %rdx,0x18(%rsp)
mov    %rsi,0x58(%rsp)
mov    %rdi,0x50(%rsp)
mov    0xc8(%rsp),%rcx
movabs $0x3ff0000000000000,%rax
mov    %rax,0x38(%rcx)
lea    0x0(,%r13,8),%ebp
mov    %ebp,%edi
call   1060 <malloc@plt>
mov    %rax,(%rsp)
mov    %ebp,%edi
call   1060 <malloc@plt>
mov    %rax,0x38(%rsp)
mov    %ebp,%edi
call   1060 <malloc@plt>
mov    %rax,0x30(%rsp)
movq   $0x0,0x70(%rsp)
xorpd  %xmm1,%xmm1
mov    %r13d,%r15d
xorpd  %xmm0,%xmm0
test   %r13d,%r13d
jle    127e <trsrch+0x11e>
cmp    $0x1,%r13d
jne    1204 <trsrch+0xa4>
xorpd  %xmm0,%xmm0
xor    %eax,%eax
jmp    1259 <trsrch+0xf9>
mov    %r15d,%ecx
and    $0xfffffffe,%ecx
xorpd  %xmm0,%xmm0
xor    %eax,%eax
movsd  (%rbx,%rax,8),%xmm2
movsd  0x8(%rbx,%rax,8),%xmm3
movsd  (%r12,%rax,8),%xmm4
movsd  0x8(%r12,%rax,8),%xmm5
movapd %xmm2,%xmm6
mulsd  %xmm4,%xmm6
mulsd  %xmm2,%xmm6
mulsd  %xmm4,%xmm6
addsd  %xmm0,%xmm6
movapd %xmm3,%xmm0
mulsd  %xmm5,%xmm0
mulsd  %xmm3,%xmm0
mulsd  %xmm5,%xmm0
addsd  %xmm6,%xmm0
add    $0x2,%rax
cmp    %rax,%rcx
jne    1210 <trsrch+0xb0>
test   $0x1,%r15b
je     127e <trsrch+0x11e>
movsd  (%rbx,%rax,8),%xmm2
movsd  (%r12,%rax,8),%xmm3
movapd %xmm2,%xmm4
mulsd  %xmm3,%xmm4
mulsd  %xmm2,%xmm4
mulsd  %xmm3,%xmm4
addsd  %xmm4,%xmm0
mov    0xb0(%rsp),%r14d
ucomisd %xmm1,%xmm0
mov    %rbx,0x10(%rsp)
jb     1297 <trsrch+0x137>
sqrtsd %xmm0,%xmm0
jmp    12a1 <trsrch+0x141>
call   1070 <sqrt@plt>
mov    0x10(%rsp),%rbx
movsd  %xmm0,0x28(%rsp)
mov    0x18(%rsp),%rbp
cmp    $0x1,%r14d
je     12d2 <trsrch+0x172>
mov    0xc8(%rsp),%rax
movsd  (%rax),%xmm0
ucomisd 0xd3a(%rip),%xmm0
jne    152f <trsrch+0x3cf>
jp     152f <trsrch+0x3cf>
mov    0xc8(%rsp),%rax
movq   $0x0,0x8(%rax)
test   %r13d,%r13d
jle    1350 <trsrch+0x1f0>
cmp    $0x1,%r13d
mov    (%rsp),%rdi
jne    1369 <trsrch+0x209>
xor    %eax,%eax
mov    %rax,%rcx
not    %rcx
test   $0x1,%r15b
je     1313 <trsrch+0x1b3>
movsd  0x0(%rbp,%rax,8),%xmm0
divsd  (%rbx,%rax,8),%xmm0
movsd  %xmm0,(%rdi,%rax,8)
or     $0x1,%rax
add    %r15,%rcx
je     1426 <trsrch+0x2c6>
nopl   0x0(%rax)
movsd  0x0(%rbp,%rax,8),%xmm0
divsd  (%rbx,%rax,8),%xmm0
movsd  %xmm0,(%rdi,%rax,8)
movsd  0x8(%rbp,%rax,8),%xmm0
divsd  0x8(%rbx,%rax,8),%xmm0
movsd  %xmm0,0x8(%rdi,%rax,8)
add    $0x2,%rax
cmp    %rax,%r15
jne    1320 <trsrch+0x1c0>
jmp    1426 <trsrch+0x2c6>
mov    (%rsp),%rdi
mov    %r13d,%esi
call   1040 <l2norm@plt>
movapd %xmm0,%xmm3
mulsd  %xmm0,%xmm3
jmp    14c9 <trsrch+0x369>
lea    (%rdi,%r15,8),%rax
lea    0x0(,%r15,8),%rcx
add    %rbp,%rcx
cmp    %rcx,%rdi
setb   %r8b
cmp    %rbp,%rax
seta   %dl
lea    (%rbx,%r15,8),%rcx
cmp    %rcx,%rdi
setb   %cl
cmp    %rbx,%rax
seta   %sil
xor    %eax,%eax
test   %dl,%r8b
jne    12f3 <trsrch+0x193>
and    %sil,%cl
jne    12f3 <trsrch+0x193>
mov    %r15d,%eax
and    $0xfffffffe,%eax
lea    -0x2(%rax),%rdx
mov    %rdx,%rcx
shr    %rcx
add    $0x1,%rcx
test   %rdx,%rdx
je     162e <trsrch+0x4ce>
mov    %rcx,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %edx,%edx
movupd 0x0(%rbp,%rdx,8),%xmm0
movupd (%rbx,%rdx,8),%xmm1
divpd  %xmm1,%xmm0
movupd %xmm0,(%rdi,%rdx,8)
movupd 0x10(%rbp,%rdx,8),%xmm0
movupd 0x10(%rbx,%rdx,8),%xmm1
divpd  %xmm1,%xmm0
movupd %xmm0,0x10(%rdi,%rdx,8)
add    $0x4,%rdx
add    $0xfffffffffffffffe,%rsi
jne    13d0 <trsrch+0x270>
test   $0x1,%cl
je     141d <trsrch+0x2bd>
movupd 0x0(%rbp,%rdx,8),%xmm0
movupd (%rbx,%rdx,8),%xmm1
divpd  %xmm1,%xmm0
movupd %xmm0,(%rdi,%rdx,8)
cmp    %r15,%rax
jne    12f3 <trsrch+0x193>
mov    %r13d,%esi
call   1040 <l2norm@plt>
movapd %xmm0,%xmm3
mulsd  %xmm0,%xmm3
test   %r13d,%r13d
jle    14c9 <trsrch+0x369>
lea    0x0(,%r15,8),%rax
lea    0x8(,%r15,8),%r8
xorpd  %xmm4,%xmm4
xor    %r9d,%r9d
mov    %r15,%rsi
mov    %rbp,%rdi
mov    0x10(%rsp),%rbx
mov    0xb8(%rsp),%rdx
nopl   0x0(%rax)
xor    %ecx,%ecx
mov    %rdx,%rbp
xorpd  %xmm0,%xmm0
nopl   0x0(%rax)
movsd  0x0(%rbp),%xmm1
mulsd  (%rdi,%rcx,8),%xmm1
movsd  (%rbx,%rcx,8),%xmm2
mulsd  %xmm2,%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    %rax,%rbp
add    $0x1,%rcx
cmp    %rcx,%rsi
jne    1480 <trsrch+0x320>
mulsd  %xmm0,%xmm0
addsd  %xmm0,%xmm4
add    $0x1,%r9
add    %r8,%rdx
add    $0x8,%rbx
add    $0x8,%rdi
add    $0xffffffffffffffff,%rsi
cmp    %r15,%r9
jne    1470 <trsrch+0x310>
jmp    14cd <trsrch+0x36d>
xorpd  %xmm4,%xmm4
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
jb     14e0 <trsrch+0x380>
xorps  %xmm0,%xmm0
sqrtsd %xmm3,%xmm0
jmp    1501 <trsrch+0x3a1>
movapd %xmm3,%xmm0
movsd  %xmm3,0x8(%rsp)
movsd  %xmm4,0x40(%rsp)
call   1070 <sqrt@plt>
movsd  0x40(%rsp),%xmm4
movsd  0x8(%rsp),%xmm3
mulsd  %xmm0,%xmm3
divsd  %xmm4,%xmm3
mov    0xc8(%rsp),%rax
movsd  %xmm3,(%rax)
ucomisd 0x20(%rsp),%xmm3
jbe    152f <trsrch+0x3cf>
movsd  0x20(%rsp),%xmm0
mov    0xc8(%rsp),%rax
movsd  %xmm0,(%rax)
mov    %r13,0x8(%rsp)
mov    $0x4,%ebp
mov    %r12,0x48(%rsp)
mov    0x18(%rsp),%r14
mov    0x10(%rsp),%r13
mov    0x38(%rsp),%rbx
nopl   (%rax)
mov    %r14,%rdi
mov    %r12,%rsi
mov    0x8(%rsp),%r12
mov    %r12d,%edx
mov    %r13,%rcx
mov    0xb8(%rsp),%r8
mov    0xc0(%rsp),%r9
movsd  0x28(%rsp),%xmm0
movsd  0x68(%rsp),%xmm1
push   %rbx
mov    0xd0(%rsp),%r15
push   %r15
call   1050 <trstep@plt>
add    $0x10,%rsp
movsd  (%r15),%xmm0
movsd  %xmm0,0x10(%r15)
mov    0x50(%rsp),%rdi
mov    0x58(%rsp),%rsi
mov    %r14,%rdx
mov    %rbx,%rcx
mov    %r12d,%r8d
mov    0x48(%rsp),%r12
mov    %r13,%r9
movsd  0x20(%rsp),%xmm0
movsd  0x60(%rsp),%xmm1
push   0xd0(%rsp)
lea    0x78(%rsp),%rax
push   %rax
push   0x40(%rsp)
push   %r15
push   $0x0
push   0xe8(%rsp)
push   0xe8(%rsp)
push   %rbp
call   1080 <trupdate@plt>
add    $0x40,%rsp
mov    %eax,%ebp
cmp    $0x2,%eax
jl     1600 <trsrch+0x4a0>
cmp    $0xf,%ebp
jne    1550 <trsrch+0x3f0>
mov    (%rsp),%rdi
call   1030 <free@plt>
mov    0x38(%rsp),%rdi
call   1030 <free@plt>
mov    0x30(%rsp),%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edx,%edx
test   $0x1,%cl
jne    1409 <trsrch+0x2a9>
jmp    141d <trsrch+0x2bd>

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

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