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

```asm
<gint1_fns_basis>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xa0,%rsp
  mov    %rdi,-0x78(%rbp)
  mov    %rsi,-0x80(%rbp)
  mov    %rdx,-0x88(%rbp)
  mov    %rcx,-0x90(%rbp)
  mov    %r8,-0x98(%rbp)
  mov    %r9,-0xa0(%rbp)
  movl   $0x0,-0x64(%rbp)
  mov    $0x50,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L241
  movl   $0xffffffff,-0x64(%rbp)
  jmp    L93
L241:
  mov    0x30(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x28(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  jne    L58
  movl   $0xffffffff,-0x64(%rbp)
  jmp    L93
L58:
  movl   $0x0,-0x60(%rbp)
  jmp    L92
L217:
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  movl   $0x0,-0x68(%rbp)
  jmp    L12
L234:
  mov    -0x20(%rbp),%rax
  pxor   %xmm0,%xmm0
  movsd  %xmm0,(%rax)
  addq   $0x8,-0x20(%rbp)
  addl   $0x1,-0x68(%rbp)
L12:
  mov    -0x68(%rbp),%eax
  cmp    0x30(%rbp),%eax
  jl     L234
  mov    0x18(%rbp),%rax
  mov    %rax,-0x48(%rbp)
  mov    0x20(%rbp),%rax
  mov    %rax,-0x40(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x30(%rbp)
  movl   $0x0,-0x70(%rbp)
  jmp    L62
L235:
  mov    -0x70(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0xa0(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x90(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x70(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x98(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x58(%rbp)
  mov    -0x58(%rbp),%eax
  mov    %eax,%edx
  neg    %edx
  cmovns %edx,%eax
  cmp    $0x3,%eax
  jle    L90
  movl   $0xfffffffe,-0x64(%rbp)
  jmp    L93
L90:
  cmpl   $0xffffffff,-0x58(%rbp)
  jge    L68
  mov    -0x58(%rbp),%edx
  mov    $0x0,%eax
  sub    %edx,%eax
  add    %eax,%eax
  add    $0x1,%eax
  jmp    L204
L68:
  cmpl   $0xffffffff,-0x58(%rbp)
  je     L145
  mov    -0x58(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    -0x58(%rbp),%eax
  add    $0x2,%eax
  imul   %edx,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  jmp    L204
L145:
  mov    $0x4,%eax
L204:
  mov    %eax,-0x54(%rbp)
  movl   $0x0,-0x6c(%rbp)
  jmp    L60
L244:
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rdi
  mov    -0x10(%rbp),%rcx
  mov    -0x88(%rbp),%rdx
  mov    -0x8(%rbp),%rsi
  mov    -0x58(%rbp),%eax
  movq   %rdi,%xmm0
  mov    %eax,%edi
  call   <gint1_fn_dispatch@plt>
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x50(%rbp)
  addq   $0x8,-0x40(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  cmpl   $0xffffffff,-0x58(%rbp)
  jne    L167
  mov    -0x20(%rbp),%rax
  movsd  (%rax),%xmm1
  mov    -0x50(%rbp),%rax
  movsd  (%rax),%xmm2
  mov    -0x48(%rbp),%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm1,%xmm0
  mov    -0x20(%rbp),%rax
  movsd  %xmm0,(%rax)
  addq   $0x8,-0x20(%rbp)
  addq   $0x8,-0x50(%rbp)
  addq   $0x8,-0x48(%rbp)
L167:
  cmpl   $0xffffffff,-0x58(%rbp)
  sete   %al
  movzbl %al,%edx
  mov    -0x54(%rbp),%eax
  sub    %edx,%eax
  mov    %eax,-0x68(%rbp)
  jmp    L73
L155:
  mov    -0x20(%rbp),%rax
  movsd  (%rax),%xmm1
  mov    -0x50(%rbp),%rax
  movsd  (%rax),%xmm2
  mov    -0x48(%rbp),%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm1,%xmm0
  mov    -0x20(%rbp),%rax
  movsd  %xmm0,(%rax)
  addq   $0x8,-0x20(%rbp)
  addq   $0x8,-0x50(%rbp)
  subl   $0x1,-0x68(%rbp)
L73:
  cmpl   $0x0,-0x68(%rbp)
  jg     L155
  addq   $0x8,-0x48(%rbp)
  addl   $0x1,-0x6c(%rbp)
L60:
  mov    -0x70(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x6c(%rbp)
  jl     L244
  mov    -0x54(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,-0x30(%rbp)
  addl   $0x1,-0x70(%rbp)
L62:
  mov    -0x70(%rbp),%eax
  cmp    0x48(%rbp),%eax
  jl     L235
  movl   $0x0,-0x5c(%rbp)
  jmp    L191
L82:
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x5c(%rbp),%eax
  imul   0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x38(%rbp)
  movl   $0x0,-0x68(%rbp)
  jmp    L210
L116:
  mov    -0x20(%rbp),%rax
  movsd  (%rax),%xmm1
  mov    -0x38(%rbp),%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  -0x18(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  addq   $0x8,-0x20(%rbp)
  addq   $0x8,-0x38(%rbp)
  addl   $0x1,-0x68(%rbp)
L210:
  mov    -0x68(%rbp),%eax
  cmp    0x30(%rbp),%eax
  jl     L116
  mov    -0x5c(%rbp),%eax
  imul   0x38(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x80(%rbp),%rax
  add    %rdx,%rax
  movsd  -0x18(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x5c(%rbp)
L191:
  mov    -0x5c(%rbp),%eax
  cmp    0x28(%rbp),%eax
  jl     L82
  addq   $0x18,-0x88(%rbp)
  addq   $0x8,-0x80(%rbp)
  addl   $0x1,-0x60(%rbp)
L92:
  mov    -0x60(%rbp),%eax
  cmp    0x38(%rbp),%eax
  jl     L217
  nop
L93:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x64(%rbp),%eax
  leave
  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;
}
```