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

```asm
<_globdir_split_pattern>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,-0x48(%rbp)
  movq   $0x1,-0x30(%rbp)
  movq   $0x0,-0x18(%rbp)
  cmpq   $0x0,-0x48(%rbp)
  je     L5
  mov    -0x48(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L195
L5:
  mov    $0x1,%esi
  mov    $0x8,%edi
  call   <calloc@plt>
  jmp    L187
L195:
  mov    -0x48(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  jmp    L173
L12:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L202
  addq   $0x1,-0x30(%rbp)
  jmp    L77
L24:
  addq   $0x1,-0x28(%rbp)
L77:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  je     L24
L202:
  addq   $0x1,-0x28(%rbp)
L173:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L12
  mov    -0x30(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,%rsi
  mov    $0x8,%edi
  call   <calloc@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L228
  mov    $0x0,%eax
  jmp    L187
L228:
  mov    -0x48(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  movq   $0x0,-0x38(%rbp)
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L90
  mov    -0x38(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x38(%rbp)
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rbx
  lea    D4(%rip),%rax
  mov    %rax,%rdi
  call   <strdup@plt>
  mov    %rax,(%rbx)
  mov    (%rbx),%rax
  test   %rax,%rax
  je     L166
  jmp    L20
L129:
  addq   $0x1,-0x28(%rbp)
L20:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  je     L129
L90:
  mov    -0x28(%rbp),%rax
  mov    $0x2f,%esi
  mov    %rax,%rdi
  call   <_globat_strchrnul@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  sub    -0x28(%rbp),%rax
  mov    %eax,%ecx
  mov    -0x38(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x38(%rbp)
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rbx
  mov    -0x28(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <strndup@plt>
  mov    %rax,(%rbx)
  mov    (%rbx),%rax
  test   %rax,%rax
  je     L80
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L150
  jmp    L154
L203:
  addq   $0x1,-0x20(%rbp)
L154:
  mov    -0x20(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  je     L203
  mov    -0x20(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L75
  mov    -0x38(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x38(%rbp)
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rbx
  lea    D4(%rip),%rax
  mov    %rax,%rdi
  call   <strdup@plt>
  mov    %rax,(%rbx)
  mov    (%rbx),%rax
  test   %rax,%rax
  jne    L96
  jmp    L212
L75:
  mov    -0x20(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x28(%rbp)
  jmp    L90
L150:
  nop
  jmp    L35
L96:
  nop
L35:
  mov    -0x18(%rbp),%rax
  jmp    L187
L166:
  nop
  jmp    L212
L80:
  nop
L212:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <_globdir_freepattern@plt>
  mov    $0x0,%eax
L187:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: parse_data
arguments: tag: D4
datatype: string

tool: D4: /

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;
}
```