user: Converte this assembly snippet into its equivalent C code:

```asm
<adirname>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  movq   $0x0,-0x18(%rbp)
  movq   $0x0,-0x10(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strxnullorempty@plt>
  test   %rax,%rax
  je     L92
  lea    D50(%rip),%rax
  mov    %rax,%rdi
  call   <astrcpy@plt>
  mov    %rax,-0x18(%rbp)
  jmp    L11
L92:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <astrcpy@plt>
  mov    $0x2f,%edx
  mov    $0x5c,%esi
  mov    %rax,%rdi
  call   <strxreplace@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  mov    $0x2f,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  jne    L30
  lea    D50(%rip),%rax
  mov    %rax,%rdi
  call   <astrcpy@plt>
  mov    %rax,-0x18(%rbp)
  jmp    L120
L30:
  mov    -0x10(%rbp),%rax
  lea    D7(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strxequals@plt>
  test   %rax,%rax
  jne    L97
  mov    -0x10(%rbp),%rax
  lea    D50(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strxequals@plt>
  test   %rax,%rax
  jne    L97
  mov    -0x10(%rbp),%rax
  lea    D68(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strxequals@plt>
  test   %rax,%rax
  je     L72
L97:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <astrcpy@plt>
  mov    %rax,-0x18(%rbp)
  jmp    L120
L72:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L120
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
L120:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cltq
  mov    %rax,-0x8(%rbp)
L82:
  mov    -0x10(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L10
  cmpq   $0x0,-0x8(%rbp)
  jne    L45
  lea    D7(%rip),%rax
  mov    %rax,%rdi
  call   <astrcpy@plt>
  mov    %rax,-0x18(%rbp)
  jmp    L11
L45:
  mov    -0x8(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <astrleft@plt>
  mov    %rax,-0x18(%rbp)
  jmp    L11
L10:
  subq   $0x1,-0x8(%rbp)
  jmp    L82
L11:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdx
  mov    $0x101,%esi
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  call   <mu__free@plt>
  mov    -0x18(%rbp),%rax
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_tag: D50
type_guessed: string
name: parse_data
arguments: data_tag: D7
type_guessed: string
name: parse_data
arguments: data_tag: D68
type_guessed: string
name: parse_data
arguments: data_tag: D13
type_guessed: string

tool: D50: .

tool: D7: /

tool: D68: ..

tool: D13: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/kaiaie/bile/refs/heads/master/src/astring.c

assistant: ```c
char *adirname(const char *path) {
  char *result = NULL;
  char *tmp = NULL;
  size_t ii;
  if (strxnullorempty(path)) {
    result = astrcpy(".");
  } else {
    tmp = strxreplace(astrcpy(path), '\\', '/');
    if (strchr(tmp, '/') == NULL) {
      result = astrcpy(".");
    } else if (strxequals(tmp, "/") || strxequals(tmp, ".") || strxequals(tmp, "..")) {
      result = astrcpy(tmp);
    } else {
      if (tmp[strlen(tmp) - 1] == '/')
        tmp[strlen(tmp) - 1] = '\0';
    }
    ii = strlen(tmp);
    while (ii >= 0) {
      if (tmp[ii] == '/') {
        if (ii == 0) {
          result = astrcpy("/");
        } else {
          result = astrleft(tmp, ii);
        }
        break;
      }
      ii--;
    }
  }
  mu__free("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/kaiaie/bile/refs/heads/master/src/astring.c", 257, tmp);
  return result;
}
```