user: Converte this assembly snippet into its equivalent C code:

```asm
<Interpolate>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %edx,-0x40(%rbp)
  mov    %rcx,-0x48(%rbp)
  mov    %r8d,-0x4c(%rbp)
  mov    %r9d,-0x50(%rbp)
  cmpl   $0x1,0x30(%rbp)
  je     L22
  cmpl   $0x1,0x38(%rbp)
  jne    L119
L22:
  cmpl   $0x1,-0x3c(%rbp)
  je     L213
  cmpl   $0x1,-0x40(%rbp)
  je     L213
L119:
  lea    D30(%rip),%rax
  mov    %rax,%rdi
  call   <DymosimError@plt>
  movq   %xmm0,%rax
  jmp    L74
L213:
  cmpl   $0x1,0x30(%rbp)
  jle    L171
  mov    0x30(%rbp),%eax
  jmp    L175
L171:
  mov    0x38(%rbp),%eax
L175:
  mov    %eax,-0x24(%rbp)
  cmpl   $0x1,-0x3c(%rbp)
  jle    L200
  mov    -0x3c(%rbp),%eax
  jmp    L106
L200:
  mov    -0x40(%rbp),%eax
L106:
  mov    %eax,-0x20(%rbp)
  mov    -0x4c(%rbp),%eax
  imul   -0x50(%rbp),%eax
  mov    %eax,-0x1c(%rbp)
  mov    0x18(%rbp),%eax
  imul   0x20(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x24(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  je     L139
  lea    D44(%rip),%rax
  mov    %rax,%rdi
  call   <DymosimError@plt>
  movq   %xmm0,%rax
  jmp    L74
L139:
  movl   $0x0,-0x2c(%rbp)
  movl   $0x1,-0x28(%rbp)
  movl   $0x0,-0x30(%rbp)
  jmp    L184
L87:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm3
  movsd  %xmm3,-0x58(%rbp)
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  movq   %rax,%xmm0
  call   <floor@plt>
  movsd  -0x58(%rbp),%xmm3
  ucomisd %xmm0,%xmm3
  jp     L165
  ucomisd %xmm0,%xmm3
  je     L223
L165:
  lea    D22(%rip),%rax
  mov    %rax,%rdi
  call   <DymosimError@plt>
  movq   %xmm0,%rax
  jmp    L74
L223:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  cvttsd2si %xmm0,%eax
  add    %eax,-0x2c(%rbp)
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  cvttsd2si %xmm0,%eax
  mov    -0x28(%rbp),%edx
  imul   %edx,%eax
  mov    %eax,-0x28(%rbp)
  addl   $0x1,-0x30(%rbp)
L184:
  mov    -0x30(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jl     L87
  mov    -0x1c(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  je     L75
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  call   <DymosimError@plt>
  movq   %xmm0,%rax
  jmp    L74
L75:
  mov    -0x18(%rbp),%eax
  cmp    -0x28(%rbp),%eax
  je     L187
  lea    D7(%rip),%rax
  mov    %rax,%rdi
  call   <DymosimError@plt>
  movq   %xmm0,%rax
  jmp    L74
L187:
  cmpl   $0x1,-0x20(%rbp)
  jg     L250
  mov    0x28(%rbp),%rax
  mov    (%rax),%rax
  mov    -0x18(%rbp),%edx
  mov    -0x1c(%rbp),%esi
  mov    -0x48(%rbp),%rdi
  mov    $0x1,%r9d
  mov    %edx,%r8d
  mov    0x10(%rbp),%rcx
  mov    $0x1,%edx
  movq   %rax,%xmm0
  call   <Interpolate1@plt>
  movq   %xmm0,%rax
  jmp    L74
L250:
  mov    0x28(%rbp),%rax
  movsd  (%rax),%xmm1
  mov    -0x48(%rbp),%rax
  movsd  (%rax),%xmm0
  comisd %xmm1,%xmm0
  jb     L156
  movl   $0x0,-0x14(%rbp)
  mov    -0x24(%rbp),%eax
  lea    -0x1(%rax),%r8d
  mov    0x28(%rbp),%rax
  lea    0x8(%rax),%rdi
  mov    -0x38(%rbp),%rax
  movsd  (%rax),%xmm0
  cvttsd2si %xmm0,%ecx
  mov    -0x18(%rbp),%eax
  cltd
  idiv   %ecx
  mov    %eax,%r9d
  mov    -0x14(%rbp),%eax
  imul   -0x28(%rbp),%eax
  mov    -0x38(%rbp),%rdx
  movsd  (%rdx),%xmm0
  cvttsd2si %xmm0,%esi
  cltd
  idiv   %esi
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x10(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x38(%rbp),%rax
  movsd  (%rax),%xmm0
  cvttsd2si %xmm0,%edx
  mov    -0x1c(%rbp),%eax
  sub    %edx,%eax
  mov    %eax,%r10d
  mov    -0x38(%rbp),%rax
  movsd  (%rax),%xmm0
  cvttsd2si %xmm0,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rax,%rdx
  mov    -0x20(%rbp),%eax
  lea    -0x1(%rax),%esi
  mov    -0x38(%rbp),%rax
  add    $0x8,%rax
  push   $0x1
  push   %r8
  push   %rdi
  push   $0x1
  push   %r9
  push   %rcx
  mov    $0x1,%r9d
  mov    %r10d,%r8d
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    %rax,%rdi
  call   <Interpolate>
  add    $0x30,%rsp
  movq   %xmm0,%rax
  jmp    L74
L156:
  mov    0x28(%rbp),%rax
  movsd  (%rax),%xmm0
  mov    -0x38(%rbp),%rax
  movsd  (%rax),%xmm1
  cvttsd2si %xmm1,%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  comisd %xmm1,%xmm0
  jb     L186
  mov    -0x38(%rbp),%rax
  movsd  (%rax),%xmm0
  cvttsd2si %xmm0,%eax
  sub    $0x1,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x24(%rbp),%eax
  lea    -0x1(%rax),%r8d
  mov    0x28(%rbp),%rax
  lea    0x8(%rax),%rdi
  mov    -0x38(%rbp),%rax
  movsd  (%rax),%xmm0
  cvttsd2si %xmm0,%ecx
  mov    -0x18(%rbp),%eax
  cltd
  idiv   %ecx
  mov    %eax,%r9d
  mov    -0x14(%rbp),%eax
  imul   -0x28(%rbp),%eax
  mov    -0x38(%rbp),%rdx
  movsd  (%rdx),%xmm0
  cvttsd2si %xmm0,%esi
  cltd
  idiv   %esi
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x10(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x38(%rbp),%rax
  movsd  (%rax),%xmm0
  cvttsd2si %xmm0,%edx
  mov    -0x1c(%rbp),%eax
  sub    %edx,%eax
  mov    %eax,%r10d
  mov    -0x38(%rbp),%rax
  movsd  (%rax),%xmm0
  cvttsd2si %xmm0,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rax,%rdx
  mov    -0x20(%rbp),%eax
  lea    -0x1(%rax),%esi
  mov    -0x38(%rbp),%rax
  add    $0x8,%rax
  push   $0x1
  push   %r8
  push   %rdi
  push   $0x1
  push   %r9
  push   %rcx
  mov    $0x1,%r9d
  mov    %r10d,%r8d
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    %rax,%rdi
  call   <Interpolate>
  add    $0x30,%rsp
  movq   %xmm0,%rax
  jmp    L74
L186:
  mov    -0x38(%rbp),%rax
  movsd  (%rax),%xmm0
  cvttsd2si %xmm0,%ecx
  mov    0x28(%rbp),%rax
  mov    (%rax),%rax
  mov    -0x48(%rbp),%rdx
  mov    %ecx,%esi
  mov    %rdx,%rdi
  movq   %rax,%xmm0
  call   <SearchGrid@plt>
  mov    %eax,-0x14(%rbp)
  mov    -0x24(%rbp),%eax
  lea    -0x1(%rax),%r8d
  mov    0x28(%rbp),%rax
  lea    0x8(%rax),%rdi
  mov    -0x38(%rbp),%rax
  movsd  (%rax),%xmm0
  cvttsd2si %xmm0,%ecx
  mov    -0x18(%rbp),%eax
  cltd
  idiv   %ecx
  mov    %eax,%r9d
  mov    -0x14(%rbp),%eax
  imul   -0x28(%rbp),%eax
  mov    -0x38(%rbp),%rdx
  movsd  (%rdx),%xmm0
  cvttsd2si %xmm0,%esi
  cltd
  idiv   %esi
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x10(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x38(%rbp),%rax
  movsd  (%rax),%xmm0
  cvttsd2si %xmm0,%edx
  mov    -0x1c(%rbp),%eax
  sub    %edx,%eax
  mov    %eax,%r10d
  mov    -0x38(%rbp),%rax
  movsd  (%rax),%xmm0
  cvttsd2si %xmm0,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rax,%rdx
  mov    -0x20(%rbp),%eax
  lea    -0x1(%rax),%esi
  mov    -0x38(%rbp),%rax
  add    $0x8,%rax
  push   $0x1
  push   %r8
  push   %rdi
  push   $0x1
  push   %r9
  push   %rcx
  mov    $0x1,%r9d
  mov    %r10d,%r8d
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    %rax,%rdi
  call   <Interpolate>
  add    $0x30,%rsp
  movq   %xmm0,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x24(%rbp),%eax
  lea    -0x1(%rax),%r8d
  mov    0x28(%rbp),%rax
  lea    0x8(%rax),%rdi
  mov    -0x38(%rbp),%rax
  movsd  (%rax),%xmm0
  cvttsd2si %xmm0,%ecx
  mov    -0x18(%rbp),%eax
  cltd
  idiv   %ecx
  mov    %eax,%r9d
  mov    -0x14(%rbp),%eax
  add    $0x1,%eax
  imul   -0x28(%rbp),%eax
  mov    -0x38(%rbp),%rdx
  movsd  (%rdx),%xmm0
  cvttsd2si %xmm0,%esi
  cltd
  idiv   %esi
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x10(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x38(%rbp),%rax
  movsd  (%rax),%xmm0
  cvttsd2si %xmm0,%edx
  mov    -0x1c(%rbp),%eax
  sub    %edx,%eax
  mov    %eax,%r10d
  mov    -0x38(%rbp),%rax
  movsd  (%rax),%xmm0
  cvttsd2si %xmm0,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rax,%rdx
  mov    -0x20(%rbp),%eax
  lea    -0x1(%rax),%esi
  mov    -0x38(%rbp),%rax
  add    $0x8,%rax
  push   $0x1
  push   %r8
  push   %rdi
  push   $0x1
  push   %r9
  push   %rcx
  mov    $0x1,%r9d
  mov    %r10d,%r8d
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    %rax,%rdi
  call   <Interpolate>
  add    $0x30,%rsp
  movq   %xmm0,%rax
  mov    %rax,-0x8(%rbp)
  movsd  -0x8(%rbp),%xmm0
  movapd %xmm0,%xmm1
  subsd  -0x10(%rbp),%xmm1
  mov    0x28(%rbp),%rax
  movsd  (%rax),%xmm0
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  subsd  %xmm2,%xmm0
  mulsd  %xmm1,%xmm0
  mov    -0x14(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  subsd  %xmm2,%xmm1
  divsd  %xmm1,%xmm0
  addsd  -0x10(%rbp),%xmm0
  movq   %xmm0,%rax
L74:
  movq   %rax,%xmm0
  leave
  ret
```

tool_calls: name: read_data
arguments: tag: D30
type_guessed: string
name: read_data
arguments: tag: D44
type_guessed: string
name: read_data
arguments: tag: D22
type_guessed: string
name: read_data
arguments: tag: D13
type_guessed: string
name: read_data
arguments: tag: D7
type_guessed: string

tool: D30: Arguments to Interpolate must be vectors.

tool: D44: The size of the argument vector is not the same as
  the dimension vector of a table.

tool: D22: The dimension vector of a table must only contain integers.

tool: D13: The size of the grid vector is not consistent with
  information in the dimension vector of a table.

tool: D7: The size of the table value vector is not
  consistent with information in the dimension vector.

assistant: ```c
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]));
  }
}
```