user: Converte this assembly snippet into its equivalent C code:

```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     L18
  movss  0x18(%rsp),%xmm5
  movss  0x14(%rsp),%xmm4
  lea    D4(%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    D95(%rip),%rdi
  divss  %xmm0,%xmm3
  movss  %xmm3,0x1c(%rsp)
  call   <fwrite@plt>
  lea    0x20(%rsp),%rdi
  call   <ctime@plt>
  lea    D8(%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    D20(%rip),%rsi
  addss  0x14(%rsp),%xmm1
  addss  0x8(%rsp),%xmm0
  mov    $0x4,%eax
  movss  D126(%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    D130(%rip),%rdi
  call   <fwrite@plt>
  mov    %r13d,%edx
  mov    %r12,%rdi
  xor    %eax,%eax
  lea    D108(%rip),%rsi
  call   <fprintf@plt>
  mov    %r13d,%edx
  mov    %r12,%rdi
  xor    %eax,%eax
  lea    D43(%rip),%rsi
  call   <fprintf@plt>
  mov    %r13d,%edx
  mov    %r12,%rdi
  xor    %eax,%eax
  lea    D128(%rip),%rsi
  call   <fprintf@plt>
  mov    %r12,%rcx
  mov    $0x3b,%edx
  mov    $0x1,%esi
  lea    D44(%rip),%rdi
  call   <fwrite@plt>
  mov    %r12,%rcx
  mov    $0x36,%edx
  mov    $0x1,%esi
  lea    D5(%rip),%rdi
  call   <fwrite@plt>
  cmp    $0x66,%bl
  mov    %r12,%rdi
  lea    D149(%rip),%rax
  lea    D86(%rip),%rdx
  lea    D87(%rip),%rsi
  cmovne %rax,%rdx
  xor    %eax,%eax
  call   <fprintf@plt>
  mov    %r12,%rdi
  pxor   %xmm0,%xmm0
  pxor   %xmm2,%xmm2
  lea    D146(%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    D57(%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    D28(%rip),%rdi
  call   <fwrite@plt>
  lea    0x26(%rsp),%rdi
  mov    %r12,%rcx
  mov    $0x2,%edx
  mov    $0x1,%esi
  call   <fwrite@plt>
  mov    $0x1,%eax
L18:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L9
  add    $0x30,%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  ret
L9:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D4
type: string
name: extract_symbolic_data
arguments: data_tag: D95
type: string
name: extract_symbolic_data
arguments: data_tag: D8
type: string
name: extract_symbolic_data
arguments: data_tag: D20
type: string
name: extract_symbolic_data
arguments: data_tag: D126
type: byte[4]
name: extract_symbolic_data
arguments: data_tag: D130
type: string
name: extract_symbolic_data
arguments: data_tag: D108
type: string
name: extract_symbolic_data
arguments: data_tag: D43
type: string
name: extract_symbolic_data
arguments: data_tag: D128
type: string
name: extract_symbolic_data
arguments: data_tag: D44
type: string
name: extract_symbolic_data
arguments: data_tag: D5
type: string
name: extract_symbolic_data
arguments: data_tag: D149
type: string
name: extract_symbolic_data
arguments: data_tag: D86
type: string
name: extract_symbolic_data
arguments: data_tag: D87
type: string
name: extract_symbolic_data
arguments: data_tag: D146
type: string
name: extract_symbolic_data
arguments: data_tag: D57
type: string
name: extract_symbolic_data
arguments: data_tag: D28
type: string

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


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


tool: D8: # creation date: %s

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


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

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


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


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


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


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


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


tool: D149: double

tool: D86: float

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


tool: D146: min_ext=%f %f %f


tool: D57: max_ext=%f %f %f


tool: D28: 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;
}
```