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

```asm
<interp_z>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %ecx,0x8(%rsp)
  mov    %fs:0x28,%rcx
  mov    %rcx,0x28(%rsp)
  xor    %ecx,%ecx
  test   %rdi,%rdi
  je     L184
  movaps %xmm1,%xmm2
  pxor   %xmm1,%xmm1
  mov    %rdi,%r10
  mov    %esi,%eax
  comiss %xmm0,%xmm1
  ja     L65
  lea    -0x1(%rsi),%ecx
  pxor   %xmm3,%xmm3
  pxor   %xmm4,%xmm4
  cvtsi2ss %ecx,%xmm3
  minss  %xmm0,%xmm3
  cvttss2si %xmm3,%r14d
  movaps %xmm3,%xmm0
  cvtsi2ss %r14d,%xmm4
  lea    0x1(%r14),%edi
  comiss %xmm4,%xmm0
  subss  %xmm4,%xmm3
  cmovbe %r14d,%edi
  comiss %xmm2,%xmm1
  ja     L132
L153:
  sub    $0x1,%edx
  pxor   %xmm0,%xmm0
  cvtsi2ss %edx,%xmm0
  minss  %xmm2,%xmm0
  cvttss2si %xmm0,%ebx
  movaps %xmm0,%xmm2
  pxor   %xmm0,%xmm0
  movaps %xmm2,%xmm1
  cvtsi2ss %ebx,%xmm0
  mov    %ebx,0x4(%rsp)
  lea    0x1(%rbx),%r12d
  comiss %xmm0,%xmm2
  subss  %xmm0,%xmm1
  jbe    L42
  cmp    %r14d,%edi
  jl     L70
L121:
  mov    0x4(%rsp),%r8d
  lea    (%rax,%rax,2),%r13d
  lea    0x2(%r14),%ecx
  mov    %r14d,0xc(%rsp)
  movslq %r13d,%rbp
  lea    0x1(%rdi),%ebx
  lea    0x1(%r14),%r15d
  imul   %r8d,%eax
  sub    %r14d,%ebx
  shl    $0x2,%rbp
  add    %r14d,%eax
  lea    (%rax,%rax,2),%edx
  movslq %edx,%rax
  add    $0x9,%edx
  lea    0x8(%r10,%rax,4),%r9
  lea    0x3(%r14),%eax
  mov    %ecx,%r14d
  mov    %eax,(%rsp)
  xor    %eax,%eax
  nop
L68:
  movss  (%r9),%xmm0
  movslq %eax,%rsi
  lea    0x1(%rax),%ecx
  movss  %xmm0,0x10(%rsp,%rsi,4)
  cmp    %r15d,%edi
  jl     L113
  lea    -0x6(%rdx),%esi
  movslq %ecx,%rcx
  lea    0x2(%rax),%r11d
  movslq %esi,%rsi
  movss  0x8(%r10,%rsi,4),%xmm0
  movss  %xmm0,0x10(%rsp,%rcx,4)
  cmp    %r14d,%edi
  jl     L113
  lea    -0x3(%rdx),%ecx
  movslq %r11d,%r11
  lea    0x3(%rax),%esi
  movslq %ecx,%rcx
  movss  0x8(%r10,%rcx,4),%xmm0
  movss  %xmm0,0x10(%rsp,%r11,4)
  cmp    (%rsp),%edi
  jl     L113
  movslq %edx,%rcx
  movslq %esi,%rsi
  movss  0x8(%r10,%rcx,4),%xmm0
  movss  %xmm0,0x10(%rsp,%rsi,4)
L113:
  add    $0x1,%r8d
  add    %ebx,%eax
  add    %rbp,%r9
  add    %r13d,%edx
  cmp    %r8d,%r12d
  jge    L68
  mov    0xc(%rsp),%r14d
  cmp    %r12d,0x4(%rsp)
  je     L148
  cmp    %r14d,%edi
  jne    L185
  movq   0x10(%rsp),%xmm0
  movlps %xmm0,0x14(%rsp)
  shufps $0xe5,%xmm0,%xmm0
  movss  %xmm0,0x1c(%rsp)
L185:
  mov    0x8(%rsp),%esi
  lea    0x10(%rsp),%rdi
  movaps %xmm3,%xmm0
  call   <interp_tri@plt>
L147:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L129
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L65:
  xor    %r14d,%r14d
  xor    %edi,%edi
  movaps %xmm1,%xmm3
  comiss %xmm2,%xmm1
  jbe    L153
L132:
  movl   $0x0,0x4(%rsp)
L42:
  mov    0x4(%rsp),%r12d
  cmp    %r14d,%edi
  jge    L121
L70:
  cmp    %r12d,0x4(%rsp)
  jne    L185
  movss  0x10(%rsp),%xmm0
  movss  0x14(%rsp),%xmm2
  unpcklps %xmm2,%xmm0
  movlps %xmm0,0x18(%rsp)
  jmp    L185
L148:
  movss  0x10(%rsp),%xmm0
  cmp    %r14d,%edi
  je     L147
  movss  0x14(%rsp),%xmm2
  unpcklps %xmm2,%xmm0
  movlps %xmm0,0x18(%rsp)
  jmp    L185
L184:
  pxor   %xmm0,%xmm0
  jmp    L147
L129:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
float interp_z(float *verts, int ncols, int nrows, int grid_scheme, float xcol, float yrow) {
  int i, ir, irowa, irowb, mxrow, ic, icola, icolb, mxcol, irc;
  float x, y, z[4];
  if (verts == 0)
    return 0.0;
  mxcol = ncols - 1;
  x = (xcol < 0.0) ? 0.0 : (xcol > (float)mxcol) ? mxcol : xcol;
  icola = icolb = x;
  if (x > (float)icolb)
    icolb++;
  x -= (float)icola;
  mxrow = nrows - 1;
  y = (yrow < 0.0) ? 0.0 : (yrow > (float)mxrow) ? mxrow : yrow;
  irowa = irowb = y;
  if (y > (float)irowb)
    irowb++;
  y -= (float)irowa;
  i = 0;
  for (ir = irowa; ir <= irowb; ir++) {
    for (ic = icola; ic <= icolb; ic++) {
      irc = (ir * ncols) + ic;
      z[i++] = verts[(irc * 3) + 2];
    }
  }
  if (irowa == irowb) {
    if (icola == icolb)
      return z[0];
    z[2] = z[0];
    z[3] = z[1];
  } else if (icola == icolb) {
    z[2] = z[1];
    z[1] = z[0];
    z[3] = z[2];
  }
  return interp_tri(z, x, y, grid_scheme);
}
```