user: Converte this assembly snippet into its equivalent C code:

```asm
<cpu_get_performance_info>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x438,%rsp
  mov    %rdi,0x18(%rsp)
  mov    %rsi,0x10(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x428(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L192
  movq   $0x0,(%rdi)
L192:
  mov    0x10(%rsp),%rax
  test   %rax,%rax
  je     L133
  movq   $0x0,(%rax)
L133:
  lea    D13(%rip),%rsi
  lea    D5(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%r14
  test   %rax,%rax
  je     L212
  lea    0x1f(%rsp),%rax
  movq   $0x0,(%rsp)
  xor    %r12d,%r12d
  lea    0x20(%rsp),%rbp
  mov    %rax,0x8(%rsp)
  lea    D29(%rip),%r15
  nop
L35:
  mov    %r14,%rdx
  mov    $0x400,%esi
  mov    %rbp,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  je     L154
  mov    %rbp,%rdi
  call   <strlen@plt>
  cmp    $0x3fd,%eax
  ja     L228
  test   %eax,%eax
  je     L168
  movslq %eax,%rbx
  sub    $0x1,%eax
  lea    0x0(%rbp,%rbx,1),%r13
  add    0x8(%rsp),%rbx
  sub    %rax,%rbx
  jmp    L132
  nopl   (%rax)
L243:
  movb   $0x0,-0x1(%r13)
  sub    $0x1,%r13
  cmp    %rbx,%r13
  je     L168
L132:
  movzbl -0x1(%r13),%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L243
L168:
  mov    $0x3a,%esi
  mov    %rbp,%rdi
  call   <strchr@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L33
  cmpb   $0x20,0x1(%rax)
  je     L37
  add    $0x1,%rbx
L33:
  mov    $0xa,%edx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <strncasecmp@plt>
  test   %eax,%eax
  jne    L96
  test   %r12,%r12
  je     L90
  mov    %r12,%rdi
  call   <xfree@plt>
L90:
  mov    %rbx,%rdi
  call   <xstrdup@plt>
  cmpq   $0x0,(%rsp)
  mov    %rax,%r12
  je     L35
L154:
  mov    %r14,%rdi
  call   <fclose@plt>
  mov    0x18(%rsp),%rax
  test   %rax,%rax
  je     L65
  mov    %r12,(%rax)
L142:
  mov    0x10(%rsp),%rax
  test   %rax,%rax
  je     L160
  mov    (%rsp),%rcx
  mov    %rcx,(%rax)
L212:
  mov    0x428(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L242
  add    $0x438,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L96:
  mov    $0x7,%edx
  lea    D36(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncasecmp@plt>
  test   %eax,%eax
  jne    L35
  mov    (%rsp),%rax
  test   %rax,%rax
  je     L51
  mov    %rax,%rdi
  call   <xfree@plt>
L51:
  mov    %rbx,%rdi
  call   <xstrdup@plt>
  mov    %rax,(%rsp)
  test   %r12,%r12
  je     L35
  jmp    L154
  nopw   0x0(%rax,%rax,1)
L37:
  add    $0x2,%rbx
  jmp    L33
L228:
  mov    %r14,%rdi
  call   <fclose@plt>
  jmp    L212
L65:
  mov    %r12,%rdi
  call   <xfree@plt>
  jmp    L142
L160:
  mov    (%rsp),%rdi
  call   <xfree@plt>
  jmp    L212
L242:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D13
type_guessed: string
name: parse_data
arguments: data_label: D5
type_guessed: string
name: parse_data
arguments: data_label: D29
type_guessed: string
name: parse_data
arguments: data_label: D36
type_guessed: string

tool: D13: r

tool: D5: /proc/cpuinfo

tool: D29: model name

tool: D36: cpu mhz

assistant: ```c
void cpu_get_performance_info(unsigned char **p_model, unsigned char **p_mhz) {
  FILE *f = NULL;
  unsigned char buf[1024];
  unsigned char *model = NULL;
  unsigned char *mhz = NULL;
  if (p_model)
    *p_model = NULL;
  if (p_mhz)
    *p_mhz = NULL;
  if (!(f = fopen("/proc/cpuinfo", "r")))
    goto failure;
  while (fgets(buf, sizeof(buf), f)) {
    int buflen = strlen(buf);
    if (buflen > sizeof(buf) - 3)
      goto failure;
    while (buflen > 0 && isspace(buf[buflen - 1]))
      buf[--buflen] = 0;
    unsigned char *s = strchr(buf, ':');
    if (s && s[1] == ' ')
      s += 2;
    else if (s)
      ++s;
    if (!strncasecmp(buf, "model name", 10)) {
      if (model)
        xfree(model);
      model = xstrdup(s);
      if (mhz)
        break;
    } else if (!strncasecmp(buf, "cpu mhz", 7)) {
      if (mhz)
        xfree(mhz);
      mhz = xstrdup(s);
      if (model)
        break;
    }
  }
  fclose(f);
  if (p_model)
    *p_model = model;
  else
    xfree(model);
  if (p_mhz)
    *p_mhz = mhz;
  else
    xfree(mhz);
  return;
failure:
  if (f)
    fclose(f);
}
```