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

```asm
<getmntent_r>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %ecx,-0x3c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x18(%rbp)
  movq   $0x0,-0x20(%rbp)
  lea    D15(%rip),%rax
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  je     L117
  cmpq   $0x0,-0x30(%rbp)
  je     L117
  cmpq   $0x0,-0x38(%rbp)
  jne    L114
L117:
  mov    $0x0,%eax
  jmp    L156
L73:
  mov    -0x38(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x23,%al
  je     L177
  mov    -0x38(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0xa,%al
  jne    L78
L177:
  nop
L114:
  mov    -0x28(%rbp),%rdx
  mov    -0x3c(%rbp),%ecx
  mov    -0x38(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <fgets@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L73
  jmp    L200
L78:
  nop
L200:
  cmpq   $0x0,-0x18(%rbp)
  jne    L152
  mov    $0x0,%eax
  jmp    L156
L152:
  lea    -0x20(%rbp),%rdx
  mov    -0x10(%rbp),%rcx
  mov    -0x38(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strtok_r@plt>
  mov    -0x30(%rbp),%rdx
  mov    %rax,0x20(%rdx)
  mov    -0x30(%rbp),%rax
  mov    0x20(%rax),%rax
  test   %rax,%rax
  jne    L43
  mov    $0x0,%eax
  jmp    L156
L43:
  lea    -0x20(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <strtok_r@plt>
  mov    -0x30(%rbp),%rdx
  mov    %rax,0x28(%rdx)
  mov    -0x30(%rbp),%rax
  mov    0x20(%rax),%rax
  test   %rax,%rax
  jne    L34
  mov    $0x0,%eax
  jmp    L156
L34:
  lea    -0x20(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <strtok_r@plt>
  mov    -0x30(%rbp),%rdx
  mov    %rax,0x18(%rdx)
  mov    -0x30(%rbp),%rax
  mov    0x18(%rax),%rax
  test   %rax,%rax
  jne    L219
  mov    $0x0,%eax
  jmp    L156
L219:
  lea    -0x20(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <strtok_r@plt>
  mov    -0x30(%rbp),%rdx
  mov    %rax,(%rdx)
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L128
  mov    -0x30(%rbp),%rax
  lea    D6(%rip),%rdx
  mov    %rdx,(%rax)
L128:
  lea    -0x20(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <strtok_r@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  je     L28
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  jmp    L3
L28:
  mov    $0x0,%eax
L3:
  mov    -0x30(%rbp),%rdx
  mov    %rax,0x10(%rdx)
  lea    -0x20(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <strtok_r@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  je     L194
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  jmp    L26
L194:
  mov    $0x0,%eax
L26:
  mov    -0x30(%rbp),%rdx
  mov    %rax,0x8(%rdx)
  mov    -0x30(%rbp),%rax
L156:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L47
  call   <__stack_chk_fail@plt>
L47:
  leave
  ret
```

tool_calls: name: parse_data
arguments: label: D15
type_infered: string
name: parse_data
arguments: label: D6
type_infered: string

tool: D15:  	


tool: 

assistant: ```c
struct mntent *getmntent_r(FILE *fp, struct mntent *mntbuf, char *buf, int buflen) {
  char *line = NULL, *saveptr = NULL;
  const char *sep = " \t\n";
  if (!fp || !mntbuf || !buf)
    return NULL;
  while ((line = fgets(buf, buflen, fp)) != NULL) {
    if (buf[0] == '#' || buf[0] == '\n')
      continue;
    break;
  }
  if (!line)
    return NULL;
  mntbuf->mnt_fsname = strtok_r(buf, sep, &saveptr);
  if (!mntbuf->mnt_fsname)
    return NULL;
  mntbuf->mnt_dir = strtok_r(NULL, sep, &saveptr);
  if (!mntbuf->mnt_fsname)
    return NULL;
  mntbuf->mnt_type = strtok_r(NULL, sep, &saveptr);
  if (!mntbuf->mnt_type)
    return NULL;
  mntbuf->mnt_opts = strtok_r(NULL, sep, &saveptr);
  if (!mntbuf->mnt_opts)
    mntbuf->mnt_opts = "";
  line = strtok_r(NULL, sep, &saveptr);
  mntbuf->mnt_freq = !line ? 0 : atoi(line);
  line = strtok_r(NULL, sep, &saveptr);
  mntbuf->mnt_passno = !line ? 0 : atoi(line);
  return mntbuf;
}
```