#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 fabs(double);
scalar_t__ isfinite(double);
void stub1(double *, double *, double *, double **, double *, double *, int);
int gnr2(double x[], int n,
         void (*funcd)(double[], double[], double[], double[][1], double *,
                       double *, int)) {
  double f, df, dx[1], x_old[1], resid[1], jac[1][1];
  double errx, x_orig[1];
  int n_iter, id, jd, i_extra, doing_extra;
  double dW, dvsq, vsq_old, vsq, W, W_old;
  int keep_iterating;
  errx = 1.;
  df = f = 1.;
  i_extra = doing_extra = 0;
  for (id = 0; id < n; id++)
    x_old[id] = x_orig[id] = x[id];
  n_iter = 0;
  keep_iterating = 1;
  while (keep_iterating) {
    (*funcd)(x, dx, resid, jac, &f, &df, n);
    errx = 0.;
    for (id = 0; id < n; id++) {
      x_old[id] = x[id];
    }
    for (id = 0; id < n; id++) {
      x[id] += dx[id];
    }
    for (id = 0; id < n; id++) {
      errx += (x[id] == 0.) ? fabs(dx[id]) : fabs(dx[id] / x[id]);
    }
    errx /= 1. * n;
    x[0] = fabs(x[0]);
    if ((fabs(errx) <= 1.0e-15) && (doing_extra == 0) && (2 > 0)) {
      doing_extra = 0;
    }
    if (doing_extra == 1)
      i_extra++;
    if (((fabs(errx) <= 1.0e-15) && (doing_extra == 0)) || (i_extra > 2) ||
        (n_iter >= (30 - 1))) {
      keep_iterating = 0;
    }
    n_iter++;
  }
  if ((isfinite(f) == 0) || (isfinite(df) == 0) || (isfinite(x[0]) == 0)) {
    return (2);
  }
  if (fabs(errx) > 1.0e-10) {
    return (1);
  }
  if ((fabs(errx) <= 1.0e-10) && (fabs(errx) > 1.0e-10)) {
    return (0);
  }
  if (fabs(errx) <= 1.0e-10) {
    return (0);
  }
  return (0);
}


