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

```asm
<smack_accesses_add_from_file>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,0x18(%rsp)
  mov    %esi,%edi
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  movq   $0x0,0x20(%rsp)
  movq   $0x0,0x28(%rsp)
  call   <dup@plt>
  mov    %eax,%ebx
  cmp    $0xffffffff,%eax
  je     L89
  lea    D24(%rip),%rsi
  mov    %eax,%edi
  call   <fdopen@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L26
  lea    0x28(%rsp),%rax
  mov    %rax,0x8(%rsp)
  lea    0x20(%rsp),%rax
  mov    %rax,0x10(%rsp)
  lea    D4(%rip),%rbx
  jmp    L133
L26:
  mov    %ebx,%edi
  call   <close@plt>
  mov    $0xffffffff,%ebx
  jmp    L89
L130:
  mov    %r14,%rcx
  mov    %r13,%rdx
  mov    %r12,%rsi
  mov    0x18(%rsp),%rdi
  call   <smack_accesses_add@plt>
L113:
  test   %eax,%eax
  jne    L114
L133:
  mov    %r15,%rdx
  mov    0x8(%rsp),%rsi
  mov    0x10(%rsp),%rdi
  call   <getline@plt>
  test   %rax,%rax
  js     L45
  lea    D6(%rip),%rsi
  mov    0x20(%rsp),%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L133
  lea    0x30(%rsp),%rbp
  mov    %rbp,%rdx
  mov    %rbx,%rsi
  mov    0x20(%rsp),%rdi
  call   <strtok_r@plt>
  mov    %rax,%r12
  mov    %rbp,%rdx
  mov    %rbx,%rsi
  mov    $0x0,%edi
  call   <strtok_r@plt>
  mov    %rax,%r13
  mov    %rbp,%rdx
  mov    %rbx,%rsi
  mov    $0x0,%edi
  call   <strtok_r@plt>
  mov    %rax,%r14
  mov    %rbp,%rdx
  mov    %rbx,%rsi
  mov    $0x0,%edi
  call   <strtok_r@plt>
  mov    %rax,%rbp
  test   %r12,%r12
  sete   %al
  test   %r13,%r13
  sete   %dl
  or     %dl,%al
  jne    L114
  test   %r14,%r14
  je     L114
  lea    0x30(%rsp),%rdx
  mov    %rbx,%rsi
  mov    $0x0,%edi
  call   <strtok_r@plt>
  test   %rax,%rax
  jne    L114
  test   %rbp,%rbp
  je     L130
  mov    %rbp,%r8
  mov    %r14,%rcx
  mov    %r13,%rdx
  mov    %r12,%rsi
  mov    0x18(%rsp),%rdi
  call   <smack_accesses_add_modify@plt>
  jmp    L113
L45:
  mov    %r15,%rdi
  call   <ferror@plt>
  test   %rax,%rax
  jne    L114
  mov    0x20(%rsp),%rdi
  call   <free@plt>
  mov    %r15,%rdi
  call   <fclose@plt>
  mov    $0x0,%ebx
  jmp    L89
L114:
  mov    0x20(%rsp),%rdi
  call   <free@plt>
  mov    %r15,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%ebx
L89:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L17
  mov    %ebx,%eax
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L17:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D24
type_infered: string
name: extract_symbolic_data
arguments: label: D4
type_infered: string
name: extract_symbolic_data
arguments: label: D6
type_infered: string

tool: D24: r

tool: D4:  	


tool: D6: 


assistant: ```c
int smack_accesses_add_from_file(struct smack_accesses *accesses, int fd) {
  FILE *file = NULL;
  char *buf = NULL;
  size_t buf_len = 0;
  char *ptr;
  const char *subject, *object, *access, *access2;
  int newfd;
  int ret;
  newfd = dup(fd);
  if (newfd == -1)
    return -1;
  file = fdopen(newfd, "r");
  if (file == NULL) {
    close(newfd);
    return -1;
  }
  while (getline(&buf, &buf_len, file) >= 0) {
    if (strcmp(buf, "\n") == 0)
      continue;
    subject = strtok_r(buf, " \t\n", &ptr);
    object = strtok_r(NULL, " \t\n", &ptr);
    access = strtok_r(NULL, " \t\n", &ptr);
    access2 = strtok_r(NULL, " \t\n", &ptr);
    if (subject == NULL || object == NULL || access == NULL || strtok_r(NULL, " \t\n", &ptr) != NULL)
      goto err_out;
    if (access2 == NULL)
      ret = smack_accesses_add(accesses, subject, object, access);
    else
      ret = smack_accesses_add_modify(accesses, subject, object, access, access2);
    if (ret)
      goto err_out;
  }
  if (ferror(file))
    goto err_out;
  free(buf);
  fclose(file);
  return 0;
err_out:
  free(buf);
  fclose(file);
  return -1;
}
```