user: Please show me the C implementation that matches the assembly code listed below:

```asm
<kde>:
  endbr64
  movaps %xmm0,%xmm7
  movaps %xmm3,%xmm0
  push   %r15
  divss  %xmm7,%xmm0
  push   %r14
  mov    %esi,%r14d
  push   %r13
  push   %r12
  mov    %edx,%r12d
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  mov    %r8,%rbx
  sub    $0x28,%rsp
  mov    %rdi,0x18(%rsp)
  movslq 0x60(%rsp),%r15
  movss  %xmm1,0x14(%rsp)
  movss  %xmm2,0x10(%rsp)
  movss  %xmm7,0xc(%rsp)
  mov    %r9,(%rsp)
  movss  %xmm3,0x8(%rsp)
  call   <ceil@plt>
  movss  0xc(%rsp),%xmm7
  movss  0x10(%rsp),%xmm2
  mov    %rax,%r13
  mov    %r14d,%eax
  movss  0x14(%rsp),%xmm1
  mov    0x18(%rsp),%rdi
  imul   %r12d,%eax
  test   %eax,%eax
  jle    L12
  cltq
  xor    %esi,%esi
  movss  %xmm2,0x14(%rsp)
  lea    0x0(,%rax,4),%rdx
  movss  %xmm1,0x10(%rsp)
  movss  %xmm7,0xc(%rsp)
  call   <memset@plt>
  movss  0xc(%rsp),%xmm7
  movss  0x10(%rsp),%xmm1
  movss  0x14(%rsp),%xmm2
  mov    %rax,%rdi
L12:
  movss  D0(%rip),%xmm9
  comiss 0x8(%rsp),%xmm9
  ja     L16
  test   %r15d,%r15d
  jle    L50
  movss  0x8(%rsp),%xmm4
  mov    %rbp,%rcx
  lea    -0x1(%r15),%eax
  mov    (%rsp),%rbp
  movsd  D1(%rip),%xmm6
  lea    0x4(%rbx,%rax,4),%r11
  mulss  %xmm4,%xmm4
L124:
  movaps %xmm2,%xmm0
  subss  (%rbx),%xmm0
  mov    $0x0,%esi
  divss  %xmm7,%xmm0
  cvttss2si %xmm0,%eax
  movss  (%rcx),%xmm0
  subss  %xmm1,%xmm0
  mov    %eax,%r8d
  lea    0x1(%r13,%rax,1),%r10d
  divss  %xmm7,%xmm0
  cvttss2si %xmm0,%edx
  mov    %edx,%r9d
  lea    0x1(%r13,%rdx,1),%edx
  sub    %r13d,%r9d
  cmovs  %esi,%r9d
  cmp    %r12d,%edx
  cmovg  %r12d,%edx
  sub    %r13d,%r8d
  cmovs  %esi,%r8d
  cmp    %r14d,%r10d
  cmovg  %r14d,%r10d
  cmp    %r8d,%r10d
  jle    L6
  mov    %r8d,%esi
  imul   %r12d,%esi
L27:
  cmp    %r9d,%edx
  jle    L133
  pxor   %xmm0,%xmm0
  pxor   %xmm5,%xmm5
  pxor   %xmm3,%xmm3
  mov    %r9d,%eax
  cvtsi2sd %r8d,%xmm0
  cvtss2sd %xmm7,%xmm5
  cvtss2sd %xmm2,%xmm3
  pxor   %xmm8,%xmm8
  cvtss2sd %xmm1,%xmm8
  addsd  %xmm6,%xmm0
  mulsd  %xmm5,%xmm0
  subsd  %xmm0,%xmm3
  cvtsd2ss %xmm3,%xmm3
  nop
L38:
  pxor   %xmm0,%xmm0
  movaps %xmm3,%xmm10
  subss  (%rbx),%xmm10
  cvtsi2sd %eax,%xmm0
  mulss  %xmm10,%xmm10
  addsd  %xmm6,%xmm0
  mulsd  %xmm5,%xmm0
  addsd  %xmm8,%xmm0
  cvtsd2ss %xmm0,%xmm0
  subss  (%rcx),%xmm0
  mulss  %xmm0,%xmm0
  addss  %xmm10,%xmm0
  comiss %xmm0,%xmm4
  jbe    L44
  divss  %xmm4,%xmm0
  movaps %xmm9,%xmm10
  lea    (%rax,%rsi,1),%r15d
  movslq %r15d,%r15
  lea    (%rdi,%r15,4),%r15
  subss  %xmm0,%xmm10
  pxor   %xmm0,%xmm0
  cvtsi2ssl 0x0(%rbp),%xmm0
  mulss  %xmm10,%xmm10
  addss  %xmm10,%xmm0
  addss  (%r15),%xmm0
  movss  %xmm0,(%r15)
L44:
  add    $0x1,%eax
  cmp    %eax,%edx
  jne    L38
L133:
  add    $0x1,%r8d
  add    %r12d,%esi
  cmp    %r8d,%r10d
  jne    L27
L6:
  add    $0x4,%rbx
  add    $0x4,%rcx
  add    $0x4,%rbp
  cmp    %rbx,%r11
  jne    L124
L50:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L16:
  test   %r15d,%r15d
  jle    L50
  mov    (%rsp),%rsi
  xor    %eax,%eax
L59:
  movss  0x0(%rbp,%rax,4),%xmm0
  subss  %xmm1,%xmm0
  divss  %xmm7,%xmm0
  cvttss2si %xmm0,%edx
  test   %edx,%edx
  js     L134
  cmp    %edx,%r12d
  jle    L134
  movaps %xmm2,%xmm0
  subss  (%rbx,%rax,4),%xmm0
  divss  %xmm7,%xmm0
  cvttss2si %xmm0,%ecx
  test   %ecx,%ecx
  js     L134
  cmp    %ecx,%r14d
  jle    L134
  imul   %r12d,%ecx
  pxor   %xmm0,%xmm0
  cvtsi2ssl (%rsi,%rax,4),%xmm0
  add    %ecx,%edx
  movslq %edx,%rdx
  lea    (%rdi,%rdx,4),%rdx
  addss  (%rdx),%xmm0
  movss  %xmm0,(%rdx)
L134:
  add    $0x1,%rax
  cmp    %rax,%r15
  jne    L59
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D0
type_guessed: byte[4]
name: retrieve_data
arguments: data_label: D1
type_guessed: f64

tool: {"D0": [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);
          }
        }
      }
    }
  }
}
```