user: What would the C source look like for the assembly code provided here?

```asm
<calculate_weights>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %edi,%r10d
  mov    %edi,0x20(%rsp)
  mov    %esi,%ebx
  mov    %rdx,%r12
  mov    %rcx,%r13
  mov    %r8,0x18(%rsp)
  mov    %r9d,%r15d
  mov    0x80(%rsp),%edi
  movsd  %xmm0,0x8(%rsp)
  movsd  %xmm1,0x28(%rsp)
  test   %r9d,%r9d
  jne    L103
  mov    %r10d,%ebx
  mov    %esi,0x20(%rsp)
L103:
  movsbl %dil,%edi
  call   <setmetric@plt>
  cltq
  mov    %rax,0x10(%rsp)
  lea    0x0(,%rbx,8),%ebp
  mov    %ebp,%edi
  call   <malloc@plt>
  mov    %rax,%r14
  test   %rax,%rax
  je     L9
  mov    %ebp,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  test   %ebx,%ebx
  jle    L9
  movsd  D4(%rip),%xmm0
  addsd  (%r14),%xmm0
  movsd  %xmm0,(%r14)
  lea    -0x1(%rbx),%eax
  mov    %rax,0x38(%rsp)
  mov    %ebx,%eax
  mov    %rax,0x30(%rsp)
  mov    $0x1,%ebp
  mov    %r15d,0x24(%rsp)
  jmp    L85
L104:
  add    $0x1,%rbx
  cmp    %rbp,%rbx
  je     L84
L75:
  sub    $0x8,%rsp
  mov    0x2c(%rsp),%eax
  push   %rax
  push   %rbx
  push   %r15
  mov    0x38(%rsp),%r9
  mov    %r13,%r8
  mov    %r13,%rcx
  mov    %r12,%rdx
  mov    %r12,%rsi
  mov    0x40(%rsp),%edi
  mov    0x30(%rsp),%rax
  call   *%rax
  add    $0x20,%rsp
  movsd  0x8(%rsp),%xmm2
  comisd %xmm0,%xmm2
  jbe    L104
  divsd  %xmm2,%xmm0
  movsd  D4(%rip),%xmm1
  subsd  %xmm0,%xmm1
  cvttsd2si %xmm1,%edi
  call   <log@plt>
  mulsd  0x28(%rsp),%xmm0
  call   <exp@plt>
  movapd %xmm0,%xmm1
  addsd  (%r14,%rbp,8),%xmm1
  movsd  %xmm1,(%r14,%rbp,8)
  addsd  (%r14,%rbx,8),%xmm0
  movsd  %xmm0,(%r14,%rbx,8)
  jmp    L104
L84:
  add    $0x1,%rbp
L85:
  mov    %ebp,%r15d
  cmp    0x30(%rsp),%rbp
  je     L79
  movsd  (%r14,%rbp,8),%xmm0
  addsd  D4(%rip),%xmm0
  movsd  %xmm0,(%r14,%rbp,8)
  test   %ebp,%ebp
  jle    L84
  mov    $0x0,%ebx
  jmp    L75
L79:
  mov    %r14,%rax
  mov    0x38(%rsp),%rcx
  lea    0x8(%r14,%rcx,8),%rdx
  movsd  D4(%rip),%xmm1
L69:
  movapd %xmm1,%xmm0
  divsd  (%rax),%xmm0
  movsd  %xmm0,(%rax)
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L69
L9:
  mov    %r14,%rax
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: parse_data
arguments: tag: D4
type_guessed: f64

tool: D4: 1

assistant: ```c
double *calculate_weights(int nrows, int ncolumns, double **data, int **mask, double weights[], int transpose, char dist, double cutoff, double exponent) {
  int i, j;
  const int ndata = (transpose == 0) ? ncolumns : nrows;
  const int nelements = (transpose == 0) ? nrows : ncolumns;
  double (*metric)(int, double **, double **, int **, int **, const double[], int, int, int) = setmetric(dist);
  double *result = malloc(nelements * sizeof(double));
  if (!result)
    return NULL;
  memset(result, 0, nelements * sizeof(double));
  for (i = 0; i < nelements; i++) {
    result[i] += 1.0;
    for (j = 0; j < i; j++) {
      const double distance = metric(ndata, data, data, mask, mask, weights, i, j, transpose);
      if (distance < cutoff) {
        const double dweight = exp(exponent * log(1 - distance / cutoff));
        result[i] += dweight;
        result[j] += dweight;
      }
    }
  }
  for (i = 0; i < nelements; i++)
    result[i] = 1.0 / result[i];
  return result;
}
```