#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 DymosimError(char *);
double Interpolate1(double const, double const *, int, int, double const *, int,
                    int);
int SearchGrid(double const, double const *, int);
double const floor(double const);
double Interpolate(const double dim[], int Mdim, int Ndim, const double xval[],
                   int Mxval, int Nxval, const double yval[], int Myval,
                   int Nyval, const double x[], int Mx, int Nx) {
  int below;
  double ybelow, yabove;
  int i, dimsum, dimprod;
  int Kx, Kdim, Kxval, Kyval;
  if ((Mx != 1 && Nx != 1) || (Mdim != 1 && Ndim != 1)) {
    return DymosimError("Arguments to Interpolate must be vectors.");
  }
  Kx = Mx > 1 ? Mx : Nx;
  Kdim = Mdim > 1 ? Mdim : Ndim;
  Kxval = Mxval * Nxval;
  Kyval = Myval * Nyval;
  if (Kx != Kdim) {
    return DymosimError("The size of the argument vector is not the same as\n"
                        "  the dimension vector of a table.");
  }
  dimsum = 0;
  dimprod = 1;
  for (i = 0; i < Kdim; i++) {
    if (dim[i] != floor(dim[i])) {
      return DymosimError("The dimension vector of a table must only contain "
                          "integers.");
    }
    dimsum = dimsum + (int)dim[i];
    dimprod = dimprod * (int)dim[i];
  }
  if (Kxval != dimsum) {
    return DymosimError("The size of the grid vector is not consistent with\n"
                        "  information in the dimension vector of a table.");
  }
  if (Kyval != dimprod) {
    return DymosimError(
        "The size of the table value vector is not\n"
        "  consistent with information in the dimension vector.");
  }
  if (Kdim <= 1)
    return Interpolate1(x[0], xval, Kxval, 1, yval, Kyval, 1);
  else if (x[0] <= xval[0]) {
    below = 0;
    return Interpolate(&dim[1], Kdim - 1, 1, &xval[(int)dim[0]],
                       Kxval - (int)dim[0], 1,
                       &yval[below * dimprod / (int)dim[0]],
                       Kyval / (int)dim[0], 1, &x[1], Kx - 1, 1);
  } else if (x[0] >= xval[(int)dim[0] - 1]) {
    below = (int)dim[0] - 1;
    return Interpolate(&dim[1], Kdim - 1, 1, &xval[(int)dim[0]],
                       Kxval - (int)dim[0], 1,
                       &yval[below * dimprod / (int)dim[0]],
                       Kyval / (int)dim[0], 1, &x[1], Kx - 1, 1);
  } else {
    below = SearchGrid(x[0], xval, (int)dim[0]);
    ybelow = Interpolate(&dim[1], Kdim - 1, 1, &xval[(int)dim[0]],
                         Kxval - (int)dim[0], 1,
                         &yval[below * dimprod / (int)dim[0]],
                         Kyval / (int)dim[0], 1, &x[1], Kx - 1, 1);
    yabove = Interpolate(&dim[1], Kdim - 1, 1, &xval[(int)dim[0]],
                         Kxval - (int)dim[0], 1,
                         &yval[(below + 1) * dimprod / (int)dim[0]],
                         Kyval / (int)dim[0], 1, &x[1], Kx - 1, 1);
    return (ybelow + (yabove - ybelow) * (x[0] - xval[below]) /
                         (xval[below + 1] - xval[below]));
  }
}


