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

```asm
<spatial_disconts>:
  endbr64
  push   %r14
  push   %r13
  mov    %r8d,%r13d
  push   %r12
  push   %rbp
  lea    -0x1(%r8),%ebp
  push   %rbx
  mov    %ecx,%ebx
  cmp    $0x1,%ebp
  jle    L212
  cmp    $0x2,%ecx
  jle    L212
  lea    -0x3(%rcx),%eax
  mov    %rsi,%r10
  mov    %rdx,%rsi
  movslq %ecx,%rdx
  lea    0x0(,%rdx,4),%r12
  mov    %rdi,%rcx
  movss  D11(%rip),%xmm5
  mov    %r10,%r8
  lea    0x2(%rdx,%rax,1),%rdx
  sub    %r12,%rcx
  pxor   %xmm3,%xmm3
  sub    %r12,%r8
  mov    $0x1,%r11d
  shl    $0x2,%rdx
  movaps %xmm5,%xmm7
  movaps %xmm5,%xmm6
  movsd  D16(%rip),%xmm4
  lea    0x1(%rax),%r14
  movaps %xmm5,%xmm9
  movss  D2(%rip),%xmm8
  nopl   0x0(%rax)
L104:
  mov    %r14,%rax
  neg    %rax
  lea    (%rdx,%rax,4),%rax
  jmp    L26
  nopl   0x0(%rax)
L213:
  subss  -0x4(%rdi,%rax,1),%xmm1
  comiss %xmm1,%xmm3
  jbe    L35
  xorps  %xmm6,%xmm1
L35:
  comiss %xmm0,%xmm1
  jae    L193
  movss  (%r10,%rax,1),%xmm1
  movaps %xmm1,%xmm2
  subss  (%r8,%rax,1),%xmm2
  comiss %xmm2,%xmm3
  jbe    L16
  xorps  %xmm7,%xmm2
L16:
  comiss %xmm0,%xmm2
  jae    L193
  subss  -0x4(%r10,%rax,1),%xmm1
  comiss %xmm1,%xmm3
  jbe    L228
  xorps  %xmm9,%xmm1
L228:
  comiss %xmm0,%xmm1
  jae    L193
  movss  %xmm8,(%r9,%rax,1)
  add    $0x4,%rax
  cmp    %rdx,%rax
  je     L112
  nopl   0x0(%rax,%rax,1)
L26:
  movss  (%rdi,%rax,1),%xmm1
  pxor   %xmm0,%xmm0
  cvtss2sd (%rsi,%rax,1),%xmm0
  mulsd  %xmm4,%xmm0
  movaps %xmm1,%xmm2
  subss  (%rcx,%rax,1),%xmm2
  comiss %xmm2,%xmm3
  cvtsd2ss %xmm0,%xmm0
  jbe    L184
  xorps  %xmm5,%xmm2
L184:
  comiss %xmm0,%xmm2
  jb     L213
L193:
  movl   $0x0,(%r9,%rax,1)
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L26
L112:
  add    $0x1,%r11d
  add    %r12,%rdx
  cmp    %ebp,%r11d
  jne    L104
L212:
  test   %r13d,%r13d
  jle    L88
  cmp    $0x1,%ebx
  jne    L128
  mov    %ebp,%edx
  mov    %r9,%rax
  lea    0x4(%r9,%rdx,4),%rdx
L211:
  movl   $0x0,(%rax)
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L211
  nopw   0x0(%rax,%rax,1)
L0:
  mov    %ebx,%edx
  lea    -0x1(%rbx),%ecx
  imul   %ebp,%ebx
  lea    0x0(,%rdx,4),%r12
  movslq %ebx,%rax
  add    %rax,%rdx
  lea    0x0(,%rax,4),%rbx
  shl    $0x2,%rdx
  test   %rdx,%rdx
  jle    L187
  cmp    %r12,%rbx
  jl     L11
L187:
  mov    %r12,%rdx
  xor    %esi,%esi
  mov    %r9,%rdi
  call   <memset@plt>
  mov    %r12,%rdx
  xor    %esi,%esi
  lea    (%rax,%rbx,1),%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  jmp    1050 <memset@plt>
L128:
  movslq %ebx,%rcx
  mov    %r9,%rax
  xor    %edx,%edx
  lea    0x0(,%rcx,4),%rsi
  nop
L181:
  add    $0x1,%edx
  movl   $0x0,(%rax)
  movl   $0x0,-0x4(%rax,%rcx,4)
  add    %rsi,%rax
  cmp    %edx,%r13d
  jne    L181
L88:
  test   %ebx,%ebx
  jg     L0
L202:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L11:
  lea    0x4(%r9,%rcx,4),%rdx
  nopl   0x0(%rax,%rax,1)
L226:
  movl   $0x0,(%r9)
  movl   $0x0,(%r9,%rax,4)
  add    $0x4,%r9
  cmp    %r9,%rdx
  jne    L226
  jmp    L202
```

tool_calls: name: unpack_data
arguments: data_tag: D11
data_type: byte[4]
name: unpack_data
arguments: data_tag: D16
data_type: f64
name: unpack_data
arguments: data_tag: D2
data_type: f32

tool: {"D11": [0x00,0x00,0x00,0x80]}

tool: D16: 1.4142136

tool: D2: 1

assistant: ```c
void spatial_disconts(u, v, s2, nx, ny, discont) float *u, *v, *discont;
int nx, ny;
float *s2;
{
  float image_abs_max(), variance(), mean();
  int index, nx_max, ny_max, i, j;
  float t2;
  for (i = 1; i < ny - 1; i++) {
    for (j = 1; j < nx - 1; j++) {
      index = i * nx + j;
      t2 = s2[index] * 1.4142136;
      if ((((u[index] - u[index - nx]) < 0 ? -(u[index] - u[index - nx]) : (u[index] - u[index - nx])) >= t2) || (((u[index] - u[index - 1]) < 0 ? -(u[index] - u[index - 1]) : (u[index] - u[index - 1])) >= t2) || (((v[index] - v[index - nx]) < 0 ? -(v[index] - v[index - nx]) : (v[index] - v[index - nx])) >= t2) || (((v[index] - v[index - 1]) < 0 ? -(v[index] - v[index - 1]) : (v[index] - v[index - 1])) >= t2))
        discont[index] = 0.0;
      else
        discont[index] = 1.0;
    }
  }
  ny_max = ny - 1;
  nx_max = nx - 1;
  for (i = 0; i < ny; i++) {
    discont[i * nx] = 0.0;
    discont[i * nx + nx_max] = 0.0;
  }
  for (j = 0; j < nx; j++) {
    discont[j] = 0.0;
    discont[ny_max * nx + j] = 0.0;
  }
}
```