user: 请将以下的汇编代码转换成C语言代码：

```asm
<texture_feature_variance>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %rdx,-0x38(%rbp)
  movl   $0x0,-0x1c(%rbp)
  movl   $0x0,-0x18(%rbp)
  movl   $0x0,-0x14(%rbp)
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L115
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%esi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
L115:
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  movl   $0x0,-0x1c(%rbp)
  jmp    L50
L66:
  movl   $0x0,-0x18(%rbp)
  jmp    L46
L31:
  movl   $0x0,-0x14(%rbp)
  jmp    L72
L167:
  mov    -0x1c(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x18(%rbp),%eax
  test   %rax,%rax
  js     L1
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  jmp    L157
L1:
  mov    %rax,%rdx
  shr    %rdx
  and    $0x1,%eax
  or     %rax,%rdx
  pxor   %xmm0,%xmm0
  cvtsi2sd %rdx,%xmm0
  addsd  %xmm0,%xmm0
L157:
  mov    -0x1c(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x18(%rbp),%eax
  shl    $0x3,%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x14(%rbp),%eax
  shl    $0x3,%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  mulsd  %xmm2,%xmm0
  mov    -0x1c(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x14(%rbp)
L72:
  cmpl   $0xff,-0x14(%rbp)
  jbe    L167
  addl   $0x1,-0x18(%rbp)
L46:
  cmpl   $0xff,-0x18(%rbp)
  jbe    L31
  addl   $0x1,-0x1c(%rbp)
L50:
  mov    -0x2c(%rbp),%eax
  cmp    %eax,-0x1c(%rbp)
  jb     L66
  movl   $0x0,-0x1c(%rbp)
  jmp    L37
L40:
  movl   $0x0,-0x18(%rbp)
  jmp    L104
L30:
  movl   $0x0,-0x14(%rbp)
  jmp    L57
L77:
  mov    -0x18(%rbp),%eax
  test   %rax,%rax
  js     L33
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  jmp    L149
L33:
  mov    %rax,%rdx
  shr    %rdx
  and    $0x1,%eax
  or     %rax,%rdx
  pxor   %xmm0,%xmm0
  cvtsi2sd %rdx,%xmm0
  addsd  %xmm0,%xmm0
L149:
  mov    -0x1c(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  mov    -0x1c(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  -0x8(%rbp),%xmm0
  movapd %xmm0,%xmm2
  mulsd  %xmm0,%xmm2
  mov    -0x1c(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x18(%rbp),%eax
  shl    $0x3,%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x14(%rbp),%eax
  shl    $0x3,%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm2,%xmm0
  mov    -0x1c(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x14(%rbp)
L57:
  cmpl   $0xff,-0x14(%rbp)
  jbe    L77
  addl   $0x1,-0x18(%rbp)
L104:
  cmpl   $0xff,-0x18(%rbp)
  jbe    L30
  addl   $0x1,-0x1c(%rbp)
L37:
  mov    -0x2c(%rbp),%eax
  cmp    %eax,-0x1c(%rbp)
  jb     L40
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x1,%eax
  leave
  ret
```

tool_calls: name: read_data
arguments: data_tag: D2
data_type: string

tool: D2: Cannot allocate %d bytes for memory.


assistant: ```c
int texture_feature_variance(double ***glcm, int n_object, double *variance) {
  unsigned int i = 0, j = 0, k = 0;
  double *mean;
  mean = (double *)malloc(n_object * sizeof(double));
  if (mean == NULL) {
    printf("Cannot allocate %d bytes for memory.\n", (n_object * sizeof(double)));
    exit(-1);
  }
  memset(mean, 0, (n_object * sizeof(double)));
  for (i = 0; i < n_object; i++) {
    for (j = 0; j < 256; j++) {
      for (k = 0; k < 256; k++) {
        mean[i] += j * glcm[i][j][k];
      }
    }
  }
  for (i = 0; i < n_object; i++) {
    for (j = 0; j < 256; j++) {
      for (k = 0; k < 256; k++) {
        double tmp = (j - mean[i]);
        variance[i] += tmp * tmp * glcm[i][j][k];
      }
    }
  }
  free(mean);
  return 1;
}
```