user: 请从给定的汇编指令推导出C源代码：

```asm
<cpu_map__read_all_cpu_map>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    D7(%rip),%rsi
  lea    D4(%rip),%rdi
  call   <fopen@plt>
  test   %rax,%rax
  je     L25
  mov    %rax,%r15
  movb   $0x0,0x13(%rsp)
  mov    $0xffffffff,%ebx
  mov    $0x0,%r14d
  mov    $0x0,%r12d
  mov    $0x0,%ebp
  jmp    L132
L25:
  mov    $0x0,%eax
  call   <cpu_map__default_new@plt>
  mov    %rax,0x8(%rsp)
  jmp    L145
L126:
  add    $0x1,%ebx
  lea    0x1(%rbp),%eax
  cltq
  cmp    0x14(%rsp),%ebx
  jge    L31
L130:
  mov    %eax,%ebp
  mov    %ebx,-0x4(%r12,%rax,4)
  add    $0x1,%ebx
  add    $0x1,%rax
  cmp    %ebx,0x14(%rsp)
  jg     L130
L31:
  cmp    %r14d,%ebp
  je     L196
L142:
  lea    0x1(%rbp),%edi
  mov    0x14(%rsp),%ebx
  movslq %ebp,%rbp
  mov    %ebx,(%r12,%rbp,4)
  cmp    $0x2,%r13d
  je     L154
  cmp    $0x1,%r13d
  je     L176
L158:
  cmpb   $0xa,0x13(%rsp)
  je     L176
  mov    $0xffffffff,%ebx
L103:
  mov    %edi,%ebp
L132:
  lea    0x13(%rsp),%rcx
  lea    0x14(%rsp),%rdx
  lea    D3(%rip),%rsi
  mov    %r15,%rdi
  call   <fscanf@plt>
  mov    %eax,%r13d
  test   %eax,%eax
  jle    L107
  test   %ebx,%ebx
  js     L31
  mov    %ebp,%eax
  add    0x14(%rsp),%eax
  sub    %ebx,%eax
  cmp    %r14d,%eax
  jle    L126
  lea    0x7f(%rax),%r14d
  lea    0x0(,%r14,4),%esi
  mov    %r12,%rdi
  call   <realloc@plt>
  mov    %rax,0x8(%rsp)
  test   %rax,%rax
  je     L100
  mov    %rax,%r12
  jmp    L126
L196:
  add    $0x100,%r14d
  lea    0x0(,%r14,4),%esi
  mov    %r12,%rdi
  call   <realloc@plt>
  mov    %rax,0x8(%rsp)
  test   %rax,%rax
  je     L100
  mov    %rax,%r12
  jmp    L142
L154:
  cmpb   $0x2d,0x13(%rsp)
  jne    L158
  jmp    L103
L107:
  mov    %ebp,%edi
L176:
  test   %edi,%edi
  jle    L83
  mov    %r12,%rsi
  call   <cpu_map__trim_new@plt>
  mov    %rax,0x8(%rsp)
L100:
  mov    %r12,%rdi
  call   <free@plt>
  mov    %r15,%rdi
  call   <fclose@plt>
L145:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L48
  mov    0x8(%rsp),%rax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L83:
  mov    $0x0,%eax
  call   <cpu_map__default_new@plt>
  mov    %rax,0x8(%rsp)
  jmp    L100
L48:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: label: D7
datatype: string
name: disassemble_data
arguments: label: D4
datatype: string
name: disassemble_data
arguments: label: D3
datatype: string

tool: D7: r

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

tool: D3: %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;
}
```