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

```asm
<spatial_disconts>:
  endbr64
  push   %r14
  mov    %ecx,%r10d
  push   %r13
  lea    -0x1(%r8),%r13d
  push   %r12
  mov    %r8d,%r12d
  push   %rbp
  push   %rbx
  cmp    $0x1,%r13d
  jle    L149
  movslq %ecx,%rbp
  mov    %rsi,%r11
  mov    %r10d,%ebx
  mov    %rdx,%rsi
  neg    %rbp
  movss  D5(%rip),%xmm5
  movss  D4(%rip),%xmm8
  mov    $0x1,%r8d
  movaps %xmm5,%xmm9
  shl    $0x2,%rbp
  movaps %xmm5,%xmm7
  movaps %xmm5,%xmm6
  lea    (%rdi,%rbp,1),%rcx
  add    %r11,%rbp
  nopl   0x0(%rax,%rax,1)
L31:
  cmp    $0x2,%r10d
  jle    L24
  movslq %ebx,%rdx
  lea    -0x3(%r10),%r14d
  movsd  D16(%rip),%xmm4
  pxor   %xmm3,%xmm3
  lea    0x4(,%rdx,4),%rax
  lea    0x2(%rdx,%r14,1),%rdx
  shl    $0x2,%rdx
  jmp    L39
L89:
  subss  -0x4(%rdi,%rax,1),%xmm1
  comiss %xmm1,%xmm3
  jbe    L155
  xorps  %xmm6,%xmm1
L155:
  comiss %xmm0,%xmm1
  jae    L10
  movss  (%r11,%rax,1),%xmm1
  movaps %xmm1,%xmm2
  subss  0x0(%rbp,%rax,1),%xmm2
  comiss %xmm2,%xmm3
  jbe    L35
  xorps  %xmm7,%xmm2
L35:
  comiss %xmm0,%xmm2
  jae    L10
  subss  -0x4(%r11,%rax,1),%xmm1
  comiss %xmm1,%xmm3
  jbe    L62
  xorps  %xmm9,%xmm1
L62:
  comiss %xmm0,%xmm1
  jae    L10
  movss  %xmm8,(%r9,%rax,1)
  add    $0x4,%rax
  cmp    %rdx,%rax
  je     L24
  nopl   0x0(%rax,%rax,1)
L39:
  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    L112
  xorps  %xmm5,%xmm2
L112:
  comiss %xmm0,%xmm2
  jb     L89
L10:
  movl   $0x0,(%r9,%rax,1)
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L39
L24:
  add    $0x1,%r8d
  add    %r10d,%ebx
  cmp    %r13d,%r8d
  jne    L31
L149:
  test   %r12d,%r12d
  jle    L148
  movslq %r10d,%rcx
  mov    %r9,%rax
  xor    %edx,%edx
  lea    0x0(,%rcx,4),%rsi
  nopl   (%rax)
L128:
  add    $0x1,%edx
  movl   $0x0,(%rax)
  movl   $0x0,-0x4(%rax,%rcx,4)
  add    %rsi,%rax
  cmp    %edx,%r12d
  jne    L128
L148:
  test   %r10d,%r10d
  jle    L46
  mov    %r10d,%edx
  lea    -0x1(%r10),%ecx
  imul   %r13d,%r10d
  lea    0x0(,%rdx,4),%r12
  movslq %r10d,%rax
  add    %rax,%rdx
  lea    0x0(,%rax,4),%rbx
  shl    $0x2,%rdx
  test   %rdx,%rdx
  jle    L131
  cmp    %r12,%rbx
  jl     L170
L131:
  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>
L170:
  lea    0x4(%r9,%rcx,4),%rdx
  nopl   (%rax)
L81:
  movl   $0x0,(%r9)
  movl   $0x0,(%r9,%rax,4)
  add    $0x4,%r9
  cmp    %r9,%rdx
  jne    L81
L46:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D5
datatype: byte[4]
name: disassemble_data
arguments: data_tag: D4
datatype: f32
name: disassemble_data
arguments: data_tag: D16
datatype: f64

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

tool: D4: 1

tool: D16: 1.4142136

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;
  }
}
```