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

```asm
<gint1_fns_basis>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xa8,%rsp
  mov    %rdi,0x88(%rsp)
  mov    %rsi,%r14
  mov    %rsi,0x68(%rsp)
  mov    %rdx,0x18(%rsp)
  mov    %rcx,0x40(%rsp)
  mov    %r8,0x90(%rsp)
  mov    %r9,%r12
  mov    %r9,0x98(%rsp)
  mov    0x108(%rsp),%ebp
  mov    $0x50,%edi
  call   <malloc@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L251
  movslq 0x100(%rsp),%rbx
  mov    0x100(%rsp),%eax
  lea    0x0(,%rax,8),%edi
  call   <malloc@plt>
  mov    %rax,%rdi
  mov    %rax,0x60(%rsp)
  test   %rax,%rax
  je     L149
  test   %ebp,%ebp
  jle    L11
  mov    %ebp,%eax
  lea    (%r14,%rax,8),%rax
  mov    %rax,0x80(%rsp)
  mov    0x100(%rsp),%eax
  lea    -0x1(%rax),%eax
  mov    %rax,0x70(%rsp)
  lea    0x8(%rdi,%rax,8),%rax
  mov    %rax,0x78(%rsp)
  mov    0x118(%rsp),%eax
  lea    -0x1(%rax),%eax
  lea    0x4(%r12,%rax,4),%rax
  mov    %rax,0x48(%rsp)
  movslq %ebp,%rbp
  lea    0x0(,%rbp,8),%rax
  mov    %rax,0x58(%rsp)
  lea    0x0(,%rbx,8),%rax
  mov    %rax,0x50(%rsp)
  mov    %r15,%r13
L51:
  mov    0x60(%rsp),%rax
  mov    0x78(%rsp),%rdx
  cmpl   $0x0,0x100(%rsp)
  jle    L14
L208:
  movq   $0x0,(%rax)
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L208
L14:
  cmpl   $0x0,0x118(%rsp)
  jle    L105
  mov    0x90(%rsp),%rax
  mov    %rax,0x30(%rsp)
  mov    0xe0(%rsp),%rax
  mov    %rax,0x38(%rsp)
  mov    0x98(%rsp),%rax
  mov    %rax,0x28(%rsp)
  mov    0x60(%rsp),%r12
  mov    0xf0(%rsp),%r14
  mov    0xe8(%rsp),%r15
  jmp    L127
L38:
  mov    %ebp,%eax
  neg    %eax
  lea    0x1(%rax,%rax,1),%eax
  mov    %eax,0x4(%rsp)
L207:
  mov    0x38(%rsp),%rax
  mov    %rax,0x10(%rsp)
  cmpl   $0x0,(%rax)
  jle    L36
  mov    $0x0,%ebx
  mov    %r12,0x20(%rsp)
  jmp    L180
L83:
  movsd  0x0(%r13),%xmm0
  mulsd  (%r15),%xmm0
  addsd  (%r12),%xmm0
  movsd  %xmm0,(%r12)
  add    $0x8,%r15
  mov    0x4(%rsp),%eax
  lea    -0x1(%rax),%esi
  test   %esi,%esi
  jle    L109
  lea    0x8(%r12),%rdx
  lea    0x8(%r13),%rdi
L19:
  mov    $0x0,%eax
L238:
  movsd  (%rdi,%rax,8),%xmm0
  mulsd  (%r15),%xmm0
  addsd  (%rdx,%rax,8),%xmm0
  movsd  %xmm0,(%rdx,%rax,8)
  add    $0x1,%rax
  mov    %esi,%ecx
  sub    %eax,%ecx
  test   %ecx,%ecx
  jg     L238
L109:
  add    $0x8,%r15
  add    $0x1,%ebx
  mov    0x10(%rsp),%rax
  cmp    %ebx,(%rax)
  jle    L36
L180:
  mov    %r13,%rcx
  mov    0x18(%rsp),%rdx
  movsd  (%r14),%xmm0
  mov    0x8(%rsp),%rsi
  mov    %ebp,%edi
  call   <gint1_fn_dispatch@plt>
  add    $0x8,%r14
  cmp    $0xffffffff,%ebp
  je     L83
  mov    0x20(%rsp),%rdx
  mov    %r13,%rdi
  mov    0x4(%rsp),%esi
  jmp    L19
L36:
  movslq 0x4(%rsp),%rax
  lea    (%r12,%rax,8),%r12
  addq   $0x4,0x28(%rsp)
  mov    0x28(%rsp),%rax
  addq   $0x4,0x30(%rsp)
  addq   $0x4,0x38(%rsp)
  cmp    %rax,0x48(%rsp)
  je     L105
L127:
  mov    0x28(%rsp),%rax
  mov    (%rax),%eax
  lea    (%rax,%rax,2),%eax
  cltq
  mov    0x40(%rsp),%rbx
  lea    (%rbx,%rax,8),%rax
  mov    %rax,0x8(%rsp)
  mov    0x30(%rsp),%rax
  mov    (%rax),%ebp
  mov    %ebp,%eax
  neg    %eax
  cmovs  %ebp,%eax
  cmp    $0x3,%eax
  jg     L15
  cmp    $0xffffffff,%ebp
  jl     L38
  movl   $0x4,0x4(%rsp)
  je     L207
  lea    0x1(%rbp),%eax
  lea    0x2(%rbp),%edx
  imul   %edx,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,0x4(%rsp)
  jmp    L207
L105:
  cmpl   $0x0,0xf8(%rsp)
  jle    L181
  mov    0x68(%rsp),%r8
  mov    0x88(%rsp),%rdi
  mov    $0x0,%esi
  mov    0x60(%rsp),%r9
  mov    0x70(%rsp),%r10
  mov    0xf8(%rsp),%r11d
  mov    0x100(%rsp),%ebx
L200:
  mov    %rdi,%rcx
  test   %ebx,%ebx
  jle    L67
  mov    $0x0,%eax
  pxor   %xmm1,%xmm1
L209:
  movsd  (%r9,%rax,8),%xmm0
  mulsd  (%rcx,%rax,8),%xmm0
  addsd  %xmm0,%xmm1
  mov    %rax,%rdx
  add    $0x1,%rax
  cmp    %r10,%rdx
  jne    L209
L69:
  movsd  %xmm1,(%r8)
  add    $0x1,%esi
  add    0x58(%rsp),%r8
  add    0x50(%rsp),%rdi
  cmp    %esi,%r11d
  jne    L200
L181:
  addq   $0x18,0x18(%rsp)
  addq   $0x8,0x68(%rsp)
  mov    0x68(%rsp),%rax
  cmp    0x80(%rsp),%rax
  jne    L51
  mov    %r13,%r15
  mov    $0x0,%ebx
  jmp    L106
L67:
  pxor   %xmm1,%xmm1
  jmp    L69
L251:
  mov    $0xffffffff,%ebx
  jmp    L106
L149:
  mov    $0xffffffff,%ebx
  jmp    L106
L11:
  mov    $0x0,%ebx
  jmp    L106
L15:
  mov    %r13,%r15
  mov    $0xfffffffe,%ebx
L106:
  mov    %r15,%rdi
  call   <free@plt>
  mov    0x60(%rsp),%rdi
  call   <free@plt>
  mov    %ebx,%eax
  add    $0xa8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int gint1_fns_basis(double *weights, double *orbs, double *points, double *centers, int *shell_types, int *shell_map, int *num_primitives, double *ccoeffs, double *exponents, int num_orbs, int num_dof, int num_points, int num_centers, int num_shells, int num_ccoeffs, int num_exponents) {
  int shell, shell_type, primitive, dof, num_shell_dof, result, i_point, i_orb;
  double *work, *out, *center, *ccoeff, *exponent, *weight, *shell_fns, *basis_fns, *fn;
  double tmp;
  result = 0;
  work = malloc(10 * sizeof(double));
  if (work == NULL) {
    result = -1;
    goto EXIT;
  };
  basis_fns = malloc(num_dof * sizeof(double));
  if (basis_fns == NULL) {
    result = -1;
    goto EXIT;
  };
  for (i_point = 0; i_point < num_points; i_point++) {
    fn = basis_fns;
    for (dof = 0; dof < num_dof; dof++) {
      *fn = 0.0;
      fn++;
    }
    ccoeff = ccoeffs;
    exponent = exponents;
    shell_fns = basis_fns;
    for (shell = 0; shell < num_shells; shell++) {
      center = centers + (3 * shell_map[shell]);
      shell_type = shell_types[shell];
      if (abs(shell_type) > 3) {
        result = -2;
        goto EXIT;
      };
      num_shell_dof = ((shell_type < -1) ? (-2 * shell_type + 1) : ((shell_type == -1) ? (4) : (((shell_type + 1) * (shell_type + 2)) / 2)));
      for (primitive = 0; primitive < num_primitives[shell]; primitive++) {
        gint1_fn_dispatch(shell_type, center, *exponent, points, work);
        out = work;
        exponent++;
        fn = shell_fns;
        if (shell_type == -1) {
          *fn += (*out) * (*ccoeff);
          fn++;
          out++;
          ccoeff++;
        }
        for (dof = num_shell_dof - (shell_type == -1); dof > 0; dof--) {
          *fn += (*out) * (*ccoeff);
          fn++;
          out++;
        }
        ccoeff++;
      }
      shell_fns += num_shell_dof;
    }
    for (i_orb = 0; i_orb < num_orbs; i_orb++) {
      tmp = 0.0;
      fn = basis_fns;
      weight = weights + i_orb * num_dof;
      for (dof = 0; dof < num_dof; dof++) {
        tmp += (*fn) * (*weight);
        fn++;
        weight++;
      }
      *(orbs + i_orb * num_points) = tmp;
    }
    points += 3;
    orbs++;
  }
EXIT:
  free(work);
  free(basis_fns);
  return result;
}
```