user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<arch__cpuinfo_freq>:
  endbr64
  push   %r15
  mov    %rsi,%r15
  lea    D21(%rip),%rsi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,0x8(%rsp)
  lea    D7(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  movq   $0x0,0x18(%rsp)
  movq   $0x0,0x20(%rsp)
  call   <fopen@plt>
  test   %rax,%rax
  je     L21
  mov    %rax,%rbp
  lea    0x20(%rsp),%r12
  lea    0x18(%rsp),%rbx
  lea    D88(%rip),%r13
  nopl   0x0(%rax)
L42:
  mov    %rbp,%rdx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <getline@plt>
  test   %rax,%rax
  jle    L70
  mov    0x18(%rsp),%rdi
  mov    $0x5,%edx
  mov    %r13,%rsi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L42
  mov    0x18(%rsp),%r14
  lea    D63(%rip),%rsi
  mov    %r14,%rdi
  call   <strcspn@plt>
  mov    0x8(%rsp),%rdx
  mov    %r15,%rcx
  lea    D9(%rip),%rsi
  cltq
  lea    0x1(%r14,%rax,1),%rdi
  call   <sscanf@plt>
  cmp    $0x2,%eax
  jne    L42
  lea    D45(%rip),%rsi
  mov    %r15,%rdi
  call   <strcasecmp@plt>
  test   %rax,%rax
  jne    L82
  mov    0x8(%rsp),%rax
  movsd  D40(%rip),%xmm0
  mulsd  (%rax),%xmm0
  movsd  %xmm0,(%rax)
L70:
  lea    D27(%rip),%r13
  lea    D1(%rip),%r14
  nopl   0x0(%rax)
L58:
  mov    %rbp,%rdx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <getline@plt>
  test   %rax,%rax
  jle    L45
  mov    0x18(%rsp),%rdi
  mov    $0x6,%edx
  mov    %r13,%rsi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L58
  mov    0x18(%rsp),%rdi
  mov    $0x3a,%esi
  call   <strchr@plt>
  mov    %rax,%rdx
  sub    0x18(%rsp),%rdx
  add    $0x2,%rdx
  cmp    0x20(%rsp),%rdx
  jae    L58
  lea    0x2(%rax),%rdi
  mov    $0x7,%edx
  mov    %r14,%rsi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L58
  xor    %r12d,%r12d
  jmp    L12
  nopw   0x0(%rax,%rax,1)
L45:
  mov    $0xffffffff,%r12d
L12:
  mov    0x18(%rsp),%rdi
  call   <free@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
L75:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L133
  add    $0x38,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L82:
  lea    D102(%rip),%rsi
  mov    %r15,%rdi
  call   <strcasecmp@plt>
  test   %rax,%rax
  jne    L70
  mov    0x8(%rsp),%rax
  movsd  D50(%rip),%xmm0
  mulsd  (%rax),%xmm0
  movsd  %xmm0,(%rax)
  jmp    L70
L21:
  mov    $0xffffffff,%r12d
  jmp    L75
L133:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: tag: D21
type: string
name: parse_data
arguments: tag: D7
type: string
name: parse_data
arguments: tag: D88
type: string
name: parse_data
arguments: tag: D63
type: string
name: parse_data
arguments: tag: D9
type: string
name: parse_data
arguments: tag: D45
type: string
name: parse_data
arguments: tag: D40
type: byte[8]
name: parse_data
arguments: tag: D27
type: string
name: parse_data
arguments: tag: D1
type: string
name: parse_data
arguments: tag: D102
type: string
name: parse_data
arguments: tag: D50
type: byte[8]

tool: D21: r

tool: D7: /proc/cpuinfo

tool: D88: clock

tool: D63: :

tool: D9: %lf%10s

tool: D45: GHz

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

tool: D27: platform

tool: D1: pSeries

tool: D102: MHz

tool: {"D50": [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;
}
```