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

```asm
<write_AVS_header>:
  endbr64
  push   %r13
  mov    %esi,%r13d
  push   %r12
  mov    %rdi,%r12
  xor    %edi,%edi
  push   %rbx
  mov    %edx,%ebx
  sub    $0x30,%rsp
  movss  %xmm0,0x4(%rsp)
  movss  %xmm1,0xc(%rsp)
  movss  %xmm2,0x10(%rsp)
  movss  %xmm3,0x8(%rsp)
  movss  %xmm4,0x14(%rsp)
  movss  %xmm5,0x18(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  mov    $0xc0c,%eax
  mov    %ax,0x26(%rsp)
  call   <time@plt>
  mov    %eax,0x20(%rsp)
  xor    %eax,%eax
  test   %r12,%r12
  je     L0
  movss  0x18(%rsp),%xmm5
  movss  0x14(%rsp),%xmm4
  lea    D168(%rip),%rdi
  movss  0x10(%rsp),%xmm2
  movss  0xc(%rsp),%xmm1
  movss  0x8(%rsp),%xmm3
  movss  0x4(%rsp),%xmm0
  call   <printf@plt>
  lea    -0x1(%r13),%eax
  pxor   %xmm0,%xmm0
  mov    %r12,%rcx
  cvtsi2ss %eax,%xmm0
  movss  0x8(%rsp),%xmm3
  subss  0x4(%rsp),%xmm3
  mov    $0x25,%edx
  mov    $0x1,%esi
  lea    D134(%rip),%rdi
  divss  %xmm0,%xmm3
  movss  %xmm3,0x1c(%rsp)
  call   <fwrite@plt>
  lea    0x20(%rsp),%rdi
  call   <ctime@plt>
  lea    D115(%rip),%rsi
  mov    %r12,%rdi
  mov    %rax,%rdx
  xor    %eax,%eax
  call   <fprintf@plt>
  movss  0x10(%rsp),%xmm2
  mov    %r13d,%edx
  addss  0x18(%rsp),%xmm2
  movss  0xc(%rsp),%xmm1
  movss  0x4(%rsp),%xmm0
  mov    %r12,%rdi
  lea    D169(%rip),%rsi
  addss  0x14(%rsp),%xmm1
  addss  0x8(%rsp),%xmm0
  mov    $0x4,%eax
  movss  D61(%rip),%xmm4
  movss  0x1c(%rsp),%xmm3
  mulss  %xmm4,%xmm2
  cvtss2sd %xmm3,%xmm3
  mulss  %xmm4,%xmm1
  mulss  %xmm4,%xmm0
  cvtss2sd %xmm2,%xmm2
  cvtss2sd %xmm1,%xmm1
  cvtss2sd %xmm0,%xmm0
  call   <fprintf@plt>
  mov    %r12,%rcx
  mov    $0x34,%edx
  mov    $0x1,%esi
  lea    D137(%rip),%rdi
  call   <fwrite@plt>
  mov    %r13d,%edx
  mov    %r12,%rdi
  xor    %eax,%eax
  lea    D8(%rip),%rsi
  call   <fprintf@plt>
  mov    %r13d,%edx
  mov    %r12,%rdi
  xor    %eax,%eax
  lea    D163(%rip),%rsi
  call   <fprintf@plt>
  mov    %r13d,%edx
  mov    %r12,%rdi
  xor    %eax,%eax
  lea    D56(%rip),%rsi
  call   <fprintf@plt>
  mov    %r12,%rcx
  mov    $0x3b,%edx
  mov    $0x1,%esi
  lea    D11(%rip),%rdi
  call   <fwrite@plt>
  mov    %r12,%rcx
  mov    $0x36,%edx
  mov    $0x1,%esi
  lea    D16(%rip),%rdi
  call   <fwrite@plt>
  cmp    $0x66,%bl
  mov    %r12,%rdi
  lea    D70(%rip),%rax
  lea    D143(%rip),%rdx
  lea    D18(%rip),%rsi
  cmovne %rax,%rdx
  xor    %eax,%eax
  call   <fprintf@plt>
  mov    %r12,%rdi
  pxor   %xmm0,%xmm0
  pxor   %xmm2,%xmm2
  lea    D75(%rip),%rsi
  pxor   %xmm1,%xmm1
  mov    $0x3,%eax
  cvtss2sd 0x4(%rsp),%xmm0
  cvtss2sd 0x10(%rsp),%xmm2
  cvtss2sd 0xc(%rsp),%xmm1
  call   <fprintf@plt>
  mov    %r12,%rdi
  lea    D126(%rip),%rsi
  pxor   %xmm0,%xmm0
  pxor   %xmm2,%xmm2
  mov    $0x3,%eax
  pxor   %xmm1,%xmm1
  cvtss2sd 0x8(%rsp),%xmm0
  cvtss2sd 0x18(%rsp),%xmm2
  cvtss2sd 0x14(%rsp),%xmm1
  call   <fprintf@plt>
  mov    %r12,%rcx
  mov    $0x3e,%edx
  mov    $0x1,%esi
  lea    D166(%rip),%rdi
  call   <fwrite@plt>
  lea    0x26(%rsp),%rdi
  mov    %r12,%rcx
  mov    $0x2,%edx
  mov    $0x1,%esi
  call   <fwrite@plt>
  mov    $0x1,%eax
L0:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L2
  add    $0x30,%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  ret
L2:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D168
datatype: string
name: read_data
arguments: label: D134
datatype: string
name: read_data
arguments: label: D115
datatype: string
name: read_data
arguments: label: D169
datatype: string
name: read_data
arguments: label: D61
datatype: byte[4]
name: read_data
arguments: label: D137
datatype: string
name: read_data
arguments: label: D8
datatype: string
name: read_data
arguments: label: D163
datatype: string
name: read_data
arguments: label: D56
datatype: string
name: read_data
arguments: label: D11
datatype: string
name: read_data
arguments: label: D16
datatype: string
name: read_data
arguments: label: D70
datatype: string
name: read_data
arguments: label: D143
datatype: string
name: read_data
arguments: label: D18
datatype: string
name: read_data
arguments: label: D75
datatype: string
name: read_data
arguments: label: D126
datatype: string
name: read_data
arguments: label: D166
datatype: string

tool: D168: writing an AVS header, min (%f, %f, %f): max (%f, %f, %f)


tool: D134: # AVS field file -- generated by GEM


tool: D115: # creation date: %s

tool: D169: # Scalar field for cubic lattice: ON_GEOM_CENT resolved to (%f %f %f) %i %f 


tool: {"D61": [0x00,0x00,0x00,0x3f]}

tool: D137: ndim=3         # number of dimensions in the field 


tool: D8: dim1=%i # dimension of axis 1


tool: D163: dim2=%i # dimension of axis 2


tool: D56: dim3=%i # dimension of axis 3


tool: D11: nspace=3       # number of physical coordinates per point 


tool: D16: veclen=1       # number of data components per point 


tool: D70: double

tool: D143: float

tool: D18: data=%s    # data type (byte, integer, float, double) 


tool: D75: min_ext=%f %f %f


tool: D126: max_ext=%f %f %f


tool: D166: field=uniform  # field type (uniform, rectilinear, irregular)


assistant: ```c
int write_AVS_header(FILE *fp, int dim, float xmin, float ymin, float zmin, float xmax, float ymax, float zmax, char gridtype) {
  const char FORM_FEEDS[2] = {12, 12};
  float center_x, center_y, center_z, spacing;
  time_t tclock = time(0);
  if (fp == NULL)
    return 0;
  printf("writing an AVS header, min (%f, %f, %f): max (%f, %f, %f)\n", xmin, ymin, zmin, xmax, ymax, zmax);
  center_x = (xmin + xmax) / 2.;
  center_y = (ymin + ymax) / 2.;
  center_z = (zmin + zmax) / 2.;
  spacing = (xmax - xmin) / (float)(dim - 1);
  fprintf(fp, "# AVS field file -- generated by GEM\n");
  fprintf(fp, "# creation date: %s", ctime(&tclock));
  fprintf(fp, "# Scalar field for cubic lattice: ON_GEOM_CENT resolved to (%f %f %f) %i %f \n", center_x, center_y, center_z, dim, spacing);
  fprintf(fp, "ndim=3         # number of dimensions in the field \n");
  fprintf(fp, "dim1=%i # dimension of axis 1\n", dim);
  fprintf(fp, "dim2=%i # dimension of axis 2\n", dim);
  fprintf(fp, "dim3=%i # dimension of axis 3\n", dim);
  fprintf(fp, "nspace=3       # number of physical coordinates per point \n");
  fprintf(fp, "veclen=1       # number of data components per point \n");
  fprintf(fp, "data=%s    # data type (byte, integer, float, double) \n", ((gridtype == 'f') ? "float" : "double"));
  fprintf(fp, "min_ext=%f %f %f\n", xmin, ymin, zmin);
  fprintf(fp, "max_ext=%f %f %f\n", xmax, ymax, zmax);
  fprintf(fp, "field=uniform  # field type (uniform, rectilinear, irregular)\n");
  fwrite(FORM_FEEDS, sizeof(char), 2, fp);
  return 1;
}
```