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

```asm
<morphological_feature_object_orientation>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%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,-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    L19
  mov    -0x44(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%esi
  lea    D59(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
L19:
  mov    -0x44(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  movq   $0x0,-0x18(%rbp)
  mov    -0x44(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L40
  mov    -0x44(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%esi
  lea    D59(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
L40:
  mov    -0x44(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  movq   $0x0,-0x10(%rbp)
  mov    -0x44(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L26
  mov    -0x44(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%esi
  lea    D59(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
L26:
  mov    -0x44(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  movq   $0x0,-0x8(%rbp)
  mov    -0x44(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L6
  mov    -0x44(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%esi
  lea    D59(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
L6:
  mov    -0x44(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    -0x20(%rbp),%r8
  mov    -0x50(%rbp),%rdi
  mov    -0x44(%rbp),%ecx
  mov    -0x40(%rbp),%edx
  mov    -0x3c(%rbp),%esi
  mov    -0x38(%rbp),%rax
  mov    %r8,%r9
  mov    %rdi,%r8
  mov    %rax,%rdi
  pxor   %xmm1,%xmm1
  mov    D67(%rip),%rax
  movq   %rax,%xmm0
  call   <morphological_feature_central_moments@plt>
  mov    -0x18(%rbp),%r9
  mov    -0x50(%rbp),%r8
  mov    -0x44(%rbp),%ecx
  mov    -0x40(%rbp),%edx
  mov    -0x3c(%rbp),%esi
  mov    -0x38(%rbp),%rdi
  movsd  D90(%rip),%xmm0
  mov    D90(%rip),%rax
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  call   <morphological_feature_central_moments@plt>
  mov    -0x10(%rbp),%r9
  mov    -0x50(%rbp),%r8
  mov    -0x44(%rbp),%ecx
  mov    -0x40(%rbp),%edx
  mov    -0x3c(%rbp),%esi
  mov    -0x38(%rbp),%rdi
  mov    D45(%rip),%rax
  pxor   %xmm1,%xmm1
  movq   %rax,%xmm0
  call   <morphological_feature_central_moments@plt>
  mov    -0x8(%rbp),%r8
  mov    -0x50(%rbp),%rdi
  mov    -0x44(%rbp),%ecx
  mov    -0x40(%rbp),%edx
  mov    -0x3c(%rbp),%esi
  mov    -0x38(%rbp),%rax
  movsd  D45(%rip),%xmm0
  mov    %r8,%r9
  mov    %rdi,%r8
  mov    %rax,%rdi
  movapd %xmm0,%xmm1
  mov    D67(%rip),%rax
  movq   %rax,%xmm0
  call   <morphological_feature_central_moments@plt>
  movl   $0x0,-0x24(%rbp)
  jmp    L24
L0:
  mov    -0x24(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x24(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  divsd  %xmm1,%xmm0
  addsd  %xmm0,%xmm0
  mov    -0x24(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x24(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  divsd  %xmm2,%xmm1
  mov    -0x24(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  mov    -0x24(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm3
  divsd  %xmm3,%xmm2
  subsd  %xmm2,%xmm1
  divsd  %xmm1,%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  call   <atan@plt>
  mov    -0x24(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movsd  D88(%rip),%xmm1
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x24(%rbp)
L24:
  mov    -0x44(%rbp),%eax
  cmp    %eax,-0x24(%rbp)
  jb     L0
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x1,%eax
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D59
datatype: string
name: disassemble_data
arguments: data_tag: D67
datatype: f64
name: disassemble_data
arguments: data_tag: D90
datatype: f64
name: disassemble_data
arguments: data_tag: D45
datatype: f64
name: disassemble_data
arguments: data_tag: D88
datatype: f64

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


tool: D67: 0

tool: D90: 1

tool: D45: 2

tool: D88: 0.5

assistant: ```c
int morphological_feature_object_orientation(int **obj_id, int width, int height, int n_object, unsigned char *image, double *object_orientation) {
  unsigned int i = 0;
  double *mi00 = NULL;
  mi00 = (double *)malloc(n_object * sizeof(double));
  if (mi00 == NULL) {
    printf("Cannot allocate %d bytes for memory.\n", (n_object * sizeof(double)));
    exit(-1);
  }
  memset(mi00, 0, (n_object * sizeof(double)));
  double *mi11 = NULL;
  mi11 = (double *)malloc(n_object * sizeof(double));
  if (mi11 == NULL) {
    printf("Cannot allocate %d bytes for memory.\n", (n_object * sizeof(double)));
    exit(-1);
  }
  memset(mi11, 0, (n_object * sizeof(double)));
  double *mi20 = NULL;
  mi20 = (double *)malloc(n_object * sizeof(double));
  if (mi20 == NULL) {
    printf("Cannot allocate %d bytes for memory.\n", (n_object * sizeof(double)));
    exit(-1);
  }
  memset(mi20, 0, (n_object * sizeof(double)));
  double *mi02 = NULL;
  mi02 = (double *)malloc(n_object * sizeof(double));
  if (mi02 == NULL) {
    printf("Cannot allocate %d bytes for memory.\n", (n_object * sizeof(double)));
    exit(-1);
  }
  memset(mi02, 0, (n_object * sizeof(double)));
  morphological_feature_central_moments(0.0, 0.0, obj_id, width, height, n_object, image, mi00);
  morphological_feature_central_moments(1.0, 1.0, obj_id, width, height, n_object, image, mi11);
  morphological_feature_central_moments(2.0, 0.0, obj_id, width, height, n_object, image, mi20);
  morphological_feature_central_moments(0.0, 2.0, obj_id, width, height, n_object, image, mi02);
  for (i = 0; i < n_object; i++) {
    object_orientation[i] = 0.5 * atan((2.0 * (mi11[i] / mi00[i])) / ((mi20[i] / mi00[i]) - (mi02[i] / mi00[i])));
  }
  free(mi00);
  free(mi11);
  free(mi20);
  free(mi02);
  return 1;
}
```