x86 assembly (clang, -O0):
<gnr2>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
movsd  0xed2(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xec5(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xeb8(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x74(%rbp)
movl   $0x0,-0x70(%rbp)
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    119d <gnr2+0x8d>
mov    -0x10(%rbp),%rax
movslq -0x68(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movslq -0x68(%rbp),%rax
movsd  %xmm0,-0x60(%rbp,%rax,8)
movslq -0x68(%rbp),%rax
movsd  %xmm0,-0x40(%rbp,%rax,8)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1162 <gnr2+0x52>
movl   $0x0,-0x64(%rbp)
movl   $0x1,-0xac(%rbp)
cmpl   $0x0,-0xac(%rbp)
je     13d5 <gnr2+0x2c5>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rdi
lea    -0x38(%rbp),%rsi
lea    -0x48(%rbp),%rdx
lea    -0x50(%rbp),%rcx
mov    -0x14(%rbp),%r10d
lea    -0x28(%rbp),%r8
lea    -0x30(%rbp),%r9
mov    %r10d,(%rsp)
call   *%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1221 <gnr2+0x111>
mov    -0x10(%rbp),%rax
movslq -0x68(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movslq -0x68(%rbp),%rax
movsd  %xmm0,-0x40(%rbp,%rax,8)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    11f0 <gnr2+0xe0>
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    125e <gnr2+0x14e>
movslq -0x68(%rbp),%rax
movsd  -0x38(%rbp,%rax,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x68(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1228 <gnr2+0x118>
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12fd <gnr2+0x1ed>
mov    -0x10(%rbp),%rax
movslq -0x68(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12b3 <gnr2+0x1a3>
jp     12b3 <gnr2+0x1a3>
movslq -0x68(%rbp),%rax
movsd  -0x38(%rbp,%rax,8),%xmm0
movaps 0xd7e(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
jmp    12dd <gnr2+0x1cd>
movslq -0x68(%rbp),%rax
movsd  -0x38(%rbp,%rax,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x68(%rbp),%rcx
divsd  (%rax,%rcx,8),%xmm0
movaps 0xd4f(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xb8(%rbp),%xmm0
ff
addsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1265 <gnr2+0x155>
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  0xcf6(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movaps 0xcf5(%rip),%xmm1
pand   %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x58(%rbp),%xmm1
movaps 0xcdd(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xcc1(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     136a <gnr2+0x25a>
cmpl   $0x0,-0x74(%rbp)
jne    136a <gnr2+0x25a>
movl   $0x0,-0x74(%rbp)
cmpl   $0x1,-0x74(%rbp)
jne    137d <gnr2+0x26d>
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
movsd  -0x58(%rbp),%xmm1
movaps 0xc97(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xc7b(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     13a9 <gnr2+0x299>
cmpl   $0x0,-0x74(%rbp)
je     13bd <gnr2+0x2ad>
cmpl   $0x2,-0x70(%rbp)
jg     13bd <gnr2+0x2ad>
cmpl   $0x1d,-0x64(%rbp)
jl     13c7 <gnr2+0x2b7>
movl   $0x0,-0xac(%rbp)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    11ae <gnr2+0x9e>
movsd  -0x28(%rbp),%xmm0
call   1030 <isfinite@plt>
cmp    $0x0,%rax
je     1414 <gnr2+0x304>
movsd  -0x30(%rbp),%xmm0
call   1030 <isfinite@plt>
cmp    $0x0,%rax
je     1414 <gnr2+0x304>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <isfinite@plt>
cmp    $0x0,%rax
jne    1420 <gnr2+0x310>
movl   $0x2,-0x4(%rbp)
jmp    14d3 <gnr2+0x3c3>
movsd  -0x58(%rbp),%xmm0
movaps 0xbf4(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xbd0(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    144e <gnr2+0x33e>
movl   $0x1,-0x4(%rbp)
jmp    14d3 <gnr2+0x3c3>
movsd  -0x58(%rbp),%xmm1
movaps 0xbc6(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xba2(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     149e <gnr2+0x38e>
movsd  -0x58(%rbp),%xmm0
movaps 0xba4(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xb80(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    149e <gnr2+0x38e>
movl   $0x0,-0x4(%rbp)
jmp    14d3 <gnr2+0x3c3>
movsd  -0x58(%rbp),%xmm1
movaps 0xb76(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xb52(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     14cc <gnr2+0x3bc>
movl   $0x0,-0x4(%rbp)
jmp    14d3 <gnr2+0x3c3>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gnr2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
movabs $0x3ff0000000000000,%rax
mov    %rax,0x18(%rsp)
mov    %rax,0x10(%rsp)
cvtsi2sd %esi,%xmm0
movsd  %xmm0,0x20(%rsp)
mov    %esi,%r13d
mov    %r13d,%eax
and    $0xfffffffc,%eax
mov    %rax,0x50(%rsp)
add    $0xfffffffffffffffc,%rax
mov    %rax,0x48(%rsp)
mov    %rax,%rcx
shr    $0x2,%rcx
add    $0x1,%rcx
mov    %rcx,%rax
mov    %rcx,0x40(%rsp)
and    $0xfffffffffffffffe,%rcx
mov    %rcx,0x38(%rsp)
mov    %r13d,%r12d
and    $0xfffffffe,%r12d
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebp,(%rsp)
mov    %rbx,%rdi
lea    0x8(%rsp),%rsi
lea    0x60(%rsp),%rdx
lea    0x58(%rsp),%rcx
lea    0x18(%rsp),%r8
lea    0x10(%rsp),%r9
call   *%r14
xorpd  %xmm7,%xmm7
movapd 0xe42(%rip),%xmm6
xorpd  %xmm5,%xmm5
test   %ebp,%ebp
jle    12e0 <gnr2+0x1d0>
movsd  0x8(%rsp),%xmm0
cmp    $0x4,%ebp
jae    11e0 <gnr2+0xd0>
xor    %eax,%eax
jmp    1280 <gnr2+0x170>
nopl   0x0(%rax)
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
cmpq   $0x0,0x48(%rsp)
je     136e <gnr2+0x25e>
mov    0x38(%rsp),%rcx
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
movupd (%rbx,%rax,8),%xmm2
movupd 0x10(%rbx,%rax,8),%xmm3
movupd 0x20(%rbx,%rax,8),%xmm4
movupd 0x30(%rbx,%rax,8),%xmm5
addpd  %xmm1,%xmm2
addpd  %xmm1,%xmm3
movupd %xmm2,(%rbx,%rax,8)
movupd %xmm3,0x10(%rbx,%rax,8)
addpd  %xmm1,%xmm4
addpd  %xmm1,%xmm5
movupd %xmm4,0x20(%rbx,%rax,8)
movupd %xmm5,0x30(%rbx,%rax,8)
add    $0x8,%rax
add    $0xfffffffffffffffe,%rcx
jne    1200 <gnr2+0xf0>
testb  $0x1,0x40(%rsp)
je     126d <gnr2+0x15d>
movupd (%rbx,%rax,8),%xmm2
movupd 0x10(%rbx,%rax,8),%xmm3
addpd  %xmm1,%xmm2
addpd  %xmm1,%xmm3
movupd %xmm2,(%rbx,%rax,8)
movupd %xmm3,0x10(%rbx,%rax,8)
mov    0x50(%rsp),%rcx
mov    %rcx,%rax
cmp    %r13,%rcx
je     1297 <gnr2+0x187>
nopw   0x0(%rax,%rax,1)
movsd  (%rbx,%rax,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx,%rax,8)
add    $0x1,%rax
cmp    %rax,%r13
jne    1280 <gnr2+0x170>
xorpd  %xmm5,%xmm5
test   %ebp,%ebp
jle    12e0 <gnr2+0x1d0>
movsd  0x8(%rsp),%xmm0
movapd %xmm0,%xmm1
andpd  %xmm6,%xmm1
xorpd  %xmm5,%xmm5
xor    %eax,%eax
cmp    $0x1,%ebp
jne    1331 <gnr2+0x221>
test   $0x1,%r13b
je     12e0 <gnr2+0x1d0>
movsd  (%rbx,%rax,8),%xmm2
ucomisd %xmm7,%xmm2
jne    12cb <gnr2+0x1bb>
jnp    12d7 <gnr2+0x1c7>
divsd  %xmm2,%xmm0
andpd  %xmm6,%xmm0
movapd %xmm0,%xmm1
addsd  %xmm1,%xmm5
nopl   0x0(%rax,%rax,1)
divsd  0x20(%rsp),%xmm5
movsd  (%rbx),%xmm0
movapd 0xd0e(%rip),%xmm1
andpd  %xmm1,%xmm0
movlpd %xmm0,(%rbx)
andpd  %xmm1,%xmm5
movsd  0xd0a(%rip),%xmm0
ucomisd %xmm5,%xmm0
jae    1380 <gnr2+0x270>
lea    0x1(%r15),%eax
cmp    $0x1d,%r15d
mov    %eax,%r15d
jb     1190 <gnr2+0x80>
jmp    1380 <gnr2+0x270>
nop
addsd  %xmm2,%xmm5
addsd  %xmm3,%xmm5
add    $0x2,%rax
cmp    %rax,%r12
je     12b8 <gnr2+0x1a8>
movsd  (%rbx,%rax,8),%xmm3
ucomisd %xmm7,%xmm3
movapd %xmm1,%xmm2
jne    1342 <gnr2+0x232>
jnp    134e <gnr2+0x23e>
movapd %xmm0,%xmm2
divsd  %xmm3,%xmm2
andpd  %xmm6,%xmm2
movsd  0x8(%rbx,%rax,8),%xmm4
ucomisd %xmm7,%xmm4
movapd %xmm1,%xmm3
jne    1360 <gnr2+0x250>
jnp    1320 <gnr2+0x210>
movapd %xmm0,%xmm3
divsd  %xmm4,%xmm3
andpd  %xmm6,%xmm3
jmp    1320 <gnr2+0x210>
xor    %eax,%eax
testb  $0x1,0x40(%rsp)
jne    124f <gnr2+0x13f>
jmp    126d <gnr2+0x15d>
movapd %xmm5,0x20(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <isfinite@plt>
mov    $0x2,%ebp
test   %rax,%rax
je     13d0 <gnr2+0x2c0>
movsd  0x10(%rsp),%xmm0
call   1030 <isfinite@plt>
test   %rax,%rax
je     13d0 <gnr2+0x2c0>
movsd  (%rbx),%xmm0
call   1030 <isfinite@plt>
test   %rax,%rax
je     13d0 <gnr2+0x2c0>
mov    $0x1,%ebp
movapd 0x20(%rsp),%xmm0
ucomisd 0xc4c(%rip),%xmm0
ja     13d0 <gnr2+0x2c0>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @gnr2(double* %0, i32 %1, void (double*, double*, double*, [1 x double]*, double*, double*, i32)* %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca i32
%7 = alloca void (double*, double*, double*, [1 x double]*, double*, double*, i32)*
%8 = alloca double
%9 = alloca double
%10 = alloca [1 x double]
%11 = alloca [1 x double]
%12 = alloca [1 x double]
%13 = alloca [1 x [1 x double]]
%14 = alloca double
%15 = alloca [1 x double]
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca i32
store double* %0, double** %5
store i32 %1, i32* %6
store void (double*, double*, double*, [1 x double]*, double*, double*, i32)* %2, void (double*, double*, double*, [1 x double]*, double*, double*, i32)** %7
store double 1.000000e+00, double* %14
store double 1.000000e+00, double* %8
store double 1.000000e+00, double* %9
store i32 0, i32* %20
store i32 0, i32* %19
store i32 0, i32* %17
br label %28
28: ; preds = %44, %3
%29 = load i32, i32* %17
%30 = load i32, i32* %6
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %47
32: ; preds = %28
%33 = load double*, double** %5
%34 = load i32, i32* %17
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %33, i64 %35
%37 = load double, double* %36
%38 = load i32, i32* %17
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [1 x double], [1 x double]* %15, i64 0, i64 %39
store double %37, double* %40
%41 = load i32, i32* %17
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [1 x double], [1 x double]* %11, i64 0, i64 %42
store double %37, double* %43
br label %44
44: ; preds = %32
%45 = load i32, i32* %17
%46 = add nsw i32 %45, 1
store i32 %46, i32* %17
br label %28
47: ; preds = %28
store i32 0, i32* %16
store i32 1, i32* %27
br label %48
48: ; preds = %169, %47
%49 = load i32, i32* %27
%50 = icmp ne i32 %49, 0
br i1 %50, label %51, label %172
51: ; preds = %48
%52 = load void (double*, double*, double*, [1 x double]*, double*, double*, i32)*, void (double*, double*, double*, [1 x double]*, double*, double*, i32)** %7
%53 = load double*, double** %5
%54 = getelementptr inbounds [1 x double], [1 x double]* %10, i64 0, i64 0
%55 = getelementptr inbounds [1 x double], [1 x double]* %12, i64 0, i64 0
%56 = getelementptr inbounds [1 x [1 x double]], [1 x [1 x double]]* %13, i64 0, i64 0
%57 = load i32, i32* %6
store double 0.000000e+00, double* %14
store i32 0, i32* %17
br label %58
58: ; preds = %71, %51
%59 = load i32, i32* %17
%60 = load i32, i32* %6
%61 = icmp slt i32 %59, %60
br i1 %61, label %62, label %74
62: ; preds = %58
%63 = load double*, double** %5
%64 = load i32, i32* %17
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double, double* %63, i64 %65
%67 = load double, double* %66
%68 = load i32, i32* %17
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [1 x double], [1 x double]* %11, i64 0, i64 %69
store double %67, double* %70
br label %71
71: ; preds = %62
%72 = load i32, i32* %17
%73 = add nsw i32 %72, 1
store i32 %73, i32* %17
br label %58
74: ; preds = %58
store i32 0, i32* %17
br label %75
75: ; preds = %90, %74
%76 = load i32, i32* %17
%77 = load i32, i32* %6
%78 = icmp slt i32 %76, %77
br i1 %78, label %79, label %93
79: ; preds = %75
%80 = load i32, i32* %17
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [1 x double], [1 x double]* %10, i64 0, i64 %81
%83 = load double, double* %82
%84 = load double*, double** %5
%85 = load i32, i32* %17
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds double, double* %84, i64 %86
%88 = load double, double* %87
%89 = fadd double %88, %83
store double %89, double* %87
br label %90
90: ; preds = %79
%91 = load i32, i32* %17
%92 = add nsw i32 %91, 1
store i32 %92, i32* %17
br label %75
93: ; preds = %75
store i32 0, i32* %17
br label %94
94: ; preds = %127, %93
%95 = load i32, i32* %17
%96 = load i32, i32* %6
%97 = icmp slt i32 %95, %96
br i1 %97, label %98, label %130
98: ; preds = %94
%99 = load double*, double** %5
%100 = load i32, i32* %17
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds double, double* %99, i64 %101
%103 = load double, double* %102
%104 = fcmp oeq double %103, 0.000000e+00
br i1 %104, label %105, label %111
105: ; preds = %98
%106 = load i32, i32* %17
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds [1 x double], [1 x double]* %10, i64 0, i64 %107
%109 = load double, double* %108
%110 = call double @llvm.fabs.f64(double %109)
br label %123
111: ; preds = %98
%112 = load i32, i32* %17
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds [1 x double], [1 x double]* %10, i64 0, i64 %113
%115 = load double, double* %114
%116 = load double*, double** %5
%117 = load i32, i32* %17
%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 = call double @llvm.fabs.f64(double %121)
br label %123
123: ; preds = %111, %105
%124 = phi double [ %110, %105 ], [ %122, %111 ]
%125 = load double, double* %14
%126 = fadd double %125, %124
store double %126, double* %14
br label %127
127: ; preds = %123
%128 = load i32, i32* %17
%129 = add nsw i32 %128, 1
store i32 %129, i32* %17
br label %94
130: ; preds = %94
%131 = load i32, i32* %6
%132 = sitofp i32 %131 to double
%133 = fmul double 1.000000e+00, %132
%134 = load double, double* %14
%135 = fdiv double %134, %133
store double %135, double* %14
%136 = load double*, double** %5
%137 = getelementptr inbounds double, double* %136, i64 0
%138 = load double, double* %137
%139 = call double @llvm.fabs.f64(double %138)
%140 = load double*, double** %5
%141 = getelementptr inbounds double, double* %140, i64 0
store double %139, double* %141
%142 = load double, double* %14
%143 = call double @llvm.fabs.f64(double %142)
%144 = fcmp ole double %143, 1.000000e-15
br i1 %144, label %145, label %149
145: ; preds = %130
%146 = load i32, i32* %20
%147 = icmp eq i32 %146, 0
br i1 %147, label %148, label %149
148: ; preds = %145
store i32 0, i32* %20
br label %149
149: ; preds = %148, %145, %130
%150 = load i32, i32* %20
%151 = icmp eq i32 %150, 1
br i1 %151, label %152, label %155
152: ; preds = %149
%153 = load i32, i32* %19
%154 = add nsw i32 %153, 1
store i32 %154, i32* %19
br label %155
155: ; preds = %152, %149
%156 = load double, double* %14
%157 = call double @llvm.fabs.f64(double %156)
%158 = fcmp ole double %157, 1.000000e-15
br i1 %158, label %159, label %162
159: ; preds = %155
%160 = load i32, i32* %20
%161 = icmp eq i32 %160, 0
br i1 %161, label %168, label %162
162: ; preds = %159, %155
%163 = load i32, i32* %19
%164 = icmp sgt i32 %163, 2
br i1 %164, label %168, label %165
165: ; preds = %162
%166 = load i32, i32* %16
%167 = icmp sge i32 %166, 29
br i1 %167, label %168, label %169
168: ; preds = %165, %162, %159
store i32 0, i32* %27
br label %169
169: ; preds = %168, %165
%170 = load i32, i32* %16
%171 = add nsw i32 %170, 1
store i32 %171, i32* %16
br label %48
172: ; preds = %48
%173 = load double, double* %8
%174 = call i64 @isfinite(double %173)
%175 = icmp eq i64 %174, 0
br i1 %175, label %186, label %176
176: ; preds = %172
%177 = load double, double* %9
%178 = call i64 @isfinite(double %177)
%179 = icmp eq i64 %178, 0
br i1 %179, label %186, label %180
180: ; preds = %176
%181 = load double*, double** %5
%182 = getelementptr inbounds double, double* %181, i64 0
%183 = load double, double* %182
%184 = call i64 @isfinite(double %183)
%185 = icmp eq i64 %184, 0
br i1 %185, label %186, label %187
186: ; preds = %180, %176, %172
store i32 2, i32* %4
br label %207
187: ; preds = %180
%188 = load double, double* %14
%189 = call double @llvm.fabs.f64(double %188)
%190 = fcmp ogt double %189, 1.000000e-10
br i1 %190, label %191, label %192
191: ; preds = %187
store i32 1, i32* %4
br label %207
192: ; preds = %187
%193 = load double, double* %14
%194 = call double @llvm.fabs.f64(double %193)
%195 = fcmp ole double %194, 1.000000e-10
br i1 %195, label %196, label %201
196: ; preds = %192
%197 = load double, double* %14
%198 = call double @llvm.fabs.f64(double %197)
%199 = fcmp ogt double %198, 1.000000e-10
br i1 %199, label %200, label %201
200: ; preds = %196
store i32 0, i32* %4
br label %207
201: ; preds = %196, %192
%202 = load double, double* %14
%203 = call double @llvm.fabs.f64(double %202)
%204 = fcmp ole double %203, 1.000000e-10
br i1 %204, label %205, label %206
205: ; preds = %201
store i32 0, i32* %4
br label %207
206: ; preds = %201
store i32 0, i32* %4
br label %207
207: ; preds = %206, %205, %200, %191, %186
%208 = load i32, i32* %4
ret i32 %208
}

LLVM IR (-O2):
define i32 @gnr2(double* %0, i32 %1, void (double*, double*, double*, [1 x double]*, double*, double*, i32)* nocapture %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca [1 x double]
%7 = alloca [1 x double]
%8 = alloca [1 x [1 x double]]
%9 = bitcast double* %4 to i8*
%10 = bitcast double* %5 to i8*
%11 = bitcast [1 x double]* %6 to i8*
%12 = bitcast [1 x double]* %7 to i8*
%13 = bitcast [1 x [1 x double]]* %8 to i8*
store double 1.000000e+00, double* %4
store double 1.000000e+00, double* %5
%14 = getelementptr inbounds [1 x double], [1 x double]* %6, i64 0, i64 0
%15 = getelementptr inbounds [1 x double], [1 x double]* %7, i64 0, i64 0
%16 = getelementptr inbounds [1 x [1 x double]], [1 x [1 x double]]* %8, i64 0, i64 0
%17 = icmp sgt i32 %1, 0
%18 = sitofp i32 %1 to double
%19 = zext i32 %1 to i64
%20 = and i64 %19, 4294967292
%21 = add nsw i64 %20, -4
%22 = lshr exact i64 %21, 2
%23 = add nuw nsw i64 %22, 1
%24 = icmp ult i32 %1, 4
%25 = and i64 %19, 4294967292
%26 = and i64 %23, 1
%27 = icmp eq i64 %21, 0
%28 = and i64 %23, 9223372036854775806
%29 = icmp eq i64 %26, 0
%30 = icmp eq i64 %25, %19
%31 = and i64 %19, 1
%32 = icmp eq i32 %1, 1
%33 = and i64 %19, 4294967294
%34 = icmp eq i64 %31, 0
br label %35
35: ; preds = %3, %138
%36 = phi i32 [ 0, %3 ], [ %147, %138 ]
br i1 %17, label %37, label %138
37: ; preds = %35
%38 = load double, double* %14
br i1 %24, label %85, label %39
39: ; preds = %37
%40 = insertelement <2 x double> poison, double %38, i64 0
%41 = shufflevector <2 x double> %40, <2 x double> poison, <2 x i32> zeroinitializer
%42 = insertelement <2 x double> poison, double %38, i64 0
%43 = shufflevector <2 x double> %42, <2 x double> poison, <2 x i32> zeroinitializer
br i1 %27, label %71, label %44
44: ; preds = %39, %44
%45 = phi i64 [ %68, %44 ], [ 0, %39 ]
%46 = phi i64 [ %69, %44 ], [ 0, %39 ]
%47 = getelementptr inbounds double, double* %0, i64 %45
%48 = bitcast double* %47 to <2 x double>*
%49 = load <2 x double>, <2 x double>* %48
%50 = getelementptr inbounds double, double* %47, i64 2
%51 = bitcast double* %50 to <2 x double>*
%52 = load <2 x double>, <2 x double>* %51
%53 = fadd <2 x double> %41, %49
%54 = fadd <2 x double> %43, %52
%55 = bitcast double* %47 to <2 x double>*
store <2 x double> %53, <2 x double>* %55
%56 = bitcast double* %50 to <2 x double>*
store <2 x double> %54, <2 x double>* %56
%57 = or i64 %45, 4
%58 = getelementptr inbounds double, double* %0, i64 %57
%59 = bitcast double* %58 to <2 x double>*
%60 = load <2 x double>, <2 x double>* %59
%61 = getelementptr inbounds double, double* %58, i64 2
%62 = bitcast double* %61 to <2 x double>*
%63 = load <2 x double>, <2 x double>* %62
%64 = fadd <2 x double> %41, %60
%65 = fadd <2 x double> %43, %63
%66 = bitcast double* %58 to <2 x double>*
store <2 x double> %64, <2 x double>* %66
%67 = bitcast double* %61 to <2 x double>*
store <2 x double> %65, <2 x double>* %67
%68 = add nuw i64 %45, 8
%69 = add i64 %46, 2
%70 = icmp eq i64 %69, %28
br i1 %70, label %71, label %44
71: ; preds = %44, %39
%72 = phi i64 [ 0, %39 ], [ %68, %44 ]
br i1 %29, label %84, label %73
73: ; preds = %71
%74 = getelementptr inbounds double, double* %0, i64 %72
%75 = bitcast double* %74 to <2 x double>*
%76 = load <2 x double>, <2 x double>* %75
%77 = getelementptr inbounds double, double* %74, i64 2
%78 = bitcast double* %77 to <2 x double>*
%79 = load <2 x double>, <2 x double>* %78
%80 = fadd <2 x double> %41, %76
%81 = fadd <2 x double> %43, %79
%82 = bitcast double* %74 to <2 x double>*
store <2 x double> %80, <2 x double>* %82
%83 = bitcast double* %77 to <2 x double>*
store <2 x double> %81, <2 x double>* %83
br label %84
84: ; preds = %71, %73
br i1 %30, label %87, label %85
85: ; preds = %37, %84
%86 = phi i64 [ 0, %37 ], [ %25, %84 ]
br label %91
87: ; preds = %91, %84
br i1 %17, label %88, label %138
88: ; preds = %87
%89 = load double, double* %14
%90 = call double @llvm.fabs.f64(double %89)
br i1 %32, label %124, label %98
91: ; preds = %85, %91
%92 = phi i64 [ %96, %91 ], [ %86, %85 ]
%93 = getelementptr inbounds double, double* %0, i64 %92
%94 = load double, double* %93
%95 = fadd double %38, %94
store double %95, double* %93
%96 = add nuw nsw i64 %92, 1
%97 = icmp eq i64 %96, %19
br i1 %97, label %87, label %91
98: ; preds = %88, %118
%99 = phi i64 [ %121, %118 ], [ 0, %88 ]
%100 = phi double [ %120, %118 ], [ 0.000000e+00, %88 ]
%101 = phi i64 [ %122, %118 ], [ 0, %88 ]
%102 = getelementptr inbounds double, double* %0, i64 %99
%103 = load double, double* %102
%104 = fcmp oeq double %103, 0.000000e+00
br i1 %104, label %108, label %105
105: ; preds = %98
%106 = fdiv double %89, %103
%107 = call double @llvm.fabs.f64(double %106)
br label %108
108: ; preds = %98, %105
%109 = phi double [ %107, %105 ], [ %90, %98 ]
%110 = fadd double %100, %109
%111 = or i64 %99, 1
%112 = getelementptr inbounds double, double* %0, i64 %111
%113 = load double, double* %112
%114 = fcmp oeq double %113, 0.000000e+00
br i1 %114, label %118, label %115
115: ; preds = %108
%116 = fdiv double %89, %113
%117 = call double @llvm.fabs.f64(double %116)
br label %118
118: ; preds = %115, %108
%119 = phi double [ %117, %115 ], [ %90, %108 ]
%120 = fadd double %110, %119
%121 = add nuw nsw i64 %99, 2
%122 = add i64 %101, 2
%123 = icmp eq i64 %122, %33
br i1 %123, label %124, label %98
124: ; preds = %118, %88
%125 = phi double [ undef, %88 ], [ %120, %118 ]
%126 = phi i64 [ 0, %88 ], [ %121, %118 ]
%127 = phi double [ 0.000000e+00, %88 ], [ %120, %118 ]
br i1 %34, label %138, label %128
128: ; preds = %124
%129 = getelementptr inbounds double, double* %0, i64 %126
%130 = load double, double* %129
%131 = fcmp oeq double %130, 0.000000e+00
br i1 %131, label %135, label %132
132: ; preds = %128
%133 = fdiv double %89, %130
%134 = call double @llvm.fabs.f64(double %133)
br label %135
135: ; preds = %132, %128
%136 = phi double [ %134, %132 ], [ %90, %128 ]
%137 = fadd double %127, %136
br label %138
138: ; preds = %135, %124, %35, %87
%139 = phi double [ 0.000000e+00, %87 ], [ 0.000000e+00, %35 ], [ %125, %124 ], [ %137, %135 ]
%140 = fdiv double %139, %18
%141 = load double, double* %0
%142 = call double @llvm.fabs.f64(double %141)
store double %142, double* %0
%143 = call double @llvm.fabs.f64(double %140)
%144 = fcmp ole double %143, 1.000000e-15
%145 = icmp ugt i32 %36, 28
%146 = select i1 %144, i1 true, i1 %145
%147 = add nuw nsw i32 %36, 1
br i1 %146, label %148, label %35
148: ; preds = %138
%149 = load double, double* %4
%150 = call i64 @isfinite(double %149)
%151 = icmp eq i64 %150, 0
br i1 %151, label %163, label %152
152: ; preds = %148
%153 = load double, double* %5
%154 = call i64 @isfinite(double %153)
%155 = icmp eq i64 %154, 0
br i1 %155, label %163, label %156
156: ; preds = %152
%157 = load double, double* %0
%158 = call i64 @isfinite(double %157)
%159 = icmp eq i64 %158, 0
br i1 %159, label %163, label %160
160: ; preds = %156
%161 = fcmp ogt double %143, 1.000000e-10
br i1 %161, label %163, label %162
162: ; preds = %160
br label %163
163: ; preds = %162, %160, %148, %152, %156
%164 = phi i32 [ 2, %156 ], [ 2, %152 ], [ 2, %148 ], [ 1, %160 ], [ 0, %162 ]
ret i32 %164
}