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

```asm
<glob_to_regex>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    D29(%rip),%rax
  mov    %rax,%rdi
  call   <strdup@plt>
  mov    %rax,-0x18(%rbp)
  movq   $0x1,-0x10(%rbp)
  jmp    L105
L54:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%esi
  lea    D19(%rip),%rax
  mov    %rax,%rdi
  call   <char_is_one_of@plt>
  test   %rax,%rax
  je     L171
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x5e,%al
  jne    L90
  mov    -0x18(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  sub    $0x1,%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x5b,%al
  je     L203
L90:
  lea    -0x10(%rbp),%rcx
  lea    -0x18(%rbp),%rax
  mov    $0x5c,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strappendch@plt>
  test   %rax,%rax
  je     L203
  jmp    L293
L171:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x21,%al
  jne    L270
  mov    -0x18(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  sub    $0x1,%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x5b,%al
  jne    L270
  lea    -0x10(%rbp),%rcx
  lea    -0x18(%rbp),%rax
  mov    $0x5e,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strappendch@plt>
  test   %rax,%rax
  jne    L183
  jmp    L105
L270:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x5c,%al
  jne    L289
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  movzbl (%rax),%eax
  movsbl %al,%edx
  lea    -0x10(%rbp),%rcx
  lea    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strappendch@plt>
  test   %rax,%rax
  je     L203
  jmp    L293
L289:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x3f,%al
  jne    L233
  lea    -0x10(%rbp),%rcx
  lea    -0x18(%rbp),%rax
  mov    $0x2e,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strappendch@plt>
  test   %rax,%rax
  jne    L169
  addq   $0x1,-0x28(%rbp)
  jmp    L105
L233:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2a,%al
  jne    L203
  mov    -0x10(%rbp),%rax
  cmp    $0x1,%rax
  jne    L120
  lea    -0x10(%rbp),%rcx
  lea    -0x18(%rbp),%rax
  lea    D14(%rip),%rdx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strappend@plt>
  test   %rax,%rax
  je     L142
  jmp    L293
L120:
  lea    -0x10(%rbp),%rcx
  lea    -0x18(%rbp),%rax
  lea    D38(%rip),%rdx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strappend@plt>
  test   %rax,%rax
  jne    L102
L142:
  addq   $0x1,-0x28(%rbp)
  jmp    L105
L203:
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  movzbl (%rax),%eax
  movsbl %al,%edx
  lea    -0x10(%rbp),%rcx
  lea    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strappendch@plt>
  test   %rax,%rax
  jne    L288
L105:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L54
  jmp    L293
L183:
  nop
  jmp    L293
L169:
  nop
  jmp    L293
L102:
  nop
  jmp    L293
L288:
  nop
L293:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L89
  lea    -0x10(%rbp),%rcx
  lea    -0x18(%rbp),%rax
  mov    $0x24,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strappendch@plt>
  test   %rax,%rax
  je     L263
L89:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x0,%eax
  jmp    L13
L263:
  mov    -0x18(%rbp),%rax
L13:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L11
  call   <__stack_chk_fail@plt>
L11:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D29
type: string
name: retrieve_data
arguments: data_tag: D19
type: string
name: retrieve_data
arguments: data_tag: D14
type: string
name: retrieve_data
arguments: data_tag: D38
type: string

tool: D29: ^$

tool: D19: ^.$()|+{

tool: D14: [^.].*

tool: D38: .*

assistant: ```c
char *glob_to_regex(const char glob[]) {
  static const char CHARS_TO_ESCAPE[] = "^.$()|+{";
  char *result = strdup("^$");
  size_t result_len = 1;
  while (*glob != '\0') {
    if (char_is_one_of(CHARS_TO_ESCAPE, *glob)) {
      if (*glob != '^' || result[result_len - 1] != '[') {
        if (strappendch(&result, &result_len, '\\') != 0) {
          break;
        }
      }
    } else if (*glob == '!' && result[result_len - 1] == '[') {
      if (strappendch(&result, &result_len, '^') != 0) {
        break;
      }
      continue;
    } else if (*glob == '\\') {
      if (strappendch(&result, &result_len, *glob++) != 0) {
        break;
      }
    } else if (*glob == '?') {
      if (strappendch(&result, &result_len, '.') != 0) {
        break;
      }
      ++glob;
      continue;
    } else if (*glob == '*') {
      if (result_len == 1) {
        if (strappend(&result, &result_len, "[^.].*") != 0) {
          break;
        }
      } else {
        if (strappend(&result, &result_len, ".*") != 0) {
          break;
        }
      }
      ++glob;
      continue;
    }
    if (strappendch(&result, &result_len, *glob++) != 0) {
      break;
    }
  }
  if (*glob != '\0' || strappendch(&result, &result_len, '$') != 0) {
    free(result);
    return NULL;
  }
  return result;
}
```