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


x86 assembly (clang, -O0):
<InterpolateDerS>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0xe8,%rsp
mov    0x50(%rbp),%rax
mov    0x48(%rbp),%eax
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %ecx,-0x34(%rbp)
mov    %r8d,-0x38(%rbp)
mov    %r9,-0x40(%rbp)
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
cmpl   $0x1,0x40(%rbp)
je     11bf <InterpolateDerS+0x6f>
cmpl   $0x1,0x48(%rbp)
jne    11d3 <InterpolateDerS+0x83>
cmpl   $0x1,-0x34(%rbp)
je     11e4 <InterpolateDerS+0x94>
cmpl   $0x1,-0x38(%rbp)
je     11e4 <InterpolateDerS+0x94>
lea    0xe26(%rip),%rdi
call   1060 <DymosimError@plt>
jmp    1845 <InterpolateDerS+0x6f5>
cmpl   $0x1,0x40(%rbp)
jle    11fc <InterpolateDerS+0xac>
mov    0x40(%rbp),%eax
mov    %eax,-0x84(%rbp)
jmp    1205 <InterpolateDerS+0xb5>
mov    0x48(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    %eax,-0x54(%rbp)
cmpl   $0x1,-0x34(%rbp)
jle    1226 <InterpolateDerS+0xd6>
mov    -0x34(%rbp),%eax
mov    %eax,-0x88(%rbp)
jmp    122f <InterpolateDerS+0xdf>
mov    -0x38(%rbp),%eax
mov    %eax,-0x88(%rbp)
mov    -0x88(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    0x10(%rbp),%eax
imul   0x18(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    0x28(%rbp),%eax
imul   0x30(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x58(%rbp),%eax
je     1269 <InterpolateDerS+0x119>
lea    0xdcb(%rip),%rdi
call   1060 <DymosimError@plt>
jmp    1845 <InterpolateDerS+0x6f5>
movl   $0x0,-0x4c(%rbp)
movl   $0x1,-0x50(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x58(%rbp),%eax
jge    131b <InterpolateDerS+0x1cb>
mov    -0x30(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x30(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1070 <floor@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jne    12d1 <InterpolateDerS+0x181>
jp     12d1 <InterpolateDerS+0x181>
jmp    12e2 <InterpolateDerS+0x192>
lea    0xda8(%rip),%rdi
call   1060 <DymosimError@plt>
jmp    1845 <InterpolateDerS+0x6f5>
mov    -0x4c(%rbp),%eax
mov    -0x30(%rbp),%rcx
movslq -0x48(%rbp),%rdx
cvttsd2si (%rcx,%rdx,8),%ecx
add    %ecx,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x50(%rbp),%eax
mov    -0x30(%rbp),%rcx
movslq -0x48(%rbp),%rdx
cvttsd2si (%rcx,%rdx,8),%ecx
imul   %ecx,%eax
mov    %eax,-0x50(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    127e <InterpolateDerS+0x12e>
mov    -0x5c(%rbp),%eax
cmp    -0x4c(%rbp),%eax
je     1338 <InterpolateDerS+0x1e8>
lea    0xd8e(%rip),%rdi
call   1060 <DymosimError@plt>
jmp    1845 <InterpolateDerS+0x6f5>
mov    -0x60(%rbp),%eax
cmp    -0x50(%rbp),%eax
je     1355 <InterpolateDerS+0x205>
lea    0xdd6(%rip),%rdi
call   1060 <DymosimError@plt>
jmp    1845 <InterpolateDerS+0x6f5>
cmpl   $0x1,-0x58(%rbp)
jg     13a1 <InterpolateDerS+0x251>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    0x38(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x40(%rbp),%rdx
mov    -0x5c(%rbp),%ecx
mov    0x20(%rbp),%r9
mov    -0x60(%rbp),%eax
mov    0x50(%rbp),%r8
movsd  (%r8),%xmm1
mov    $0x1,%r8d
mov    %eax,(%rsp)
movl   $0x1,0x8(%rsp)
call   1050 <Interpolate1DerS@plt>
jmp    1845 <InterpolateDerS+0x6f5>
mov    0x38(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jb     1499 <InterpolateDerS+0x349>
movl   $0x0,-0x44(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x98(%rbp)
mov    -0x58(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x40(%rbp),%r9
mov    -0x30(%rbp),%rax
cvttsd2si (%rax),%eax
cltq
shl    $0x3,%rax
add    %rax,%r9
mov    -0x5c(%rbp),%r15d
mov    -0x30(%rbp),%rax
cvttsd2si (%rax),%eax
sub    %eax,%r15d
mov    0x20(%rbp),%r14
mov    -0x44(%rbp),%eax
imul   -0x50(%rbp),%eax
mov    -0x30(%rbp),%rdx
cvttsd2si (%rdx),%r8d
cltd
idiv   %r8d
cltq
shl    $0x3,%rax
add    %rax,%r14
mov    -0x60(%rbp),%eax
mov    -0x30(%rbp),%rdx
cvttsd2si (%rdx),%r8d
cltd
idiv   %r8d
mov    -0x98(%rbp),%rdx
mov    %eax,%ebx
mov    0x38(%rbp),%r11
add    $0x8,%r11
mov    -0x54(%rbp),%r10d
sub    $0x1,%r10d
mov    0x50(%rbp),%rax
add    $0x8,%rax
mov    $0x1,%r8d
mov    %r15d,(%rsp)
movl   $0x1,0x8(%rsp)
mov    %r14,0x10(%rsp)
mov    %ebx,0x18(%rsp)
movl   $0x1,0x20(%rsp)
mov    %r11,0x28(%rsp)
mov    %r10d,0x30(%rsp)
movl   $0x1,0x38(%rsp)
mov    %rax,0x40(%rsp)
call   1040 <InterpolateDerS@plt>
jmp    1845 <InterpolateDerS+0x6f5>
mov    0x38(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x40(%rbp),%rax
mov    -0x30(%rbp),%rcx
cvttsd2si (%rcx),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
ucomisd (%rax,%rcx,8),%xmm0
jb     15a3 <InterpolateDerS+0x453>
mov    -0x30(%rbp),%rax
cvttsd2si (%rax),%eax
sub    $0x1,%eax
mov    %eax,-0x44(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0xa0(%rbp)
mov    -0x58(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x40(%rbp),%r9
mov    -0x30(%rbp),%rax
cvttsd2si (%rax),%eax
cltq
shl    $0x3,%rax
add    %rax,%r9
mov    -0x5c(%rbp),%r15d
mov    -0x30(%rbp),%rax
cvttsd2si (%rax),%eax
sub    %eax,%r15d
mov    0x20(%rbp),%r14
mov    -0x44(%rbp),%eax
imul   -0x50(%rbp),%eax
mov    -0x30(%rbp),%rdx
cvttsd2si (%rdx),%r8d
cltd
idiv   %r8d
cltq
shl    $0x3,%rax
add    %rax,%r14
mov    -0x60(%rbp),%eax
mov    -0x30(%rbp),%rdx
cvttsd2si (%rdx),%r8d
cltd
idiv   %r8d
mov    -0xa0(%rbp),%rdx
mov    %eax,%ebx
mov    0x38(%rbp),%r11
add    $0x8,%r11
mov    -0x54(%rbp),%r10d
sub    $0x1,%r10d
mov    0x50(%rbp),%rax
add    $0x8,%rax
mov    $0x1,%r8d
mov    %r15d,(%rsp)
movl   $0x1,0x8(%rsp)
mov    %r14,0x10(%rsp)
mov    %ebx,0x18(%rsp)
movl   $0x1,0x20(%rsp)
mov    %r11,0x28(%rsp)
mov    %r10d,0x30(%rsp)
movl   $0x1,0x38(%rsp)
mov    %rax,0x40(%rsp)
call   1040 <InterpolateDerS@plt>
jmp    1845 <InterpolateDerS+0x6f5>
mov    0x38(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%rax
cvttsd2si (%rax),%esi
call   1030 <SearchGrid@plt>
mov    %eax,-0x44(%rbp)
mov    -0x30(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0xb0(%rbp)
mov    -0x58(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x40(%rbp),%r9
mov    -0x30(%rbp),%rax
cvttsd2si (%rax),%eax
cltq
shl    $0x3,%rax
add    %rax,%r9
mov    -0x5c(%rbp),%r15d
mov    -0x30(%rbp),%rax
cvttsd2si (%rax),%eax
sub    %eax,%r15d
mov    0x20(%rbp),%r14
mov    -0x44(%rbp),%eax
imul   -0x50(%rbp),%eax
mov    -0x30(%rbp),%rdx
cvttsd2si (%rdx),%esi
cltd
idiv   %esi
cltq
shl    $0x3,%rax
add    %rax,%r14
mov    -0x60(%rbp),%eax
mov    -0x30(%rbp),%rdx
cvttsd2si (%rdx),%esi
cltd
idiv   %esi
mov    -0xb0(%rbp),%rdx
mov    %eax,%ebx
mov    0x38(%rbp),%r11
add    $0x8,%r11
mov    -0x54(%rbp),%r10d
sub    $0x1,%r10d
mov    0x50(%rbp),%rax
add    $0x8,%rax
lea    -0x68(%rbp),%rdi
lea    -0x78(%rbp),%rsi
mov    $0x1,%r8d
mov    %r15d,(%rsp)
movl   $0x1,0x8(%rsp)
mov    %r14,0x10(%rsp)
mov    %ebx,0x18(%rsp)
movl   $0x1,0x20(%rsp)
mov    %r11,0x28(%rsp)
mov    %r10d,0x30(%rsp)
movl   $0x1,0x38(%rsp)
mov    %rax,0x40(%rsp)
call   1040 <InterpolateDerS@plt>
mov    -0x30(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0xa8(%rbp)
mov    -0x58(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x40(%rbp),%r9
mov    -0x30(%rbp),%rax
cvttsd2si (%rax),%eax
cltq
shl    $0x3,%rax
add    %rax,%r9
mov    -0x5c(%rbp),%r15d
mov    -0x30(%rbp),%rax
cvttsd2si (%rax),%eax
sub    %eax,%r15d
mov    0x20(%rbp),%r14
mov    -0x44(%rbp),%eax
add    $0x1,%eax
imul   -0x50(%rbp),%eax
mov    -0x30(%rbp),%rdx
cvttsd2si (%rdx),%esi
cltd
idiv   %esi
cltq
shl    $0x3,%rax
add    %rax,%r14
mov    -0x60(%rbp),%eax
mov    -0x30(%rbp),%rdx
cvttsd2si (%rdx),%esi
cltd
idiv   %esi
mov    -0xa8(%rbp),%rdx
mov    %eax,%ebx
mov    0x38(%rbp),%r11
add    $0x8,%r11
mov    -0x54(%rbp),%r10d
sub    $0x1,%r10d
mov    0x50(%rbp),%rax
add    $0x8,%rax
lea    -0x70(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    $0x1,%r8d
mov    %r15d,(%rsp)
movl   $0x1,0x8(%rsp)
mov    %r14,0x10(%rsp)
mov    %ebx,0x18(%rsp)
movl   $0x1,0x20(%rsp)
mov    %r11,0x28(%rsp)
mov    %r10d,0x30(%rsp)
movl   $0x1,0x38(%rsp)
mov    %rax,0x40(%rsp)
call   1040 <InterpolateDerS@plt>
movsd  -0x68(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm1
subsd  -0x68(%rbp),%xmm1
mov    0x38(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
mov    -0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x70(%rbp),%xmm0
subsd  -0x68(%rbp),%xmm0
mov    0x50(%rbp),%rax
mulsd  (%rax),%xmm0
mov    -0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm1
divsd  %xmm1,%xmm0
movsd  -0x78(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm2
subsd  -0x78(%rbp),%xmm2
mov    0x38(%rbp),%rax
movsd  (%rax),%xmm3
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm3
mulsd  %xmm3,%xmm2
mov    -0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm3
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0xe8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<InterpolateDerS>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %rdx,%r10
mov    0x100(%rsp),%r12
mov    0xf8(%rsp),%ebx
mov    0xf0(%rsp),%edx
mov    0xe8(%rsp),%r13
mov    0xe0(%rsp),%r14d
mov    0xd8(%rsp),%eax
mov    0xd0(%rsp),%r15
mov    0xc8(%rsp),%ebp
mov    0xc0(%rsp),%r11d
movq   $0x0,(%rdi)
movq   $0x0,(%rsi)
cmp    $0x1,%edx
je     11c0 <InterpolateDerS+0x70>
cmp    $0x1,%ebx
jne    11cb <InterpolateDerS+0x7b>
cmp    $0x1,%ecx
je     11d7 <InterpolateDerS+0x87>
cmp    $0x1,%r8d
je     11d7 <InterpolateDerS+0x87>
lea    0xe2e(%rip),%rdi
jmp    137d <InterpolateDerS+0x22d>
mov    %r11d,0x8(%rsp)
mov    %rsi,0x18(%rsp)
mov    %rdi,0x10(%rsp)
cmp    $0x2,%edx
cmovge %edx,%ebx
cmp    $0x2,%ecx
cmovge %ecx,%r8d
cmp    %r8d,%ebx
jne    1393 <InterpolateDerS+0x243>
mov    %eax,0x40(%rsp)
mov    %r14,0x20(%rsp)
mov    %r15,0x30(%rsp)
mov    %r12,(%rsp)
mov    %r13,0x60(%rsp)
mov    %r9,0x38(%rsp)
test   %ebx,%ebx
mov    %rbx,0x28(%rsp)
jle    1280 <InterpolateDerS+0x130>
mov    %ebx,%r13d
mov    $0x1,%r15d
xor    %r14d,%r14d
xor    %r12d,%r12d
mov    %r10,%rbx
movsd  (%r10,%r14,8),%xmm0
movsd  %xmm0,0x48(%rsp)
call   1070 <floor@plt>
movsd  0x48(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jne    1376 <InterpolateDerS+0x226>
jp     1376 <InterpolateDerS+0x226>
movapd %xmm1,%xmm0
cvttsd2si %xmm1,%eax
add    %eax,%r12d
imul   %eax,%r15d
add    $0x1,%r14
cmp    %r14,%r13
mov    %rbx,%r10
jne    1230 <InterpolateDerS+0xe0>
jmp    1289 <InterpolateDerS+0x139>
nopw   0x0(%rax,%rax,1)
xor    %r12d,%r12d
mov    $0x1,%r15d
imul   0x8(%rsp),%ebp
cmp    %r12d,%ebp
jne    139c <InterpolateDerS+0x24c>
mov    0x20(%rsp),%rbx
imul   0x40(%rsp),%ebx
cmp    %r15d,%ebx
jne    13a5 <InterpolateDerS+0x255>
mov    0x60(%rsp),%r13
movsd  0x0(%r13),%xmm0
mov    0x28(%rsp),%r11
cmp    $0x1,%r11d
jle    13ae <InterpolateDerS+0x25e>
mov    0x38(%rsp),%r9
movsd  (%r9),%xmm1
ucomisd %xmm0,%xmm1
mov    0x30(%rsp),%r15
jb     133f <InterpolateDerS+0x1ef>
cvttsd2si (%r10),%eax
add    $0xffffffff,%r11d
add    $0x8,%r10
movslq %eax,%rcx
lea    (%r9,%rcx,8),%r9
sub    %ecx,%ebp
mov    %ebx,%eax
cltd
idiv   %ecx
add    $0x8,%r13
mov    (%rsp),%r12
add    $0x8,%r12
mov    0x10(%rsp),%rdi
movq   $0x0,(%rdi)
mov    0x18(%rsp),%rsi
movq   $0x0,(%rsi)
mov    $0x1,%r8d
mov    %r11d,%ecx
mov    %ebp,%edx
mov    %ebp,0x8(%rsp)
mov    $0x1,%ebp
mov    $0x1,%r14d
mov    %r11d,%edx
mov    $0x1,%ebx
jmp    11e6 <InterpolateDerS+0x96>
cvttsd2si (%r10),%esi
movslq %esi,%rcx
ucomisd -0x8(%r9,%rcx,8),%xmm0
jb     13ec <InterpolateDerS+0x29c>
lea    -0x1(%rcx),%eax
add    $0x8,%r10
add    $0xffffffff,%r11d
lea    (%r9,%rcx,8),%r9
sub    %ecx,%ebp
imul   %ebx,%eax
cltd
idiv   %ecx
cltq
lea    (%r15,%rax,8),%r15
jmp    12ef <InterpolateDerS+0x19f>
lea    0xd03(%rip),%rdi
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <DymosimError@plt>
lea    0xc90(%rip),%rdi
jmp    137d <InterpolateDerS+0x22d>
lea    0xd19(%rip),%rdi
jmp    137d <InterpolateDerS+0x22d>
lea    0xd75(%rip),%rdi
jmp    137d <InterpolateDerS+0x22d>
mov    (%rsp),%rax
movsd  (%rax),%xmm1
mov    0x10(%rsp),%rdi
mov    0x18(%rsp),%rsi
mov    0x38(%rsp),%rdx
mov    %ebp,%ecx
mov    $0x1,%r8d
mov    0x30(%rsp),%r9
push   $0x1
push   %rbx
call   1050 <Interpolate1DerS@plt>
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r9,%rdi
mov    %rbp,0x8(%rsp)
mov    %r10,%r14
mov    %r11,%r12
mov    %rbx,0x20(%rsp)
call   1030 <SearchGrid@plt>
mov    %rax,0x48(%rsp)
mov    %r14,0x58(%rsp)
lea    0x8(%r14),%rbx
mov    %rbx,0x40(%rsp)
add    $0xffffffff,%r12d
cvttsd2si (%r14),%ecx
movslq %ecx,%rcx
mov    0x38(%rsp),%r14
lea    (%r14,%rcx,8),%r9
mov    %ebp,%r10d
sub    %ecx,%r10d
mov    0x20(%rsp),%rsi
imul   %esi,%eax
cltd
idiv   %ecx
cltq
lea    (%r15,%rax,8),%rax
mov    %rax,0x50(%rsp)
mov    %esi,%eax
cltd
idiv   %ecx
lea    0x8(%r13),%r11
mov    (%rsp),%rcx
lea    0x8(%rcx),%rbp
mov    %rbp,0x28(%rsp)
sub    $0x8,%rsp
lea    0x88(%rsp),%rdi
lea    0x78(%rsp),%rsi
mov    %rbx,%rdx
mov    %r12d,%ecx
mov    $0x1,%r8d
push   %rbp
push   $0x1
push   %r12
mov    %r12,%r15
push   %r11
mov    %r11,%rbp
push   $0x1
push   %rax
push   0x88(%rsp)
push   $0x1
push   %r10
call   1040 <InterpolateDerS@plt>
add    $0x50,%rsp
mov    0x58(%rsp),%rax
cvttsd2si (%rax),%eax
movslq %eax,%rcx
lea    (%r14,%rcx,8),%r9
mov    0x8(%rsp),%rbx
sub    %ecx,%ebx
mov    0x48(%rsp),%r12
lea    0x1(%r12),%eax
mov    0x20(%rsp),%rsi
imul   %esi,%eax
cltd
idiv   %ecx
cltq
mov    0x30(%rsp),%rdx
lea    (%rdx,%rax,8),%r10
mov    %esi,%eax
cltd
idiv   %ecx
sub    $0x8,%rsp
lea    0x80(%rsp),%rdi
lea    0x70(%rsp),%rsi
mov    0x48(%rsp),%rdx
mov    %r15d,%ecx
mov    $0x1,%r8d
push   0x30(%rsp)
push   $0x1
push   %r15
push   %rbp
push   $0x1
push   %rax
push   %r10
push   $0x1
push   %rbx
call   1040 <InterpolateDerS@plt>
add    $0x50,%rsp
movsd  0x80(%rsp),%xmm1
movsd  0x78(%rsp),%xmm0
subsd  %xmm1,%xmm0
movsd  0x0(%r13),%xmm2
movslq %r12d,%rax
movsd  (%r14,%rax,8),%xmm3
movsd  0x8(%r14,%rax,8),%xmm4
subsd  %xmm3,%xmm2
mulsd  %xmm0,%xmm2
subsd  %xmm3,%xmm4
divsd  %xmm4,%xmm2
addsd  %xmm1,%xmm2
mov    0x10(%rsp),%rcx
movsd  %xmm2,(%rcx)
mov    (%rsp),%rcx
mulsd  (%rcx),%xmm0
movsd  (%r14,%rax,8),%xmm1
movsd  0x8(%r14,%rax,8),%xmm2
subsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
movsd  0x70(%rsp),%xmm3
movsd  0x68(%rsp),%xmm4
subsd  %xmm3,%xmm4
movsd  0x0(%r13),%xmm5
subsd  %xmm1,%xmm5
mulsd  %xmm4,%xmm5
divsd  %xmm2,%xmm5
addsd  %xmm3,%xmm5
addsd  %xmm0,%xmm5
mov    0x18(%rsp),%rax
movsd  %xmm5,(%rax)
add    $0x88,%rsp
jmp    13e1 <InterpolateDerS+0x291>

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 void @InterpolateDerS(double* %0, double* %1, double* %2, i32 %3, i32 %4, double* %5, i32 %6, i32 %7, double* %8, i32 %9, i32 %10, double* %11, i32 %12, i32 %13, double* %14) {
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
%19 = alloca i32
%20 = alloca i32
%21 = alloca double*
%22 = alloca i32
%23 = alloca i32
%24 = alloca double*
%25 = alloca i32
%26 = alloca i32
%27 = alloca double*
%28 = alloca i32
%29 = alloca i32
%30 = alloca double*
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca i32
%35 = alloca i32
%36 = alloca i32
%37 = alloca i32
%38 = alloca i32
%39 = alloca double
%40 = alloca double
%41 = alloca double
%42 = alloca double
store double* %0, double** %16
store double* %1, double** %17
store double* %2, double** %18
store i32 %3, i32* %19
store i32 %4, i32* %20
store double* %5, double** %21
store i32 %6, i32* %22
store i32 %7, i32* %23
store double* %8, double** %24
store i32 %9, i32* %25
store i32 %10, i32* %26
store double* %11, double** %27
store i32 %12, i32* %28
store i32 %13, i32* %29
store double* %14, double** %30
%43 = load double*, double** %16
store double 0.000000e+00, double* %43
%44 = load double*, double** %17
store double 0.000000e+00, double* %44
%45 = load i32, i32* %28
%46 = icmp ne i32 %45, 1
br i1 %46, label %47, label %50
47: ; preds = %15
%48 = load i32, i32* %29
%49 = icmp ne i32 %48, 1
br i1 %49, label %56, label %50
50: ; preds = %47, %15
%51 = load i32, i32* %19
%52 = icmp ne i32 %51, 1
br i1 %52, label %53, label %58
53: ; preds = %50
%54 = load i32, i32* %20
%55 = icmp ne i32 %54, 1
br i1 %55, label %56, label %58
56: ; preds = %53, %47
%57 = call i32 @DymosimError(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
br label %438
58: ; preds = %53, %50
%59 = load i32, i32* %28
%60 = icmp sgt i32 %59, 1
br i1 %60, label %61, label %63
61: ; preds = %58
%62 = load i32, i32* %28
br label %65
63: ; preds = %58
%64 = load i32, i32* %29
br label %65
65: ; preds = %63, %61
%66 = phi i32 [ %62, %61 ], [ %64, %63 ]
store i32 %66, i32* %35
%67 = load i32, i32* %19
%68 = icmp sgt i32 %67, 1
br i1 %68, label %69, label %71
69: ; preds = %65
%70 = load i32, i32* %19
br label %73
71: ; preds = %65
%72 = load i32, i32* %20
br label %73
73: ; preds = %71, %69
%74 = phi i32 [ %70, %69 ], [ %72, %71 ]
store i32 %74, i32* %36
%75 = load i32, i32* %22
%76 = load i32, i32* %23
%77 = mul nsw i32 %75, %76
store i32 %77, i32* %37
%78 = load i32, i32* %25
%79 = load i32, i32* %26
%80 = mul nsw i32 %78, %79
store i32 %80, i32* %38
%81 = load i32, i32* %35
%82 = load i32, i32* %36
%83 = icmp ne i32 %81, %82
br i1 %83, label %84, label %86
84: ; preds = %73
%85 = call i32 @DymosimError(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.1, i64 0, i64 0))
br label %438
86: ; preds = %73
store i32 0, i32* %33
store i32 1, i32* %34
store i32 0, i32* %32
br label %87
87: ; preds = %123, %86
%88 = load i32, i32* %32
%89 = load i32, i32* %36
%90 = icmp slt i32 %88, %89
br i1 %90, label %91, label %126
91: ; preds = %87
%92 = load double*, double** %18
%93 = load i32, i32* %32
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds double, double* %92, i64 %94
%96 = load double, double* %95
%97 = load double*, double** %18
%98 = load i32, i32* %32
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds double, double* %97, i64 %99
%101 = load double, double* %100
%102 = call double @floor(double %101)
%103 = fcmp une double %96, %102
br i1 %103, label %104, label %106
104: ; preds = %91
%105 = call i32 @DymosimError(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0))
br label %438
106: ; preds = %91
%107 = load i32, i32* %33
%108 = load double*, double** %18
%109 = load i32, i32* %32
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds double, double* %108, i64 %110
%112 = load double, double* %111
%113 = fptosi double %112 to i32
%114 = add nsw i32 %107, %113
store i32 %114, i32* %33
%115 = load i32, i32* %34
%116 = load double*, double** %18
%117 = load i32, i32* %32
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds double, double* %116, i64 %118
%120 = load double, double* %119
%121 = fptosi double %120 to i32
%122 = mul nsw i32 %115, %121
store i32 %122, i32* %34
br label %123
123: ; preds = %106
%124 = load i32, i32* %32
%125 = add nsw i32 %124, 1
store i32 %125, i32* %32
br label %87
126: ; preds = %87
%127 = load i32, i32* %37
%128 = load i32, i32* %33
%129 = icmp ne i32 %127, %128
br i1 %129, label %130, label %132
130: ; preds = %126
%131 = call i32 @DymosimError(i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str.3, i64 0, i64 0))
br label %438
132: ; preds = %126
%133 = load i32, i32* %38
%134 = load i32, i32* %34
%135 = icmp ne i32 %133, %134
br i1 %135, label %136, label %138
136: ; preds = %132
%137 = call i32 @DymosimError(i8* getelementptr inbounds ([97 x i8], [97 x i8]* @.str.4, i64 0, i64 0))
br label %438
138: ; preds = %132
%139 = load i32, i32* %36
%140 = icmp sle i32 %139, 1
br i1 %140, label %141, label %155
141: ; preds = %138
%142 = load double*, double** %16
%143 = load double*, double** %17
%144 = load double*, double** %27
%145 = getelementptr inbounds double, double* %144, i64 0
%146 = load double, double* %145
%147 = load double*, double** %21
%148 = load i32, i32* %37
%149 = load double*, double** %24
%150 = load i32, i32* %38
%151 = load double*, double** %30
%152 = getelementptr inbounds double, double* %151, i64 0
%153 = load double, double* %152
%154 = call i32 @Interpolate1DerS(double* %142, double* %143, double %146, double* %147, i32 %148, i32 1, double* %149, i32 %150, i32 1, double %153)
br label %438
155: ; preds = %138
%156 = load double*, double** %27
%157 = getelementptr inbounds double, double* %156, i64 0
%158 = load double, double* %157
%159 = load double*, double** %21
%160 = getelementptr inbounds double, double* %159, i64 0
%161 = load double, double* %160
%162 = fcmp ole double %158, %161
br i1 %162, label %163, label %206
163: ; preds = %155
store i32 0, i32* %31
%164 = load double*, double** %16
%165 = load double*, double** %17
%166 = load double*, double** %18
%167 = getelementptr inbounds double, double* %166, i64 1
%168 = load i32, i32* %36
%169 = sub nsw i32 %168, 1
%170 = load double*, double** %21
%171 = load double*, double** %18
%172 = getelementptr inbounds double, double* %171, i64 0
%173 = load double, double* %172
%174 = fptosi double %173 to i32
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds double, double* %170, i64 %175
%177 = load i32, i32* %37
%178 = load double*, double** %18
%179 = getelementptr inbounds double, double* %178, i64 0
%180 = load double, double* %179
%181 = fptosi double %180 to i32
%182 = sub nsw i32 %177, %181
%183 = load double*, double** %24
%184 = load i32, i32* %31
%185 = load i32, i32* %34
%186 = mul nsw i32 %184, %185
%187 = load double*, double** %18
%188 = getelementptr inbounds double, double* %187, i64 0
%189 = load double, double* %188
%190 = fptosi double %189 to i32
%191 = sdiv i32 %186, %190
%192 = sext i32 %191 to i64
%193 = getelementptr inbounds double, double* %183, i64 %192
%194 = load i32, i32* %38
%195 = load double*, double** %18
%196 = getelementptr inbounds double, double* %195, i64 0
%197 = load double, double* %196
%198 = fptosi double %197 to i32
%199 = sdiv i32 %194, %198
%200 = load double*, double** %27
%201 = getelementptr inbounds double, double* %200, i64 1
%202 = load i32, i32* %35
%203 = sub nsw i32 %202, 1
%204 = load double*, double** %30
%205 = getelementptr inbounds double, double* %204, i64 1
br label %438
206: ; preds = %155
%207 = load double*, double** %27
%208 = getelementptr inbounds double, double* %207, i64 0
%209 = load double, double* %208
%210 = load double*, double** %21
%211 = load double*, double** %18
%212 = getelementptr inbounds double, double* %211, i64 0
%213 = load double, double* %212
%214 = fptosi double %213 to i32
%215 = sub nsw i32 %214, 1
%216 = sext i32 %215 to i64
%217 = getelementptr inbounds double, double* %210, i64 %216
%218 = load double, double* %217
%219 = fcmp oge double %209, %218
br i1 %219, label %220, label %268
220: ; preds = %206
%221 = load double*, double** %18
%222 = getelementptr inbounds double, double* %221, i64 0
%223 = load double, double* %222
%224 = fptosi double %223 to i32
%225 = sub nsw i32 %224, 1
store i32 %225, i32* %31
%226 = load double*, double** %16
%227 = load double*, double** %17
%228 = load double*, double** %18
%229 = getelementptr inbounds double, double* %228, i64 1
%230 = load i32, i32* %36
%231 = sub nsw i32 %230, 1
%232 = load double*, double** %21
%233 = load double*, double** %18
%234 = getelementptr inbounds double, double* %233, i64 0
%235 = load double, double* %234
%236 = fptosi double %235 to i32
%237 = sext i32 %236 to i64
%238 = getelementptr inbounds double, double* %232, i64 %237
%239 = load i32, i32* %37
%240 = load double*, double** %18
%241 = getelementptr inbounds double, double* %240, i64 0
%242 = load double, double* %241
%243 = fptosi double %242 to i32
%244 = sub nsw i32 %239, %243
%245 = load double*, double** %24
%246 = load i32, i32* %31
%247 = load i32, i32* %34
%248 = mul nsw i32 %246, %247
%249 = load double*, double** %18
%250 = getelementptr inbounds double, double* %249, i64 0
%251 = load double, double* %250
%252 = fptosi double %251 to i32
%253 = sdiv i32 %248, %252
%254 = sext i32 %253 to i64
%255 = getelementptr inbounds double, double* %245, i64 %254
%256 = load i32, i32* %38
%257 = load double*, double** %18
%258 = getelementptr inbounds double, double* %257, i64 0
%259 = load double, double* %258
%260 = fptosi double %259 to i32
%261 = sdiv i32 %256, %260
%262 = load double*, double** %27
%263 = getelementptr inbounds double, double* %262, i64 1
%264 = load i32, i32* %35
%265 = sub nsw i32 %264, 1
%266 = load double*, double** %30
%267 = getelementptr inbounds double, double* %266, i64 1
br label %438
268: ; preds = %206
%269 = load double*, double** %27
%270 = getelementptr inbounds double, double* %269, i64 0
%271 = load double, double* %270
%272 = load double*, double** %21
%273 = load double*, double** %18
%274 = getelementptr inbounds double, double* %273, i64 0
%275 = load double, double* %274
%276 = fptosi double %275 to i32
%277 = call i32 @SearchGrid(double %271, double* %272, i32 %276)
store i32 %277, i32* %31
%278 = load double*, double** %18
%279 = getelementptr inbounds double, double* %278, i64 1
%280 = load i32, i32* %36
%281 = sub nsw i32 %280, 1
%282 = load double*, double** %21
%283 = load double*, double** %18
%284 = getelementptr inbounds double, double* %283, i64 0
%285 = load double, double* %284
%286 = fptosi double %285 to i32
%287 = sext i32 %286 to i64
%288 = getelementptr inbounds double, double* %282, i64 %287
%289 = load i32, i32* %37
%290 = load double*, double** %18
%291 = getelementptr inbounds double, double* %290, i64 0
%292 = load double, double* %291
%293 = fptosi double %292 to i32
%294 = sub nsw i32 %289, %293
%295 = load double*, double** %24
%296 = load i32, i32* %31
%297 = load i32, i32* %34
%298 = mul nsw i32 %296, %297
%299 = load double*, double** %18
%300 = getelementptr inbounds double, double* %299, i64 0
%301 = load double, double* %300
%302 = fptosi double %301 to i32
%303 = sdiv i32 %298, %302
%304 = sext i32 %303 to i64
%305 = getelementptr inbounds double, double* %295, i64 %304
%306 = load i32, i32* %38
%307 = load double*, double** %18
%308 = getelementptr inbounds double, double* %307, i64 0
%309 = load double, double* %308
%310 = fptosi double %309 to i32
%311 = sdiv i32 %306, %310
%312 = load double*, double** %27
%313 = getelementptr inbounds double, double* %312, i64 1
%314 = load i32, i32* %35
%315 = sub nsw i32 %314, 1
%316 = load double*, double** %30
%317 = getelementptr inbounds double, double* %316, i64 1
%318 = load double*, double** %18
%319 = getelementptr inbounds double, double* %318, i64 1
%320 = load i32, i32* %36
%321 = sub nsw i32 %320, 1
%322 = load double*, double** %21
%323 = load double*, double** %18
%324 = getelementptr inbounds double, double* %323, i64 0
%325 = load double, double* %324
%326 = fptosi double %325 to i32
%327 = sext i32 %326 to i64
%328 = getelementptr inbounds double, double* %322, i64 %327
%329 = load i32, i32* %37
%330 = load double*, double** %18
%331 = getelementptr inbounds double, double* %330, i64 0
%332 = load double, double* %331
%333 = fptosi double %332 to i32
%334 = sub nsw i32 %329, %333
%335 = load double*, double** %24
%336 = load i32, i32* %31
%337 = add nsw i32 %336, 1
%338 = load i32, i32* %34
%339 = mul nsw i32 %337, %338
%340 = load double*, double** %18
%341 = getelementptr inbounds double, double* %340, i64 0
%342 = load double, double* %341
%343 = fptosi double %342 to i32
%344 = sdiv i32 %339, %343
%345 = sext i32 %344 to i64
%346 = getelementptr inbounds double, double* %335, i64 %345
%347 = load i32, i32* %38
%348 = load double*, double** %18
%349 = getelementptr inbounds double, double* %348, i64 0
%350 = load double, double* %349
%351 = fptosi double %350 to i32
%352 = sdiv i32 %347, %351
%353 = load double*, double** %27
%354 = getelementptr inbounds double, double* %353, i64 1
%355 = load i32, i32* %35
%356 = sub nsw i32 %355, 1
%357 = load double*, double** %30
%358 = getelementptr inbounds double, double* %357, i64 1
%359 = load double, double* %39
%360 = load double, double* %40
%361 = load double, double* %39
%362 = fsub double %360, %361
%363 = load double*, double** %27
%364 = getelementptr inbounds double, double* %363, i64 0
%365 = load double, double* %364
%366 = load double*, double** %21
%367 = load i32, i32* %31
%368 = sext i32 %367 to i64
%369 = getelementptr inbounds double, double* %366, i64 %368
%370 = load double, double* %369
%371 = fsub double %365, %370
%372 = fmul double %362, %371
%373 = load double*, double** %21
%374 = load i32, i32* %31
%375 = add nsw i32 %374, 1
%376 = sext i32 %375 to i64
%377 = getelementptr inbounds double, double* %373, i64 %376
%378 = load double, double* %377
%379 = load double*, double** %21
%380 = load i32, i32* %31
%381 = sext i32 %380 to i64
%382 = getelementptr inbounds double, double* %379, i64 %381
%383 = load double, double* %382
%384 = fsub double %378, %383
%385 = fdiv double %372, %384
%386 = fadd double %359, %385
%387 = load double*, double** %16
store double %386, double* %387
%388 = load double, double* %40
%389 = load double, double* %39
%390 = fsub double %388, %389
%391 = load double*, double** %30
%392 = getelementptr inbounds double, double* %391, i64 0
%393 = load double, double* %392
%394 = fmul double %390, %393
%395 = load double*, double** %21
%396 = load i32, i32* %31
%397 = add nsw i32 %396, 1
%398 = sext i32 %397 to i64
%399 = getelementptr inbounds double, double* %395, i64 %398
%400 = load double, double* %399
%401 = load double*, double** %21
%402 = load i32, i32* %31
%403 = sext i32 %402 to i64
%404 = getelementptr inbounds double, double* %401, i64 %403
%405 = load double, double* %404
%406 = fsub double %400, %405
%407 = fdiv double %394, %406
%408 = load double, double* %41
%409 = load double, double* %42
%410 = load double, double* %41
%411 = fsub double %409, %410
%412 = load double*, double** %27
%413 = getelementptr inbounds double, double* %412, i64 0
%414 = load double, double* %413
%415 = load double*, double** %21
%416 = load i32, i32* %31
%417 = sext i32 %416 to i64
%418 = getelementptr inbounds double, double* %415, i64 %417
%419 = load double, double* %418
%420 = fsub double %414, %419
%421 = fmul double %411, %420
%422 = load double*, double** %21
%423 = load i32, i32* %31
%424 = add nsw i32 %423, 1
%425 = sext i32 %424 to i64
%426 = getelementptr inbounds double, double* %422, i64 %425
%427 = load double, double* %426
%428 = load double*, double** %21
%429 = load i32, i32* %31
%430 = sext i32 %429 to i64
%431 = getelementptr inbounds double, double* %428, i64 %430
%432 = load double, double* %431
%433 = fsub double %427, %432
%434 = fdiv double %421, %433
%435 = fadd double %408, %434
%436 = fadd double %407, %435
%437 = load double*, double** %17
store double %436, double* %437
br label %438
438: ; preds = %268, %220, %163, %141, %136, %130, %104, %84, %56
ret void
}

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