user: 请将以下的汇编代码转换成C语言代码：

```asm
<grid_search_nn>:
  endbr64
  push   %r15
  mov    %rcx,%r15
  push   %r14
  mov    %r9,%r14
  push   %r13
  mov    %r8,%r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  sub    $0x88,%rsp
  lea    0x78(%rsp),%rbp
  lea    0x70(%rsp),%rbx
  mov    %rsi,0x8(%rsp)
  movsd  %xmm0,(%rsp)
  mov    %rbx,%rsi
  movapd %xmm1,%xmm0
  mov    %rbp,%rdi
  mov    %rdx,0x48(%rsp)
  call   <sincos@plt>
  movsd  (%rsp),%xmm2
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  movsd  0x70(%rsp),%xmm7
  movapd %xmm2,%xmm0
  movsd  %xmm7,0x18(%rsp)
  movsd  0x78(%rsp),%xmm7
  movsd  %xmm7,0x20(%rsp)
  call   <sincos@plt>
  lea    0x8(%r15),%rax
  movsd  0x70(%rsp),%xmm7
  movapd D0(%rip),%xmm0
  mov    %rax,0x50(%rsp)
  lea    0x10(%r15),%rax
  mov    %rax,0x58(%rsp)
  lea    0x18(%r15),%rax
  mov    %rax,0x60(%rsp)
  mov    0x8(%rsp),%rax
  movsd  %xmm7,0x28(%rsp)
  movsd  0x78(%rsp),%xmm7
  movups %xmm0,(%r15)
  movsd  %xmm7,0x30(%rsp)
  movups %xmm0,0x10(%r15)
  cmp    %rax,%r12
  jg     L89
  movsd  D0(%rip),%xmm7
  add    $0x1,%rax
  movl   $0x0,0x40(%rsp)
  mov    %rax,0x38(%rsp)
  movsd  %xmm7,0x10(%rsp)
  jmp    L13
  nopl   0x0(%rax,%rax,1)
L117:
  add    $0x1,%r12
  cmp    0x38(%rsp),%r12
  je     L123
L13:
  movsd  0x0(%r13,%r12,8),%xmm0
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <sincos@plt>
  movsd  0x70(%rsp),%xmm2
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  movsd  0x78(%rsp),%xmm1
  movsd  (%r14,%r12,8),%xmm0
  movsd  %xmm2,0x8(%rsp)
  movsd  %xmm1,(%rsp)
  call   <sincos@plt>
  movsd  0x18(%rsp),%xmm0
  movsd  0x20(%rsp),%xmm3
  mulsd  0x70(%rsp),%xmm0
  movsd  0x8(%rsp),%xmm2
  mulsd  0x78(%rsp),%xmm3
  movsd  (%rsp),%xmm1
  mulsd  0x28(%rsp),%xmm2
  mulsd  0x30(%rsp),%xmm1
  addsd  %xmm3,%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm1,%xmm0
  call   <acos@plt>
  movsd  0x10(%rsp),%xmm6
  comisd %xmm0,%xmm6
  jbe    L117
  movsd  (%r15),%xmm1
  movsd  0x10(%r15),%xmm2
  comisd %xmm0,%xmm1
  ja     L115
  movsd  0x8(%r15),%xmm1
  comisd %xmm0,%xmm1
  ja     L75
  comisd %xmm0,%xmm2
  ja     L37
  movsd  0x18(%r15),%xmm1
  comisd %xmm0,%xmm1
  jbe    L117
  mov    0x48(%rsp),%rax
  mov    0x60(%rsp),%r8
  lea    0xc(%rax),%r9
L22:
  movsd  %xmm0,(%r8)
  movsd  0x18(%r15),%xmm4
  mov    %r12d,(%r9)
  add    $0x1,%r12
  movl   $0xffffffff,0x40(%rsp)
  movsd  %xmm4,0x10(%rsp)
  cmp    0x38(%rsp),%r12
  jne    L13
L123:
  movapd D28(%rip),%xmm3
  movupd (%r15),%xmm1
  movapd D23(%rip),%xmm0
  mov    0x40(%rsp),%eax
  addpd  %xmm3,%xmm1
  movapd %xmm0,%xmm2
  divpd  %xmm1,%xmm2
  movupd 0x10(%r15),%xmm1
  addpd  %xmm3,%xmm1
  divpd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  addsd  %xmm2,%xmm1
  movapd %xmm2,%xmm7
  unpckhpd %xmm7,%xmm7
  addsd  %xmm7,%xmm1
  movapd %xmm0,%xmm3
  movapd %xmm0,%xmm7
  addsd  %xmm1,%xmm3
  unpckhpd %xmm7,%xmm7
  movapd %xmm7,%xmm1
  addsd  %xmm3,%xmm1
  unpcklpd %xmm1,%xmm1
  divpd  %xmm1,%xmm2
  divpd  %xmm1,%xmm0
  movups %xmm2,(%r15)
  movups %xmm0,0x10(%r15)
  add    $0x88,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L115:
  mov    0x48(%rsp),%r9
  mov    %r15,%r8
  xor    %edi,%edi
  mov    %r9,%rcx
L103:
  lea    0x1(%rdi),%r11
  mov    $0x3,%r10d
  mov    %r9,0x68(%rsp)
  sub    %rdi,%r10
  lea    0x0(,%r11,4),%rax
  mov    %r8,0x40(%rsp)
  lea    0x0(,%r10,4),%rdx
  lea    -0x4(%rcx,%rax,1),%rsi
  mov    %r11,0x8(%rsp)
  lea    (%rcx,%rax,1),%rdi
  movsd  %xmm0,0x10(%rsp)
  mov    %r10,(%rsp)
  call   <memmove@plt>
  mov    0x8(%rsp),%r11
  mov    (%rsp),%r10
  lea    0x0(,%r11,8),%rdi
  lea    0x0(,%r10,8),%rdx
  lea    -0x8(%r15,%rdi,1),%rsi
  add    %r15,%rdi
  call   <memmove@plt>
  movsd  0x10(%rsp),%xmm0
  mov    0x40(%rsp),%r8
  mov    0x68(%rsp),%r9
  jmp    L22
  nopl   0x0(%rax)
L75:
  mov    0x48(%rsp),%rax
  mov    0x50(%rsp),%r8
  mov    $0x1,%edi
  lea    0x4(%rax),%r9
  mov    %rax,%rcx
  jmp    L103
  nopl   0x0(%rax,%rax,1)
L37:
  mov    0x48(%rsp),%rax
  mov    0x58(%rsp),%r8
  mov    $0x2,%edi
  lea    0x8(%rax),%r9
  mov    %rax,%rcx
  jmp    L103
  nopl   0x0(%rax,%rax,1)
L89:
  movl   $0x0,0x40(%rsp)
  jmp    L123
```

