user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<_globdir_split_pattern>:
  endbr64
  test   %rdi,%rdi
  je     L153
  push   %r13
  mov    %rdi,%rax
  mov    $0x2,%esi
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  movzbl (%rdi),%edx
  test   %dl,%dl
  jne    L71
  jmp    L30
  xchg   %ax,%ax
L202:
  movzbl 0x1(%rcx),%edx
  add    $0x1,%rax
  test   %dl,%dl
  je     L23
L71:
  mov    %rax,%rcx
  cmp    $0x2f,%dl
  jne    L202
  cmpb   $0x2f,(%rax)
  jne    L134
  nopl   (%rax)
L128:
  add    $0x1,%rax
  cmpb   $0x2f,(%rax)
  je     L128
  mov    %rax,%rcx
  add    $0x1,%rsi
  add    $0x1,%rax
  movzbl 0x1(%rcx),%edx
  test   %dl,%dl
  jne    L71
  nopl   0x0(%rax)
L23:
  mov    $0x8,%edi
  call   <calloc@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L95
  xor    %r12d,%r12d
  cmpb   $0x2f,0x0(%rbp)
  je     L210
  nop
L199:
  mov    $0x2f,%esi
  mov    %rbp,%rdi
  add    $0x1,%r12
  call   <_globat_strchrnul@plt>
  mov    %rbp,%rdi
  mov    %eax,%esi
  mov    %rax,%rbx
  sub    %ebp,%esi
  call   <strndup@plt>
  mov    %rax,-0x8(%r13,%r12,8)
  test   %rax,%rax
  je     L122
  cmpb   $0x0,(%rbx)
  jne    L27
  jmp    L95
  nopl   0x0(%rax)
L116:
  add    $0x1,%rbx
L27:
  movzbl 0x1(%rbx),%eax
  cmp    $0x2f,%al
  je     L116
  test   %al,%al
  je     L65
  lea    0x1(%rbx),%rbp
  jmp    L199
L65:
  lea    D15(%rip),%rdi
  call   <strdup@plt>
  mov    %rax,0x0(%r13,%r12,8)
  test   %rax,%rax
  jne    L95
L122:
  mov    %r13,%rdi
  xor    %r13d,%r13d
  call   <_globdir_freepattern@plt>
L95:
  add    $0x8,%rsp
  mov    %r13,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L30:
  add    $0x8,%rsp
  mov    $0x1,%esi
  mov    $0x8,%edi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  jmp    10a0 <calloc@plt>
L210:
  lea    D15(%rip),%rdi
  call   <strdup@plt>
  mov    %rax,0x0(%r13)
  test   %rax,%rax
  jne    L47
  jmp    L122
  nopl   (%rax)
L204:
  add    $0x1,%rbp
L47:
  cmpb   $0x2f,0x0(%rbp)
  je     L204
  mov    $0x1,%r12d
  jmp    L199
L134:
  add    $0x1,%rsi
  jmp    L202
L153:
  mov    $0x1,%esi
  mov    $0x8,%edi
  jmp    10a0 <calloc@plt>
```

tool_calls: name: unpack_data
arguments: label: D15
type: string

tool: D15: /

assistant: ```c
char **_globdir_split_pattern(const char *pattern) {
  size_t i, count = 1;
  char **parts = NULL;
  const char *c;
  if (pattern == NULL || pattern[0] == '\0') {
    return calloc(sizeof(char *), 1);
  }
  for (c = pattern; *c != '\0'; c++) {
    if (*c == '/') {
      count++;
      while (*c == '/') {
        c++;
      }
    }
  }
  if ((parts = calloc(sizeof(char *), count + 1)) == NULL) {
    return NULL;
  }
  c = pattern;
  i = 0;
  if (*c == '/') {
    if ((parts[i++] = strdup("/")) == NULL) {
      goto error;
    }
    while (*c == '/') {
      c++;
    }
  }
  while (1) {
    const char *sep = _globat_strchrnul(c, '/');
    if ((parts[i++] = strndup(c, sep - c)) == NULL) {
      goto error;
    }
    if (sep[0] == '\0') {
      break;
    }
    while (sep[1] == '/') {
      sep++;
    }
    if (sep[1] == '\0') {
      if ((parts[i++] = strdup("/")) == NULL) {
        goto error;
      }
      break;
    } else {
      c = sep + 1;
    }
  }
  return parts;
error:
  _globdir_freepattern(parts);
  return NULL;
}
```