user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x78,%rsp
  mov    %rsi,0x58(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x68(%rsp)
  xor    %eax,%eax
  cmp    $0x5,%edi
  jne    L103
L220:
  mov    0x58(%rsp),%rax
  mov    0x8(%rax),%rdi
  lea    D37(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,0x20(%rsp)
  test   %rax,%rax
  je     L30
L268:
  mov    0x58(%rsp),%rbx
  mov    0x10(%rbx),%rdi
  call   <atol@plt>
  mov    %rax,%r15
  mov    0x18(%rbx),%rdi
  call   <atol@plt>
  mov    %rax,%r14
  mov    %rax,0x10(%rsp)
  mov    %rax,%rdx
  mov    %r15,%rsi
  lea    D120(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    0x0(,%r15,4),%edi
  call   <malloc@plt>
  mov    %rax,%rbx
  mov    %r14d,%ebp
  imul   %r15d,%ebp
  shl    $0x2,%ebp
  mov    %ebp,%edi
  call   <malloc@plt>
  mov    %rax,%r13
  mov    %rax,0x28(%rsp)
  mov    %ebp,%edi
  call   <malloc@plt>
  mov    %rax,%rbp
  mov    %rax,0x30(%rsp)
  lea    0x0(,%r14,8),%edi
  call   <malloc@plt>
  mov    %rax,%r14
  test   %r13,%r13
  sete   %al
  test   %rbp,%rbp
  sete   %dl
  or     %dl,%al
  jne    L84
  test   %rbx,%rbx
  jne    L121
L84:
  lea    D139(%rip),%rdi
  call   <puts@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L121:
  mov    $0x0,%ebp
  mov    0x20(%rsp),%r12
  jmp    L228
L103:
  lea    D49(%rip),%rdi
  call   <puts@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  jmp    L220
L30:
  mov    0x58(%rsp),%rax
  mov    0x8(%rax),%rsi
  lea    D127(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L268
L51:
  add    $0x1,%rbp
L228:
  mov    %r12,%rcx
  mov    %r15,%rdx
  mov    $0x4,%esi
  mov    %rbx,%rdi
  call   <fread@plt>
  cmp    %r15,%rax
  je     L51
  mov    %rbp,%rsi
  mov    %rbp,0x18(%rsp)
  lea    D114(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    0x20(%rsp),%rbp
  mov    %rbp,%rdi
  call   <rewind@plt>
  mov    0x10(%rsp),%rdx
  imul   %r15,%rdx
  mov    %rbp,%rcx
  mov    $0x4,%esi
  mov    0x28(%rsp),%rbp
  mov    %rbp,%rdi
  call   <fread@plt>
  lea    0x0(,%r15,4),%rax
  mov    %rax,0x8(%rsp)
  movss  D8(%rip),%xmm7
  movss  %xmm7,0x40(%rsp)
  movq   $0x1,0x38(%rsp)
  sub    0x30(%rsp),%rbp
  mov    %rbp,0x50(%rsp)
  mov    %rbx,0x48(%rsp)
  jmp    L91
L179:
  mov    0x10(%rsp),%rbx
  test   %rbx,%rbx
  jle    L164
  mov    %r14,%r12
  mov    0x30(%rsp),%r13
  mov    $0x0,%ebp
  jmp    L206
L243:
  add    $0x1,%rbp
  add    $0x8,%r12
  add    0x8(%rsp),%r13
  cmp    %rbp,%rbx
  je     L164
L206:
  mov    (%r12),%rdx
  test   %rdx,%rdx
  je     L243
  mov    %r15,%rsi
  mov    %r13,%rdi
  call   <norm@plt>
  mov    0x50(%rsp),%rax
  lea    (%rax,%r13,1),%rdi
  mov    0x8(%rsp),%rdx
  mov    %r13,%rsi
  call   <memcpy@plt>
  jmp    L243
L164:
  movss  0x44(%rsp),%xmm5
  movss  %xmm5,0x40(%rsp)
L91:
  mov    0x10(%rsp),%rbx
  test   %rbx,%rbx
  jle    L229
  mov    0x30(%rsp),%r13
  mov    %r14,%r12
  mov    $0x0,%ebp
L132:
  mov    %r15,%rsi
  mov    %r13,%rdi
  call   <zero@plt>
  movq   $0x0,(%r12)
  add    $0x1,%rbp
  add    0x8(%rsp),%r13
  add    $0x8,%r12
  cmp    %rbp,%rbx
  jne    L132
L229:
  movl   $0x0,0x64(%rsp)
  mov    0x20(%rsp),%rdi
  call   <rewind@plt>
  cmpq   $0x0,0x18(%rsp)
  jle    L158
  mov    $0x0,%ebp
  lea    0x64(%rsp),%r12
  mov    0x48(%rsp),%rbx
  mov    0x30(%rsp),%r13
L214:
  mov    0x20(%rsp),%rcx
  mov    %r15,%rdx
  mov    $0x4,%esi
  mov    %rbx,%rdi
  call   <fread@plt>
  mov    %r12,%r8
  mov    0x10(%rsp),%rcx
  mov    %r15,%rdx
  mov    %rbx,%rsi
  mov    0x28(%rsp),%rdi
  call   <quantise@plt>
  addq   $0x1,(%r14,%rax,8)
  imul   %r15,%rax
  lea    0x0(%r13,%rax,4),%rdi
  mov    %r15,%rdx
  mov    %rbx,%rsi
  call   <acc@plt>
  add    $0x1,%rbp
  cmp    %rbp,0x18(%rsp)
  jne    L214
L158:
  pxor   %xmm0,%xmm0
  cvtsi2ssq 0x18(%rsp),%xmm0
  movss  0x64(%rsp),%xmm1
  movaps %xmm1,%xmm2
  divss  %xmm0,%xmm2
  movss  %xmm2,0x44(%rsp)
  movss  0x40(%rsp),%xmm0
  subss  %xmm2,%xmm0
  divss  %xmm2,%xmm0
  pxor   %xmm3,%xmm3
  cvtss2sd %xmm0,%xmm3
  movq   %xmm3,%rbp
  pxor   %xmm0,%xmm0
  cvtss2sd %xmm2,%xmm0
  movapd %xmm3,%xmm1
  mov    0x38(%rsp),%rbx
  mov    %rbx,%rsi
  lea    D67(%rip),%rdi
  mov    $0x2,%eax
  call   <printf@plt>
  mov    %rbx,%rax
  add    $0x1,%rax
  mov    %rax,0x38(%rsp)
  movq   %rbp,%xmm4
  comisd D63(%rip),%xmm4
  ja     L179
  comisd D63(%rip),%xmm4
  ja     L164
  mov    0x58(%rsp),%rax
  mov    0x20(%rax),%rdi
  lea    D86(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L147
L252:
  mov    0x10(%rsp),%rbx
  mov    %rbx,%rcx
  mov    %r15,%rdx
  lea    D132(%rip),%rsi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  movq   $0x0,0x8(%rsp)
  mov    $0x0,%r14d
  lea    D68(%rip),%r13
  test   %rbx,%rbx
  jg     L71
L79:
  mov    %r12,%rdi
  call   <fclose@plt>
  mov    0x68(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L4
  mov    $0x0,%eax
  add    $0x78,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L147:
  mov    0x58(%rsp),%rax
  mov    0x20(%rax),%rsi
  lea    D84(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L252
L249:
  pxor   %xmm0,%xmm0
  cvtss2sd 0x0(%rbp),%xmm0
  mov    %r13,%rsi
  mov    %r12,%rdi
  mov    $0x1,%eax
  call   <fprintf@plt>
  add    $0x1,%rbx
  add    $0x4,%rbp
  cmp    %rbx,%r15
  jne    L249
L9:
  mov    %r12,%rsi
  mov    $0xa,%edi
  call   <fputc@plt>
  add    $0x1,%r14
  add    %r15,0x8(%rsp)
  cmp    %r14,0x10(%rsp)
  je     L79
L71:
  mov    0x28(%rsp),%rax
  mov    0x8(%rsp),%rcx
  lea    (%rax,%rcx,4),%rbp
  mov    $0x0,%ebx
  test   %r15,%r15
  jg     L249
  jmp    L9
L4:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D37
data_type: string
name: disassemble_data
arguments: data_label: D120
data_type: string
name: disassemble_data
arguments: data_label: D139
data_type: string
name: disassemble_data
arguments: data_label: D49
data_type: string
name: disassemble_data
arguments: data_label: D127
data_type: string
name: disassemble_data
arguments: data_label: D114
data_type: string
name: disassemble_data
arguments: data_label: D8
data_type: f32
name: disassemble_data
arguments: data_label: D67
data_type: string
name: disassemble_data
arguments: data_label: D63
data_type: f64
name: disassemble_data
arguments: data_label: D86
data_type: string
name: disassemble_data
arguments: data_label: D132
data_type: string
name: disassemble_data
arguments: data_label: D68
data_type: string
name: disassemble_data
arguments: data_label: D84
data_type: string

tool: D37: rb

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


tool: D139: Error in malloc.

tool: D49: usage: vqtrain TrainFile K M VQFile

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


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


tool: D8: 1e+32

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


tool: D63: 0.001

tool: D86: wt

tool: D132: %d %d


tool: D68: %f  

tool: D84: Error opening VQ file: %s


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: vqtrain TrainFile K M VQFile\n");
    exit(0);
  }
  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) == 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.001)
      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.001);
  fvq = fopen(argv[4], "wt");
  if (fvq == NULL) {
    printf("Error opening VQ file: %s\n", argv[4]);
    exit(1);
  }
  fprintf(fvq, "%d %d\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;
}
```