tool_calls: name: parse_data
arguments: tag: D0
datatype: byte[16]
name: parse_data
arguments: tag: D28
datatype: byte[16]
name: parse_data
arguments: tag: D23
datatype: f64[2]

tool: {"D0": [0x40,0x8c,0xb5,0x78,0x1d,0xaf,0x15,0x44,0x40,0x8c,0xb5,0x78,0x1d,0xaf,0x15,0x44]}

tool: {"D28": [0x9b,0x2b,0xa1,0x86,0x9b,0x84,0x06,0x3d,0x9b,0x2b,0xa1,0x86,0x9b,0x84,0x06,0x3d]}

tool: {"D23": [1.0,1.0]}

assistant: ```c
int grid_search_nn(long min_add, long max_add, int *restrict nbr_add, double *restrict nbr_dist, double plat, double plon, const double *restrict src_center_lat, const double *restrict src_center_lon) {
  int search_result = 0;
  long n, srch_add;
  long i;
  double dist_min, distance;
  double coslat_dst = cos(plat);
  double sinlat_dst = sin(plat);
  double coslon_dst = cos(plon);
  double sinlon_dst = sin(plon);
  dist_min = 1.e+20;
  for (n = 0; n < 4; ++n)
    nbr_dist[n] = 1.e+20;
  for (srch_add = min_add; srch_add <= max_add; ++srch_add) {
    distance = acos(coslat_dst * cos(src_center_lat[srch_add]) * (coslon_dst * cos(src_center_lon[srch_add]) + sinlon_dst * sin(src_center_lon[srch_add])) + sinlat_dst * sin(src_center_lat[srch_add]));
    if (distance < dist_min) {
      for (n = 0; n < 4; ++n) {
        if (distance < nbr_dist[n]) {
          for (i = 3; i > n; --i) {
            nbr_add[i] = nbr_add[i - 1];
            nbr_dist[i] = nbr_dist[i - 1];
          }
          search_result = -1;
          nbr_add[n] = srch_add;
          nbr_dist[n] = distance;
          dist_min = nbr_dist[3];
          break;
        }
      }
    }
  }
  for (n = 0; n < 4; ++n)
    nbr_dist[n] = 1.0 / (nbr_dist[n] + 1.e-14);
  distance = 0.0;
  for (n = 0; n < 4; ++n)
    distance += nbr_dist[n];
  for (n = 0; n < 4; ++n)
    nbr_dist[n] /= distance;
  return (search_result);
}
```