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

```asm
<arch__cpuinfo_freq>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,0x8(%rsp)
  mov    %rsi,%r14
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  movq   $0x0,0x18(%rsp)
  movq   $0x0,0x20(%rsp)
  lea    D74(%rip),%rsi
  lea    D56(%rip),%rdi
  call   <fopen@plt>
  test   %rax,%rax
  je     L118
  mov    %rax,%rbx
  lea    D6(%rip),%r13
  lea    0x20(%rsp),%r12
  lea    D80(%rip),%r15
L82:
  lea    0x18(%rsp),%rdi
  mov    %rbx,%rdx
  mov    %r12,%rsi
  call   <getline@plt>
  test   %rax,%rax
  jle    L12
  mov    $0x5,%edx
  mov    %r13,%rsi
  mov    0x18(%rsp),%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L82
  mov    0x18(%rsp),%rbp
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <strcspn@plt>
  cltq
  lea    0x1(%rbp,%rax,1),%rdi
  mov    %r14,%rcx
  mov    0x8(%rsp),%rdx
  lea    D25(%rip),%rsi
  call   <sscanf@plt>
  cmp    $0x2,%eax
  jne    L82
  lea    D103(%rip),%rsi
  mov    %r14,%rdi
  call   <strcasecmp@plt>
  test   %rax,%rax
  jne    L26
  movsd  D50(%rip),%xmm0
  mov    0x8(%rsp),%rax
  mulsd  (%rax),%xmm0
  movsd  %xmm0,(%rax)
L12:
  lea    D106(%rip),%r13
  lea    0x20(%rsp),%r12
  lea    0x18(%rsp),%rbp
  lea    D29(%rip),%r14
L59:
  mov    %rbx,%rdx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <getline@plt>
  test   %rax,%rax
  jle    L7
  mov    $0x6,%edx
  mov    %r13,%rsi
  mov    0x18(%rsp),%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L59
  mov    $0x3a,%esi
  mov    0x18(%rsp),%rdi
  call   <strchr@plt>
  mov    %rax,%rdx
  sub    0x18(%rsp),%rdx
  add    $0x2,%rdx
  cmp    0x20(%rsp),%rdx
  jae    L59
  lea    0x2(%rax),%rdi
  mov    $0x7,%edx
  mov    %r14,%rsi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L59
  mov    $0x0,%ebp
  jmp    L69
L26:
  lea    D40(%rip),%rsi
  mov    %r14,%rdi
  call   <strcasecmp@plt>
  test   %rax,%rax
  jne    L12
  movsd  D104(%rip),%xmm0
  mov    0x8(%rsp),%rax
  mulsd  (%rax),%xmm0
  movsd  %xmm0,(%rax)
  jmp    L12
L7:
  mov    $0xffffffff,%ebp
L69:
  mov    0x18(%rsp),%rdi
  call   <free@plt>
  mov    %rbx,%rdi
  call   <fclose@plt>
L0:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L138
  mov    %ebp,%eax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L118:
  mov    $0xffffffff,%ebp
  jmp    L0
L138:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D74
datatype: string
name: disassemble_data
arguments: data_label: D56
datatype: string
name: disassemble_data
arguments: data_label: D6
datatype: string
name: disassemble_data
arguments: data_label: D80
datatype: string
name: disassemble_data
arguments: data_label: D25
datatype: string
name: disassemble_data
arguments: data_label: D103
datatype: string
name: disassemble_data
arguments: data_label: D50
datatype: byte[8]
name: disassemble_data
arguments: data_label: D106
datatype: string
name: disassemble_data
arguments: data_label: D29
datatype: string
name: disassemble_data
arguments: data_label: D40
datatype: string
name: disassemble_data
arguments: data_label: D104
datatype: byte[8]

tool: D74: r

tool: D56: /proc/cpuinfo

tool: D6: clock

tool: D80: :

tool: D25: %lf%10s

tool: D103: GHz

tool: {"D50": [0x00,0x00,0x00,0x00,0x65,0xcd,0xcd,0x41]}

tool: D106: platform

tool: D29: pSeries

tool: D40: MHz

tool: {"D104": [0x00,0x00,0x00,0x00,0x80,0x84,0x2e,0x41]}

assistant: ```c
int arch__cpuinfo_freq(double *freq, char *unit) {
  FILE *f;
  char *line = NULL, *c;
  size_t len = 0;
  int ret = -1;
  if ((f = fopen("/proc/cpuinfo", "r")) == NULL) {
    return -1;
  }
  while (getline(&line, &len, f) > 0) {
    if (strncmp(line, "clock", sizeof("clock") - 1)) {
      continue;
    }
    if (sscanf(line + strcspn(line, ":") + 1, "%lf%10s", freq, unit) == 2) {
      if (strcasecmp(unit, "GHz") == 0) {
        *freq *= 1000000000;
      } else if (strcasecmp(unit, "MHz") == 0) {
        *freq *= 1000000;
      }
      break;
    }
  }
  while (getline(&line, &len, f) > 0) {
    if (strncmp(line, "platform", sizeof("sizeof") - 1)) {
      continue;
    }
    c = strchr(line, ':');
    if (c - line + 2 < len && !strncmp(c + 2, "pSeries", sizeof("pSeries") - 1)) {
      ret = 0;
      break;
    }
  }
  free(line);
  fclose(f);
  return ret;
}
```