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

```asm
<unique_dir>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  mov    %rdi,%r13
  add    $0x3,%rdi
  push   %r12
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  call   <strlen@plt>
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %r13,%rdi
  mov    %rax,%r12
  call   <strlen@plt>
  mov    %r13,%rsi
  mov    %r12,%rdi
  mov    %eax,%edx
  call   <strncpy@plt>
  mov    %r13,%rdi
  call   <strlen@plt>
  mov    %r12,%rdi
  movb   $0x0,(%r12,%rax,1)
  call   <opendir@plt>
  test   %rax,%rax
  je     L24
  mov    %r13,%rdi
  mov    %rax,%r14
  mov    $0x2,%r13d
  mov    $0x2,%ebx
  call   <strlen@plt>
  mov    %r14,%rdi
  add    $0x1,%eax
  movslq %eax,%r15
  movb   $0x5f,-0x1(%r12,%r15,1)
  lea    (%r12,%r15,1),%r14
  movb   $0x0,0x1(%r12,%r15,1)
  mov    %r15,-0x58(%rbp)
  call   <closedir@plt>
  movss  D0(%rip),%xmm2
  movq   $0x1,-0x48(%rbp)
  movss  %xmm2,-0x50(%rbp)
  nopl   0x0(%rax,%rax,1)
L39:
  mov    %ebx,%edi
  mov    %ebx,-0x4c(%rbp)
  call   <alloca@plt>
  mov    %r13d,%edx
  lea    D18(%rip),%rsi
  mov    %rax,%rdi
  mov    %rax,%r15
  call   <sprintf@plt>
  mov    -0x48(%rbp),%rax
  mov    %ebx,%edx
  mov    %r15,%rsi
  mov    %r14,%rdi
  movb   $0x0,(%r15,%rax,1)
  call   <strncpy@plt>
  mov    %r12,%rdi
  call   <opendir@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L20
  call   <closedir@plt>
  add    $0x1,%r13d
  pxor   %xmm0,%xmm0
  cvtsi2ss %r13d,%xmm0
  ucomiss -0x50(%rbp),%xmm0
  jp     L39
  jne    L39
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %r12,%rdi
  lea    0x2(%rax),%esi
  call   <realloc@plt>
  mov    %rax,%rdi
  mov    %rax,%r12
  call   <strlen@plt>
  mov    %ebx,%esi
  mov    $0xa,%edi
  add    $0x1,%ebx
  movb   $0x0,(%r12,%rax,1)
  call   <pow@plt>
  movslq -0x4c(%rbp),%rax
  movss  %xmm0,-0x50(%rbp)
  mov    %rax,-0x48(%rbp)
  mov    -0x58(%rbp),%rax
  lea    (%r12,%rax,1),%r14
  jmp    L39
  nopl   0x0(%rax,%rax,1)
L24:
  xor    %edi,%edi
  call   <closedir@plt>
  nopw   0x0(%rax,%rax,1)
L20:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L54
  lea    -0x28(%rbp),%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L54:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: tag: D0
type: f32
name: parse_data
arguments: tag: D18
type: string

tool: D0: 10

tool: D18: %d

assistant: ```c
char *unique_dir(const char *name) {
  char *new_name = malloc(strlen(name + 3));
  strncpy(new_name, name, strlen(name));
  new_name[strlen(name)] = '\0';
  DIR *d;
  if (!(d = opendir(new_name))) {
    closedir(d);
    return new_name;
  }
  int count = 1;
  int place = 1;
  float res = 10;
  int pos = strlen(name) + 1;
  new_name[pos - 1] = '_';
  new_name[pos + 1] = '\0';
  do {
    if (d)
      closedir(d);
    if (++count == res) {
      new_name = realloc(new_name, strlen(new_name) + 2);
      new_name[strlen(new_name)] = '\0';
      res = pow(10, ++place);
    }
    char *num = alloca(place + 1);
    sprintf(num, "%d", count);
    num[place] = '\0';
    strncpy(new_name + pos, num, place + 1);
  } while (d = opendir(new_name));
  return new_name;
}
```