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

```asm
<mergecb>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x68,%rsp
  mov    %rdi,0x38(%rsp)
  mov    %rdx,0x40(%rsp)
  mov    %ecx,0x58(%rsp)
  mov    %r8d,0x30(%rsp)
  movss  %xmm0,0x5c(%rsp)
  mov    %r9d,0x1c(%rsp)
  mov    %r8d,%ebx
  cmp    $0x1,%r8d
  je     L8
  mov    %rsi,%r15
  mov    %rdx,%rbp
  mov    %ecx,%r14d
  mov    $0x4,%esi
  mov    %r8d,%edi
  call   <calloc@plt>
  mov    %rax,%rsi
  mov    %rax,0x48(%rsp)
  test   %r14d,%r14d
  jle    L99
  mov    %rbp,%rax
  lea    -0x1(%r14),%edx
  lea    0x1(%rbp,%rdx,1),%rcx
L34:
  movzbl (%rax),%edx
  addl   $0x1,(%rsi,%rdx,4)
  add    $0x1,%rax
  cmp    %rcx,%rax
  jne    L34
L99:
  mov    0x30(%rsp),%ebx
  mov    %ebx,%esi
  mov    %ebx,%edi
  call   <fmatrix@plt>
  mov    %rax,0x50(%rsp)
  cmp    $0x1,%ebx
  jle    L180
  add    $0x8,%rax
  mov    %rax,0x20(%rsp)
  lea    -0x2(%rbx),%eax
  add    $0x2,%rax
  mov    %rax,0x28(%rsp)
  mov    $0x1,%r14d
  lea    -0x1(%rbx),%eax
  mov    %eax,0x34(%rsp)
L59:
  cmp    %r14d,0x30(%rsp)
  jle    L44
  mov    0x20(%rsp),%rbp
  lea    -0x8(%rbp),%r12
  lea    0x0(,%r14,4),%rbx
  lea    -0x4(%rbx),%rax
  mov    %rax,0x8(%rsp)
  mov    0x34(%rsp),%eax
  sub    %r14d,%eax
  lea    0x1(%r14,%rax,1),%rax
  shl    $0x2,%rax
  mov    %rax,0x10(%rsp)
L178:
  mov    %rbx,%r13
  add    (%r12),%r13
  mov    (%r15,%rbx,2),%rsi
  mov    -0x8(%r15,%r14,8),%rdi
  mov    0x1c(%rsp),%edx
  call   <distance2@plt>
  movss  %xmm0,0x0(%r13)
  mov    (%r12),%rax
  movss  (%rax,%rbx,1),%xmm0
  mov    0x0(%rbp),%rax
  mov    0x8(%rsp),%rcx
  movss  %xmm0,(%rax,%rcx,1)
  add    $0x4,%rbx
  add    $0x8,%rbp
  cmp    0x10(%rsp),%rbx
  jne    L178
L44:
  add    $0x1,%r14
  addq   $0x8,0x20(%rsp)
  cmp    0x28(%rsp),%r14
  jne    L59
L180:
  pxor   %xmm0,%xmm0
  comiss 0x5c(%rsp),%xmm0
  ja     L222
L5:
  movss  0x5c(%rsp),%xmm0
  lea    D6(%rip),%rdi
  call   <printf@plt>
  push   $0x0
  mov    0x50(%rsp),%r12
  push   %r12
  mov    0x2c(%rsp),%eax
  push   %rax
  lea    0x74(%rsp),%rax
  push   %rax
  mov    0x50(%rsp),%ebp
  mov    %ebp,%r9d
  mov    0x78(%rsp),%r8d
  mov    0x60(%rsp),%rcx
  mov    %r15,%rdx
  mov    0x58(%rsp),%rsi
  mov    0x70(%rsp),%r14
  mov    %r14,%rdi
  call   <mergecb1@plt>
  mov    %eax,%ebx
  add    $0x20,%rsp
  mov    %ebp,%esi
  mov    %r14,%rdi
  call   <free_fmatrix@plt>
  mov    %r12,%rdi
  call   <free@plt>
L8:
  mov    %ebx,%eax
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L222:
  mov    0x1c(%rsp),%r14d
  mov    %r14d,%esi
  mov    0x30(%rsp),%ebx
  mov    %ebx,%edi
  call   <fmatrix@plt>
  mov    %rax,%r13
  test   %ebx,%ebx
  jle    L114
  lea    -0x1(%rbx),%eax
  lea    0x0(,%rax,8),%rbx
  lea    0x8(%r15,%rbx,1),%r9
  mov    %r14d,%r10d
  lea    -0x1(%r14),%eax
  lea    0x4(,%rax,4),%rdi
  mov    %r15,%rcx
  mov    %r13,%r8
  sub    %r15,%r8
  jmp    L185
L76:
  mov    (%rcx),%rdx
  movss  (%rdx,%rax,1),%xmm0
  mov    (%rsi),%rdx
  movss  %xmm0,(%rdx,%rax,1)
  add    $0x4,%rax
  cmp    %rdi,%rax
  jne    L76
L72:
  add    $0x8,%rcx
  cmp    %r9,%rcx
  je     L65
L185:
  lea    (%r8,%rcx,1),%rsi
  mov    $0x0,%eax
  test   %r10d,%r10d
  jg     L76
  jmp    L72
L112:
  movl   $0x43c80000,0x5c(%rsp)
  jmp    L66
L126:
  movl   $0x44480000,0x5c(%rsp)
  jmp    L66
L65:
  mov    $0x4,%esi
  mov    0x30(%rsp),%r14d
  mov    %r14d,%edi
  call   <calloc@plt>
  mov    %rax,%rcx
  mov    %rax,%rbp
  mov    %r14d,%eax
  mov    0x48(%rsp),%rdx
  lea    (%rdx,%rax,4),%rsi
  sub    %rdx,%rcx
L86:
  mov    (%rdx),%eax
  mov    %eax,(%rcx,%rdx,1)
  add    $0x4,%rdx
  cmp    %rsi,%rdx
  jne    L86
  mov    0x30(%rsp),%r14d
  mov    %r14d,%esi
  mov    %r14d,%edi
  call   <fmatrix@plt>
  mov    %rax,%r9
  mov    %rax,%r12
  mov    0x50(%rsp),%rax
  lea    0x8(%rax,%rbx,1),%r10
  mov    %r14d,%edi
  shl    $0x2,%rdi
  mov    %rax,%r8
  sub    %rax,%r9
L11:
  mov    %r8,%rsi
  lea    (%r9,%r8,1),%rcx
  mov    $0x0,%eax
L83:
  mov    (%rsi),%rdx
  movss  (%rdx,%rax,1),%xmm0
  mov    (%rcx),%rdx
  movss  %xmm0,(%rdx,%rax,1)
  add    $0x4,%rax
  cmp    %rdi,%rax
  jne    L83
  add    $0x8,%r8
  cmp    %r10,%r8
  jne    L11
L12:
  cmpl   $0x3,0x1c(%rsp)
  je     L112
  cmpl   $0x1,0x1c(%rsp)
  je     L126
L66:
  push   $0x1
  push   %rbp
  mov    0x2c(%rsp),%eax
  push   %rax
  lea    0x74(%rsp),%rax
  push   %rax
  mov    0x50(%rsp),%ebx
  mov    %ebx,%r9d
  mov    0x78(%rsp),%r8d
  mov    0x60(%rsp),%rcx
  mov    %r13,%rdx
  mov    0x58(%rsp),%rsi
  mov    %r12,%rdi
  call   <mergecb1@plt>
  add    $0x20,%rsp
  mov    %ebx,%esi
  mov    %r13,%rdi
  call   <free_fmatrix@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  mov    %ebx,%esi
  mov    %r12,%rdi
  call   <free_fmatrix@plt>
  jmp    L5
L114:
  mov    $0x4,%esi
  mov    0x30(%rsp),%ebx
  mov    %ebx,%edi
  call   <calloc@plt>
  mov    %rax,%rbp
  mov    %ebx,%esi
  mov    %ebx,%edi
  call   <fmatrix@plt>
  mov    %rax,%r12
  jmp    L12
```

