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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x90,%rsp
  mov    %edi,-0x84(%rbp)
  mov    %rsi,-0x90(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpl   $0x5,-0x84(%rbp)
  je     L34
  mov    -0x90(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rsi
  lea    D35(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L34:
  mov    -0x90(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  lea    D81(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x50(%rbp)
  cmpq   $0x0,-0x50(%rbp)
  jne    L48
  mov    -0x90(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  mov    %rax,%rsi
  lea    D99(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L48:
  mov    -0x90(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <atol@plt>
  mov    %rax,-0x48(%rbp)
  mov    -0x90(%rbp),%rax
  add    $0x18,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <atol@plt>
  mov    %rax,-0x40(%rbp)
  mov    -0x40(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  mov    %rax,%rsi
  lea    D74(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x48(%rbp),%rax
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x38(%rbp)
  mov    -0x48(%rbp),%rax
  mov    %eax,%edx
  mov    -0x40(%rbp),%rax
  imul   %edx,%eax
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x30(%rbp)
  mov    -0x48(%rbp),%rax
  mov    %eax,%edx
  mov    -0x40(%rbp),%rax
  imul   %edx,%eax
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x28(%rbp)
  mov    -0x40(%rbp),%rax
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x20(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  je     L201
  cmpq   $0x0,-0x30(%rbp)
  je     L201
  cmpq   $0x0,-0x28(%rbp)
  je     L201
  cmpq   $0x0,-0x38(%rbp)
  jne    L207
L201:
  lea    D126(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L207:
  movq   $0x0,-0x68(%rbp)
  jmp    L29
L65:
  addq   $0x1,-0x68(%rbp)
L29:
  mov    -0x50(%rbp),%rcx
  mov    -0x48(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  mov    $0x4,%esi
  mov    %rax,%rdi
  call   <fread@plt>
  mov    -0x48(%rbp),%rdx
  cmp    %rdx,%rax
  je     L65
  mov    -0x68(%rbp),%rax
  mov    %rax,%rsi
  lea    D15(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x50(%rbp),%rax
  mov    %rax,%rdi
  call   <rewind@plt>
  mov    -0x48(%rbp),%rax
  imul   -0x40(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x50(%rbp),%rcx
  mov    -0x30(%rbp),%rax
  mov    $0x4,%esi
  mov    %rax,%rdi
  call   <fread@plt>
  movss  D66(%rip),%xmm0
  movss  %xmm0,-0x74(%rbp)
  movq   $0x1,-0x58(%rbp)
L155:
  movss  -0x74(%rbp),%xmm0
  movss  %xmm0,-0x70(%rbp)
  movq   $0x0,-0x60(%rbp)
  jmp    L188
L113:
  mov    -0x60(%rbp),%rax
  imul   -0x48(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  mov    -0x48(%rbp),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <zero@plt>
  mov    -0x60(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movq   $0x0,(%rax)
  addq   $0x1,-0x60(%rbp)
L188:
  mov    -0x60(%rbp),%rax
  cmp    -0x40(%rbp),%rax
  jl     L113
  pxor   %xmm0,%xmm0
  movss  %xmm0,-0x78(%rbp)
  mov    -0x50(%rbp),%rax
  mov    %rax,%rdi
  call   <rewind@plt>
  movq   $0x0,-0x60(%rbp)
  jmp    L105
L164:
  mov    -0x50(%rbp),%rcx
  mov    -0x48(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  mov    $0x4,%esi
  mov    %rax,%rdi
  call   <fread@plt>
  lea    -0x78(%rbp),%rdi
  mov    -0x40(%rbp),%rcx
  mov    -0x48(%rbp),%rdx
  mov    -0x38(%rbp),%rsi
  mov    -0x30(%rbp),%rax
  mov    %rdi,%r8
  mov    %rax,%rdi
  call   <quantise@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  add    $0x1,%rdx
  mov    %rdx,(%rax)
  mov    -0x10(%rbp),%rax
  imul   -0x48(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x48(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <acc@plt>
  addq   $0x1,-0x60(%rbp)
L105:
  mov    -0x60(%rbp),%rax
  cmp    -0x68(%rbp),%rax
  jl     L164
  movss  -0x78(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2ssq -0x68(%rbp),%xmm1
  divss  %xmm1,%xmm0
  movss  %xmm0,-0x74(%rbp)
  movss  -0x70(%rbp),%xmm0
  subss  -0x74(%rbp),%xmm0
  divss  -0x74(%rbp),%xmm0
  movss  %xmm0,-0x6c(%rbp)
  pxor   %xmm0,%xmm0
  cvtss2sd -0x6c(%rbp),%xmm0
  pxor   %xmm2,%xmm2
  cvtss2sd -0x74(%rbp),%xmm2
  movq   %xmm2,%rdx
  mov    -0x58(%rbp),%rax
  movapd %xmm0,%xmm1
  movq   %rdx,%xmm0
  mov    %rax,%rsi
  lea    D109(%rip),%rax
  mov    %rax,%rdi
  mov    $0x2,%eax
  call   <printf@plt>
  addq   $0x1,-0x58(%rbp)
  pxor   %xmm0,%xmm0
  cvtss2sd -0x6c(%rbp),%xmm0
  comisd D128(%rip),%xmm0
  jbe    L62
  movq   $0x0,-0x60(%rbp)
  jmp    L133
L77:
  mov    -0x60(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  test   %rax,%rax
  je     L5
  mov    -0x60(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x60(%rbp),%rax
  imul   -0x48(%rbp),%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x28(%rbp),%rax
  add    %rax,%rcx
  mov    -0x48(%rbp),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <norm@plt>
  mov    -0x48(%rbp),%rax
  shl    $0x2,%rax
  mov    %rax,%rdx
  mov    -0x60(%rbp),%rax
  imul   -0x48(%rbp),%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x28(%rbp),%rax
  add    %rax,%rcx
  mov    -0x60(%rbp),%rax
  imul   -0x48(%rbp),%rax
  lea    0x0(,%rax,4),%rsi
  mov    -0x30(%rbp),%rax
  add    %rsi,%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
L5:
  addq   $0x1,-0x60(%rbp)
L133:
  mov    -0x60(%rbp),%rax
  cmp    -0x40(%rbp),%rax
  jl     L77
L62:
  pxor   %xmm0,%xmm0
  cvtss2sd -0x6c(%rbp),%xmm0
  comisd D128(%rip),%xmm0
  ja     L155
  mov    -0x90(%rbp),%rax
  add    $0x20,%rax
  mov    (%rax),%rax
  lea    D76(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L94
  mov    -0x90(%rbp),%rax
  add    $0x20,%rax
  mov    (%rax),%rax
  mov    %rax,%rsi
  lea    D42(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L94:
  mov    -0x40(%rbp),%rcx
  mov    -0x48(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  lea    D28(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  movq   $0x0,-0x58(%rbp)
  jmp    L220
L82:
  movq   $0x0,-0x60(%rbp)
  jmp    L2
L18:
  mov    -0x58(%rbp),%rax
  imul   -0x48(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  pxor   %xmm3,%xmm3
  cvtss2sd %xmm0,%xmm3
  movq   %xmm3,%rdx
  mov    -0x18(%rbp),%rax
  movq   %rdx,%xmm0
  lea    D71(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x1,%eax
  call   <fprintf@plt>
  addq   $0x1,-0x60(%rbp)
L2:
  mov    -0x60(%rbp),%rax
  cmp    -0x48(%rbp),%rax
  jl     L18
  mov    -0x18(%rbp),%rax
  mov    %rax,%rsi
  mov    $0xa,%edi
  call   <fputc@plt>
  addq   $0x1,-0x58(%rbp)
L220:
  mov    -0x58(%rbp),%rax
  cmp    -0x40(%rbp),%rax
  jl     L82
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L107
  call   <__stack_chk_fail@plt>
L107:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: label: D35
type: string
name: disassemble_data
arguments: label: D81
type: string
name: disassemble_data
arguments: label: D99
type: string
name: disassemble_data
arguments: label: D74
type: string
name: disassemble_data
arguments: label: D126
type: string
name: disassemble_data
arguments: label: D15
type: string
name: disassemble_data
arguments: label: D66
type: f32
name: disassemble_data
arguments: label: D109
type: string
name: disassemble_data
arguments: label: D128
type: f64
name: disassemble_data
arguments: label: D76
type: string
name: disassemble_data
arguments: label: D42
type: string
name: disassemble_data
arguments: label: D28
type: string
name: disassemble_data
arguments: label: D71
type: string

tool: D35: usage: %s TrainFile K(dimension) M(codebook size) VQFile


tool: D81: rb

tool: D99: Error opening training database file: %s


tool: D74: dimension K=%ld  number of entries M=%ld


tool: D126: Error in malloc.

tool: D15: J=%ld entries in training set


tool: D66: 1e+32

tool: D109:   Iteration %ld, Dn = %f, Delta = %e


tool: D128: 0.01

tool: D76: wt

tool: D42: Error opening VQ file: %s


tool: D28: %ld %ld


tool: D71: %f  

assistant: ```c
int main(int argc, char *argv[]) {
  long k, m;
  float *vec;
  float *cb;
  float *cent;
  long *n;
  long J;
  long i, j;
  long ind;
  float se;
  float Dn, Dn_1;
  float delta;
  FILE *ftrain;
  FILE *fvq;
  if (argc != 5) {
    printf("usage: %s TrainFile K(dimension) M(codebook size) VQFile\n", argv[0]);
    exit(1);
  }
  ftrain = fopen(argv[1], "rb");
  if (ftrain == NULL) {
    printf("Error opening training database file: %s\n", argv[1]);
    exit(1);
  }
  k = atol(argv[2]);
  m = atol(argv[3]);
  printf("dimension K=%ld  number of entries M=%ld\n", k, m);
  vec = (float *)malloc(sizeof(float) * k);
  cb = (float *)malloc(sizeof(float) * k * m);
  cent = (float *)malloc(sizeof(float) * k * m);
  n = (long *)malloc(sizeof(long) * m);
  if (cb == NULL || cb == NULL || cent == NULL || vec == NULL) {
    printf("Error in malloc.\n");
    exit(1);
  }
  J = 0;
  while (fread(vec, sizeof(float), k, ftrain) == (size_t)k)
    J++;
  printf("J=%ld entries in training set\n", J);
  rewind(ftrain);
  fread(cb, sizeof(float), k * m, ftrain);
  Dn = 1E32;
  j = 1;
  do {
    Dn_1 = Dn;
    for (i = 0; i < m; i++) {
      zero(&cent[i * k], k);
      n[i] = 0;
    }
    se = 0.0;
    rewind(ftrain);
    for (i = 0; i < J; i++) {
      fread(vec, sizeof(float), k, ftrain);
      ind = quantise(cb, vec, k, m, &se);
      n[ind]++;
      acc(&cent[ind * k], vec, k);
    }
    Dn = se / J;
    delta = (Dn_1 - Dn) / Dn;
    printf("\r  Iteration %ld, Dn = %f, Delta = %e\n", j, Dn, delta);
    j++;
    if (delta > 0.01)
      for (i = 0; i < m; i++) {
        if (n[i] != 0) {
          norm(&cent[i * k], k, n[i]);
          memcpy(&cb[i * k], &cent[i * k], k * sizeof(float));
        }
      }
  } while (delta > 0.01);
  fvq = fopen(argv[4], "wt");
  if (fvq == NULL) {
    printf("Error opening VQ file: %s\n", argv[4]);
    exit(1);
  }
  fprintf(fvq, "%ld %ld\n", k, m);
  for (j = 0; j < m; j++) {
    for (i = 0; i < k; i++)
      fprintf(fvq, "%f  ", cb[j * k + i]);
    fprintf(fvq, "\n");
  }
  fclose(fvq);
  return 0;
}
```