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

```asm
<dsmooth>:
  endbr64
  push   %r15
  cvtss2sd %xmm0,%xmm0
  movapd %xmm0,%xmm1
  push   %r14
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mulsd  D2(%rip),%xmm1
  movsd  %xmm0,(%rsp)
  mov    %esi,0x28(%rsp)
  mov    %edx,0x2c(%rsp)
  mov    %rcx,0x18(%rsp)
  cvttsd2si %xmm1,%edi
  call   <ceilf@plt>
  lea    (%rax,%rax,1),%ebp
  lea    0x1(%rbp),%r13d
  mov    %ebp,%ebx
  lea    0x0(,%r13,4),%edi
  shr    $0x1f,%ebx
  call   <malloc@plt>
  movsd  (%rsp),%xmm0
  add    %r13d,%ebx
  pxor   %xmm4,%xmm4
  mov    %rax,0x48(%rsp)
  sar    %ebx
  movapd %xmm0,%xmm1
  addsd  %xmm0,%xmm1
  mulsd  %xmm0,%xmm1
  movsd  D14(%rip),%xmm0
  divsd  %xmm1,%xmm0
  cvtsd2ss %xmm0,%xmm4
  movss  %xmm4,0x8(%rsp)
  test   %r13d,%r13d
  jle    L18
  pxor   %xmm0,%xmm0
  mov    0x48(%rsp),%r14
  cvtsi2ss %r13d,%xmm0
  xor    %r13d,%r13d
  cvtss2sd %xmm0,%xmm0
  subsd  D5(%rip),%xmm0
  mulsd  D41(%rip),%xmm0
  movsd  %xmm0,(%rsp)
  nopl   0x0(%rax)
L167:
  pxor   %xmm0,%xmm0
  cvtsi2ss %r13d,%xmm0
  cvtss2sd %xmm0,%xmm0
  subsd  (%rsp),%xmm0
  cvtsd2ss %xmm0,%xmm0
  mulss  %xmm0,%xmm0
  mulss  0x8(%rsp),%xmm0
  call   <exp@plt>
  mov    %r13,%rax
  movss  %xmm0,(%r14,%r13,4)
  add    $0x1,%r13
  cmp    %rbp,%rax
  jne    L167
  mov    0x48(%rsp),%rdx
  pxor   %xmm0,%xmm0
  mov    %rdx,%rax
  lea    0x4(%rdx,%rbp,4),%rcx
L28:
  addss  (%rdx),%xmm0
  add    $0x4,%rdx
  cmp    %rcx,%rdx
  jne    L28
  movss  D8(%rip),%xmm1
  divss  %xmm0,%xmm1
  nopl   0x0(%rax)
L120:
  movss  (%rax),%xmm0
  add    $0x4,%rax
  mulss  %xmm1,%xmm0
  movss  %xmm0,-0x4(%rax)
  cmp    %rcx,%rax
  jne    L120
L18:
  mov    0x2c(%rsp),%r14d
  mov    0x28(%rsp),%edi
  mov    %r14d,%esi
  call   <MAX@plt>
  lea    0x0(,%rax,4),%edi
  call   <malloc@plt>
  mov    0x48(%rsp),%rsi
  mov    %rax,%rbp
  movslq %ebx,%rax
  lea    (%rsi,%rax,4),%rax
  mov    %rax,0x8(%rsp)
  test   %r14d,%r14d
  jle    L152
  movslq 0x28(%rsp),%rax
  movl   $0x0,0x20(%rsp)
  mov    %r12,%r15
  mov    %rbp,(%rsp)
  mov    %rax,%rsi
  mov    %rax,0x10(%rsp)
  shl    $0x2,%rax
  mov    %rax,0x40(%rsp)
  mov    0x18(%rsp),%rax
  shl    $0x2,%esi
  mov    %esi,0x38(%rsp)
  mov    %rax,0x30(%rsp)
  cs nopw 0x0(%rax,%rax,1)
L46:
  mov    0x28(%rsp),%eax
  mov    0x8(%rsp),%r14
  xor    %r12d,%r12d
  lea    -0x1(%rax),%r13d
  test   %eax,%eax
  jle    L11
  mov    %r15,%rax
  mov    %r14,%r15
  mov    %r12,%r14
  mov    %rax,%r12
L123:
  mov    %r14d,%edi
  xor    %esi,%esi
  sub    %ebx,%edi
  call   <MAX@plt>
  lea    (%rbx,%r14,1),%edi
  mov    %r13d,%esi
  mov    %eax,%ebp
  call   <MIN@plt>
  cmp    %eax,%ebp
  jg     L121
  movslq %ebp,%rdx
  pxor   %xmm1,%xmm1
  nopl   0x0(%rax)
L23:
  movss  (%r12,%rdx,4),%xmm0
  mulss  (%r15,%rdx,4),%xmm0
  add    $0x1,%rdx
  addss  %xmm0,%xmm1
  cmp    %edx,%eax
  jge    L23
L218:
  mov    (%rsp),%rax
  sub    $0x4,%r15
  movss  %xmm1,(%rax,%r14,4)
  add    $0x1,%r14
  cmp    0x10(%rsp),%r14
  jne    L123
  mov    %r12,%r15
L11:
  mov    0x30(%rsp),%r14
  mov    (%rsp),%rsi
  mov    0x38(%rsp),%edx
  mov    %r14,%rdi
  call   <memcpy@plt>
  mov    0x40(%rsp),%rsi
  addl   $0x1,0x20(%rsp)
  mov    0x20(%rsp),%eax
  add    %rsi,%r14
  add    %rsi,%r15
  mov    %r14,0x30(%rsp)
  cmp    %eax,0x2c(%rsp)
  jne    L46
  mov    (%rsp),%rbp
L152:
  mov    0x28(%rsp),%edx
  test   %edx,%edx
  jle    L84
  movslq 0x28(%rsp),%rax
  mov    %rbp,(%rsp)
  xor    %r12d,%r12d
  mov    %rax,0x30(%rsp)
  lea    0x0(,%rax,4),%r13
  mov    0x2c(%rsp),%eax
  sub    $0x1,%eax
  mov    %rax,0x10(%rsp)
  mov    %rax,%r14
  lea    0x4(%rbp,%rax,4),%rax
  mov    %rax,0x38(%rsp)
  mov    0x8(%rsp),%rax
  add    $0x4,%rax
  mov    %rax,0x20(%rsp)
  nopl   0x0(%rax)
L157:
  mov    0x2c(%rsp),%eax
  xor    %r15d,%r15d
  test   %eax,%eax
  jle    L73
  mov    %r13,%rax
  mov    %r15,%r13
  mov    %rax,%r15
  nopl   0x0(%rax,%rax,1)
L150:
  mov    %r13d,%edi
  xor    %esi,%esi
  sub    %ebx,%edi
  call   <MAX@plt>
  lea    (%rbx,%r13,1),%edi
  mov    %r14d,%esi
  mov    %eax,%ebp
  call   <MIN@plt>
  mov    %eax,%ecx
  cmp    %eax,%ebp
  jg     L198
  mov    0x28(%rsp),%eax
  mov    0x18(%rsp),%rsi
  sub    %ebp,%ecx
  pxor   %xmm1,%xmm1
  imul   %ebp,%eax
  cltq
  add    %r12,%rax
  lea    (%rsi,%rax,4),%rdx
  mov    0x8(%rsp),%rax
  movslq %ebp,%rsi
  sub    %r13,%rsi
  add    %rsi,%rcx
  lea    (%rax,%rsi,4),%rax
  mov    0x20(%rsp),%rsi
  lea    (%rsi,%rcx,4),%rcx
  nopw   0x0(%rax,%rax,1)
L183:
  movss  (%rdx),%xmm0
  mulss  (%rax),%xmm0
  add    $0x4,%rax
  add    %r15,%rdx
  addss  %xmm0,%xmm1
  cmp    %rax,%rcx
  jne    L183
L172:
  mov    (%rsp),%rax
  movss  %xmm1,(%rax,%r13,4)
  lea    0x1(%r13),%rax
  cmp    0x10(%rsp),%r13
  je     L210
  mov    %rax,%r13
  jmp    L150
  nopl   (%rax)
L210:
  mov    0x18(%rsp),%rax
  mov    0x38(%rsp),%rcx
  mov    %r15,%r13
  lea    (%rax,%r12,4),%rdx
  mov    (%rsp),%rax
  nopl   (%rax)
L163:
  movss  (%rax),%xmm0
  add    $0x4,%rax
  movss  %xmm0,(%rdx)
  add    %r13,%rdx
  cmp    %rcx,%rax
  jne    L163
L73:
  add    $0x1,%r12
  cmp    %r12,0x30(%rsp)
  jne    L157
  mov    (%rsp),%rbp
L84:
  test   %rbp,%rbp
  je     L133
  mov    %rbp,%rdi
  call   <free@plt>
L133:
  mov    0x48(%rsp),%rax
  test   %rax,%rax
  je     L140
  add    $0x58,%rsp
  mov    %rax,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10b0 <free@plt>
  nopl   0x0(%rax)
L121:
  pxor   %xmm1,%xmm1
  jmp    L218
  nopl   0x0(%rax)
L198:
  pxor   %xmm1,%xmm1
  jmp    L172
L140:
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: parse_data
arguments: tag: D2
data_type: f64
name: parse_data
arguments: tag: D14
data_type: f32[2]
name: parse_data
arguments: tag: D5
data_type: f64
name: parse_data
arguments: tag: D41
data_type: f64
name: parse_data
arguments: tag: D8
data_type: byte[4]

tool: D2: 3

tool: {"D14": [0.0,-1.875]}

tool: D5: 1

tool: D41: 0.5

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

assistant: ```c
void dsmooth(float *image, int nx, int ny, float sigma, float *smooth) {
  int i, j, npix, half, start, end, sample;
  float neghalfinvvar, total, scale, dx, sum;
  float *kernel1D;
  float *kernel_shifted;
  float *smooth_temp;
  npix = 2 * ((int)ceilf(3. * sigma)) + 1;
  half = npix / 2;
  kernel1D = malloc(npix * sizeof(float));
  neghalfinvvar = -1.0 / (2.0 * sigma * sigma);
  for (i = 0; i < npix; i++) {
    dx = ((float)i - 0.5 * ((float)npix - 1.));
    kernel1D[i] = exp((dx * dx) * neghalfinvvar);
  }
  total = 0.0;
  for (i = 0; i < npix; i++)
    total += kernel1D[i];
  scale = 1. / total;
  for (i = 0; i < npix; i++)
    kernel1D[i] *= scale;
  smooth_temp = malloc(sizeof(float) * MAX(nx, ny));
  kernel_shifted = kernel1D + half;
  for (j = 0; j < ny; j++) {
    float *imagerow = image + j * nx;
    for (i = 0; i < nx; i++) {
      start = i - half;
      start = MAX(start, 0);
      end = i + half;
      end = MIN(end, nx - 1);
      sum = 0.0;
      for (sample = start; sample <= end; sample++)
        sum += imagerow[sample] * kernel_shifted[sample - i];
      smooth_temp[i] = sum;
    }
    memcpy(smooth + j * nx, smooth_temp, nx * sizeof(float));
  }
  for (i = 0; i < nx; i++) {
    float *imagecol = smooth + i;
    for (j = 0; j < ny; j++) {
      start = j - half;
      start = MAX(start, 0);
      end = j + half;
      end = MIN(end, ny - 1);
      sum = 0.0;
      for (sample = start; sample <= end; sample++)
        sum += imagecol[sample * nx] * kernel_shifted[sample - j];
      smooth_temp[j] = sum;
    }
    for (j = 0; j < ny; j++)
      smooth[i + j * nx] = smooth_temp[j];
  }
  {
    if ((smooth_temp) != NULL)
      free((char *)(smooth_temp));
    (smooth_temp) = NULL;
  };
  {
    if ((kernel1D) != NULL)
      free((char *)(kernel1D));
    (kernel1D) = NULL;
  };
}
```