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

```asm
<scan_block>:
  endbr64
  push   %r15
  mov    $0x200,%edx
  lea    D13(%rip),%rsi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x618,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x608(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r13
  mov    %r13,%rdi
  call   <strncpy@plt>
  mov    %r13,%rdi
  call   <opendir@plt>
  test   %rax,%rax
  je     L99
  mov    %rax,%rdi
  mov    %rax,%r12
  call   <readdir@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L107
  lea    0x200(%rsp),%rbp
  nopl   0x0(%rax,%rax,1)
L79:
  mov    (%rbx),%rax
  cmpb   $0x2e,(%rax)
  je     L52
  mov    $0x200,%edx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <strncpy@plt>
  mov    $0x200,%edx
  lea    D2(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncat@plt>
  mov    (%rbx),%rsi
  mov    %rbp,%rdi
  mov    $0x200,%edx
  call   <strncat@plt>
  mov    %rbp,%rdi
  call   <device_list_insert@plt>
  test   %rax,%rax
  jne    L52
  mov    %rbp,%rdi
  call   <opendir@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  jne    L105
L52:
  mov    %r12,%rdi
  call   <readdir@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  jne    L79
L107:
  mov    %r12,%rdi
  call   <closedir@plt>
L99:
  mov    0x608(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L53
  add    $0x618,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L105:
  mov    %rbx,%rdi
  call   <readdir@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L59
L91:
  mov    (%rax),%rdi
  cmpb   $0x2e,(%rdi)
  je     L105
  lea    D36(%rip),%rsi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L105
  lea    0x400(%rsp),%r14
  mov    $0x200,%edx
  mov    %rbp,%rsi
  mov    %r14,%rdi
  call   <strncpy@plt>
  mov    $0x200,%edx
  lea    D2(%rip),%rsi
  mov    %r14,%rdi
  call   <strncat@plt>
  mov    (%r15),%rsi
  mov    $0x200,%edx
  mov    %r14,%rdi
  call   <strncat@plt>
  mov    %r14,%rdi
  call   <device_list_insert@plt>
  mov    %rbx,%rdi
  call   <readdir@plt>
  mov    %rax,%r15
  test   %rax,%rax
  jne    L91
L59:
  mov    %rbx,%rdi
  call   <closedir@plt>
  jmp    L52
L53:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: label: D13
type_guessed: string
name: disassemble_data
arguments: label: D2
type_guessed: string
name: disassemble_data
arguments: label: D36
type_guessed: string

tool: D13: /sys/block

tool: D2: /

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