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

```asm
<color_feature_standard_deviation>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %edx,-0x40(%rbp)
  mov    %ecx,-0x44(%rbp)
  mov    %r8,-0x50(%rbp)
  mov    %r9,-0x58(%rbp)
  movl   $0x0,-0x28(%rbp)
  movl   $0x0,-0x24(%rbp)
  movq   $0x0,-0x20(%rbp)
  mov    -0x44(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x20(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  jne    L7
  mov    -0x44(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%esi
  lea    D6(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
L7:
  mov    -0x20(%rbp),%rax
  mov    $0x8,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  movl   $0x0,-0x28(%rbp)
  jmp    L3
L42:
  movl   $0x0,-0x24(%rbp)
  jmp    L71
L72:
  mov    -0x28(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x24(%rbp),%eax
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  je     L83
  mov    -0x3c(%rbp),%eax
  imul   -0x28(%rbp),%eax
  mov    %eax,%edx
  mov    -0x24(%rbp),%eax
  add    %eax,%edx
  mov    %edx,%eax
  add    %eax,%eax
  lea    (%rax,%rdx,1),%ebx
  mov    %ebx,%edx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  movsd  D14(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%eax
  mov    %eax,%edx
  lea    0x1(%rbx),%eax
  mov    %eax,%ecx
  mov    -0x58(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  movsd  D20(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%eax
  add    %eax,%edx
  lea    0x2(%rbx),%eax
  mov    %eax,%ecx
  mov    -0x58(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  movsd  D33(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%eax
  add    %edx,%eax
  mov    %al,-0x29(%rbp)
  movzbl -0x29(%rbp),%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  mov    -0x28(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x24(%rbp),%eax
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    0x10(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  mov    -0x28(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x24(%rbp),%eax
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  -0x18(%rbp),%xmm0
  mulsd  %xmm0,%xmm0
  mov    -0x28(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x24(%rbp),%eax
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  jmp    L36
L83:
  nop
L36:
  addl   $0x1,-0x24(%rbp)
L71:
  mov    -0x3c(%rbp),%eax
  cmp    %eax,-0x24(%rbp)
  jb     L72
  addl   $0x1,-0x28(%rbp)
L3:
  mov    -0x40(%rbp),%eax
  cmp    %eax,-0x28(%rbp)
  jb     L42
  movl   $0x0,-0x28(%rbp)
  jmp    L50
L59:
  mov    -0x28(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x28(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  divsd  %xmm1,%xmm0
  movq   %xmm0,%rax
  mov    -0x28(%rbp),%edx
  lea    0x0(,%rdx,8),%rcx
  mov    0x18(%rbp),%rdx
  lea    (%rcx,%rdx,1),%rbx
  movq   %rax,%xmm0
  call   <sqrt@plt>
  movq   %xmm0,%rax
  mov    %rax,(%rbx)
  addl   $0x1,-0x28(%rbp)
L50:
  mov    -0x44(%rbp),%eax
  cmp    %eax,-0x28(%rbp)
  jb     L59
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x1,%eax
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: label: D6
type: string
name: disassemble_data
arguments: label: D14
type: f64
name: disassemble_data
arguments: label: D20
type: f64
name: disassemble_data
arguments: label: D33
type: f64

tool: D6: color_feature_standard_deviation:Cannot allocate %d bytes for memory.


tool: D14: 0.2126

tool: D20: 0.7152

tool: D33: 0.0722

assistant: ```c
int color_feature_standard_deviation(int **obj_id, int width, int height, int n_object, int *area, unsigned char *image, double *mean, double *color_std_dev) {
  unsigned int i = 0, j = 0;
  double *sum = NULL;
  sum = (double *)malloc(n_object * sizeof(double));
  if (sum == NULL) {
    printf("color_feature_standard_deviation:Cannot allocate %d bytes for memory.\n", (n_object * sizeof(double)));
    exit(-1);
  }
  memset(sum, 0, sizeof(n_object * sizeof(double)));
  for (i = 0; i < height; i++) {
    for (j = 0; j < width; j++) {
      if (!obj_id[i][j])
        continue;
      register unsigned int idx = (j + i * width) * 3;
      unsigned char val = ((unsigned char)(0.2126 * (double)(image[idx])) + (unsigned char)(0.7152 * (double)(image[idx + 1])) + (unsigned char)(0.0722 * (double)(image[idx + 2])));
      double tmp = ((double)val - mean[obj_id[i][j] - 1]);
      sum[obj_id[i][j] - 1] += (tmp * tmp);
    }
  }
  for (i = 0; i < n_object; i++) {
    color_std_dev[i] = sqrt(sum[i] / area[i]);
  }
  free(sum);
  return 1;
}
```