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

```asm
<cpu_map__read_all_cpu_map>:
  endbr64
  push   %r15
  lea    D1(%rip),%rsi
  lea    D5(%rip),%rdi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  call   <fopen@plt>
  test   %rax,%rax
  je     L41
  mov    %rax,%rbp
  lea    0x14(%rsp),%rax
  movb   $0x0,0x13(%rsp)
  xor    %ebx,%ebx
  mov    %rax,(%rsp)
  mov    $0xffffffff,%r13d
  xor    %r12d,%r12d
  xor    %r15d,%r15d
  lea    0x13(%rsp),%r14
  nopw   0x0(%rax,%rax,1)
L89:
  mov    (%rsp),%rdx
  mov    %r14,%rcx
  lea    D15(%rip),%rsi
  mov    %rbp,%rdi
  call   <fscanf@plt>
  mov    %eax,%ecx
  test   %eax,%eax
  jle    L209
  test   %r13d,%r13d
  js     L194
  mov    0x14(%rsp),%esi
  lea    (%rsi,%r15,1),%eax
  sub    %r13d,%eax
  cmp    %ebx,%eax
  jg     L168
L39:
  lea    0x1(%r15),%eax
  lea    0x1(%r13),%edx
  cltq
  cmp    %esi,%edx
  jge    L194
  xchg   %ax,%ax
L147:
  mov    %edx,-0x4(%r12,%rax,4)
  movslq %eax,%r15
  add    $0x1,%edx
  add    $0x1,%rax
  cmp    %edx,0x14(%rsp)
  jg     L147
L194:
  cmp    %ebx,%r15d
  je     L90
L9:
  mov    0x14(%rsp),%r13d
  lea    0x1(%r15),%edi
  mov    %r13d,(%r12,%r15,4)
  cmp    $0x2,%ecx
  je     L181
  cmp    $0x1,%ecx
  je     L70
  movzbl 0x13(%rsp),%eax
  cmp    $0xa,%al
  je     L70
L119:
  mov    $0xffffffff,%r13d
L185:
  movslq %edi,%r15
  jmp    L89
  nopl   0x0(%rax)
L181:
  movzbl 0x13(%rsp),%eax
  cmp    $0x2d,%al
  je     L185
  cmp    $0xa,%al
  jne    L119
L70:
  mov    %r12,%rsi
  call   <cpu_map__trim_new@plt>
  mov    %rax,%r10
L31:
  mov    %r12,%rdi
  mov    %r10,(%rsp)
  call   <free@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    (%rsp),%r10
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L25
  add    $0x28,%rsp
  mov    %r10,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L90:
  lea    0x100(%r15),%ebx
  mov    %r12,%rdi
  mov    %ecx,0xc(%rsp)
  lea    0x0(,%rbx,4),%esi
  call   <realloc@plt>
  mov    %rax,%r10
  test   %rax,%rax
  je     L31
  mov    0xc(%rsp),%ecx
  mov    %rax,%r12
  jmp    L9
  xchg   %ax,%ax
L168:
  lea    0x7f(%rax),%ebx
  mov    %r12,%rdi
  mov    %ecx,0xc(%rsp)
  lea    0x0(,%rbx,4),%esi
  call   <realloc@plt>
  mov    %rax,%r10
  test   %rax,%rax
  je     L31
  mov    0x14(%rsp),%esi
  mov    0xc(%rsp),%ecx
  mov    %rax,%r12
  jmp    L39
L209:
  test   %r15d,%r15d
  jne    L61
  xor    %eax,%eax
  call   <cpu_map__default_new@plt>
  mov    %rax,%r10
  jmp    L31
L41:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L25
  add    $0x28,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1110 <cpu_map__default_new@plt>
L61:
  mov    %r15d,%edi
  jmp    L70
L25:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_tag: D1
data_type: string
name: retrieve_data
arguments: data_tag: D5
data_type: string
name: retrieve_data
arguments: data_tag: D15
data_type: string

tool: D1: r

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

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