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

```asm
<wrfile>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %r8,%r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  sub    $0x118,%rsp
  mov    %rdi,0x28(%rsp)
  mov    %rdx,0x38(%rsp)
  mov    %ecx,0x30(%rsp)
  mov    %r9d,0x14(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x108(%rsp)
  xor    %eax,%eax
  call   <filec_getdebug@plt>
  mov    %eax,0x34(%rsp)
  test   %eax,%eax
  jne    L174
L255:
  mov    0x30(%rsp),%esi
  movl   $0x1,0x5c(%rsp)
  test   %esi,%esi
  jle    L586
  mov    0x30(%rsp),%eax
  lea    0x50(%rsp),%rcx
  mov    $0x1,%r15d
  lea    0xb0(%rsp),%rbx
  mov    %rcx,0x20(%rsp)
  lea    D15(%rip),%rcx
  lea    0x60(%rsp),%rbp
  add    $0x1,%eax
  mov    %rcx,0x18(%rsp)
  lea    D206(%rip),%r14
  mov    %rax,0x8(%rsp)
  mov    $0x1,%eax
  jmp    L491
  nopl   0x0(%rax)
L278:
  mov    -0x4(%r13,%r15,4),%edx
L463:
  lea    D236(%rip),%rsi
  mov    %rbp,%rdi
  add    $0x1,%r15
  call   <sprintf@plt>
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <puthd@plt>
  cmp    %r15,0x8(%rsp)
  je     L57
L16:
  mov    0x5c(%rsp),%eax
L491:
  imul   -0x4(%r13,%r15,4),%eax
  mov    %r15d,%edx
  mov    %r14,%rsi
  mov    %rbx,%rdi
  mov    %eax,0x5c(%rsp)
  call   <sprintf@plt>
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <gethd@plt>
  cmpb   $0x0,0x60(%rsp)
  je     L278
  mov    0x20(%rsp),%rdx
  mov    0x18(%rsp),%rsi
  mov    %rbp,%rdi
  call   <sscanf@plt>
  mov    -0x4(%r13,%r15,4),%edx
  cmp    $0x1,%eax
  jne    L463
  cmp    0x50(%rsp),%edx
  jne    L463
  add    $0x1,%r15
  cmp    %r15,0x8(%rsp)
  jne    L16
  nopl   0x0(%rax,%rax,1)
L57:
  lea    D230(%rip),%r13
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <gethd@plt>
  mov    0x20(%rsp),%rdx
  mov    0x18(%rsp),%rsi
  mov    %rbp,%rdi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L207
  mov    0x30(%rsp),%eax
  cmp    %eax,0x50(%rsp)
  je     L607
L207:
  mov    0x30(%rsp),%edx
  mov    0x18(%rsp),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <puthd@plt>
L607:
  lea    D81(%rip),%r13
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  lea    D111(%rip),%r14
  call   <gethd@plt>
  cmpl   $0x1,0x14(%rsp)
  je     L546
  cmpl   $0x2,0x14(%rsp)
  lea    D202(%rip),%r14
  je     L546
  cmpl   $0x3,0x14(%rsp)
  lea    D310(%rip),%r14
  je     L546
  cmpl   $0x4,0x14(%rsp)
  lea    D223(%rip),%r14
  je     L546
  cmpl   $0x5,0x14(%rsp)
  lea    D247(%rip),%r14
  jne    L17
  nopl   0x0(%rax)
L546:
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L276
L81:
  lea    D35(%rip),%r13
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <gethd@plt>
  xor    %eax,%eax
  call   <getbo@plt>
  test   %eax,%eax
  jne    L522
  lea    D341(%rip),%r14
  mov    %rbp,%rdi
  mov    %r14,%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L75
L522:
  xor    %eax,%eax
  call   <getbo@plt>
  cmp    $0x1,%eax
  je     L414
L570:
  mov    0x14(%rsp),%eax
  movl   $0x0,0x4c(%rsp)
  cmp    $0x1,%eax
  je     L3
  cmp    $0x7,%eax
  jg     L2
  cmp    $0x4,%eax
  jg     L39
  sub    $0x3,%eax
  cmp    $0x1,%eax
  ja     L3
  shll   0x5c(%rsp)
  cs nopw 0x0(%rax,%rax,1)
L3:
  mov    $0x200,%esi
  mov    %r12,%rdi
  lea    0x54(%rsp),%r13
  call   <padhd@plt>
  mov    %r12,%rsi
  mov    %r13,%rdi
  call   <gethdl@plt>
  mov    0x34(%rsp),%ecx
  mov    0x5c(%rsp),%eax
  add    0x54(%rsp),%eax
  mov    %eax,0x40(%rsp)
  test   %ecx,%ecx
  jne    L188
  movl   $0x1,0x44(%rsp)
L204:
  mov    0x28(%rsp),%rbx
  lea    0x4c(%rsp),%r14
  lea    0x44(%rsp),%rbp
  mov    %rbx,%rdi
  call   <strlen@plt>
  lea    0x40(%rsp),%rcx
  mov    %r14,%r8
  mov    %rbx,%rsi
  lea    0x58(%rsp),%rdx
  mov    %rbp,%rdi
  mov    %eax,0x58(%rsp)
  call   <dskbow_@plt>
  mov    0x4c(%rsp),%eax
  test   %eax,%eax
  je     L582
L477:
  mov    0x108(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L34
  add    $0x118,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L2:
  cmpl   $0x9,0x14(%rsp)
  jg     L588
  shll   $0x3,0x5c(%rsp)
  jmp    L3
  nopl   0x0(%rax)
L588:
  cmpl   $0xa,0x14(%rsp)
  jne    L3
  shll   $0x4,0x5c(%rsp)
  jmp    L3
  nopl   (%rax)
L39:
  shll   $0x2,0x5c(%rsp)
  jmp    L3
  nopw   0x0(%rax,%rax,1)
L414:
  lea    D293(%rip),%r14
  mov    %rbp,%rdi
  mov    %r14,%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L570
L75:
  mov    %r12,%rdx
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <puthd@plt>
  jmp    L570
  cs nopw 0x0(%rax,%rax,1)
L17:
  cmpl   $0x6,0x14(%rsp)
  lea    D328(%rip),%r14
  je     L546
  cmpl   $0x7,0x14(%rsp)
  lea    D235(%rip),%r14
  je     L546
  cmpl   $0x8,0x14(%rsp)
  je     L105
  cmpl   $0x9,0x14(%rsp)
  jne    L225
  lea    D127(%rip),%rsi
  mov    %rbp,%rdi
  lea    D235(%rip),%r14
  call   <strcmp@plt>
  test   %rax,%rax
  je     L81
  nopl   0x0(%rax)
L276:
  mov    %r12,%rdx
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <puthd@plt>
  jmp    L81
  nopl   0x0(%rax,%rax,1)
L582:
  lea    0x48(%rsp),%r15
  mov    %rbp,%rdi
  movl   $0x0,0x48(%rsp)
  mov    %r15,%rsi
  call   <dskbww_@plt>
  mov    %r13,%rdx
  mov    %r14,%rcx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <dskbw_@plt>
  mov    0x4c(%rsp),%edx
  test   %edx,%edx
  jne    L372
  mov    0x38(%rsp),%rsi
  lea    0x5c(%rsp),%rdx
  mov    %r14,%rcx
  mov    %rbp,%rdi
  call   <dskbw_@plt>
  mov    0x4c(%rsp),%eax
  test   %eax,%eax
  je     L547
L372:
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <dskbcw_@plt>
  mov    0x4c(%rsp),%eax
  jmp    L477
  xchg   %ax,%ax
L188:
  mov    %r12,%rsi
  lea    D252(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x28(%rsp),%rsi
  xor    %eax,%eax
  lea    D215(%rip),%rdi
  movl   $0x1,0x44(%rsp)
  call   <printf@plt>
  jmp    L204
  nopl   0x0(%rax)
L174:
  mov    0x28(%rsp),%rsi
  lea    D245(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %r12,%rsi
  lea    D49(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x30(%rsp),%ebx
  xor    %eax,%eax
  lea    D313(%rip),%rdi
  mov    %ebx,%esi
  call   <printf@plt>
  test   %ebx,%ebx
  jle    L404
  mov    0x30(%rsp),%eax
  mov    %r13,%r14
  lea    D350(%rip),%rbx
  sub    $0x1,%eax
  lea    0x4(%r13,%rax,4),%rbp
  nopw   0x0(%rax,%rax,1)
L262:
  mov    (%r14),%esi
  mov    %rbx,%rdi
  xor    %eax,%eax
  add    $0x4,%r14
  call   <printf@plt>
  cmp    %r14,%rbp
  jne    L262
L404:
  mov    0x14(%rsp),%ebx
  xor    %eax,%eax
  lea    D320(%rip),%rdi
  mov    %ebx,%esi
  call   <printf@plt>
  cmp    $0x1,%ebx
  je     L111
  mov    0x14(%rsp),%eax
  cmp    $0x8,%eax
  ja     L255
  lea    D14(%rip),%rdx
  movslq (%rdx,%rax,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  nopl   0x0(%rax)
L547:
  mov    %r15,%rsi
  mov    %rbp,%rdi
  movl   $0x1,0x48(%rsp)
  call   <dskbww_@plt>
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <dskbcw_@plt>
  mov    0x4c(%rsp),%eax
  jmp    L477
L225:
  cmpl   $0xa,0x14(%rsp)
  jne    L81
  lea    D63(%rip),%rsi
  mov    %rbp,%rdi
  lea    D239(%rip),%r14
  call   <strcmp@plt>
  test   %rax,%rax
  je     L81
  jmp    L276
  xchg   %ax,%ax
L105:
  lea    D239(%rip),%r14
  jmp    L546
  nopl   0x0(%rax)
L586:
  lea    0x50(%rsp),%rax
  lea    0x60(%rsp),%rbp
  mov    %rax,0x20(%rsp)
  lea    D15(%rip),%rax
  mov    %rax,0x18(%rsp)
  jmp    L57
L111:
  lea    D148(%rip),%rdi
  call   <puts@plt>
  jmp    L255
  lea    D175(%rip),%rdi
  call   <puts@plt>
  jmp    L255
  lea    D149(%rip),%rdi
  call   <puts@plt>
  jmp    L255
  lea    D210(%rip),%rdi
  call   <puts@plt>
  jmp    L255
  lea    D303(%rip),%rdi
  call   <puts@plt>
  jmp    L255
  lea    D26(%rip),%rdi
  call   <puts@plt>
  jmp    L255
  lea    D104(%rip),%rdi
  call   <puts@plt>
  jmp    L255
  lea    D222(%rip),%rdi
  call   <puts@plt>
  jmp    L255
L34:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D15
type_infered: string
name: extract_symbolic_data
arguments: tag: D206
type_infered: string
name: extract_symbolic_data
arguments: tag: D236
type_infered: string
name: extract_symbolic_data
arguments: tag: D230
type_infered: string
name: extract_symbolic_data
arguments: tag: D81
type_infered: string
name: extract_symbolic_data
arguments: tag: D111
type_infered: string
name: extract_symbolic_data
arguments: tag: D202
type_infered: string
name: extract_symbolic_data
arguments: tag: D310
type_infered: string
name: extract_symbolic_data
arguments: tag: D223
type_infered: string
name: extract_symbolic_data
arguments: tag: D247
type_infered: string
name: extract_symbolic_data
arguments: tag: D35
type_infered: string
name: extract_symbolic_data
arguments: tag: D341
type_infered: string
name: extract_symbolic_data
arguments: tag: D293
type_infered: string
name: extract_symbolic_data
arguments: tag: D328
type_infered: string
name: extract_symbolic_data
arguments: tag: D235
type_infered: string
name: extract_symbolic_data
arguments: tag: D127
type_infered: string
name: extract_symbolic_data
arguments: tag: D252
type_infered: string
name: extract_symbolic_data
arguments: tag: D215
type_infered: string
name: extract_symbolic_data
arguments: tag: D245
type_infered: string
name: extract_symbolic_data
arguments: tag: D49
type_infered: string
name: extract_symbolic_data
arguments: tag: D313
type_infered: string
name: extract_symbolic_data
arguments: tag: D350
type_infered: string
name: extract_symbolic_data
arguments: tag: D320
type_infered: string
name: extract_symbolic_data
arguments: tag: D63
type_infered: string
name: extract_symbolic_data
arguments: tag: D239
type_infered: string
name: extract_symbolic_data
arguments: tag: D148
type_infered: string
name: extract_symbolic_data
arguments: tag: D175
type_infered: string
name: extract_symbolic_data
arguments: tag: D149
type_infered: string
name: extract_symbolic_data
arguments: tag: D210
type_infered: string
name: extract_symbolic_data
arguments: tag: D303
type_infered: string
name: extract_symbolic_data
arguments: tag: D26
type_infered: string
name: extract_symbolic_data
arguments: tag: D104
type_infered: string
name: extract_symbolic_data
arguments: tag: D222
type_infered: string

tool: D15: %d

tool: D206: SIZE%d

tool: D236: %4d

tool: D230: DIM

tool: D81: TYPE

tool: D111: signed_byte

tool: D202: unsigned_byte

tool: D310: signed_short

tool: D223: unsigned_short

tool: D247: signed_long

tool: D35: BYTE_ORDER

tool: D341: little_endian

tool: D293: big_endian

tool: D328: unsigned_long

tool: D235: float

tool: D127: complex

tool: D252: Updated Header        : 
%s<END


tool: D215: Opening file : %s


tool: D245: Filename      : %s


tool: D49: Header        : 
%s<END


tool: D313: Array dim     : %d


tool: D350:               : %d


tool: D320: Type          : %d

tool: D63: double_complex

tool: D239: double

tool: D148:  (signed_byte)

tool: D175:  (double)

tool: D149:  (unsigned_byte)

tool: D210:  (signed_short)

tool: D303:  (unsigned_short)

tool: D26:  (signed_long)

tool: D104:  (unsigned_long)

tool: D222:  (float)

assistant: ```c
int wrfile(char *filename, char *head, char *array, int naxis, int *axis, int type) {
  int size, lun;
  int lflag;
  int istat;
  char s[80], s1[80];
  int t;
  int headl, j, i;
  int as;
  int filec_debug = filec_getdebug();
  if (filec_debug) {
    printf("Filename      : %s\n", filename);
    printf("Header        : \n%s<END\n", head);
    printf("Array dim     : %d\n", naxis);
    for (i = 0; i < naxis; i++)
      printf("              : %d\n", axis[i]);
    printf("Type          : %d", type);
    if (type == 1)
      printf(" (signed_byte)\n");
    else if (type == 2)
      printf(" (unsigned_byte)\n");
    else if (type == 3)
      printf(" (signed_short)\n");
    else if (type == 4)
      printf(" (unsigned_short)\n");
    else if (type == 5)
      printf(" (signed_long)\n");
    else if (type == 6)
      printf(" (unsigned_long)\n");
    else if (type == 7)
      printf(" (float)\n");
    else if (type == 8)
      printf(" (double)\n");
  }
  as = 1;
  for (i = 0; i < naxis; i++) {
    as *= axis[i];
    sprintf(s1, "SIZE%d", i + 1);
    gethd(s1, s, head);
    if (*s == 0 || sscanf(s, "%d", &t) != 1 || t != axis[i]) {
      sprintf(s, "%4d", axis[i]);
      puthd(s1, s, head);
    }
  }
  gethd("DIM", s, head);
  if (sscanf(s, "%d", &t) != 1 || t != naxis) {
    sprintf(s, "%d", naxis);
    puthd("DIM", s, head);
  }
  gethd("TYPE", s, head);
  if (type == 1 && strcmp(s, "signed_byte"))
    puthd("TYPE", "signed_byte", head);
  else if (type == 2 && strcmp(s, "unsigned_byte"))
    puthd("TYPE", "unsigned_byte", head);
  else if (type == 3 && strcmp(s, "signed_short"))
    puthd("TYPE", "signed_short", head);
  else if (type == 4 && strcmp(s, "unsigned_short"))
    puthd("TYPE", "unsigned_short", head);
  else if (type == 5 && strcmp(s, "signed_long"))
    puthd("TYPE", "signed_long", head);
  else if (type == 6 && strcmp(s, "unsigned_long"))
    puthd("TYPE", "unsigned_long", head);
  else if (type == 7 && strcmp(s, "float"))
    puthd("TYPE", "float", head);
  else if (type == 8 && strcmp(s, "double"))
    puthd("TYPE", "double", head);
  else if (type == 9 && strcmp(s, "complex"))
    puthd("TYPE", "float", head);
  else if (type == 10 && strcmp(s, "double_complex"))
    puthd("TYPE", "double", head);
  gethd("BYTE_ORDER", s, head);
  if (getbo() == 0 && strcmp(s, "little_endian") != 0)
    puthd("BYTE_ORDER", "little_endian", head);
  else if (getbo() == 1 && strcmp(s, "big_endian") != 0)
    puthd("BYTE_ORDER", "big_endian", head);
  istat = 0;
  if (type == 1)
    as *= sizeof(char);
  else if (type == 2)
    as *= sizeof(unsigned char);
  else if (type == 3)
    as *= sizeof(short);
  else if (type == 4)
    as *= sizeof(unsigned short);
  else if (type == 5)
    as *= sizeof(int);
  else if (type == 6)
    as *= sizeof(unsigned int);
  else if (type == 7)
    as *= sizeof(float);
  else if (type == 8)
    as *= sizeof(double);
  else if (type == 9)
    as *= 2 * sizeof(float);
  else if (type == 10)
    as *= 2 * sizeof(double);
  padhd(head, 512);
  gethdl(&headl, head);
  size = headl + as;
  if (filec_debug)
    printf("Updated Header        : \n%s<END\n", head);
  lun = 1;
  if (filec_debug)
    printf("Opening file : %s\n", filename);
  j = strlen(filename);
  dskbow_(&lun, filename, &j, &size, &istat);
  if (istat != 0)
    return (istat);
  lflag = (1 == 0);
  dskbww_(&lun, &lflag);
  dskbw_(&lun, head, &headl, &istat);
  if (istat != 0)
    goto close;
  dskbw_(&lun, (char *)array, &as, &istat);
  if (istat != 0)
    goto close;
  lflag = (1 == 1);
  dskbww_(&lun, &lflag);
close:
  dskbcw_(&lun, &istat);
  return (istat);
}
```