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

```asm
<get_u_v_avg>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %edx,-0x40(%rbp)
  movss  %xmm0,-0x44(%rbp)
  mov    %rcx,-0x50(%rbp)
  mov    %r8,-0x58(%rbp)
  movl   $0xa,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  mulss  -0x44(%rbp),%xmm0
  cvttss2si %xmm0,%eax
  mov    %eax,-0x14(%rbp)
  movl   $0x0,-0x30(%rbp)
  movl   $0x0,-0x2c(%rbp)
  movl   $0x0,-0x20(%rbp)
  movl   $0x0,-0x1c(%rbp)
  movl   $0x0,-0x28(%rbp)
  jmp    L67
L72:
  movl   $0x0,-0x24(%rbp)
  jmp    L14
L24:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x10(%rbp)
  cmpl   $0x0,-0x10(%rbp)
  jne    L86
  addl   $0x3,-0x30(%rbp)
  jmp    L29
L86:
  mov    -0x30(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x30(%rbp),%eax
  cltq
  add    $0x2,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x8(%rbp)
  mov    -0xc(%rbp),%eax
  mov    %eax,%edx
  neg    %edx
  cmovns %edx,%eax
  mov    %eax,%ecx
  mov    -0x8(%rbp),%eax
  mov    %eax,%edx
  neg    %edx
  cmovns %edx,%eax
  lea    (%rcx,%rax,1),%edx
  mov    -0x18(%rbp),%eax
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  cltd
  idivl  -0x10(%rbp)
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jge    L74
  addl   $0x1,-0x2c(%rbp)
  mov    -0xc(%rbp),%eax
  add    %eax,-0x20(%rbp)
  mov    -0x8(%rbp),%eax
  add    %eax,-0x1c(%rbp)
L74:
  addl   $0x3,-0x30(%rbp)
L29:
  addl   $0x1,-0x24(%rbp)
L14:
  mov    -0x24(%rbp),%eax
  cmp    -0x40(%rbp),%eax
  jl     L24
  addl   $0x1,-0x28(%rbp)
L67:
  mov    -0x28(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jl     L72
  cmpl   $0x0,-0x2c(%rbp)
  jne    L18
  mov    $0xffffffff,%eax
  jmp    L63
L18:
  pxor   %xmm0,%xmm0
  cvtsi2ssl -0x20(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2ssl -0x2c(%rbp),%xmm1
  divss  %xmm1,%xmm0
  mov    -0x50(%rbp),%rax
  movss  %xmm0,(%rax)
  pxor   %xmm0,%xmm0
  cvtsi2ssl -0x1c(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2ssl -0x2c(%rbp),%xmm1
  divss  %xmm1,%xmm0
  mov    -0x58(%rbp),%rax
  movss  %xmm0,(%rax)
  mov    $0x0,%eax
L63:
  pop    %rbp
  ret
```

assistant: ```c
int get_u_v_avg(const int16_t *img_yuv, const int height, const int width, const float threshold, float *u_avg, float *v_avg) {
  int index, num_gray_pixel, y, x;
  int sum_u, sum_v;
  int pixel_y, pixel_u, pixel_v, color_val;
  const int shift_fact = 10;
  const int thresh = threshold * ((float)(1 << shift_fact));
  index = 0;
  num_gray_pixel = 0;
  sum_u = 0;
  sum_v = 0;
  for (y = 0; y < height; y++) {
    for (x = 0; x < width; x++) {
      pixel_y = img_yuv[index];
      if (pixel_y == 0) {
        index += 3;
        continue;
      }
      pixel_u = img_yuv[index + 1];
      pixel_v = img_yuv[index + 2];
      color_val = ((abs(pixel_u) + abs(pixel_v)) << shift_fact) / pixel_y;
      if (color_val < thresh) {
        num_gray_pixel++;
        sum_u += pixel_u;
        sum_v += pixel_v;
      }
      index += 3;
    }
  }
  if (num_gray_pixel == 0) {
    return -1;
  }
  *u_avg = ((float)sum_u) / num_gray_pixel;
  *v_avg = ((float)sum_v) / num_gray_pixel;
  return 0;
}
```