user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<irafrdhead>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x68,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  movl   $0x0,(%rsi)
  lea    D23(%rip),%rsi
  call   <fopen@plt>
  test   %rax,%rax
  je     L85
  xor    %esi,%esi
  mov    $0x2,%edx
  mov    %rax,%rdi
  mov    %rax,%rbp
  call   <fseek@plt>
  test   %rax,%rax
  jne    L126
  mov    %rbp,%rdi
  call   <ftell@plt>
  mov    %rax,%r14
  test   %rax,%rax
  js     L98
  xor    %edx,%edx
  xor    %esi,%esi
  mov    %rbp,%rdi
  call   <fseek@plt>
  test   %rax,%rax
  jne    L79
  lea    0x1388(%r14),%r15d
  mov    $0x1,%edi
  mov    %r15d,%esi
  call   <calloc@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L86
  mov    %r15d,(%rbx)
  mov    %r14,%rdx
  mov    %rax,%rdi
  mov    %rbp,%rcx
  mov    $0x1,%esi
  call   <fread@plt>
  mov    %rbp,%rdi
  mov    %eax,%r14d
  call   <fclose@plt>
  cmp    $0x3ff,%r14d
  jle    L106
L128:
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L22
  add    $0x68,%rsp
  mov    %r13,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L86:
  mov    %rsp,%rbp
  mov    %r15d,%edx
  lea    D36(%rip),%rsi
  xor    %eax,%eax
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <ffpmsg@plt>
  mov    %r12,%rdi
  call   <ffpmsg@plt>
  jmp    L128
  nopl   0x0(%rax)
L126:
  lea    D20(%rip),%rdi
  xor    %r13d,%r13d
  call   <ffpmsg@plt>
  mov    %r12,%rdi
  call   <ffpmsg@plt>
  jmp    L128
  nopl   0x0(%rax)
L79:
  lea    D26(%rip),%rdi
  xor    %r13d,%r13d
  call   <ffpmsg@plt>
  mov    %r12,%rdi
  call   <ffpmsg@plt>
  jmp    L128
  nopl   0x0(%rax)
L98:
  lea    D55(%rip),%rdi
  xor    %r13d,%r13d
  call   <ffpmsg@plt>
  mov    %r12,%rdi
  call   <ffpmsg@plt>
  jmp    L128
  nopl   0x0(%rax)
L85:
  lea    D31(%rip),%rdi
  xor    %r13d,%r13d
  call   <ffpmsg@plt>
  mov    %r12,%rdi
  call   <ffpmsg@plt>
  jmp    L128
  nopl   0x0(%rax)
L106:
  mov    %rsp,%rbp
  mov    $0x400,%ecx
  mov    %r14d,%edx
  xor    %eax,%eax
  lea    D21(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <ffpmsg@plt>
  mov    %r12,%rdi
  call   <ffpmsg@plt>
  mov    %r13,%rdi
  xor    %r13d,%r13d
  call   <free@plt>
  jmp    L128
L22:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D23
data_type: string
name: parse_data
arguments: data_label: D36
data_type: string
name: parse_data
arguments: data_label: D20
data_type: string
name: parse_data
arguments: data_label: D26
data_type: string
name: parse_data
arguments: data_label: D55
data_type: string
name: parse_data
arguments: data_label: D31
data_type: string
name: parse_data
arguments: data_label: D21
data_type: string

tool: D23: rb

tool: D36: IRAFRHEAD Cannot allocate %d-byte header

tool: D20: IRAFRHEAD: cannot seek in file:

tool: D26: IRAFRHEAD: cannot seek to beginning of file:

tool: D55: IRAFRHEAD: cannot get pos. in file:

tool: D31: unable to open IRAF header file:

tool: D21: IRAFRHEAD header file: %d / %d bytes read.

assistant: ```c
char *irafrdhead(const char *filename, int *lihead) {
  FILE *fd;
  int nbr;
  char *irafheader;
  char errmsg[81];
  long nbhead;
  int nihead;
  *lihead = 0;
  fd = fopen(filename, "rb");
  if (fd == NULL) {
    ffpmsg("unable to open IRAF header file:");
    ffpmsg(filename);
    return (NULL);
  }
  if (fseek(fd, 0, 2) != 0) {
    ffpmsg("IRAFRHEAD: cannot seek in file:");
    ffpmsg(filename);
    return (NULL);
  }
  nbhead = ftell(fd);
  if (nbhead < 0) {
    ffpmsg("IRAFRHEAD: cannot get pos. in file:");
    ffpmsg(filename);
    return (NULL);
  }
  if (fseek(fd, 0, 0) != 0) {
    ffpmsg("IRAFRHEAD: cannot seek to beginning of file:");
    ffpmsg(filename);
    return (NULL);
  }
  nihead = nbhead + 5000;
  irafheader = (char *)calloc(1, nihead);
  if (irafheader == NULL) {
    sprintf(errmsg, "IRAFRHEAD Cannot allocate %d-byte header", nihead);
    ffpmsg(errmsg);
    ffpmsg(filename);
    return (NULL);
  }
  *lihead = nihead;
  nbr = fread(irafheader, 1, nbhead, fd);
  fclose(fd);
  if (nbr < 1024) {
    sprintf(errmsg, "IRAFRHEAD header file: %d / %d bytes read.", nbr, 1024);
    ffpmsg(errmsg);
    ffpmsg(filename);
    free(irafheader);
    return (NULL);
  }
  return (irafheader);
}
```