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

```asm
<createPartitionNodes>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    D16(%rip),%rsi
  mov    $0xa,%edi
  call   <logMessage@plt>
  lea    D112(%rip),%rdi
  call   <opendir@plt>
  test   %rax,%rax
  je     L129
  mov    %rax,%r12
  mov    $0x0,%r15d
  lea    D60(%rip),%r14
L158:
  mov    %r12,%rdi
  call   <readdir@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L54
  mov    %r14,%rsi
  mov    (%rbx),%edi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L158
  lea    D139(%rip),%rsi
  mov    (%rbx),%edi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L158
  mov    (%rbx),%edx
  lea    D118(%rip),%rsi
  mov    $0xa,%edi
  mov    $0x0,%eax
  call   <logMessage@plt>
  lea    0x18(%rsp),%rdi
  mov    (%rbx),%edx
  lea    D24(%rip),%rsi
  mov    $0x0,%eax
  call   <asprintf@plt>
  test   %rax,%rax
  jle    L39
  mov    (%rbx),%esi
  mov    0x18(%rsp),%rdi
  call   <createDevNode@plt>
  cmp    $0x1,%eax
  adc    $0x0,%r15d
  mov    0x18(%rsp),%rdi
  call   <free@plt>
  lea    0x18(%rsp),%rdi
  mov    (%rbx),%edx
  lea    D34(%rip),%rsi
  mov    $0x0,%eax
  call   <asprintf@plt>
  test   %rax,%rax
  jle    L82
  mov    0x18(%rsp),%rdi
  call   <opendir@plt>
  mov    %rax,%r13
  lea    0x20(%rsp),%rax
  mov    %rax,0x8(%rsp)
  test   %r13,%r13
  jne    L163
  mov    (%rbx),%edx
  lea    D131(%rip),%rsi
  mov    $0x28,%edi
  mov    $0x0,%eax
  call   <logMessage@plt>
  mov    0x18(%rsp),%rdi
  call   <free@plt>
  jmp    L158
L129:
  lea    D37(%rip),%rsi
  mov    $0x28,%edi
  mov    $0x0,%eax
  call   <logMessage@plt>
  mov    $0xffffffff,%r15d
  jmp    L29
L39:
  mov    (%rbx),%edx
  lea    D86(%rip),%rsi
  mov    $0x28,%edi
  mov    $0x0,%eax
  call   <logMessage@plt>
  jmp    L158
L82:
  mov    (%rbx),%edx
  lea    D91(%rip),%rsi
  mov    $0x28,%edi
  mov    $0x0,%eax
  call   <logMessage@plt>
  jmp    L158
L9:
  mov    0x0(%rbp),%edx
  lea    D86(%rip),%rsi
  mov    $0x28,%edi
  mov    $0x0,%eax
  call   <logMessage@plt>
L163:
  mov    %r13,%rdi
  call   <readdir@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L87
  mov    (%rbx),%edi
  call   <strlen@plt>
  mov    %eax,%edx
  mov    (%rbx),%esi
  mov    0x0(%rbp),%edi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L163
  mov    0x0(%rbp),%edx
  lea    D118(%rip),%rsi
  mov    $0xa,%edi
  call   <logMessage@plt>
  mov    0x0(%rbp),%ecx
  mov    (%rbx),%edx
  lea    D107(%rip),%rsi
  mov    0x8(%rsp),%rdi
  mov    $0x0,%eax
  call   <asprintf@plt>
  test   %rax,%rax
  jle    L9
  mov    0x0(%rbp),%esi
  mov    0x20(%rsp),%rdi
  call   <createDevNode@plt>
  cmp    $0x1,%eax
  adc    $0x0,%r15d
  mov    0x20(%rsp),%rdi
  call   <free@plt>
  jmp    L163
L87:
  mov    %r13,%rdi
  call   <closedir@plt>
  mov    0x18(%rsp),%rdi
  call   <free@plt>
  jmp    L158
L54:
  mov    %r12,%rdi
  call   <closedir@plt>
L29:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L45
  mov    %r15d,%eax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L45:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D16
type_guessed: string
name: disassemble_data
arguments: data_tag: D112
type_guessed: string
name: disassemble_data
arguments: data_tag: D60
type_guessed: string
name: disassemble_data
arguments: data_tag: D139
type_guessed: string
name: disassemble_data
arguments: data_tag: D118
type_guessed: string
name: disassemble_data
arguments: data_tag: D24
type_guessed: string
name: disassemble_data
arguments: data_tag: D34
type_guessed: string
name: disassemble_data
arguments: data_tag: D131
type_guessed: string
name: disassemble_data
arguments: data_tag: D37
type_guessed: string
name: disassemble_data
arguments: data_tag: D86
type_guessed: string
name: disassemble_data
arguments: data_tag: D91
type_guessed: string
name: disassemble_data
arguments: data_tag: D107
type_guessed: string

tool: D16: Creating device nodes...

tool: D112: /sys/block

tool: D60: ..

tool: D139: .

tool: D118: Trying to create device nodes for %s.

tool: D24: /sys/block/%s/dev

tool: D34: /sys/block/%s

tool: D131: Cannot read /sys/block/%s. Partition nodes will not be created and driver discs may not work

tool: D37: Cannot read /sys/block. Device nodes will not be created and driver discs may not work

tool: D86: Cannot allocate memory for device info (%s).

tool: D91: Cannot allocate memory for device subdirectory (%s).

tool: D107: /sys/block/%s/%s/dev

assistant: ```c
int createPartitionNodes() {
  DIR *d, *subd;
  int numfound = 0;
  struct dirent *dirp;
  struct dirent *subdirp;
  logMessage(10, "Creating device nodes...");
  d = opendir("/sys/block");
  if (!d) {
    logMessage(40, "Cannot read /sys/block. Device nodes will not be created and driver discs may not work");
    return -1;
  }
  while ((dirp = readdir(d)) != NULL) {
    char *dname;
    if (!strcmp(dirp->d_name, "..") || !strcmp(dirp->d_name, "."))
      continue;
    logMessage(10, "Trying to create device nodes for %s.", dirp->d_name);
    if (asprintf(&dname, "/sys/block/%s/dev", dirp->d_name) <= 0) {
      logMessage(40, "Cannot allocate memory for device info (%s).", dirp->d_name);
      continue;
    }
    if (!createDevNode(dname, dirp->d_name))
      numfound++;
    free(dname);
    if (asprintf(&dname, "/sys/block/%s", dirp->d_name) <= 0) {
      logMessage(40, "Cannot allocate memory for device subdirectory (%s).", dirp->d_name);
      continue;
    }
    subd = opendir(dname);
    if (!subd) {
      logMessage(40, "Cannot read /sys/block/%s. Partition nodes will not be created and driver discs may not work", dirp->d_name);
      free(dname);
      continue;
    }
    while ((subdirp = readdir(subd)) != NULL) {
      char *subdirname;
      if (strncmp(subdirp->d_name, dirp->d_name, strlen(dirp->d_name))) {
        continue;
      }
      logMessage(10, "Trying to create device nodes for %s.", subdirp->d_name);
      if (asprintf(&subdirname, "/sys/block/%s/%s/dev", dirp->d_name, subdirp->d_name) <= 0) {
        logMessage(40, "Cannot allocate memory for device info (%s).", subdirp->d_name);
        continue;
      }
      if (!createDevNode(subdirname, subdirp->d_name))
        numfound++;
      free(subdirname);
    }
    closedir(subd);
    free(dname);
  }
  closedir(d);
  return numfound;
}
```