x86 assembly (clang, -O0):
<Interpolate>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0xa8,%rsp
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
mov    %edx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    %r9d,-0x30(%rbp)
cmpl   $0x1,0x30(%rbp)
je     119a <Interpolate+0x4a>
cmpl   $0x1,0x38(%rbp)
jne    11ae <Interpolate+0x5e>
cmpl   $0x1,-0x1c(%rbp)
je     11c4 <Interpolate+0x74>
cmpl   $0x1,-0x20(%rbp)
je     11c4 <Interpolate+0x74>
lea    0xe4b(%rip),%rdi
call   1060 <DymosimError@plt>
movsd  %xmm0,-0x10(%rbp)
jmp    16df <Interpolate+0x58f>
cmpl   $0x1,0x30(%rbp)
jle    11d9 <Interpolate+0x89>
mov    0x30(%rbp),%eax
mov    %eax,-0x68(%rbp)
jmp    11df <Interpolate+0x8f>
mov    0x38(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x68(%rbp),%eax
mov    %eax,-0x58(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jle    11fa <Interpolate+0xaa>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x6c(%rbp)
jmp    1200 <Interpolate+0xb0>
mov    -0x20(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x2c(%rbp),%eax
imul   -0x30(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    0x18(%rbp),%eax
imul   0x20(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x5c(%rbp),%eax
je     123c <Interpolate+0xec>
lea    0xdfd(%rip),%rdi
call   1060 <DymosimError@plt>
movsd  %xmm0,-0x10(%rbp)
jmp    16df <Interpolate+0x58f>
movl   $0x0,-0x50(%rbp)
movl   $0x1,-0x54(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x5c(%rbp),%eax
jge    12ed <Interpolate+0x19d>
mov    -0x18(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1070 <floor@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jne    129e <Interpolate+0x14e>
jp     129e <Interpolate+0x14e>
jmp    12b4 <Interpolate+0x164>
lea    0xddb(%rip),%rdi
call   1060 <DymosimError@plt>
movsd  %xmm0,-0x10(%rbp)
jmp    16df <Interpolate+0x58f>
mov    -0x50(%rbp),%eax
mov    -0x18(%rbp),%rcx
movslq -0x4c(%rbp),%rdx
cvttsd2si (%rcx,%rdx,8),%ecx
add    %ecx,%eax
mov    %eax,-0x50(%rbp)
mov    -0x54(%rbp),%eax
mov    -0x18(%rbp),%rcx
movslq -0x4c(%rbp),%rdx
cvttsd2si (%rcx,%rdx,8),%ecx
imul   %ecx,%eax
mov    %eax,-0x54(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1251 <Interpolate+0x101>
mov    -0x60(%rbp),%eax
cmp    -0x50(%rbp),%eax
je     130f <Interpolate+0x1bf>
lea    0xdbc(%rip),%rdi
call   1060 <DymosimError@plt>
movsd  %xmm0,-0x10(%rbp)
jmp    16df <Interpolate+0x58f>
mov    -0x64(%rbp),%eax
cmp    -0x54(%rbp),%eax
je     1331 <Interpolate+0x1e1>
lea    0xdff(%rip),%rdi
call   1060 <DymosimError@plt>
movsd  %xmm0,-0x10(%rbp)
jmp    16df <Interpolate+0x58f>
cmpl   $0x1,-0x5c(%rbp)
jg     136a <Interpolate+0x21a>
mov    0x28(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x28(%rbp),%rdi
mov    -0x60(%rbp),%esi
mov    0x10(%rbp),%rcx
mov    -0x64(%rbp),%r8d
mov    $0x1,%r9d
mov    %r9d,%edx
call   1040 <Interpolate1@plt>
movsd  %xmm0,-0x10(%rbp)
jmp    16df <Interpolate+0x58f>
mov    0x28(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jb     1439 <Interpolate+0x2e9>
movl   $0x0,-0x34(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x8,%rdi
mov    -0x5c(%rbp),%esi
sub    $0x1,%esi
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rax
cvttsd2si (%rax),%eax
cltq
shl    $0x3,%rax
add    %rax,%rcx
mov    -0x60(%rbp),%r8d
mov    -0x18(%rbp),%rax
cvttsd2si (%rax),%eax
sub    %eax,%r8d
mov    0x10(%rbp),%rbx
mov    -0x34(%rbp),%eax
imul   -0x54(%rbp),%eax
mov    -0x18(%rbp),%rdx
cvttsd2si (%rdx),%r9d
cltd
idiv   %r9d
cltq
shl    $0x3,%rax
add    %rax,%rbx
mov    -0x64(%rbp),%eax
mov    -0x18(%rbp),%rdx
cvttsd2si (%rdx),%r9d
cltd
idiv   %r9d
mov    %eax,%r11d
mov    0x28(%rbp),%r10
add    $0x8,%r10
mov    -0x58(%rbp),%eax
sub    $0x1,%eax
mov    $0x1,%r9d
mov    %r9d,%edx
mov    %rbx,(%rsp)
mov    %r11d,0x8(%rsp)
movl   $0x1,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %eax,0x20(%rsp)
movl   $0x1,0x28(%rsp)
call   1050 <Interpolate@plt>
movsd  %xmm0,-0x10(%rbp)
jmp    16df <Interpolate+0x58f>
mov    0x28(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x18(%rbp),%rcx
cvttsd2si (%rcx),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
ucomisd (%rax,%rcx,8),%xmm0
jb     151a <Interpolate+0x3ca>
mov    -0x18(%rbp),%rax
cvttsd2si (%rax),%eax
sub    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x8,%rdi
mov    -0x5c(%rbp),%esi
sub    $0x1,%esi
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rax
cvttsd2si (%rax),%eax
cltq
shl    $0x3,%rax
add    %rax,%rcx
mov    -0x60(%rbp),%r8d
mov    -0x18(%rbp),%rax
cvttsd2si (%rax),%eax
sub    %eax,%r8d
mov    0x10(%rbp),%rbx
mov    -0x34(%rbp),%eax
imul   -0x54(%rbp),%eax
mov    -0x18(%rbp),%rdx
cvttsd2si (%rdx),%r9d
cltd
idiv   %r9d
cltq
shl    $0x3,%rax
add    %rax,%rbx
mov    -0x64(%rbp),%eax
mov    -0x18(%rbp),%rdx
cvttsd2si (%rdx),%r9d
cltd
idiv   %r9d
mov    %eax,%r11d
mov    0x28(%rbp),%r10
add    $0x8,%r10
mov    -0x58(%rbp),%eax
sub    $0x1,%eax
mov    $0x1,%r9d
mov    %r9d,%edx
mov    %rbx,(%rsp)
mov    %r11d,0x8(%rsp)
movl   $0x1,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %eax,0x20(%rsp)
movl   $0x1,0x28(%rsp)
call   1050 <Interpolate@plt>
movsd  %xmm0,-0x10(%rbp)
jmp    16df <Interpolate+0x58f>
mov    0x28(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rax
cvttsd2si (%rax),%esi
call   1030 <SearchGrid@plt>
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x8,%rdi
mov    -0x5c(%rbp),%esi
sub    $0x1,%esi
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rax
cvttsd2si (%rax),%eax
cltq
shl    $0x3,%rax
add    %rax,%rcx
mov    -0x60(%rbp),%r8d
mov    -0x18(%rbp),%rax
cvttsd2si (%rax),%eax
sub    %eax,%r8d
mov    0x10(%rbp),%rbx
mov    -0x34(%rbp),%eax
imul   -0x54(%rbp),%eax
mov    -0x18(%rbp),%rdx
cvttsd2si (%rdx),%r9d
cltd
idiv   %r9d
cltq
shl    $0x3,%rax
add    %rax,%rbx
mov    -0x64(%rbp),%eax
mov    -0x18(%rbp),%rdx
cvttsd2si (%rdx),%r9d
cltd
idiv   %r9d
mov    %eax,%r11d
mov    0x28(%rbp),%r10
add    $0x8,%r10
mov    -0x58(%rbp),%eax
sub    $0x1,%eax
mov    $0x1,%r9d
mov    %r9d,%edx
mov    %rbx,(%rsp)
mov    %r11d,0x8(%rsp)
movl   $0x1,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %eax,0x20(%rsp)
movl   $0x1,0x28(%rsp)
call   1050 <Interpolate@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x8,%rdi
mov    -0x5c(%rbp),%esi
sub    $0x1,%esi
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rax
cvttsd2si (%rax),%eax
cltq
shl    $0x3,%rax
add    %rax,%rcx
mov    -0x60(%rbp),%r8d
mov    -0x18(%rbp),%rax
cvttsd2si (%rax),%eax
sub    %eax,%r8d
mov    0x10(%rbp),%rbx
mov    -0x34(%rbp),%eax
add    $0x1,%eax
imul   -0x54(%rbp),%eax
mov    -0x18(%rbp),%rdx
cvttsd2si (%rdx),%r9d
cltd
idiv   %r9d
cltq
shl    $0x3,%rax
add    %rax,%rbx
mov    -0x64(%rbp),%eax
mov    -0x18(%rbp),%rdx
cvttsd2si (%rdx),%r9d
cltd
idiv   %r9d
mov    %eax,%r11d
mov    0x28(%rbp),%r10
add    $0x8,%r10
mov    -0x58(%rbp),%eax
sub    $0x1,%eax
mov    $0x1,%r9d
mov    %r9d,%edx
mov    %rbx,(%rsp)
mov    %r11d,0x8(%rsp)
movl   $0x1,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %eax,0x20(%rsp)
movl   $0x1,0x28(%rsp)
call   1050 <Interpolate@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
subsd  -0x40(%rbp),%xmm1
mov    0x28(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0xa8,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<Interpolate>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdi,%rbp
mov    0xa8(%rsp),%edi
mov    0xa0(%rsp),%ebx
mov    0x98(%rsp),%r13
mov    0x90(%rsp),%r10d
mov    0x88(%rsp),%eax
mov    0x80(%rsp),%r15
cmp    $0x1,%ebx
je     1198 <Interpolate+0x48>
cmp    $0x1,%edi
jne    11a2 <Interpolate+0x52>
cmp    $0x1,%esi
je     11ef <Interpolate+0x9f>
cmp    $0x1,%edx
je     11ef <Interpolate+0x9f>
lea    0xe57(%rip),%rdi
jmp    1335 <Interpolate+0x1e5>
xchg   %ax,%ax
cvttsd2si 0x0(%rbp),%eax
add    $0xffffffff,%r11d
add    $0x8,%rbp
movslq %eax,%rsi
lea    (%rcx,%rsi,8),%rcx
sub    %esi,%ebx
mov    %r12d,%eax
cltd
idiv   %esi
add    $0x8,%r13
mov    $0x1,%edx
mov    %r11d,%esi
mov    %ebx,%r8d
mov    $0x1,%r9d
mov    $0x1,%r10d
mov    %r11d,%ebx
mov    $0x1,%edi
cmp    $0x2,%ebx
cmovge %ebx,%edi
cmp    $0x2,%esi
cmovge %esi,%edx
cmp    %edx,%edi
jne    1348 <Interpolate+0x1f8>
mov    %r8d,0x28(%rsp)
mov    %eax,0x18(%rsp)
mov    %r10d,0x20(%rsp)
mov    %r15,0x8(%rsp)
mov    %r9d,0x4(%rsp)
mov    %r13,0x40(%rsp)
mov    %rcx,0x10(%rsp)
test   %edi,%edi
mov    %rdi,0x38(%rsp)
jle    1290 <Interpolate+0x140>
mov    %edi,%r13d
mov    $0x1,%r15d
xor    %r12d,%r12d
xor    %r14d,%r14d
nopl   (%rax)
mov    %rbp,%rbx
movsd  0x0(%rbp,%r12,8),%xmm0
movsd  %xmm0,0x30(%rsp)
call   1070 <floor@plt>
movsd  0x30(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jne    132e <Interpolate+0x1de>
jp     132e <Interpolate+0x1de>
movapd %xmm1,%xmm0
cvttsd2si %xmm1,%eax
add    %eax,%r14d
imul   %eax,%r15d
add    $0x1,%r12
cmp    %r12,%r13
mov    %rbx,%rbp
jne    1240 <Interpolate+0xf0>
jmp    1299 <Interpolate+0x149>
nopl   0x0(%rax,%rax,1)
xor    %r14d,%r14d
mov    $0x1,%r15d
mov    0x4(%rsp),%ebx
imul   0x28(%rsp),%ebx
cmp    %r14d,%ebx
jne    1351 <Interpolate+0x201>
mov    0x20(%rsp),%r12d
imul   0x18(%rsp),%r12d
cmp    %r15d,%r12d
jne    135a <Interpolate+0x20a>
mov    0x40(%rsp),%r13
movsd  0x0(%r13),%xmm0
mov    0x38(%rsp),%r11
cmp    $0x1,%r11d
jle    1363 <Interpolate+0x213>
mov    0x10(%rsp),%rcx
movsd  (%rcx),%xmm1
ucomisd %xmm0,%xmm1
mov    0x8(%rsp),%r15
jae    11b0 <Interpolate+0x60>
cvttsd2si 0x0(%rbp),%esi
movslq %esi,%rdi
ucomisd -0x8(%rcx,%rdi,8),%xmm0
jb     1390 <Interpolate+0x240>
lea    -0x1(%rdi),%eax
add    $0x8,%rbp
add    $0xffffffff,%r11d
lea    (%rcx,%rdi,8),%rcx
sub    %edi,%ebx
imul   %r12d,%eax
cltd
idiv   %edi
cltq
lea    (%r15,%rax,8),%r15
mov    %r12d,%eax
cltd
idiv   %edi
jmp    11cc <Interpolate+0x7c>
lea    0xd4b(%rip),%rdi
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <DymosimError@plt>
lea    0xcdb(%rip),%rdi
jmp    1335 <Interpolate+0x1e5>
lea    0xd64(%rip),%rdi
jmp    1335 <Interpolate+0x1e5>
lea    0xdc0(%rip),%rdi
jmp    1335 <Interpolate+0x1e5>
mov    0x10(%rsp),%rdi
mov    %ebx,%esi
mov    $0x1,%edx
mov    0x8(%rsp),%rcx
mov    %r12d,%r8d
mov    $0x1,%r9d
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <Interpolate1@plt>
mov    %rcx,%rdi
mov    %rcx,%r14
mov    %ebx,0x4(%rsp)
mov    %r11,%rbx
call   1030 <SearchGrid@plt>
mov    %rax,0x30(%rsp)
lea    0x8(%rbp),%rdi
mov    %rdi,0x20(%rsp)
cvttsd2si 0x0(%rbp),%ecx
add    $0xffffffff,%ebx
movslq %ecx,%rsi
lea    (%r14,%rsi,8),%rcx
mov    0x4(%rsp),%r8d
sub    %esi,%r8d
imul   %r12d,%eax
cltd
idiv   %esi
cltq
lea    (%r15,%rax,8),%r10
mov    %r12d,%eax
cltd
idiv   %esi
lea    0x8(%r13),%r11
mov    %r11,0x18(%rsp)
mov    %rbx,%r14
mov    %r14d,%esi
mov    $0x1,%edx
mov    $0x1,%r9d
push   $0x1
push   %rbx
push   %r11
push   $0x1
push   %rax
push   %r10
call   1050 <Interpolate@plt>
add    $0x30,%rsp
cvttsd2si 0x0(%rbp),%eax
movsd  %xmm0,0x28(%rsp)
movslq %eax,%rsi
mov    0x10(%rsp),%rbx
lea    (%rbx,%rsi,8),%rcx
mov    0x4(%rsp),%r8d
sub    %esi,%r8d
mov    0x30(%rsp),%r15
lea    0x1(%r15),%eax
imul   %r12d,%eax
cltd
idiv   %esi
cltq
mov    0x8(%rsp),%rdx
lea    (%rdx,%rax,8),%r10
mov    %r12d,%eax
cltd
idiv   %esi
mov    0x20(%rsp),%rdi
mov    %r14d,%esi
mov    $0x1,%edx
mov    $0x1,%r9d
push   $0x1
push   %r14
push   0x28(%rsp)
push   $0x1
push   %rax
push   %r10
call   1050 <Interpolate@plt>
add    $0x30,%rsp
movsd  0x28(%rsp),%xmm4
subsd  %xmm4,%xmm0
movsd  0x0(%r13),%xmm1
movslq %r15d,%rax
movsd  (%rbx,%rax,8),%xmm2
movsd  0x8(%rbx,%rax,8),%xmm3
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
subsd  %xmm2,%xmm3
divsd  %xmm3,%xmm0
addsd  %xmm4,%xmm0
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [42 x i8] c"Arguments to Interpolate must be vectors.\00"
@.str.1 = [86 x i8] c"The size of the argument vector is not the same as\0A the dimension vector of a table.\00"
@.str.2 = [60 x i8] c"The dimension vector of a table must only contain integers.\00"
@.str.3 = [101 x i8] c"The size of the grid vector is not consistent with\0A information in the dimension vector of a table.\00"
@.str.4 = [97 x i8] c"The size of the table value vector is not\0A consistent with information in the dimension vector.\00"
define double @Interpolate(double* %0, i32 %1, i32 %2, double* %3, i32 %4, i32 %5, double* %6, i32 %7, i32 %8, double* %9, i32 %10, i32 %11) {
%13 = icmp ne i32 %10, 1
%14 = icmp ne i32 %11, 1
%15 = and i1 %13, %14
br i1 %15, label %33, label %16
16: ; preds = %12
%17 = icmp ne i32 %1, 1
%18 = icmp ne i32 %2, 1
%19 = and i1 %17, %18
br i1 %19, label %33, label %20
20: ; preds = %16, %112
%21 = phi double* [ %113, %112 ], [ %0, %16 ]
%22 = phi i32 [ %114, %112 ], [ %1, %16 ]
%23 = phi i32 [ 1, %112 ], [ %2, %16 ]
%24 = phi double* [ %116, %112 ], [ %3, %16 ]
%25 = phi i32 [ %117, %112 ], [ %4, %16 ]
%26 = phi i32 [ 1, %112 ], [ %5, %16 ]
%27 = phi double* [ %121, %112 ], [ %6, %16 ]
%28 = phi i32 [ %122, %112 ], [ %7, %16 ]
%29 = phi i32 [ 1, %112 ], [ %8, %16 ]
%30 = phi double* [ %123, %112 ], [ %9, %16 ]
%31 = phi i32 [ %114, %112 ], [ %10, %16 ]
%32 = phi i32 [ 1, %112 ], [ %11, %16 ]
br label %35
33: ; preds = %16, %12
%34 = tail call double @DymosimError(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
br label %124
35: ; preds = %94, %20
%36 = phi double* [ %21, %20 ], [ %95, %94 ]
%37 = phi i32 [ %22, %20 ], [ %96, %94 ]
%38 = phi i32 [ %23, %20 ], [ 1, %94 ]
%39 = phi double* [ %24, %20 ], [ %100, %94 ]
%40 = phi i32 [ %25, %20 ], [ %101, %94 ]
%41 = phi i32 [ %26, %20 ], [ 1, %94 ]
%42 = phi i32 [ %28, %20 ], [ %102, %94 ]
%43 = phi i32 [ %29, %20 ], [ 1, %94 ]
%44 = phi double* [ %30, %20 ], [ %103, %94 ]
%45 = phi i32 [ %31, %20 ], [ %96, %94 ]
%46 = phi i32 [ %32, %20 ], [ 1, %94 ]
%47 = icmp sgt i32 %45, 1
%48 = select i1 %47, i32 %45, i32 %46
%49 = icmp sgt i32 %37, 1
%50 = select i1 %49, i32 %37, i32 %38
%51 = mul nsw i32 %41, %40
%52 = mul nsw i32 %43, %42
%53 = icmp eq i32 %48, %50
br i1 %53, label %54, label %58
54: ; preds = %35
%55 = icmp sgt i32 %48, 0
br i1 %55, label %56, label %76
56: ; preds = %54
%57 = zext i32 %48 to i64
br label %60
58: ; preds = %35
%59 = tail call double @DymosimError(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.1, i64 0, i64 0))
br label %124
60: ; preds = %56, %70
%61 = phi i64 [ 0, %56 ], [ %74, %70 ]
%62 = phi i32 [ 0, %56 ], [ %72, %70 ]
%63 = phi i32 [ 1, %56 ], [ %73, %70 ]
%64 = getelementptr inbounds double, double* %36, i64 %61
%65 = load double, double* %64
%66 = tail call double @llvm.floor.f64(double %65)
%67 = fcmp une double %65, %66
br i1 %67, label %68, label %70
68: ; preds = %60
%69 = tail call double @DymosimError(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0))
br label %124
70: ; preds = %60
%71 = fptosi double %65 to i32
%72 = add nsw i32 %62, %71
%73 = mul nsw i32 %63, %71
%74 = add nuw nsw i64 %61, 1
%75 = icmp eq i64 %74, %57
br i1 %75, label %76, label %60
76: ; preds = %70, %54
%77 = phi i32 [ 1, %54 ], [ %73, %70 ]
%78 = phi i32 [ 0, %54 ], [ %72, %70 ]
%79 = icmp eq i32 %51, %78
br i1 %79, label %82, label %80
80: ; preds = %76
%81 = tail call double @DymosimError(i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str.3, i64 0, i64 0))
br label %124
82: ; preds = %76
%83 = icmp eq i32 %52, %77
br i1 %83, label %86, label %84
84: ; preds = %82
%85 = tail call double @DymosimError(i8* getelementptr inbounds ([97 x i8], [97 x i8]* @.str.4, i64 0, i64 0))
br label %124
86: ; preds = %82
%87 = icmp slt i32 %48, 2
%88 = load double, double* %44
br i1 %87, label %89, label %91
89: ; preds = %86
%90 = tail call double @Interpolate1(double %88, double* %39, i32 %51, i32 1, double* %27, i32 %52, i32 1)
br label %124
91: ; preds = %86
%92 = load double, double* %39
%93 = fcmp ugt double %88, %92
br i1 %93, label %104, label %94
94: ; preds = %91
%95 = getelementptr inbounds double, double* %36, i64 1
%96 = add nsw i32 %48, -1
%97 = load double, double* %36
%98 = fptosi double %97 to i32
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds double, double* %39, i64 %99
%101 = sub nsw i32 %51, %98
%102 = sdiv i32 %52, %98
%103 = getelementptr inbounds double, double* %44, i64 1
br label %35
104: ; preds = %91
%105 = load double, double* %36
%106 = fptosi double %105 to i32
%107 = add nsw i32 %106, -1
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds double, double* %39, i64 %108
%110 = load double, double* %109
%111 = fcmp ult double %88, %110
br i1 %111, label %126, label %112
112: ; preds = %104
%113 = getelementptr inbounds double, double* %36, i64 1
%114 = add nsw i32 %48, -1
%115 = sext i32 %106 to i64
%116 = getelementptr inbounds double, double* %39, i64 %115
%117 = sub nsw i32 %51, %106
%118 = mul nsw i32 %107, %52
%119 = sdiv i32 %118, %106
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds double, double* %27, i64 %120
%122 = sdiv i32 %52, %106
%123 = getelementptr inbounds double, double* %44, i64 1
br label %20
124: ; preds = %33, %58, %68, %80, %84, %89, %126
%125 = phi double [ %166, %126 ], [ %34, %33 ], [ %59, %58 ], [ %69, %68 ], [ %81, %80 ], [ %85, %84 ], [ %90, %89 ]
ret double %125
126: ; preds = %104
%127 = tail call i32 @SearchGrid(double %88, double* %39, i32 %106)
%128 = getelementptr inbounds double, double* %36, i64 1
%129 = add nsw i32 %48, -1
%130 = load double, double* %36
%131 = fptosi double %130 to i32
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds double, double* %39, i64 %132
%134 = sub nsw i32 %51, %131
%135 = mul nsw i32 %127, %52
%136 = sdiv i32 %135, %131
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds double, double* %27, i64 %137
%139 = sdiv i32 %52, %131
%140 = getelementptr inbounds double, double* %44, i64 1
%141 = tail call double @Interpolate(double* %128, i32 %129, i32 1, double* %133, i32 %134, i32 1, double* %138, i32 %139, i32 1, double* %140, i32 %129, i32 1)
%142 = load double, double* %36
%143 = fptosi double %142 to i32
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds double, double* %39, i64 %144
%146 = sub nsw i32 %51, %143
%147 = add nsw i32 %127, 1
%148 = mul nsw i32 %147, %52
%149 = sdiv i32 %148, %143
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds double, double* %27, i64 %150
%152 = sdiv i32 %52, %143
%153 = tail call double @Interpolate(double* %128, i32 %129, i32 1, double* %145, i32 %146, i32 1, double* %151, i32 %152, i32 1, double* %140, i32 %129, i32 1)
%154 = fsub double %153, %141
%155 = load double, double* %44
%156 = sext i32 %127 to i64
%157 = getelementptr inbounds double, double* %39, i64 %156
%158 = load double, double* %157
%159 = fsub double %155, %158
%160 = fmul double %154, %159
%161 = sext i32 %147 to i64
%162 = getelementptr inbounds double, double* %39, i64 %161
%163 = load double, double* %162
%164 = fsub double %163, %158
%165 = fdiv double %160, %164
%166 = fadd double %141, %165
br label %124
}