#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 evalDerivDisp(double *, int, double, double);
double evalDisp(double *, int, double, double);
double fabs(double);
int /*<<< orphan*/ printf(char *);
int evalInvDisp(double coeff[], int ncoeff, double m, double pixel,
                double wl_estimate, double tolerance, double *wl) {
  double wl_low, wl_high;
  double wl_step;
  double wl_test;
  double last_wl_test;
  double x_test;
  double slope;
  double x_diff;
  double min_x_diff;
  double wl_min_x_diff;
  double save_x_test;
  int niter;
  int done;
  int i;
  *wl = -1.;
  if (ncoeff < 1 || ncoeff > 9)
    return 1;
  wl_test = wl_estimate;
  x_test = evalDisp(coeff, ncoeff, m, wl_test);
  save_x_test = x_test;
  slope = evalDerivDisp(coeff, ncoeff, m, wl_test);
  x_diff = fabs(x_test - pixel);
  min_x_diff = x_diff;
  wl_min_x_diff = wl_test;
  if (slope <= 0. && m < 1.5) {
    printf(
        "Warning:  (evalInvDisp) slope of dispersion relation is negative\n");
  }
  if ((slope <= 0. || x_diff > (1024.)) && m > 1.5) {
    wl_low = 1123.;
    wl_high = 3170.;
    wl_step = (100.);
    if (slope <= 0.)
      min_x_diff = 1024. * 100;
    else
      min_x_diff = x_diff;
    wl_min_x_diff = wl_estimate;
    for (i = 0; i < 2; i++) {
      for (wl_test = wl_low; wl_test <= wl_high; wl_test += wl_step) {
        slope = evalDerivDisp(coeff, ncoeff, m, wl_test);
        if (slope > 0.) {
          x_test = evalDisp(coeff, ncoeff, m, wl_test);
          x_diff = fabs(x_test - pixel);
          if (x_diff < min_x_diff) {
            min_x_diff = x_diff;
            save_x_test = x_test;
            wl_min_x_diff = wl_test;
          }
        }
      }
      wl_low = wl_min_x_diff - wl_step;
      wl_high = wl_min_x_diff + wl_step;
      wl_step /= 10.;
    }
  }
  done = 0;
  niter = 0;
  x_test = save_x_test;
  wl_test = wl_min_x_diff;
  last_wl_test = wl_min_x_diff;
  while (!done) {
    slope = evalDerivDisp(coeff, ncoeff, m, wl_test);
    if (slope == 0.) {
      *wl = wl_test;
      return 3;
    }
    wl_test = wl_test + (pixel - x_test) / slope;
    if (fabs(wl_test - last_wl_test) < tolerance)
      done = 1;
    else if (niter > 100) {
      *wl = wl_test;
      return 2;
    }
    last_wl_test = wl_test;
    x_test = evalDisp(coeff, ncoeff, m, wl_test);
    niter++;
  }
  *wl = wl_test;
  return 0;
}


