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

```asm
<scan_block>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x628,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x618(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%rbx
  mov    $0x200,%edx
  lea    D0(%rip),%rsi
  mov    %rbx,%rdi
  call   <strncpy@plt>
  mov    %rbx,%rdi
  call   <opendir@plt>
  test   %rax,%rax
  je     L67
  mov    %rax,%r12
  mov    %rax,%rdi
  call   <readdir@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L112
  lea    0x10(%rsp),%r15
  lea    D29(%rip),%r14
  jmp    L115
L111:
  mov    %rbp,%rdi
  call   <readdir@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L138
L12:
  mov    (%rbx),%rdi
  cmpb   $0x2e,(%rdi)
  je     L111
  lea    D10(%rip),%rsi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L111
  mov    $0x200,%edx
  mov    0x8(%rsp),%rsi
  mov    %r13,%rdi
  call   <strncpy@plt>
  mov    $0x200,%edx
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <strncat@plt>
  mov    $0x200,%edx
  mov    (%rbx),%rsi
  mov    %r13,%rdi
  call   <strncat@plt>
  mov    %r13,%rdi
  call   <device_list_insert@plt>
  jmp    L111
L138:
  mov    %rbp,%rdi
  call   <closedir@plt>
L70:
  mov    %r12,%rdi
  call   <readdir@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L112
L115:
  mov    (%rbx),%rax
  cmpb   $0x2e,(%rax)
  je     L70
  lea    0x210(%rsp),%rbp
  mov    $0x200,%edx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <strncpy@plt>
  mov    $0x200,%edx
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <strncat@plt>
  mov    $0x200,%edx
  mov    (%rbx),%rsi
  mov    %rbp,%rdi
  call   <strncat@plt>
  mov    %rbp,%rdi
  call   <device_list_insert@plt>
  test   %rax,%rax
  jne    L70
  mov    %rbp,%rdi
  call   <opendir@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L70
  mov    %rax,%rdi
  call   <readdir@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L138
  lea    0x210(%rsp),%rax
  mov    %rax,0x8(%rsp)
  lea    0x410(%rsp),%r13
  jmp    L12
L112:
  mov    %r12,%rdi
  call   <closedir@plt>
L67:
  mov    0x618(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L28
  add    $0x628,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L28:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D0
type_guessed: string
name: parse_data
arguments: label: D29
type_guessed: string
name: parse_data
arguments: label: D10
type_guessed: string

tool: D0: /sys/block

tool: D29: /

tool: D10: device

assistant: ```c
void scan_block(void) {
  char base[512];
  DIR *dir;
  struct dirent *dent;
  strncpy(base, "/sys/block", sizeof(base));
  dir = opendir(base);
  if (dir != NULL) {
    for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
      char dirname[512];
      DIR *dir2;
      struct dirent *dent2;
      if (dent->d_name[0] == '.')
        continue;
      strncpy(dirname, base, sizeof(dirname));
      strncat(dirname, "/", sizeof(dirname));
      strncat(dirname, dent->d_name, sizeof(dirname));
      if (device_list_insert(dirname) != 0)
        continue;
      dir2 = opendir(dirname);
      if (dir2 != NULL) {
        for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) {
          char dirname2[512];
          if (dent2->d_name[0] == '.')
            continue;
          if (!strcmp(dent2->d_name, "device"))
            continue;
          strncpy(dirname2, dirname, sizeof(dirname2));
          strncat(dirname2, "/", sizeof(dirname2));
          strncat(dirname2, dent2->d_name, sizeof(dirname2));
          device_list_insert(dirname2);
        }
        closedir(dir2);
      }
    }
    closedir(dir);
  }
}
```