user: Translate the below assembly code into C programming language:

```asm
<cpu_map__read_all_cpu_map>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x28(%rbp)
  movl   $0x0,-0x3c(%rbp)
  movq   $0x0,-0x20(%rbp)
  movl   $0x0,-0x38(%rbp)
  lea    D9(%rip),%rax
  mov    %rax,%rsi
  lea    D26(%rip),%rax
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L31
  mov    $0x0,%eax
  call   <cpu_map__default_new@plt>
  jmp    L65
L31:
  movb   $0x0,-0x41(%rbp)
  movl   $0xffffffff,-0x34(%rbp)
L52:
  lea    -0x41(%rbp),%rcx
  lea    -0x40(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  lea    D12(%rip),%rsi
  mov    %rax,%rdi
  call   <fscanf@plt>
  mov    %eax,-0x30(%rbp)
  cmpl   $0x0,-0x30(%rbp)
  jle    L19
  cmpl   $0x0,-0x34(%rbp)
  js     L2
  mov    -0x40(%rbp),%edx
  mov    -0x3c(%rbp),%eax
  add    %edx,%eax
  sub    -0x34(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x2c(%rbp)
  mov    -0x2c(%rbp),%eax
  cmp    -0x38(%rbp),%eax
  jl     L120
  mov    -0x2c(%rbp),%eax
  sub    $0xffffff80,%eax
  mov    %eax,-0x38(%rbp)
  mov    -0x38(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  je     L164
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  jmp    L120
L133:
  mov    -0x3c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x3c(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  mov    -0x34(%rbp),%eax
  mov    %eax,(%rdx)
L120:
  addl   $0x1,-0x34(%rbp)
  mov    -0x40(%rbp),%eax
  cmp    %eax,-0x34(%rbp)
  jl     L133
L2:
  mov    -0x3c(%rbp),%eax
  cmp    -0x38(%rbp),%eax
  jne    L74
  addl   $0x100,-0x38(%rbp)
  mov    -0x38(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  je     L202
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x20(%rbp)
L74:
  mov    -0x3c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x3c(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  mov    -0x40(%rbp),%eax
  mov    %eax,(%rdx)
  cmpl   $0x2,-0x30(%rbp)
  jne    L158
  movzbl -0x41(%rbp),%eax
  cmp    $0x2d,%al
  jne    L158
  mov    -0x40(%rbp),%eax
  mov    %eax,-0x34(%rbp)
  jmp    L100
L158:
  movl   $0xffffffff,-0x34(%rbp)
L100:
  cmpl   $0x1,-0x30(%rbp)
  je     L103
  movzbl -0x41(%rbp),%eax
  cmp    $0xa,%al
  je     L103
  jmp    L52
L19:
  nop
L103:
  cmpl   $0x0,-0x3c(%rbp)
  jle    L114
  mov    -0x20(%rbp),%rdx
  mov    -0x3c(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <cpu_map__trim_new@plt>
  mov    %rax,-0x28(%rbp)
  jmp    L59
L114:
  mov    $0x0,%eax
  call   <cpu_map__default_new@plt>
  mov    %rax,-0x28(%rbp)
  jmp    L59
L164:
  nop
  jmp    L59
L202:
  nop
L59:
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    -0x28(%rbp),%rax
L65:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L41
  call   <__stack_chk_fail@plt>
L41:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D9
type_infered: string
name: disassemble_data
arguments: tag: D26
type_infered: string
name: disassemble_data
arguments: tag: D12
type_infered: string

tool: D9: r

tool: D26: /sys/devices/system/cpu/online

tool: D12: %u%c

assistant: ```c
struct cpu_map *cpu_map__read_all_cpu_map(void) {
  struct cpu_map *cpus = NULL;
  FILE *onlnf;
  int nr_cpus = 0;
  int *tmp_cpus = NULL, *tmp;
  int max_entries = 0;
  int n, cpu, prev;
  char sep;
  onlnf = fopen("/sys/devices/system/cpu/online", "r");
  if (!onlnf)
    return cpu_map__default_new();
  sep = 0;
  prev = -1;
  for (;;) {
    n = fscanf(onlnf, "%u%c", &cpu, &sep);
    if (n <= 0)
      break;
    if (prev >= 0) {
      int new_max = nr_cpus + cpu - prev - 1;
      if (new_max >= max_entries) {
        max_entries = new_max + 256 / 2;
        tmp = realloc(tmp_cpus, max_entries * sizeof(int));
        if (tmp == NULL)
          goto out_free_tmp;
        tmp_cpus = tmp;
      }
      while (++prev < cpu)
        tmp_cpus[nr_cpus++] = prev;
    }
    if (nr_cpus == max_entries) {
      max_entries += 256;
      tmp = realloc(tmp_cpus, max_entries * sizeof(int));
      if (tmp == NULL)
        goto out_free_tmp;
      tmp_cpus = tmp;
    }
    tmp_cpus[nr_cpus++] = cpu;
    if (n == 2 && sep == '-')
      prev = cpu;
    else
      prev = -1;
    if (n == 1 || sep == '\n')
      break;
  }
  if (nr_cpus > 0)
    cpus = cpu_map__trim_new(nr_cpus, tmp_cpus);
  else
    cpus = cpu_map__default_new();
out_free_tmp:
  free(tmp_cpus);
  fclose(onlnf);
  return cpus;
}
```