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

```asm
<conchi>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,%r15
  mov    %esi,%edi
  mov    %esi,0x1c(%rsp)
  mov    %edx,%r14d
  mov    $0x8,%esi
  call   <calloc@plt>
  mov    %rax,0x38(%rsp)
  test   %rax,%rax
  je     L74
L89:
  mov    $0x8,%esi
  mov    %r14d,%edi
  call   <calloc@plt>
  mov    %rax,0x30(%rsp)
  test   %rax,%rax
  je     L164
L94:
  mov    0x1c(%rsp),%eax
  test   %eax,%eax
  jle    L109
  mov    0x38(%rsp),%rdi
  mov    %rdi,%r8
  mov    %eax,%eax
  lea    (%rdi,%rax,8),%r10
  mov    $0x0,%r9d
  pxor   %xmm6,%xmm6
  movsd  %xmm6,(%rsp)
  lea    -0x1(%r14),%ebp
  lea    0x8(%r15),%rbx
  mov    0x30(%rsp),%r11
  sub    %r15,%r11
  jmp    L178
L74:
  mov    0x1c(%rsp),%esi
  lea    D74(%rip),%rdi
  call   <fatalx@plt>
  jmp    L89
L164:
  mov    %r14d,%esi
  lea    D74(%rip),%rdi
  call   <fatalx@plt>
  jmp    L94
L70:
  mov    %r8,%rcx
  movslq %r9d,%rdx
  lea    0x0(,%rdx,8),%r12
  lea    (%r15,%r12,1),%rax
  add    %rbp,%rdx
  lea    (%rbx,%rdx,8),%rdi
  mov    %r11,%rsi
  sub    %r12,%rsi
L131:
  movsd  (%rcx),%xmm0
  addsd  (%rax),%xmm0
  movsd  %xmm0,(%rcx)
  lea    (%rax,%rsi,1),%rdx
  movsd  (%rdx),%xmm0
  addsd  (%rax),%xmm0
  movsd  %xmm0,(%rdx)
  movsd  (%rsp),%xmm1
  addsd  (%rax),%xmm1
  movsd  %xmm1,(%rsp)
  add    $0x8,%rax
  cmp    %rdi,%rax
  jne    L131
L0:
  add    %r14d,%r9d
  add    $0x8,%r8
  cmp    %r10,%r8
  je     L78
L178:
  test   %r14d,%r14d
  jg     L70
  jmp    L0
L44:
  movsd  0x0(%rbp,%rbx,1),%xmm0
  movsd  0x10(%rsp),%xmm2
  subsd  %xmm2,%xmm0
  mulsd  %xmm0,%xmm0
  divsd  %xmm2,%xmm0
  addsd  0x8(%rsp),%xmm0
  movsd  %xmm0,0x8(%rsp)
  add    $0x8,%rbx
  cmp    %rbx,%r13
  je     L68
L165:
  movsd  (%r12),%xmm0
  mulsd  (%rbx),%xmm0
  divsd  (%rsp),%xmm0
  movsd  %xmm0,0x10(%rsp)
  movsd  D59(%rip),%xmm4
  comisd %xmm0,%xmm4
  jbe    L44
  lea    D12(%rip),%rdi
  call   <printf@plt>
  mov    %r14d,%edx
  mov    0x1c(%rsp),%esi
  mov    %r15,%rdi
  call   <printmat@plt>
  lea    D27(%rip),%rdi
  mov    $0x0,%eax
  call   <fatalx@plt>
  jmp    L44
L68:
  addl   $0x1,0x20(%rsp)
  mov    0x20(%rsp),%eax
  add    %r14d,0x24(%rsp)
  addq   $0x8,0x28(%rsp)
  cmp    %eax,0x1c(%rsp)
  jle    L135
L106:
  test   %r14d,%r14d
  jle    L68
  mov    0x28(%rsp),%r12
  movslq 0x24(%rsp),%rax
  lea    (%r15,%rax,8),%rbp
  mov    0x30(%rsp),%rbx
  sub    %rbx,%rbp
  jmp    L165
L78:
  movsd  D40(%rip),%xmm0
  comisd (%rsp),%xmm0
  ja     L148
L25:
  mov    0x38(%rsp),%rax
  mov    %rax,0x28(%rsp)
  lea    -0x1(%r14),%eax
  mov    0x30(%rsp),%rdi
  lea    0x8(%rdi,%rax,8),%r13
  movl   $0x0,0x24(%rsp)
  movl   $0x0,0x20(%rsp)
  pxor   %xmm7,%xmm7
  movsd  %xmm7,0x8(%rsp)
  jmp    L106
L148:
  lea    D26(%rip),%rdi
  mov    $0x0,%eax
  call   <fatalx@plt>
  jmp    L25
L109:
  lea    D26(%rip),%rdi
  mov    $0x0,%eax
  call   <fatalx@plt>
  pxor   %xmm7,%xmm7
  movsd  %xmm7,0x8(%rsp)
L135:
  mov    0x38(%rsp),%rdi
  call   <free@plt>
  mov    0x30(%rsp),%rdi
  call   <free@plt>
  movsd  0x8(%rsp),%xmm0
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: parse_data
arguments: tag: D74
type: string
name: parse_data
arguments: tag: D59
type: byte[8]
name: parse_data
arguments: tag: D12
type: string
name: parse_data
arguments: tag: D27
type: string
name: parse_data
arguments: tag: D40
type: f64
name: parse_data
arguments: tag: D26
type: string

tool: D74: Unable to allocate %d unit(s) for item 


tool: {"D59": [0x11,0xea,0x2d,0x81,0x99,0x97,0x71,0x3d]}

tool: D12: bad conchi


tool: D27: (conchi) zero row or column sum


tool: D40: 0.001

tool: D26: (conchi) no data


assistant: ```c
double conchi(double *a, int m, int n) {
  double *rsum, *csum, ee, tot = 0, chsq = 0, y;
  int i, j, k;
  if ((rsum = (double *)calloc((m), sizeof(double))) == NULL)
    fatalx("Unable to allocate %d unit(s) for item \n", m);
  if ((csum = (double *)calloc((n), sizeof(double))) == NULL)
    fatalx("Unable to allocate %d unit(s) for item \n", n);
  for (i = 0; i < m; i++) {
    for (j = 0; j < n; j++) {
      k = i * n + j;
      rsum[i] += a[k];
      csum[j] += a[k];
      tot += a[k];
    }
  }
  if (tot < 0.001)
    fatalx("(conchi) no data\n");
  for (i = 0; i < m; i++) {
    for (j = 0; j < n; j++) {
      k = i * n + j;
      ee = rsum[i] * csum[j] / tot;
      if (ee < 1.0e-12) {
        printf("bad conchi\n");
        printmat(a, m, n);
        fatalx("(conchi) zero row or column sum\n");
      }
      y = a[k] - ee;
      chsq += (y * y) / ee;
    }
  }
  free(rsum);
  free(csum);
  return chsq;
}
```