x86 assembly (clang, -O0):
<evalInvDisp>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
movsd  %xmm2,-0x30(%rbp)
movsd  %xmm3,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
mov    -0x40(%rbp),%rax
movsd  0xe9a(%rip),%xmm0
movsd  %xmm0,(%rax)
cmpl   $0x1,-0x14(%rbp)
jl     117e <evalInvDisp+0x4e>
cmpl   $0x9,-0x14(%rbp)
jle    118a <evalInvDisp+0x5a>
movl   $0x1,-0x4(%rbp)
jmp    1586 <evalInvDisp+0x456>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
call   1050 <evalDisp@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
call   1040 <evalDerivDisp@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x70(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movaps 0xe58(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
xorps  %xmm0,%xmm0
ucomisd -0x78(%rbp),%xmm0
jb     1238 <evalInvDisp+0x108>
movsd  0xde7(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1238 <evalInvDisp+0x108>
lea    0xe1d(%rip),%rdi
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
ucomisd -0x78(%rbp),%xmm0
jae    125d <evalInvDisp+0x12d>
movsd  -0x80(%rbp),%xmm0
movsd  0xdbd(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    141e <evalInvDisp+0x2ee>
movsd  -0x20(%rbp),%xmm0
movsd  0xd9e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    141e <evalInvDisp+0x2ee>
movsd  0xdac(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xd97(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xd82(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x78(%rbp),%xmm0
jb     12be <evalInvDisp+0x18e>
movsd  0xd7f(%rip),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
jmp    12cb <evalInvDisp+0x19b>
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movl   $0x0,-0xa4(%rbp)
cmpl   $0x2,-0xa4(%rbp)
jge    1419 <evalInvDisp+0x2e9>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     13cb <evalInvDisp+0x29b>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
call   1040 <evalDerivDisp@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    13b2 <evalInvDisp+0x282>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
call   1050 <evalDisp@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movaps 0xcda(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm1
movsd  -0x88(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    13ad <evalInvDisp+0x27d>
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
jmp    13b2 <evalInvDisp+0x282>
jmp    13b7 <evalInvDisp+0x287>
movsd  -0x58(%rbp),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    12f9 <evalInvDisp+0x1c9>
movsd  -0x90(%rbp),%xmm0
ff
subsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
addsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  0xc3c(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    12e2 <evalInvDisp+0x1b2>
jmp    141e <evalInvDisp+0x2ee>
movl   $0x0,-0xa0(%rbp)
movl   $0x0,-0x9c(%rbp)
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x70(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x60(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x68(%rbp)
cmpl   $0x0,-0xa0(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1472 <evalInvDisp+0x342>
jmp    1572 <evalInvDisp+0x442>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
call   1040 <evalDerivDisp@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    14be <evalInvDisp+0x38e>
jp     14be <evalInvDisp+0x38e>
movsd  -0x60(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x3,-0x4(%rbp)
jmp    1586 <evalInvDisp+0x456>
movsd  -0x60(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
subsd  -0x70(%rbp),%xmm1
divsd  -0x78(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm1
subsd  -0x68(%rbp),%xmm1
movaps 0xb54(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    150e <evalInvDisp+0x3de>
movl   $0x1,-0xa0(%rbp)
jmp    1539 <evalInvDisp+0x409>
cmpl   $0x64,-0x9c(%rbp)
jle    1534 <evalInvDisp+0x404>
movsd  -0x60(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x2,-0x4(%rbp)
jmp    1586 <evalInvDisp+0x456>
jmp    1539 <evalInvDisp+0x409>
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
call   1050 <evalDisp@plt>
movsd  %xmm0,-0x70(%rbp)
mov    -0x9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
jmp    1459 <evalInvDisp+0x329>
movsd  -0x60(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evalInvDisp>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x60,%rsp
movsd  %xmm3,0x50(%rsp)
mov    %esi,%ebx
movabs $0xbff0000000000000,%rax
mov    %rax,(%rdx)
lea    -0xa(%rbx),%eax
mov    $0x1,%r12d
cmp    $0xfffffff7,%eax
jb     1350 <evalInvDisp+0x220>
mov    %rdx,%r14
movaps %xmm1,%xmm3
mov    %rdi,%r15
mov    %ebx,%esi
movaps %xmm2,%xmm1
movsd  %xmm0,0x10(%rsp)
movsd  %xmm3,0x38(%rsp)
movsd  %xmm2,0x8(%rsp)
call   1050 <evalDisp@plt>
movsd  %xmm0,0x18(%rsp)
mov    %r15,%rdi
mov    %ebx,%esi
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1040 <evalDerivDisp@plt>
movsd  0x18(%rsp),%xmm3
movsd  0x10(%rsp),%xmm2
subsd  0x38(%rsp),%xmm3
andpd  0xe42(%rip),%xmm3
movsd  0xe4a(%rip),%xmm4
ucomisd %xmm2,%xmm4
jbe    1200 <evalInvDisp+0xd0>
xorpd  %xmm4,%xmm4
ucomisd %xmm0,%xmm4
jb     1200 <evalInvDisp+0xd0>
lea    0xe7b(%rip),%rdi
movapd %xmm3,0x20(%rsp)
movapd %xmm0,0x40(%rsp)
call   1030 <puts@plt>
movapd 0x40(%rsp),%xmm0
movapd 0x20(%rsp),%xmm3
movsd  0x10(%rsp),%xmm2
xorpd  %xmm4,%xmm4
ucomisd %xmm0,%xmm4
setae  %al
ucomisd 0xe05(%rip),%xmm3
seta   %cl
ucomisd 0xdf2(%rip),%xmm2
jbe    131f <evalInvDisp+0x1ef>
or     %cl,%al
je     131f <evalInvDisp+0x1ef>
xorpd  %xmm1,%xmm1
cmplesd %xmm1,%xmm0
movapd %xmm0,%xmm1
movsd  0xddf(%rip),%xmm0
andpd  %xmm1,%xmm0
andnpd %xmm3,%xmm1
orpd   %xmm0,%xmm1
movapd %xmm1,0x40(%rsp)
movsd  0xdcd(%rip),%xmm1
jmp    1282 <evalInvDisp+0x152>
nopl   (%rax)
movsd  0x10(%rsp),%xmm2
movsd  0x20(%rsp),%xmm1
addsd  0xdbc(%rip),%xmm1
movsd  0xdbc(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     12f7 <evalInvDisp+0x1c7>
movsd  %xmm1,0x20(%rsp)
mov    %r15,%rdi
mov    %ebx,%esi
movapd %xmm2,%xmm0
call   1040 <evalDerivDisp@plt>
ucomisd 0xdb2(%rip),%xmm0
jbe    1260 <evalInvDisp+0x130>
mov    %r15,%rdi
mov    %ebx,%esi
movsd  0x10(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
call   1050 <evalDisp@plt>
movapd %xmm0,%xmm3
subsd  0x38(%rsp),%xmm3
andpd  0xd38(%rip),%xmm3
movapd 0x40(%rsp),%xmm2
ucomisd %xmm3,%xmm2
movsd  0x10(%rsp),%xmm2
movsd  0x20(%rsp),%xmm1
jbe    126c <evalInvDisp+0x13c>
movapd %xmm3,0x40(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x18(%rsp)
jmp    126c <evalInvDisp+0x13c>
movsd  0xd41(%rip),%xmm1
movsd  0x8(%rsp),%xmm0
addsd  %xmm0,%xmm1
movsd  0xd1f(%rip),%xmm3
addsd  %xmm0,%xmm3
ucomisd %xmm1,%xmm3
jae    1421 <evalInvDisp+0x2f1>
mov    %r15,%rdi
mov    %ebx,%esi
movapd %xmm2,%xmm0
movsd  0x8(%rsp),%xmm1
call   1040 <evalDerivDisp@plt>
mov    $0x3,%r12d
ucomisd 0xd0f(%rip),%xmm0
jne    1360 <evalInvDisp+0x230>
jp     1360 <evalInvDisp+0x230>
movsd  0x8(%rsp),%xmm2
movsd  %xmm2,(%r14)
mov    %r12d,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xffffffff,%ebp
movsd  0x8(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  0x38(%rsp),%xmm3
subsd  %xmm2,%xmm3
divsd  %xmm0,%xmm3
addsd  %xmm1,%xmm3
movapd %xmm3,%xmm2
movapd %xmm3,%xmm0
subsd  %xmm1,%xmm0
andpd  0xc5a(%rip),%xmm0
movsd  0x50(%rsp),%xmm1
ucomisd %xmm0,%xmm1
movsd  %xmm3,0x8(%rsp)
ja     14c3 <evalInvDisp+0x393>
add    $0x1,%ebp
cmp    $0x64,%ebp
ja     14e5 <evalInvDisp+0x3b5>
mov    %r15,%rdi
mov    %ebx,%esi
movsd  0x10(%rsp),%xmm0
movapd %xmm2,%xmm1
call   1050 <evalDisp@plt>
movsd  %xmm0,0x18(%rsp)
mov    %r15,%rdi
mov    %ebx,%esi
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1040 <evalDerivDisp@plt>
movsd  0x18(%rsp),%xmm2
movsd  0x8(%rsp),%xmm1
ucomisd 0xc44(%rip),%xmm0
jne    1380 <evalInvDisp+0x250>
jp     1380 <evalInvDisp+0x250>
movapd %xmm1,%xmm2
jmp    134b <evalInvDisp+0x21b>
movsd  %xmm3,0x58(%rsp)
jmp    1454 <evalInvDisp+0x324>
nopl   0x0(%rax)
movsd  0x20(%rsp),%xmm1
addsd  0xc0a(%rip),%xmm1
movsd  0x58(%rsp),%xmm3
ucomisd %xmm1,%xmm3
movsd  0x10(%rsp),%xmm2
jb     131f <evalInvDisp+0x1ef>
movsd  %xmm1,0x20(%rsp)
mov    %r15,%rdi
mov    %ebx,%esi
movapd %xmm2,%xmm0
call   1040 <evalDerivDisp@plt>
ucomisd 0xbe0(%rip),%xmm0
jbe    1430 <evalInvDisp+0x300>
mov    %r15,%rdi
mov    %ebx,%esi
movsd  0x10(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
call   1050 <evalDisp@plt>
movapd %xmm0,%xmm3
subsd  0x38(%rsp),%xmm3
andpd  0xb66(%rip),%xmm3
movapd 0x40(%rsp),%xmm2
ucomisd %xmm3,%xmm2
movsd  0x20(%rsp),%xmm1
jbe    1436 <evalInvDisp+0x306>
movapd %xmm3,0x40(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x18(%rsp)
jmp    1436 <evalInvDisp+0x306>
mov    %r15,%rdi
mov    %ebx,%esi
movsd  0x10(%rsp),%xmm0
movapd %xmm2,%xmm1
call   1050 <evalDisp@plt>
movsd  0x8(%rsp),%xmm2
xor    %r12d,%r12d
jmp    134b <evalInvDisp+0x21b>
mov    $0x2,%r12d
jmp    134b <evalInvDisp+0x21b>

LLVM IR (-O0):
@.str = [66 x i8] c"Warning: (evalInvDisp) slope of dispersion relation is negative\0A\00"
define i32 @evalInvDisp(double* %0, i32 %1, double %2, double %3, double %4, double %5, double* %6) {
%8 = alloca i32
%9 = alloca double*
%10 = alloca i32
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double*
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
store double* %0, double** %9
store i32 %1, i32* %10
store double %2, double* %11
store double %3, double* %12
store double %4, double* %13
store double %5, double* %14
store double* %6, double** %15
%30 = load double*, double** %15
store double -1.000000e+00, double* %30
%31 = load i32, i32* %10
%32 = icmp slt i32 %31, 1
br i1 %32, label %36, label %33
33: ; preds = %7
%34 = load i32, i32* %10
%35 = icmp sgt i32 %34, 9
br i1 %35, label %36, label %37
36: ; preds = %33, %7
store i32 1, i32* %8
br label %186
37: ; preds = %33
%38 = load double, double* %13
store double %38, double* %19
%39 = load double*, double** %9
%40 = load i32, i32* %10
%41 = load double, double* %11
%42 = load double, double* %19
%43 = call double @evalDisp(double* %39, i32 %40, double %41, double %42)
store double %43, double* %21
%44 = load double, double* %21
store double %44, double* %26
%45 = load double*, double** %9
%46 = load i32, i32* %10
%47 = load double, double* %11
%48 = load double, double* %19
%49 = call double @evalDerivDisp(double* %45, i32 %46, double %47, double %48)
store double %49, double* %22
%50 = load double, double* %21
%51 = load double, double* %12
%52 = fsub double %50, %51
%53 = call double @llvm.fabs.f64(double %52)
store double %53, double* %23
%54 = load double, double* %23
store double %54, double* %24
%55 = load double, double* %19
store double %55, double* %25
%56 = load double, double* %22
%57 = fcmp ole double %56, 0.000000e+00
br i1 %57, label %58, label %63
58: ; preds = %37
%59 = load double, double* %11
%60 = fcmp olt double %59, 1.500000e+00
br i1 %60, label %61, label %63
61: ; preds = %58
%62 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0))
br label %63
63: ; preds = %61, %58, %37
%64 = load double, double* %22
%65 = fcmp ole double %64, 0.000000e+00
br i1 %65, label %69, label %66
66: ; preds = %63
%67 = load double, double* %23
%68 = fcmp ogt double %67, 1.024000e+03
br i1 %68, label %69, label %133
69: ; preds = %66, %63
%70 = load double, double* %11
%71 = fcmp ogt double %70, 1.500000e+00
br i1 %71, label %72, label %133
72: ; preds = %69
store double 1.123000e+03, double* %16
store double 3.170000e+03, double* %17
store double 1.000000e+02, double* %18
%73 = load double, double* %22
%74 = fcmp ole double %73, 0.000000e+00
br i1 %74, label %75, label %76
75: ; preds = %72
store double 1.024000e+05, double* %24
br label %78
76: ; preds = %72
%77 = load double, double* %23
store double %77, double* %24
br label %78
78: ; preds = %76, %75
%79 = load double, double* %13
store double %79, double* %25
store i32 0, i32* %29
br label %80
80: ; preds = %129, %78
%81 = load i32, i32* %29
%82 = icmp slt i32 %81, 2
br i1 %82, label %83, label %132
83: ; preds = %80
%84 = load double, double* %16
store double %84, double* %19
br label %85
85: ; preds = %116, %83
%86 = load double, double* %19
%87 = load double, double* %17
%88 = fcmp ole double %86, %87
br i1 %88, label %89, label %120
89: ; preds = %85
%90 = load double*, double** %9
%91 = load i32, i32* %10
%92 = load double, double* %11
%93 = load double, double* %19
%94 = call double @evalDerivDisp(double* %90, i32 %91, double %92, double %93)
store double %94, double* %22
%95 = load double, double* %22
%96 = fcmp ogt double %95, 0.000000e+00
br i1 %96, label %97, label %115
97: ; preds = %89
%98 = load double*, double** %9
%99 = load i32, i32* %10
%100 = load double, double* %11
%101 = load double, double* %19
%102 = call double @evalDisp(double* %98, i32 %99, double %100, double %101)
store double %102, double* %21
%103 = load double, double* %21
%104 = load double, double* %12
%105 = fsub double %103, %104
%106 = call double @llvm.fabs.f64(double %105)
store double %106, double* %23
%107 = load double, double* %23
%108 = load double, double* %24
%109 = fcmp olt double %107, %108
br i1 %109, label %110, label %114
110: ; preds = %97
%111 = load double, double* %23
store double %111, double* %24
%112 = load double, double* %21
store double %112, double* %26
%113 = load double, double* %19
store double %113, double* %25
br label %114
114: ; preds = %110, %97
br label %115
115: ; preds = %114, %89
br label %116
116: ; preds = %115
%117 = load double, double* %18
%118 = load double, double* %19
%119 = fadd double %118, %117
store double %119, double* %19
br label %85
120: ; preds = %85
%121 = load double, double* %25
%122 = load double, double* %18
%123 = fsub double %121, %122
store double %123, double* %16
%124 = load double, double* %25
%125 = load double, double* %18
%126 = fadd double %124, %125
store double %126, double* %17
%127 = load double, double* %18
%128 = fdiv double %127, 1.000000e+01
store double %128, double* %18
br label %129
129: ; preds = %120
%130 = load i32, i32* %29
%131 = add nsw i32 %130, 1
store i32 %131, i32* %29
br label %80
132: ; preds = %80
br label %133
133: ; preds = %132, %69, %66
store i32 0, i32* %28
store i32 0, i32* %27
%134 = load double, double* %26
store double %134, double* %21
%135 = load double, double* %25
store double %135, double* %19
%136 = load double, double* %25
store double %136, double* %20
br label %137
137: ; preds = %174, %133
%138 = load i32, i32* %28
%139 = icmp ne i32 %138, 0
%140 = xor i1 %139, true
br i1 %140, label %141, label %183
141: ; preds = %137
%142 = load double*, double** %9
%143 = load i32, i32* %10
%144 = load double, double* %11
%145 = load double, double* %19
%146 = call double @evalDerivDisp(double* %142, i32 %143, double %144, double %145)
store double %146, double* %22
%147 = load double, double* %22
%148 = fcmp oeq double %147, 0.000000e+00
br i1 %148, label %149, label %152
149: ; preds = %141
%150 = load double, double* %19
%151 = load double*, double** %15
store double %150, double* %151
store i32 3, i32* %8
br label %186
152: ; preds = %141
%153 = load double, double* %19
%154 = load double, double* %12
%155 = load double, double* %21
%156 = fsub double %154, %155
%157 = load double, double* %22
%158 = fdiv double %156, %157
%159 = fadd double %153, %158
store double %159, double* %19
%160 = load double, double* %19
%161 = load double, double* %20
%162 = fsub double %160, %161
%163 = call double @llvm.fabs.f64(double %162)
%164 = load double, double* %14
%165 = fcmp olt double %163, %164
br i1 %165, label %166, label %167
166: ; preds = %152
store i32 1, i32* %28
br label %174
167: ; preds = %152
%168 = load i32, i32* %27
%169 = icmp sgt i32 %168, 100
br i1 %169, label %170, label %173
170: ; preds = %167
%171 = load double, double* %19
%172 = load double*, double** %15
store double %171, double* %172
store i32 2, i32* %8
br label %186
173: ; preds = %167
br label %174
174: ; preds = %173, %166
%175 = load double, double* %19
store double %175, double* %20
%176 = load double*, double** %9
%177 = load i32, i32* %10
%178 = load double, double* %11
%179 = load double, double* %19
%180 = call double @evalDisp(double* %176, i32 %177, double %178, double %179)
store double %180, double* %21
%181 = load i32, i32* %27
%182 = add nsw i32 %181, 1
store i32 %182, i32* %27
br label %137
183: ; preds = %137
%184 = load double, double* %19
%185 = load double*, double** %15
store double %184, double* %185
store i32 0, i32* %8
br label %186
186: ; preds = %183, %170, %149, %36
%187 = load i32, i32* %8
ret i32 %187
}

LLVM IR (-O2):
@str = [65 x i8] c"Warning: (evalInvDisp) slope of dispersion relation is negative\00"
define i32 @evalInvDisp(double* %0, i32 %1, double %2, double %3, double %4, double %5, double* nocapture writeonly %6) {
store double -1.000000e+00, double* %6
%8 = add i32 %1, -10
%9 = icmp ult i32 %8, -9
br i1 %9, label %97, label %10
10: ; preds = %7
%11 = tail call double @evalDisp(double* %0, i32 %1, double %2, double %4)
%12 = tail call double @evalDerivDisp(double* %0, i32 %1, double %2, double %4)
%13 = fsub double %11, %3
%14 = tail call double @llvm.fabs.f64(double %13)
%15 = fcmp ole double %12, 0.000000e+00
%16 = fcmp olt double %2, 1.500000e+00
%17 = and i1 %16, %15
br i1 %17, label %18, label %20
18: ; preds = %10
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str, i64 0, i64 0))
br label %20
20: ; preds = %18, %10
%21 = fcmp ogt double %14, 1.024000e+03
%22 = select i1 %15, i1 true, i1 %21
%23 = fcmp ogt double %2, 1.500000e+00
%24 = and i1 %23, %22
br i1 %24, label %25, label %69
25: ; preds = %20
%26 = select i1 %15, double 1.024000e+05, double %14
br label %27
27: ; preds = %25, %40
%28 = phi double [ %43, %40 ], [ %11, %25 ]
%29 = phi double [ %42, %40 ], [ %4, %25 ]
%30 = phi double [ %41, %40 ], [ %26, %25 ]
%31 = phi double [ %44, %40 ], [ 1.123000e+03, %25 ]
%32 = tail call double @evalDerivDisp(double* %0, i32 %1, double %2, double %31)
%33 = fcmp ogt double %32, 0.000000e+00
br i1 %33, label %34, label %40
34: ; preds = %27
%35 = tail call double @evalDisp(double* %0, i32 %1, double %2, double %31)
%36 = fsub double %35, %3
%37 = tail call double @llvm.fabs.f64(double %36)
%38 = fcmp olt double %37, %30
br i1 %38, label %39, label %40
39: ; preds = %34
br label %40
40: ; preds = %27, %39, %34
%41 = phi double [ %37, %39 ], [ %30, %34 ], [ %30, %27 ]
%42 = phi double [ %31, %39 ], [ %29, %34 ], [ %29, %27 ]
%43 = phi double [ %35, %39 ], [ %28, %34 ], [ %28, %27 ]
%44 = fadd double %31, 1.000000e+02
%45 = fcmp ugt double %44, 3.170000e+03
br i1 %45, label %46, label %27
46: ; preds = %40
%47 = fadd double %42, -1.000000e+02
%48 = fadd double %42, 1.000000e+02
%49 = fcmp ugt double %47, %48
br i1 %49, label %69, label %50
50: ; preds = %46, %63
%51 = phi double [ %66, %63 ], [ %43, %46 ]
%52 = phi double [ %65, %63 ], [ %42, %46 ]
%53 = phi double [ %64, %63 ], [ %41, %46 ]
%54 = phi double [ %67, %63 ], [ %47, %46 ]
%55 = tail call double @evalDerivDisp(double* %0, i32 %1, double %2, double %54)
%56 = fcmp ogt double %55, 0.000000e+00
br i1 %56, label %57, label %63
57: ; preds = %50
%58 = tail call double @evalDisp(double* %0, i32 %1, double %2, double %54)
%59 = fsub double %58, %3
%60 = tail call double @llvm.fabs.f64(double %59)
%61 = fcmp olt double %60, %53
br i1 %61, label %62, label %63
62: ; preds = %57
br label %63
63: ; preds = %62, %57, %50
%64 = phi double [ %60, %62 ], [ %53, %57 ], [ %53, %50 ]
%65 = phi double [ %54, %62 ], [ %52, %57 ], [ %52, %50 ]
%66 = phi double [ %58, %62 ], [ %51, %57 ], [ %51, %50 ]
%67 = fadd double %54, 1.000000e+01
%68 = fcmp ugt double %67, %48
br i1 %68, label %69, label %50
69: ; preds = %63, %46, %20
%70 = phi double [ %4, %20 ], [ %42, %46 ], [ %65, %63 ]
%71 = phi double [ %11, %20 ], [ %43, %46 ], [ %66, %63 ]
%72 = tail call double @evalDerivDisp(double* %0, i32 %1, double %2, double %70)
%73 = fcmp oeq double %72, 0.000000e+00
br i1 %73, label %94, label %74
74: ; preds = %69, %87
%75 = phi double [ %90, %87 ], [ %72, %69 ]
%76 = phi double [ %81, %87 ], [ %70, %69 ]
%77 = phi double [ %88, %87 ], [ %71, %69 ]
%78 = phi i32 [ %89, %87 ], [ 0, %69 ]
%79 = fsub double %3, %77
%80 = fdiv double %79, %75
%81 = fadd double %76, %80
%82 = fsub double %81, %76
%83 = tail call double @llvm.fabs.f64(double %82)
%84 = fcmp olt double %83, %5
br i1 %84, label %92, label %85
85: ; preds = %74
%86 = icmp ugt i32 %78, 100
br i1 %86, label %94, label %87
87: ; preds = %85
%88 = tail call double @evalDisp(double* %0, i32 %1, double %2, double %81)
%89 = add nuw nsw i32 %78, 1
%90 = tail call double @evalDerivDisp(double* %0, i32 %1, double %2, double %81)
%91 = fcmp oeq double %90, 0.000000e+00
br i1 %91, label %94, label %74
92: ; preds = %74
%93 = tail call double @evalDisp(double* %0, i32 %1, double %2, double %81)
br label %94
94: ; preds = %87, %85, %69, %92
%95 = phi double [ %81, %92 ], [ %70, %69 ], [ %81, %85 ], [ %81, %87 ]
%96 = phi i32 [ 0, %92 ], [ 3, %69 ], [ 2, %85 ], [ 3, %87 ]
store double %95, double* %6
br label %97
97: ; preds = %94, %7
%98 = phi i32 [ 1, %7 ], [ %96, %94 ]
ret i32 %98
}