user: 请将以下的汇编代码转换成C语言代码:

```asm
<scan_block>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x630,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x610(%rbp),%rax
  mov    $0x200,%edx
  lea    D10(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  lea    -0x610(%rbp),%rax
  mov    %rax,%rdi
  call   <opendir@plt>
  mov    %rax,-0x620(%rbp)
  cmpq   $0x0,-0x620(%rbp)
  je     L107
  mov    -0x620(%rbp),%rax
  mov    %rax,%rdi
  call   <readdir@plt>
  mov    %rax,-0x630(%rbp)
  jmp    L116
L80:
  mov    -0x630(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  je     L19
  lea    -0x610(%rbp),%rcx
  lea    -0x410(%rbp),%rax
  mov    $0x200,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  lea    -0x410(%rbp),%rax
  mov    $0x200,%edx
  lea    D32(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncat@plt>
  mov    -0x630(%rbp),%rax
  mov    (%rax),%rcx
  lea    -0x410(%rbp),%rax
  mov    $0x200,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncat@plt>
  lea    -0x410(%rbp),%rax
  mov    %rax,%rdi
  call   <device_list_insert@plt>
  test   %rax,%rax
  jne    L124
  lea    -0x410(%rbp),%rax
  mov    %rax,%rdi
  call   <opendir@plt>
  mov    %rax,-0x618(%rbp)
  cmpq   $0x0,-0x618(%rbp)
  je     L10
  mov    -0x618(%rbp),%rax
  mov    %rax,%rdi
  call   <readdir@plt>
  mov    %rax,-0x628(%rbp)
  jmp    L68
L128:
  mov    -0x628(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  je     L50
  mov    -0x628(%rbp),%rax
  mov    (%rax),%rax
  lea    D7(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L12
  lea    -0x410(%rbp),%rcx
  lea    -0x210(%rbp),%rax
  mov    $0x200,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  lea    -0x210(%rbp),%rax
  mov    $0x200,%edx
  lea    D32(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncat@plt>
  mov    -0x628(%rbp),%rax
  mov    (%rax),%rcx
  lea    -0x210(%rbp),%rax
  mov    $0x200,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncat@plt>
  lea    -0x210(%rbp),%rax
  mov    %rax,%rdi
  call   <device_list_insert@plt>
  jmp    L129
L50:
  nop
  jmp    L129
L12:
  nop
L129:
  mov    -0x618(%rbp),%rax
  mov    %rax,%rdi
  call   <readdir@plt>
  mov    %rax,-0x628(%rbp)
L68:
  cmpq   $0x0,-0x628(%rbp)
  jne    L128
  mov    -0x618(%rbp),%rax
  mov    %rax,%rdi
  call   <closedir@plt>
  jmp    L10
L19:
  nop
  jmp    L10
L124:
  nop
L10:
  mov    -0x620(%rbp),%rax
  mov    %rax,%rdi
  call   <readdir@plt>
  mov    %rax,-0x630(%rbp)
L116:
  cmpq   $0x0,-0x630(%rbp)
  jne    L80
  mov    -0x620(%rbp),%rax
  mov    %rax,%rdi
  call   <closedir@plt>
L107:
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L121
  call   <__stack_chk_fail@plt>
L121:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D10
type_guessed: string
name: retrieve_data
arguments: data_tag: D32
type_guessed: string
name: retrieve_data
arguments: data_tag: D7
type_guessed: string

tool: D10: /sys/block

tool: D32: /

tool: D7: 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);
  }
}
```