user: Please show me the C implementation that matches the assembly code listed below:

```asm
<gamma_index>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  add    $0xffffffffffffff80,%rsp
  mov    %edi,-0x44(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %rdx,-0x58(%rbp)
  mov    %rcx,-0x60(%rbp)
  mov    %r8,-0x68(%rbp)
  movsd  %xmm0,-0x70(%rbp)
  movsd  %xmm1,-0x78(%rbp)
  movsd  -0x70(%rbp),%xmm0
  divsd  -0x78(%rbp),%xmm0
  movsd  %xmm0,-0x28(%rbp)
  movl   $0x1,-0x34(%rbp)
  mov    -0x44(%rbp),%eax
  cltq
  shl    $0x2,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x44(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movl   $0x1,(%rax)
  mov    -0x44(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x30(%rbp)
  jmp    L10
L75:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%ecx
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    -0x30(%rbp),%edx
  movslq %edx,%rdx
  shl    $0x2,%rdx
  lea    -0x4(%rdx),%rsi
  mov    -0x20(%rbp),%rdx
  add    %rsi,%rdx
  imul   %ecx,%eax
  mov    %eax,(%rdx)
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    -0x34(%rbp),%edx
  imul   %edx,%eax
  mov    %eax,-0x34(%rbp)
  subl   $0x1,-0x30(%rbp)
L10:
  cmpl   $0x0,-0x30(%rbp)
  jg     L75
  mov    -0x50(%rbp),%rax
  mov    (%rax),%eax
  mov    -0x34(%rbp),%edx
  imul   %edx,%eax
  mov    %eax,-0x34(%rbp)
  mov    -0x34(%rbp),%eax
  cltq
  shl    $0x3,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x34(%rbp),%eax
  cltq
  shl    $0x3,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  movl   $0x0,-0x30(%rbp)
  jmp    L26
L67:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  divsd  -0x28(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  divsd  -0x28(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x30(%rbp)
L26:
  mov    -0x30(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jl     L67
  mov    -0x44(%rbp),%eax
  cltq
  shl    $0x2,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x30(%rbp)
  jmp    L84
L6:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movl   $0x0,(%rax)
  addl   $0x1,-0x30(%rbp)
L84:
  mov    -0x30(%rbp),%eax
  cmp    -0x44(%rbp),%eax
  jl     L6
  movl   $0x0,-0x2c(%rbp)
  jmp    L89
L81:
  mov    -0x10(%rbp),%r8
  mov    -0x18(%rbp),%rdi
  mov    -0x8(%rbp),%rcx
  mov    -0x20(%rbp),%rdx
  mov    -0x50(%rbp),%rsi
  mov    -0x44(%rbp),%eax
  mov    %r8,%r9
  mov    %rdi,%r8
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <gamma_index_point@plt>
  pxor   %xmm2,%xmm2
  cvtsi2sd %eax,%xmm2
  movq   %xmm2,%rax
  movq   %rax,%xmm0
  call   <sqrt@plt>
  movq   %xmm0,%rax
  mov    -0x2c(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x68(%rbp),%rdx
  add    %rcx,%rdx
  movq   %rax,%xmm0
  divsd  -0x78(%rbp),%xmm0
  movsd  %xmm0,(%rdx)
  mov    -0x44(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  add    $0x1,%edx
  mov    %edx,(%rax)
  mov    -0x44(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x30(%rbp)
  mov    -0x44(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x30(%rbp)
  jmp    L115
L99:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x50(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jne    L34
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movl   $0x0,(%rax)
  mov    -0x30(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  add    $0x1,%edx
  mov    %edx,(%rax)
  subl   $0x1,-0x30(%rbp)
L115:
  cmpl   $0x0,-0x30(%rbp)
  jg     L99
  jmp    L68
L34:
  nop
L68:
  addl   $0x1,-0x2c(%rbp)
L89:
  mov    -0x2c(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jl     L81
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x8(%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>
  nop
  leave
  ret
```

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);
}
```