user: 请从给定的汇编指令推导出C源代码：

```asm
<writeMainPvd>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  lea    D9(%rip),%r12
  push   %rbp
  mov    %r12,%rdi
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <opendir@plt>
  xor    %edi,%edi
  test   %rax,%rax
  je     L46
  mov    %rax,%rbp
  xor    %ebx,%ebx
  lea    D127(%rip),%r13
  jmp    L88
  cs nopw 0x0(%rax,%rax,1)
L79:
  mov    (%rax),%edi
  lea    0x4(%rsp),%rdx
  mov    %r13,%rsi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  sbb    $0xffffffff,%ebx
L88:
  mov    %rbp,%rdi
  call   <readdir@plt>
  test   %rax,%rax
  jne    L79
  lea    0x0(,%rbx,4),%edi
L46:
  call   <malloc@plt>
  mov    %r12,%rdi
  mov    %rax,%rbp
  call   <opendir@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L105
  mov    %rbp,%rbx
  mov    %rbp,%r15
  lea    D127(%rip),%r14
  xor    %r12d,%r12d
  jmp    L120
  nopw   0x0(%rax,%rax,1)
L115:
  mov    (%rax),%edi
  lea    0x4(%rsp),%rdx
  mov    %r14,%rsi
  call   <sscanf@plt>
  test   %eax,%eax
  jne    L129
L120:
  mov    %r13,%rdi
  call   <readdir@plt>
  test   %rax,%rax
  jne    L115
  lea    -0x1(%r12),%r13d
  test   %r13d,%r13d
  jle    L100
  mov    %r13d,%eax
  lea    0x4(%rbp),%r9
  nopl   (%rax)
L60:
  sub    $0x1,%eax
  mov    %rbp,%rdx
  mov    %rax,%r8
  lea    (%r9,%rax,4),%rdi
  nopl   (%rax)
L151:
  movq   (%rdx),%xmm0
  mov    %rdx,%rsi
  add    $0x4,%rdx
  pshufd $0xe5,%xmm0,%xmm2
  movd   %xmm0,%ecx
  movd   %xmm2,%eax
  pshufd $0xe1,%xmm0,%xmm1
  cmp    %eax,%ecx
  jle    L2
  movq   %xmm1,(%rsi)
L2:
  cmp    %rdi,%rdx
  jne    L151
  mov    %r8d,%eax
  test   %r8d,%r8d
  jne    L60
L100:
  lea    D135(%rip),%rsi
  lea    D28(%rip),%rdi
  call   <fopen@plt>
  mov    $0x44,%edx
  mov    $0x1,%esi
  lea    D102(%rip),%rdi
  mov    %rax,%r14
  mov    %rax,%rcx
  call   <fwrite@plt>
  mov    %r14,%rcx
  mov    $0xf,%edx
  mov    $0x1,%esi
  lea    D137(%rip),%rdi
  call   <fwrite@plt>
  test   %r12d,%r12d
  je     L56
  lea    0x4(%rbp,%r13,4),%r12
  lea    D90(%rip),%rbp
  nopl   0x0(%rax,%rax,1)
L78:
  mov    (%rbx),%edx
  mov    %rbp,%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  add    $0x4,%rbx
  mov    %edx,%ecx
  call   <fprintf@plt>
  cmp    %rbx,%r12
  jne    L78
L56:
  mov    %r14,%rcx
  mov    $0x10,%edx
  mov    $0x1,%esi
  lea    D32(%rip),%rdi
  call   <fwrite@plt>
  lea    D92(%rip),%rdi
  mov    %r14,%rcx
  mov    $0xb,%edx
  mov    $0x1,%esi
  call   <fwrite@plt>
  mov    %r14,%rdi
  call   <fclose@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L142
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L129:
  mov    0x4(%rsp),%eax
  add    $0x1,%r12d
  add    $0x4,%r15
  mov    %eax,-0x4(%r15)
  jmp    L120
L105:
  lea    D135(%rip),%rsi
  lea    D28(%rip),%rdi
  call   <fopen@plt>
  mov    $0x44,%edx
  mov    $0x1,%esi
  lea    D102(%rip),%rdi
  mov    %rax,%r14
  mov    %rax,%rcx
  call   <fwrite@plt>
  mov    %r14,%rcx
  mov    $0xf,%edx
  mov    $0x1,%esi
  lea    D137(%rip),%rdi
  call   <fwrite@plt>
  jmp    L56
L142:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D9
type: string
name: disassemble_data
arguments: data_tag: D127
type: string
name: disassemble_data
arguments: data_tag: D135
type: string
name: disassemble_data
arguments: data_tag: D28
type: string
name: disassemble_data
arguments: data_tag: D102
type: string
name: disassemble_data
arguments: data_tag: D137
type: string
name: disassemble_data
arguments: data_tag: D90
type: string
name: disassemble_data
arguments: data_tag: D32
type: string
name: disassemble_data
arguments: data_tag: D92
type: string

tool: D9: .

tool: D127: %d

tool: D135: w

tool: D28: case.pvd

tool: D102: <VTKFile type="Collection" version="0.1" byte_order="LittleEndian">


tool: D137:   <Collection>


tool: D90:     <DataSet part="0"  timestep="%d" file="%d/fields.pvtu" />


tool: D32:   </Collection>


tool: D92: </VTKFile>


assistant: ```c
void writeMainPvd() {
  uint *tSteps;
  int status, aux;
  uint nt = 0;
  DIR *d;
  struct dirent *dir;
  d = opendir(".");
  if (d) {
    while ((dir = readdir(d)) != NULL) {
      status = sscanf(dir->d_name, "%d", &aux);
      if (status != 0) {
        nt++;
      }
    }
  }
  tSteps = (uint *)malloc(nt * sizeof(uint));
  nt = 0;
  d = opendir(".");
  if (d) {
    while ((dir = readdir(d)) != NULL) {
      status = sscanf(dir->d_name, "%d", &aux);
      if (status != 0) {
        tSteps[nt] = aux;
        nt++;
      }
    }
  }
  {
    int i, j, temp;
    for (i = 0; i < (nt - 1); ++i) {
      for (j = 0; j < (nt - 1) - i; ++j) {
        if (tSteps[j] > tSteps[j + 1]) {
          temp = tSteps[j + 1];
          tSteps[j + 1] = tSteps[j];
          tSteps[j] = temp;
        }
      }
    }
  }
  FILE *file = fopen("case.pvd", "w");
  fprintf(file, "<VTKFile type=\"Collection\" version=\"0.1\" byte_order=\"LittleEndian\">\n");
  fprintf(file, "  <Collection>\n");
  uint i;
  for (i = 0; i < nt; i++) {
    fprintf(file, "    <DataSet part=\"0\"  timestep=\"%d\" file=\"%d/fields.pvtu\" />\n", tSteps[i], tSteps[i]);
  }
  fprintf(file, "  </Collection>\n");
  fprintf(file, "</VTKFile>\n");
  fclose(file);
}
```