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

```asm
<write_mesh>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %esi,%r12d
  mov    %rdx,%r13
  mov    %ecx,%r15d
  mov    %r8,(%rsp)
  mov    %r9,0x8(%rsp)
  mov    0x50(%rsp),%r14d
  lea    D2(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%rbp
  mov    %r12d,%edx
  lea    D22(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  test   %r12d,%r12d
  jle    L48
  mov    %r13,%rbx
  lea    -0x1(%r12),%eax
  lea    (%rax,%rax,2),%rax
  lea    0x18(%r13,%rax,8),%r13
  lea    D5(%rip),%r12
L43:
  movsd  0x8(%rbx),%xmm0
  cvttsd2si (%rbx),%edx
  movsd  0x10(%rbx),%xmm1
  mov    %r12,%rsi
  mov    %rbp,%rdi
  mov    $0x2,%eax
  call   <fprintf@plt>
  add    $0x18,%rbx
  cmp    %r13,%rbx
  jne    L43
L48:
  mov    %r14d,%edx
  lea    D22(%rip),%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  test   %r14d,%r14d
  jle    L32
  mov    0x60(%rsp),%r12
  mov    0x58(%rsp),%rbx
  lea    -0x1(%r14),%eax
  shl    $0x4,%rax
  lea    0x10(%rbx,%rax,1),%r14
  lea    D18(%rip),%r13
L26:
  mov    0xc(%rbx),%r9d
  mov    0x8(%rbx),%r8d
  mov    0x4(%rbx),%ecx
  sub    $0x8,%rsp
  mov    (%r12),%eax
  push   %rax
  mov    (%rbx),%edx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  add    $0x4,%r12
  add    $0x10,%rbx
  add    $0x10,%rsp
  cmp    %r14,%rbx
  jne    L26
L32:
  mov    %r15d,%edx
  lea    D22(%rip),%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  test   %r15d,%r15d
  jle    L9
  mov    0x8(%rsp),%rdi
  mov    %rdi,%r12
  mov    (%rsp),%rbx
  lea    -0x1(%r15),%eax
  lea    0x4(%rdi,%rax,4),%r14
  lea    D23(%rip),%r13
L35:
  mov    0x4(%rbx),%ecx
  mov    (%r12),%r9d
  mov    0x8(%rbx),%r8d
  mov    (%rbx),%edx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  add    $0x4,%r12
  add    $0xc,%rbx
  cmp    %r14,%r12
  jne    L35
L9:
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    $0x0,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D2
type_infered: string
name: extract_symbolic_data
arguments: tag: D22
type_infered: string
name: extract_symbolic_data
arguments: tag: D5
type_infered: string
name: extract_symbolic_data
arguments: tag: D18
type_infered: string
name: extract_symbolic_data
arguments: tag: D23
type_infered: string

tool: D2: w

tool: D22: %5d


tool: D5: %20.15lf %20.15lf %20.15lf


tool: D18: %4d %4d %4d %4d  %d


tool: D23: %4d %4d %4d  %d


assistant: ```c
int write_mesh(char *fn, int nV, double *vertex, int nF, int *face, int *facematerial, int nT, int *tetra, int *tetramaterial) {
  int i;
  FILE *f;
  f = fopen(fn, "w");
  fprintf(f, "%5d\n", nV);
  for (i = 0; i < nV; i++) {
    fprintf(f, "%20.15lf %20.15lf %20.15lf\n", vertex[3 * i + 0], vertex[3 * i + 1], vertex[3 * i + 2]);
  }
  fprintf(f, "%5d\n", nT);
  for (i = 0; i < nT; i++) {
    fprintf(f, "%4d %4d %4d %4d  %d\n", tetra[4 * i + 0], tetra[4 * i + 1], tetra[4 * i + 2], tetra[4 * i + 3], tetramaterial[i]);
  }
  fprintf(f, "%5d\n", nF);
  for (i = 0; i < nF; i++) {
    fprintf(f, "%4d %4d %4d  %d\n", face[3 * i + 0], face[3 * i + 1], face[3 * i + 2], facematerial[i]);
  }
  fclose(f);
  return 0;
}
```