user: 请将以下的汇编代码转换成C语言代码：

```asm
<dump_velocity_c>:
  endbr64
  push   %r15
  mov    %rdi,%r15
  push   %r14
  lea    D79(%rip),%r14
  push   %r13
  push   %r12
  mov    %r9,%r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x238,%rsp
  mov    %edx,0x8(%rsp)
  lea    0x120(%rsp),%r13
  lea    D58(%rip),%rdx
  mov    %ecx,0x10(%rsp)
  mov    %rdi,%rcx
  mov    %r13,%rdi
  lea    0x20(%rsp),%rbp
  mov    %r8d,0x14(%rsp)
  mov    %rsi,%r8
  mov    $0x100,%esi
  mov    %fs:0x28,%rax
  mov    %rax,0x228(%rsp)
  xor    %eax,%eax
  call   <snprintf@plt>
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <fopen@plt>
  mov    %r13,%rcx
  lea    D87(%rip),%rdx
  test   %rax,%rax
  je     L93
  mov    %rax,%rbp
  mov    %rbx,%rcx
  lea    D37(%rip),%rdx
  mov    %r13,%rdi
  mov    $0x100,%esi
  xor    %eax,%eax
  call   <snprintf@plt>
  mov    %rbp,%rcx
  mov    $0x13,%edx
  mov    $0x1,%esi
  lea    D97(%rip),%rdi
  call   <fwrite@plt>
  mov    %r13,%rdx
  mov    %rbp,%rdi
  xor    %eax,%eax
  lea    D45(%rip),%rsi
  call   <fprintf@plt>
  mov    0x14(%rsp),%r8d
  mov    0x10(%rsp),%ecx
  xor    %eax,%eax
  mov    0x8(%rsp),%edx
  lea    D82(%rip),%rsi
  mov    %rbp,%rdi
  call   <fprintf@plt>
  mov    %rbp,%rcx
  mov    $0x13,%edx
  mov    $0x1,%esi
  lea    D72(%rip),%rdi
  call   <fwrite@plt>
  mov    %rbp,%rcx
  mov    $0x14,%edx
  mov    $0x1,%esi
  lea    D25(%rip),%rdi
  call   <fwrite@plt>
  mov    %rbp,%rcx
  mov    $0x14,%edx
  mov    $0x1,%esi
  lea    D89(%rip),%rdi
  call   <fwrite@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    $0x100,%esi
  mov    %r13,%rdi
  xor    %eax,%eax
  mov    %rbx,%r8
  mov    %r15,%rcx
  lea    D105(%rip),%rdx
  call   <snprintf@plt>
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <fopen@plt>
  test   %rax,%rax
  je     L33
  mov    0x8(%rsp),%ebx
  imul   0x10(%rsp),%ebx
  mov    %rax,0x18(%rsp)
  imul   0x14(%rsp),%ebx
  lea    (%rbx,%rbx,2),%r13d
  lea    0x0(,%r13,8),%edi
  movslq %r13d,%rbx
  call   <malloc@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L43
  test   %r13d,%r13d
  mov    0x18(%rsp),%r8
  jle    L12
  mov    %rbx,%rdx
  lea    (%rax,%rbx,8),%rcx
  lea    -0x1(%r13),%esi
  shl    $0x4,%rdx
  lea    -0x8(%r12,%rdx,1),%rdx
  cmp    %rdx,%rax
  setae  %dl
  cmp    %rcx,%r12
  setae  %cl
  or     %cl,%dl
  je     L126
  cmp    $0x3,%esi
  jbe    L126
  mov    %esi,%ecx
  shr    %ecx
  shl    $0x4,%rcx
  add    %rax,%rcx
  neg    %rax
  lea    (%r12,%rax,2),%rdx
  mov    %rbp,%rax
  nopl   0x0(%rax,%rax,1)
L66:
  movupd (%rdx,%rax,2),%xmm0
  movhpd 0x10(%rdx,%rax,2),%xmm0
  add    $0x10,%rax
  movups %xmm0,-0x10(%rax)
  cmp    %rcx,%rax
  jne    L66
  and    $0xfffffffe,%esi
  lea    (%rsi,%rsi,1),%eax
  mov    %esi,%edx
  add    $0x1,%esi
  cltq
  lea    0x0(,%rdx,8),%rcx
  movsd  (%r12,%rax,8),%xmm0
  lea    0x0(,%rax,8),%rdi
  movsd  %xmm0,0x0(%rbp,%rdx,8)
  cmp    %esi,%r13d
  jle    L12
  movsd  0x10(%r12,%rdi,1),%xmm0
  movsd  %xmm0,0x8(%rbp,%rcx,1)
L12:
  mov    %r8,%rcx
  mov    %r13d,%edx
  mov    $0x8,%esi
  mov    %rbp,%rdi
  mov    %r8,0x8(%rsp)
  call   <fwrite@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  mov    0x8(%rsp),%rdi
  call   <fclose@plt>
L37:
  mov    0x228(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L62
  add    $0x238,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L33:
  lea    0x20(%rsp),%rbp
  mov    %r13,%rcx
  lea    D5(%rip),%rdx
L93:
  mov    %rbp,%rdi
  mov    $0x100,%esi
  xor    %eax,%eax
  call   <snprintf@plt>
  mov    %rbp,%rdi
  call   <perror@plt>
  jmp    L37
  nopl   0x0(%rax,%rax,1)
L43:
  lea    0x20(%rsp),%rbp
  lea    D121(%rip),%rdx
  mov    $0x100,%esi
  xor    %eax,%eax
  mov    %rbp,%rdi
  call   <snprintf@plt>
  mov    %rbp,%rdi
  call   <perror@plt>
  jmp    L37
  nopl   0x0(%rax,%rax,1)
L126:
  mov    %r13d,%edx
  lea    0x0(%rbp,%rdx,8),%rcx
  mov    %rbp,%rdx
  neg    %rdx
  lea    (%r12,%rdx,2),%rdx
  nopw   0x0(%rax,%rax,1)
L127:
  movsd  (%rdx,%rax,2),%xmm0
  add    $0x8,%rax
  movsd  %xmm0,-0x8(%rax)
  cmp    %rcx,%rax
  jne    L127
  jmp    L12
L62:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D79
type_guessed: string
name: read_data
arguments: label: D58
type_guessed: string
name: read_data
arguments: label: D87
type_guessed: string
name: read_data
arguments: label: D37
type_guessed: string
name: read_data
arguments: label: D97
type_guessed: string
name: read_data
arguments: label: D45
type_guessed: string
name: read_data
arguments: label: D82
type_guessed: string
name: read_data
arguments: label: D72
type_guessed: string
name: read_data
arguments: label: D25
type_guessed: string
name: read_data
arguments: label: D89
type_guessed: string
name: read_data
arguments: label: D105
type_guessed: string
name: read_data
arguments: label: D5
type_guessed: string
name: read_data
arguments: label: D121
type_guessed: string

tool: D79: wb

tool: D58: %s/%s.bov

tool: D87: WARNING: Unable to create BOV file (%s)

tool: D37: %s.dat

tool: D97: VARIABLE: velocity


tool: D45: DATA_FILE: %s


tool: D82: DATA_SIZE: %d %d %d


tool: D72: DATA_COMPONENTS: 3


tool: D25: DATA_FORMAT: DOUBLE


tool: D89: DATA_ENDIAN: LITTLE


tool: D105: %s/%s.dat

tool: D5: WARNING: Unable to create DAT file (%s)

tool: D121: WARNING: Unable to allocate write buffer

assistant: ```c
void dump_velocity_c(char *dname, char *fname, int nx, int ny, int nz, double *array) {
  int i, j, k;
  FILE *fp;
  char errmsg[256];
  char buf[256];
  double *wbuf;
  snprintf(buf, 256, "%s/%s.bov", dname, fname);
  fp = fopen(buf, "wb");
  if (fp == NULL) {
    snprintf(errmsg, 256, "WARNING: Unable to create BOV file (%s)", buf);
    perror(errmsg);
    return;
  }
  snprintf(buf, 256, "%s.dat", fname);
  fprintf(fp, "VARIABLE: velocity\n");
  fprintf(fp, "DATA_FILE: %s\n", buf);
  fprintf(fp, "DATA_SIZE: %d %d %d\n", nx, ny, nz);
  fprintf(fp, "DATA_COMPONENTS: 3\n");
  fprintf(fp, "DATA_FORMAT: DOUBLE\n");
  fprintf(fp, "DATA_ENDIAN: LITTLE\n");
  fclose(fp);
  snprintf(buf, 256, "%s/%s.dat", dname, fname);
  fp = fopen(buf, "wb");
  if (fp == NULL) {
    snprintf(errmsg, 256, "WARNING: Unable to create DAT file (%s)", buf);
    perror(errmsg);
    return;
  }
  wbuf = (double *)malloc(3 * nx * ny * nz * sizeof(double));
  if (wbuf == NULL) {
    snprintf(errmsg, 256, "WARNING: Unable to allocate write buffer");
    perror(errmsg);
    return;
  }
  for (i = 0; i < 3 * nx * ny * nz; i++)
    wbuf[i] = array[2 * i];
  fwrite(wbuf, sizeof(double), 3 * nx * ny * nz, fp);
  free(wbuf);
  fclose(fp);
}
```