user: Translate the below assembly code into C programming language:

```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    L141
L521:
  mov    0x30(%rsp),%esi
  movl   $0x1,0x5c(%rsp)
  test   %esi,%esi
  jle    L568
  mov    0x30(%rsp),%eax
  lea    0x50(%rsp),%rcx
  mov    $0x1,%r15d
  lea    0xb0(%rsp),%rbx
  mov    %rcx,0x20(%rsp)
  lea    D126(%rip),%rcx
  lea    0x60(%rsp),%rbp
  add    $0x1,%eax
  mov    %rcx,0x18(%rsp)
  lea    D17(%rip),%r14
  mov    %rax,0x8(%rsp)
  mov    $0x1,%eax
  jmp    L136
  nopl   0x0(%rax)
L396:
  mov    -0x4(%r13,%r15,4),%edx
L485:
  lea    D260(%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     L203
L526:
  mov    0x5c(%rsp),%eax
L136:
  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     L396
  mov    0x20(%rsp),%rdx
  mov    0x18(%rsp),%rsi
  mov    %rbp,%rdi
  call   <sscanf@plt>
  mov    -0x4(%r13,%r15,4),%edx
  cmp    $0x1,%eax
  jne    L485
  cmp    0x50(%rsp),%edx
  jne    L485
  add    $0x1,%r15
  cmp    %r15,0x8(%rsp)
  jne    L526
  nopl   0x0(%rax,%rax,1)
L203:
  lea    D128(%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    L115
  mov    0x30(%rsp),%eax
  cmp    %eax,0x50(%rsp)
  je     L91
L115:
  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>
L91:
  lea    D319(%rip),%r13
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  lea    D282(%rip),%r14
  call   <gethd@plt>
  cmpl   $0x1,0x14(%rsp)
  je     L582
  cmpl   $0x2,0x14(%rsp)
  lea    D320(%rip),%r14
  je     L582
  cmpl   $0x3,0x14(%rsp)
  lea    D350(%rip),%r14
  je     L582
  cmpl   $0x4,0x14(%rsp)
  lea    D252(%rip),%r14
  je     L582
  cmpl   $0x5,0x14(%rsp)
  lea    D231(%rip),%r14
  jne    L118
  nopl   0x0(%rax)
L582:
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L32
L257:
  lea    D41(%rip),%r13
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <gethd@plt>
  xor    %eax,%eax
  call   <getbo@plt>
  test   %eax,%eax
  jne    L330
  lea    D32(%rip),%r14
  mov    %rbp,%rdi
  mov    %r14,%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L284
L330:
  xor    %eax,%eax
  call   <getbo@plt>
  cmp    $0x1,%eax
  je     L72
L127:
  mov    0x14(%rsp),%eax
  movl   $0x0,0x4c(%rsp)
  cmp    $0x1,%eax
  je     L415
  cmp    $0x7,%eax
  jg     L490
  cmp    $0x4,%eax
  jg     L166
  sub    $0x3,%eax
  cmp    $0x1,%eax
  ja     L415
  shll   0x5c(%rsp)
  cs nopw 0x0(%rax,%rax,1)
L415:
  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    L82
  movl   $0x1,0x44(%rsp)
L480:
  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     L584
L523:
  mov    0x108(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L543
  add    $0x118,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L490:
  cmpl   $0x9,0x14(%rsp)
  jg     L212
  shll   $0x3,0x5c(%rsp)
  jmp    L415
  nopl   0x0(%rax)
L212:
  cmpl   $0xa,0x14(%rsp)
  jne    L415
  shll   $0x4,0x5c(%rsp)
  jmp    L415
  nopl   (%rax)
L166:
  shll   $0x2,0x5c(%rsp)
  jmp    L415
  nopw   0x0(%rax,%rax,1)
L72:
  lea    D94(%rip),%r14
  mov    %rbp,%rdi
  mov    %r14,%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L127
L284:
  mov    %r12,%rdx
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <puthd@plt>
  jmp    L127
  cs nopw 0x0(%rax,%rax,1)
L118:
  cmpl   $0x6,0x14(%rsp)
  lea    D27(%rip),%r14
  je     L582
  cmpl   $0x7,0x14(%rsp)
  lea    D236(%rip),%r14
  je     L582
  cmpl   $0x8,0x14(%rsp)
  je     L193
  cmpl   $0x9,0x14(%rsp)
  jne    L390
  lea    D145(%rip),%rsi
  mov    %rbp,%rdi
  lea    D236(%rip),%r14
  call   <strcmp@plt>
  test   %rax,%rax
  je     L257
  nopl   0x0(%rax)
L32:
  mov    %r12,%rdx
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <puthd@plt>
  jmp    L257
  nopl   0x0(%rax,%rax,1)
L584:
  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    L150
  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     L573
L150:
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <dskbcw_@plt>
  mov    0x4c(%rsp),%eax
  jmp    L523
  xchg   %ax,%ax
L82:
  mov    %r12,%rsi
  lea    D227(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x28(%rsp),%rsi
  xor    %eax,%eax
  lea    D240(%rip),%rdi
  movl   $0x1,0x44(%rsp)
  call   <printf@plt>
  jmp    L480
  nopl   0x0(%rax)
L141:
  mov    0x28(%rsp),%rsi
  lea    D36(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %r12,%rsi
  lea    D206(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x30(%rsp),%ebx
  xor    %eax,%eax
  lea    D90(%rip),%rdi
  mov    %ebx,%esi
  call   <printf@plt>
  test   %ebx,%ebx
  jle    L180
  mov    0x30(%rsp),%eax
  mov    %r13,%r14
  lea    D73(%rip),%rbx
  sub    $0x1,%eax
  lea    0x4(%r13,%rax,4),%rbp
  nopw   0x0(%rax,%rax,1)
L472:
  mov    (%r14),%esi
  mov    %rbx,%rdi
  xor    %eax,%eax
  add    $0x4,%r14
  call   <printf@plt>
  cmp    %r14,%rbp
  jne    L472
L180:
  mov    0x14(%rsp),%ebx
  xor    %eax,%eax
  lea    D329(%rip),%rdi
  mov    %ebx,%esi
  call   <printf@plt>
  cmp    $0x1,%ebx
  je     L434
  mov    0x14(%rsp),%eax
  cmp    $0x8,%eax
  ja     L521
  lea    D216(%rip),%rdx
  movslq (%rdx,%rax,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  nopl   0x0(%rax)
L573:
  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    L523
L390:
  cmpl   $0xa,0x14(%rsp)
  jne    L257
  lea    D292(%rip),%rsi
  mov    %rbp,%rdi
  lea    D39(%rip),%r14
  call   <strcmp@plt>
  test   %rax,%rax
  je     L257
  jmp    L32
  xchg   %ax,%ax
L193:
  lea    D39(%rip),%r14
  jmp    L582
  nopl   0x0(%rax)
L568:
  lea    0x50(%rsp),%rax
  lea    0x60(%rsp),%rbp
  mov    %rax,0x20(%rsp)
  lea    D126(%rip),%rax
  mov    %rax,0x18(%rsp)
  jmp    L203
L434:
  lea    D168(%rip),%rdi
  call   <puts@plt>
  jmp    L521
  lea    D269(%rip),%rdi
  call   <puts@plt>
  jmp    L521
  lea    D2(%rip),%rdi
  call   <puts@plt>
  jmp    L521
  lea    D117(%rip),%rdi
  call   <puts@plt>
  jmp    L521
  lea    D53(%rip),%rdi
  call   <puts@plt>
  jmp    L521
  lea    D24(%rip),%rdi
  call   <puts@plt>
  jmp    L521
  lea    D120(%rip),%rdi
  call   <puts@plt>
  jmp    L521
  lea    D75(%rip),%rdi
  call   <puts@plt>
  jmp    L521
L543:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D126
type_guessed: string
name: retrieve_data
arguments: tag: D17
type_guessed: string
name: retrieve_data
arguments: tag: D260
type_guessed: string
name: retrieve_data
arguments: tag: D128
type_guessed: string
name: retrieve_data
arguments: tag: D319
type_guessed: string
name: retrieve_data
arguments: tag: D282
type_guessed: string
name: retrieve_data
arguments: tag: D320
type_guessed: string
name: retrieve_data
arguments: tag: D350
type_guessed: string
name: retrieve_data
arguments: tag: D252
type_guessed: string
name: retrieve_data
arguments: tag: D231
type_guessed: string
name: retrieve_data
arguments: tag: D41
type_guessed: string
name: retrieve_data
arguments: tag: D32
type_guessed: string
name: retrieve_data
arguments: tag: D94
type_guessed: string
name: retrieve_data
arguments: tag: D27
type_guessed: string
name: retrieve_data
arguments: tag: D236
type_guessed: string
name: retrieve_data
arguments: tag: D145
type_guessed: string
name: retrieve_data
arguments: tag: D227
type_guessed: string
name: retrieve_data
arguments: tag: D240
type_guessed: string
name: retrieve_data
arguments: tag: D36
type_guessed: string
name: retrieve_data
arguments: tag: D206
type_guessed: string
name: retrieve_data
arguments: tag: D90
type_guessed: string
name: retrieve_data
arguments: tag: D73
type_guessed: string
name: retrieve_data
arguments: tag: D329
type_guessed: string
name: retrieve_data
arguments: tag: D292
type_guessed: string
name: retrieve_data
arguments: tag: D39
type_guessed: string
name: retrieve_data
arguments: tag: D168
type_guessed: string
name: retrieve_data
arguments: tag: D269
type_guessed: string
name: retrieve_data
arguments: tag: D2
type_guessed: string
name: retrieve_data
arguments: tag: D117
type_guessed: string
name: retrieve_data
arguments: tag: D53
type_guessed: string
name: retrieve_data
arguments: tag: D24
type_guessed: string
name: retrieve_data
arguments: tag: D120
type_guessed: string
name: retrieve_data
arguments: tag: D75
type_guessed: string

tool: D126: %d

tool: D17: SIZE%d

tool: D260: %4d

tool: D128: DIM

tool: D319: TYPE

tool: D282: signed_byte

tool: D320: unsigned_byte

tool: D350: signed_short

tool: D252: unsigned_short

tool: D231: signed_long

tool: D41: BYTE_ORDER

tool: D32: little_endian

tool: D94: big_endian

tool: D27: unsigned_long

tool: D236: float

tool: D145: complex

tool: D227: Updated Header        : 
%s<END


tool: D240: Opening file : %s


tool: D36: Filename      : %s


tool: D206: Header        : 
%s<END


tool: D90: Array dim     : %d


tool: D73:               : %d


tool: D329: Type          : %d

tool: D292: double_complex

tool: D39: double

tool: D168:  (signed_byte)

tool: D269:  (double)

tool: D2:  (unsigned_byte)

tool: D117:  (signed_short)

tool: D53:  (unsigned_short)

tool: D24:  (signed_long)

tool: D120:  (unsigned_long)

tool: D75:  (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);
}
```