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

```asm
<kde>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%rbx
  mov    %esi,0x14(%rsp)
  mov    %edx,%ebp
  movss  %xmm0,0x8(%rsp)
  movss  %xmm1,0xc(%rsp)
  movss  %xmm2,0x10(%rsp)
  mov    %rcx,%r13
  mov    %r8,%r14
  mov    %r9,%r12
  mov    0x60(%rsp),%r15d
  movaps %xmm3,%xmm7
  movss  %xmm3,0x18(%rsp)
  divss  %xmm0,%xmm7
  movaps %xmm7,%xmm0
  call   <ceil@plt>
  mov    0x14(%rsp),%ecx
  imul   %ebp,%ecx
  test   %ecx,%ecx
  jle    L114
  mov    %rbx,%rdx
  lea    -0x1(%rcx),%ecx
  lea    0x4(%rbx,%rcx,4),%rcx
L88:
  movl   $0x0,(%rdx)
  add    $0x4,%rdx
  cmp    %rcx,%rdx
  jne    L88
L114:
  movss  D15(%rip),%xmm0
  comiss 0x18(%rsp),%xmm0
  ja     L92
  test   %r15d,%r15d
  jle    L148
  mov    %eax,%r11d
  movss  0x18(%rsp),%xmm2
  mulss  %xmm2,%xmm2
  mov    %r14,%r10
  lea    -0x1(%r15),%eax
  lea    0x4(%r14,%rax,4),%rax
  mov    %rax,0x18(%rsp)
  movsd  D1(%rip),%xmm7
  movapd %xmm7,%xmm5
  movss  D15(%rip),%xmm6
  jmp    L201
L92:
  test   %r15d,%r15d
  jle    L148
  mov    %r15d,%esi
  mov    $0x0,%eax
  mov    0x14(%rsp),%edi
  jmp    L68
L124:
  add    $0x1,%rax
  cmp    %rax,%rsi
  je     L148
L68:
  movss  0x0(%r13,%rax,4),%xmm0
  subss  0xc(%rsp),%xmm0
  movss  0x8(%rsp),%xmm7
  divss  %xmm7,%xmm0
  cvttss2si %xmm0,%edx
  test   %edx,%edx
  js     L124
  cmp    %edx,%ebp
  jle    L124
  movss  0x10(%rsp),%xmm0
  subss  (%r14,%rax,4),%xmm0
  divss  %xmm7,%xmm0
  cvttss2si %xmm0,%ecx
  test   %ecx,%ecx
  js     L124
  cmp    %ecx,%edi
  jle    L124
  imul   %ebp,%ecx
  add    %ecx,%edx
  movslq %edx,%rdx
  lea    (%rbx,%rdx,4),%rdx
  pxor   %xmm0,%xmm0
  cvtsi2ssl (%r12,%rax,4),%xmm0
  addss  (%rdx),%xmm0
  movss  %xmm0,(%rdx)
  jmp    L124
L191:
  add    $0x1,%eax
  cmp    %eax,%ecx
  je     L107
L143:
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  addsd  %xmm5,%xmm0
  mulsd  %xmm3,%xmm0
  addsd  %xmm4,%xmm0
  cvtsd2ss %xmm0,%xmm0
  subss  (%rdi),%xmm0
  movaps %xmm1,%xmm8
  subss  (%rsi),%xmm8
  mulss  %xmm0,%xmm0
  mulss  %xmm8,%xmm8
  addss  %xmm8,%xmm0
  comiss %xmm0,%xmm2
  jbe    L191
  lea    (%rax,%r8,1),%edx
  movslq %edx,%rdx
  lea    (%rbx,%rdx,4),%rdx
  divss  %xmm2,%xmm0
  movaps %xmm6,%xmm8
  subss  %xmm0,%xmm8
  pxor   %xmm0,%xmm0
  cvtsi2ssl (%r12),%xmm0
  mulss  %xmm8,%xmm8
  addss  %xmm8,%xmm0
  addss  (%rdx),%xmm0
  movss  %xmm0,(%rdx)
  jmp    L191
L107:
  add    $0x1,%r9d
  add    %ebp,%r8d
  cmp    %r9d,%r15d
  je     L122
L93:
  cmp    %r14d,%ecx
  jle    L107
  pxor   %xmm3,%xmm3
  cvtss2sd 0x8(%rsp),%xmm3
  pxor   %xmm1,%xmm1
  cvtss2sd 0x10(%rsp),%xmm1
  pxor   %xmm0,%xmm0
  cvtsi2sd %r9d,%xmm0
  addsd  %xmm7,%xmm0
  mulsd  %xmm3,%xmm0
  subsd  %xmm0,%xmm1
  cvtsd2ss %xmm1,%xmm1
  mov    %r14d,%eax
  pxor   %xmm4,%xmm4
  cvtss2sd 0xc(%rsp),%xmm4
  jmp    L143
L122:
  add    $0x4,%r10
  add    $0x4,%r13
  add    $0x4,%r12
  cmp    0x18(%rsp),%r10
  je     L148
L201:
  mov    %r10,%rsi
  movss  0x10(%rsp),%xmm0
  subss  (%r10),%xmm0
  movss  0x8(%rsp),%xmm4
  divss  %xmm4,%xmm0
  cvttss2si %xmm0,%eax
  mov    %r13,%rdi
  movss  0x0(%r13),%xmm0
  subss  0xc(%rsp),%xmm0
  divss  %xmm4,%xmm0
  cvttss2si %xmm0,%edx
  mov    %edx,%r14d
  sub    %r11d,%r14d
  mov    $0x0,%ecx
  cmovs  %ecx,%r14d
  lea    0x1(%r11,%rdx,1),%ecx
  cmp    %ebp,%ecx
  cmovg  %ebp,%ecx
  mov    %eax,%r9d
  sub    %r11d,%r9d
  mov    $0x0,%edx
  cmovs  %edx,%r9d
  lea    0x1(%r11,%rax,1),%r15d
  mov    0x14(%rsp),%eax
  cmp    %eax,%r15d
  cmovg  %eax,%r15d
  cmp    %r9d,%r15d
  jle    L122
  mov    %r9d,%r8d
  imul   %ebp,%r8d
  jmp    L93
L148:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: parse_data
arguments: tag: D15
data_type: byte[4]
name: parse_data
arguments: tag: D1
data_type: f64

tool: {"D15": [0x00,0x00,0x80,0x3f]}

tool: D1: 0.5

assistant: ```c
void kde(float *density, int nRow, int nCol, float cellSize, float xMin, float yMax, float *xCor, float *yCor, int *pCount, int nHH, float bandwidth) {
  int searchWindow = (int)(ceil(bandwidth / cellSize));
  int wXMin, wYMin, wXMax, wYMax;
  float cellX, cellY;
  float dist2;
  float bandwidth2 = bandwidth * bandwidth;
  int rowID, colID;
  for (int i = 0; i < nRow * nCol; i++) {
    density[i] = 0.0f;
  }
  if (bandwidth < 1) {
    for (int k = 0; k < nHH; k++) {
      rowID = (int)((yMax - yCor[k]) / cellSize);
      colID = (int)((xCor[k] - xMin) / cellSize);
      if (colID >= 0 && colID < nCol && rowID >= 0 && rowID < nRow) {
        density[rowID * nCol + colID] += pCount[k];
      }
    }
  } else {
    for (int k = 0; k < nHH; k++) {
      rowID = (int)((yMax - yCor[k]) / cellSize);
      colID = (int)((xCor[k] - xMin) / cellSize);
      wXMin = colID - searchWindow;
      wXMax = colID + searchWindow + 1;
      wYMin = rowID - searchWindow;
      wYMax = rowID + searchWindow + 1;
      if (wXMin < 0) {
        wXMin = 0;
      }
      if (wXMax > nCol) {
        wXMax = nCol;
      }
      if (wYMin < 0) {
        wYMin = 0;
      }
      if (wYMax > nRow) {
        wYMax = nRow;
      }
      for (int m = wYMin; m < wYMax; m++) {
        for (int n = wXMin; n < wXMax; n++) {
          cellX = xMin + cellSize * (n + 0.5);
          cellY = yMax - cellSize * (m + 0.5);
          dist2 = (cellX - xCor[k]) * (cellX - xCor[k]) + (cellY - yCor[k]) * (cellY - yCor[k]);
          if (dist2 < bandwidth2) {
            density[m * nCol + n] += pCount[k] + (1 - dist2 / bandwidth2) * (1 - dist2 / bandwidth2);
          }
        }
      }
    }
  }
}
```