user: 请将以下的汇编代码转换成C语言代码：

```asm
<get_swap_info>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x88,%rsp
  mov    %rdi,0x10(%rsp)
  lea    0x78(%rsp),%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x78(%rsp)
  lea    D65(%rip),%rax
  mov    %rsi,0x58(%rsp)
  movq   $0x9,0x38(%rsp)
  movq   $0x8,0x50(%rsp)
  movq   $0xa,0x68(%rsp)
  mov    %rdx,0x70(%rsp)
  movq   $0x0,0x20(%rsp)
  mov    %rax,0x30(%rsp)
  lea    D71(%rip),%rax
  mov    %rax,0x48(%rsp)
  lea    D3(%rip),%rax
  mov    %rax,0x60(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  lea    D34(%rip),%rdi
  movq   $0x0,0x28(%rsp)
  setne  %al
  cmp    $0x1,%rsi
  lea    D5(%rip),%rsi
  sbb    $0xffffffffffffffff,%rax
  cmp    $0x1,%rdx
  sbb    $0xffffffffffffffff,%rax
  mov    %rax,0x18(%rsp)
  call   <fopen@plt>
  mov    %rax,%rbp
  lea    0x20(%rsp),%rax
  mov    %rax,0x8(%rsp)
  test   %rbp,%rbp
  je     L105
L80:
  cmpq   $0x0,0x18(%rsp)
  je     L45
  lea    0x28(%rsp),%rax
  mov    %rax,(%rsp)
  nopl   0x0(%rax,%rax,1)
L93:
  mov    0x8(%rsp),%rsi
  mov    (%rsp),%rdi
  mov    %rbp,%rdx
  call   <getline@plt>
  test   %rax,%rax
  js     L45
  mov    0x10(%rsp),%r15
  mov    0x28(%rsp),%r14
  lea    0x30(%rsp),%r13
  test   %r15,%r15
  je     L51
L91:
  mov    0x8(%r13),%r12
  mov    0x0(%r13),%rsi
  mov    %r14,%rdi
  mov    %r12,%rdx
  call   <strncmp@plt>
  test   %eax,%eax
  je     L111
L51:
  add    $0x18,%r13
  cmp    %rbx,%r13
  je     L93
  mov    0x10(%r13),%r15
  test   %r15,%r15
  jne    L91
  jmp    L51
  nopl   (%rax)
L111:
  lea    0x1(%r14,%r12,1),%rdi
  mov    %r15,%rdx
  lea    D19(%rip),%rsi
  call   <sscanf@plt>
  subq   $0x1,0x18(%rsp)
  jmp    L80
  nop
L45:
  mov    0x28(%rsp),%rdi
  call   <free@plt>
  mov    %rbp,%rdi
  call   <ferror@plt>
  test   %rax,%rax
  jne    L73
  mov    %rbp,%rdi
  call   <fclose@plt>
  xor    %eax,%eax
L100:
  mov    0x78(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L22
  add    $0x88,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L73:
  lea    D25(%rip),%rdi
  call   <warn@plt>
  mov    $0x1,%eax
  jmp    L100
L105:
  lea    D13(%rip),%rdi
  call   <warn@plt>
  mov    $0x1,%eax
  jmp    L100
L22:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D65
type: string
name: retrieve_data
arguments: data_label: D71
type: string
name: retrieve_data
arguments: data_label: D3
type: string
name: retrieve_data
arguments: data_label: D34
type: string
name: retrieve_data
arguments: data_label: D5
type: string
name: retrieve_data
arguments: data_label: D19
type: string
name: retrieve_data
arguments: data_label: D25
type: string
name: retrieve_data
arguments: data_label: D13
type: string

tool: D65: SwapTotal

tool: D71: SwapFree

tool: D3: SwapCached

tool: D34: /proc/meminfo

tool: D5: r

tool: D19: %ld kB


tool: D25: getline '/proc/meminfo':

tool: D13: fopen '/proc/meminfo':

assistant: ```c
int get_swap_info(long *s_total, long *s_free, long *s_cached) {
  FILE *fp;
  struct {
    const char *name;
    const size_t len;
    long *var;
  } ent[] = {
      {"SwapTotal", sizeof("SwapTotal") - 1, s_total},
      {"SwapFree", sizeof("SwapFree") - 1, s_free},
      {"SwapCached", sizeof("SwapCached") - 1, s_cached},
  };
  size_t line_len = 0, i, left;
  char *line = NULL;
  for (i = 0, left = 0; i < (sizeof(ent) / sizeof *(ent)); i++) {
    if (ent[i].var) {
      left++;
    }
  }
  if (!(fp = fopen("/proc/meminfo", "r"))) {
    warn("fopen '/proc/meminfo':");
    return 1;
  }
  while (left > 0 && getline(&line, &line_len, fp) >= 0) {
    for (i = 0; i < (sizeof(ent) / sizeof *(ent)); i++) {
      if (ent[i].var && !strncmp(line, ent[i].name, ent[i].len)) {
        sscanf(line + ent[i].len + 1, "%ld kB\n", ent[i].var);
        left--;
        break;
      }
    }
  }
  free(line);
  if (ferror(fp)) {
    warn("getline '/proc/meminfo':");
    return 1;
  }
  fclose(fp);
  return 0;
}
```