user: Translate the below assembly code into C programming language:

```asm
<gamma_index>:
  endbr64
  divsd  %xmm1,%xmm0
  push   %r15
  movslq %edi,%rax
  push   %r14
  lea    0x0(,%rax,4),%r15
  push   %r13
  mov    %r15,%rdi
  mov    %rax,%r13
  push   %r12
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x58,%rsp
  mov    %rcx,0x10(%rsp)
  mov    %eax,0x18(%rsp)
  mov    %r8,0x20(%rsp)
  mov    %rax,0x38(%rsp)
  movsd  %xmm1,0x28(%rsp)
  movsd  %xmm0,0x8(%rsp)
  call   <malloc@plt>
  movsd  0x8(%rsp),%xmm0
  mov    0x10(%rsp),%rcx
  mov    %rax,%r14
  lea    -0x4(%r15),%rax
  mov    %rax,0x30(%rsp)
  lea    -0x1(%r13),%eax
  test   %eax,%eax
  mov    %eax,0x1c(%rsp)
  movl   $0x1,-0x4(%r14,%r15,1)
  jle    L62
  cltq
  mov    $0x1,%r12d
  nopl   0x0(%rax)
L6:
  mov    (%rbx,%rax,4),%edx
  mov    (%r14,%rax,4),%esi
  imul   %edx,%esi
  imul   %edx,%r12d
  mov    %esi,-0x4(%r14,%rax,4)
  sub    $0x1,%rax
  test   %eax,%eax
  jg     L6
L11:
  imul   (%rbx),%r12d
  mov    %rcx,0x48(%rsp)
  movsd  %xmm0,0x40(%rsp)
  movslq %r12d,%rsi
  mov    %r12d,0x10(%rsp)
  lea    0x0(,%rsi,8),%r13
  mov    %rsi,0x8(%rsp)
  mov    %r13,%rdi
  call   <malloc@plt>
  mov    %r13,%rdi
  mov    %rax,%r12
  call   <malloc@plt>
  mov    0x10(%rsp),%ecx
  mov    %rax,%r13
  test   %ecx,%ecx
  jle    L39
  mov    0x48(%rsp),%rcx
  mov    0x8(%rsp),%rsi
  xor    %eax,%eax
  movsd  0x40(%rsp),%xmm0
  nopl   0x0(%rax,%rax,1)
L65:
  movsd  0x0(%rbp,%rax,8),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,(%r12,%rax,8)
  movsd  (%rcx,%rax,8),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x0(%r13,%rax,8)
  add    $0x1,%rax
  cmp    %rax,%rsi
  jne    L65
  mov    %r15,%rdi
  call   <malloc@plt>
  mov    0x18(%rsp),%edx
  mov    %rax,%r15
  test   %edx,%edx
  jle    L59
  mov    0x38(%rsp),%rdx
  xor    %esi,%esi
  mov    %rax,%rdi
  shl    $0x2,%rdx
  call   <memset@plt>
L59:
  mov    0x30(%rsp),%r11
  mov    %r12,%r8
  xor    %ebp,%ebp
  mov    %rbx,%r12
  add    %r15,%r11
  mov    %r11,%rbx
  nopw   0x0(%rax,%rax,1)
L120:
  mov    0x18(%rsp),%edi
  xor    %eax,%eax
  mov    %r13,%r9
  mov    %r15,%rcx
  mov    %r14,%rdx
  mov    %r12,%rsi
  mov    %r8,0x8(%rsp)
  call   <gamma_index_point@plt>
  pxor   %xmm0,%xmm0
  pxor   %xmm2,%xmm2
  mov    0x8(%rsp),%r8
  cvtsi2sd %eax,%xmm0
  ucomisd %xmm0,%xmm2
  ja     L77
  sqrtsd %xmm0,%xmm0
L131:
  mov    0x20(%rsp),%rax
  divsd  0x28(%rsp),%xmm0
  addl   $0x1,(%rbx)
  movsd  %xmm0,(%rax,%rbp,8)
  movslq 0x1c(%rsp),%rax
  test   %eax,%eax
  jg     L24
  jmp    L138
  nopl   0x0(%rax)
L126:
  addl   $0x1,-0x4(%r15,%rax,4)
  movl   $0x0,(%r15,%rax,4)
  sub    $0x1,%rax
  test   %eax,%eax
  jle    L138
L24:
  mov    (%r12,%rax,4),%edi
  cmp    %edi,(%r15,%rax,4)
  je     L126
L138:
  add    $0x1,%rbp
  cmp    %ebp,0x10(%rsp)
  jg     L120
  mov    %r8,%r12
L101:
  mov    %r14,%rdi
  call   <free@plt>
  mov    %r15,%rdi
  call   <free@plt>
  mov    %r12,%rdi
  call   <free@plt>
  add    $0x58,%rsp
  mov    %r13,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1090 <free@plt>
L62:
  mov    $0x1,%r12d
  jmp    L11
L39:
  mov    %r15,%rdi
  call   <malloc@plt>
  mov    %rax,%r15
  mov    0x18(%rsp),%eax
  test   %eax,%eax
  jle    L101
  mov    0x38(%rsp),%rdx
  xor    %esi,%esi
  mov    %r15,%rdi
  shl    $0x2,%rdx
  call   <memset@plt>
  jmp    L101
L77:
  mov    %r8,0x8(%rsp)
  call   <sqrt@plt>
  mov    0x8(%rsp),%r8
  jmp    L131
```

assistant: ```c
void gamma_index(int ndim, int *shape, double *first_matrix, double *second_matrix, double *result, double dd, double dta) {
  double rel_dd = dd / dta;
  double *first_matrix_rel;
  double *second_matrix_rel;
  int *strides;
  int *running_index;
  int total_size = 1;
  int i;
  strides = (int *)malloc(sizeof(int) * ndim);
  strides[ndim - 1] = 1;
  for (i = ndim - 1; i > 0; i--) {
    strides[i - 1] = strides[i] * shape[i];
    total_size *= shape[i];
  }
  total_size *= shape[0];
  first_matrix_rel = malloc(sizeof(double) * total_size);
  second_matrix_rel = malloc(sizeof(double) * total_size);
  for (i = 0; i < total_size; i++) {
    first_matrix_rel[i] = first_matrix[i] / rel_dd;
    second_matrix_rel[i] = second_matrix[i] / rel_dd;
  }
  running_index = (int *)malloc(sizeof(int) * ndim);
  for (i = 0; i < ndim; i++) {
    running_index[i] = 0;
  }
  for (int j = 0; j < total_size; j++) {
    result[j] = sqrt(gamma_index_point(ndim, shape, strides, running_index, first_matrix_rel, second_matrix_rel)) / dta;
    running_index[ndim - 1]++;
    i = ndim - 1;
    for (i = ndim - 1; i > 0; i--) {
      if (running_index[i] == shape[i]) {
        running_index[i] = 0;
        running_index[i - 1]++;
      } else {
        break;
      }
    }
  }
  free(strides);
  free(running_index);
  free(first_matrix_rel);
  free(second_matrix_rel);
}
```