user: Please show me the C implementation that matches the assembly code listed below:

```asm
<cst_make_url>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x2c(%rbp)
  cmpl   $0x2,-0x2c(%rbp)
  jg     L15
  mov    $0x0,%eax
  jmp    L58
L15:
  mov    -0x38(%rbp),%rax
  lea    D16(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  cmp    %rax,-0x38(%rbp)
  jae    L76
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <xstrdup@plt>
  jmp    L58
L76:
  mov    -0x38(%rbp),%rax
  lea    D8(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    -0x38(%rbp),%rdx
  add    $0x1,%rdx
  cmp    %rdx,%rax
  jne    L1
  lea    D6(%rip),%rax
  mov    %rax,%rdi
  call   <xstrdup@plt>
  mov    %rax,-0x28(%rbp)
  mov    -0x38(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x38(%rbp)
  mov    -0x28(%rbp),%rdx
  add    $0x7,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  mov    -0x38(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x38(%rbp)
  mov    -0x28(%rbp),%rdx
  add    $0x8,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  mov    -0x38(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <xstrappend@plt>
  mov    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  jmp    L38
L34:
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  movb   $0x2f,(%rax)
L38:
  mov    -0x20(%rbp),%rax
  mov    $0x5c,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x20(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  jne    L34
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  movl   $0x0,-0x30(%rbp)
  jmp    L43
L33:
  addq   $0x1,-0x20(%rbp)
  addl   $0x1,-0x30(%rbp)
L43:
  mov    -0x20(%rbp),%rax
  mov    $0x20,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x20(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  jne    L33
  cmpl   $0x0,-0x30(%rbp)
  jle    L97
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  mov    -0x30(%rbp),%eax
  add    %eax,%eax
  add    %edx,%eax
  add    $0x1,%eax
  mov    $0x1,%esi
  mov    %eax,%edi
  call   <xcalloc@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  jmp    L87
L17:
  mov    -0x20(%rbp),%rax
  cmp    -0x18(%rbp),%rax
  je     L60
  mov    -0x20(%rbp),%rax
  sub    -0x18(%rbp),%rax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rcx
  mov    -0x10(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
L60:
  mov    -0x10(%rbp),%rax
  lea    D15(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  addq   $0x1,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x10(%rbp)
L87:
  mov    -0x18(%rbp),%rax
  mov    $0x20,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x20(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  jne    L17
  jmp    L28
L67:
  mov    -0x18(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x10(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
L28:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L67
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <xfree@plt>
L97:
  mov    -0x28(%rbp),%rax
  jmp    L58
L1:
  mov    $0x0,%eax
L58:
  leave
  ret
```

tool_calls: name: read_data
arguments: data_label: D16
type: string
name: read_data
arguments: data_label: D8
type: string
name: read_data
arguments: data_label: D6
type: string
name: read_data
arguments: data_label: D15
type: string

tool: D16: ://

tool: D8: :\

tool: D6: file://*:

tool: D15: %20

assistant: ```c
char *cst_make_url(char *str) {
  int len = strlen(str);
  char *res;
  if (len < 3)
    return NULL;
  if (strstr(str, "://") > str)
    return xstrdup(str);
  else if (strstr(str, ":\\") == str + 1) {
    res = xstrdup("file://*:");
    res[7] = *str++;
    res[8] = *str++;
    res = xstrappend(res, str);
    {
      char *c;
      int i;
      c = res;
      while ((c = strchr(c, '\\')))
        *c++ = '/';
      c = res;
      i = 0;
      while ((c = strchr(c, ' '))) {
        c++;
        i++;
      }
      if (i > 0) {
        char *src, *dest, *last;
        last = src = res;
        res = dest = xcalloc(strlen(src) + (2 * i) + 1, 1);
        while ((c = strchr(src, ' '))) {
          if (c != src)
            strncpy(dest, src, c - src);
          strcat(dest, "%20");
          c++;
          src = c;
          dest = res + strlen(res);
        }
        while (*src != '\0')
          *dest++ = *src++;
        xfree(last);
      }
    }
    return res;
  } else
    return NULL;
}
```