tool_calls: name: extract_symbolic_data
arguments: tag: D6
type_infered: string

tool: D6: thresh %f 

assistant: ```c
int mergecb(float *B, float **cb, unsigned char *P, int npt, int N, float thresh, int dim) {
  int i, j, newN, *count, l, ei, *count2;
  float **dist, **dist2, **cb2;
  if (N == 1)
    return 1;
  count = (int *)calloc(N, sizeof(int));
  for (l = 0; l < npt; l++)
    count[P[l]]++;
  dist = (float **)fmatrix(N, N);
  ei = N - 1;
  for (i = 0; i < ei; i++) {
    for (j = i + 1; j < N; j++) {
      dist[i][j] = distance2(cb[i], cb[j], dim);
      dist[j][i] = dist[i][j];
    }
  }
  if (thresh < 0) {
    cb2 = (float **)fmatrix(N, dim);
    for (i = 0; i < N; i++)
      for (j = 0; j < dim; j++)
        cb2[i][j] = cb[i][j];
    count2 = (int *)calloc(N, sizeof(int));
    for (i = 0; i < N; i++)
      count2[i] = count[i];
    dist2 = (float **)fmatrix(N, N);
    for (i = 0; i < N; i++)
      for (j = 0; j < N; j++)
        dist2[i][j] = dist[i][j];
    if (dim == 3)
      thresh = 400;
    else if (dim == 1)
      thresh = 800;
    mergecb1(dist2, B, cb2, P, npt, N, &thresh, dim, count2, 1);
    free_fmatrix(cb2, N);
    free(count2);
    free_fmatrix(dist2, N);
  }
  printf("thresh %f ", thresh);
  newN = mergecb1(dist, B, cb, P, npt, N, &thresh, dim, count, 0);
  free_fmatrix(dist, N);
  free(count);
  return newN;
}
```