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

```asm
<get_socket_base_path>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x448,%rsp
  mov    %rdi,-0x448(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x430(%rbp)
  movq   $0x0,-0x428(%rbp)
  movq   $0x0,-0x420(%rbp)
  movq   $0x0,-0x418(%rbp)
  lea    -0x410(%rbp),%rdx
  mov    $0x0,%eax
  mov    $0x7e,%ecx
  mov    %rdx,%rdi
  rep stos %rax,%es:(%rdi)
  movq   $0x0,-0x438(%rbp)
  mov    -0x448(%rbp),%rax
  mov    $0x6,%edx
  lea    D29(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L40
  mov    -0x448(%rbp),%rax
  mov    $0x2f,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x430(%rbp)
  mov    $0x80,%edi
  call   <my_malloc@plt>
  mov    %rax,-0x438(%rbp)
  cmpq   $0x0,-0x438(%rbp)
  jne    L51
  mov    $0x0,%eax
  jmp    L47
L51:
  mov    -0x430(%rbp),%rdx
  mov    -0x438(%rbp),%rax
  lea    D31(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  jmp    L12
L40:
  mov    -0x448(%rbp),%rax
  mov    $0x2f,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x430(%rbp)
  mov    -0x430(%rbp),%rax
  mov    $0xa,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x428(%rbp)
  mov    -0x430(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,%rbx
  mov    -0x428(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  sub    %rax,%rbx
  mov    %rbx,%rdx
  mov    -0x430(%rbp),%rcx
  lea    -0x420(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    $0x80,%edi
  call   <my_malloc@plt>
  mov    %rax,-0x438(%rbp)
  cmpq   $0x0,-0x438(%rbp)
  jne    L64
  mov    $0x0,%eax
  jmp    L47
L64:
  lea    -0x420(%rbp),%rax
  mov    $0x5,%edx
  mov    %rax,%rsi
  mov    $0x2f,%edi
  call   <my_nstrchr@plt>
  mov    %rax,-0x430(%rbp)
  cmpq   $0x0,-0x430(%rbp)
  jne    L45
  lea    -0x420(%rbp),%rdx
  mov    -0x438(%rbp),%rax
  lea    D31(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  jmp    L12
L45:
  lea    -0x420(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,%rbx
  mov    -0x430(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,%rdx
  mov    %rbx,%rax
  sub    %rdx,%rax
  lea    0x1(%rax),%rsi
  lea    -0x420(%rbp),%rdx
  mov    -0x438(%rbp),%rax
  mov    %rdx,%rcx
  lea    D31(%rip),%rdx
  mov    %rax,%rdi
  call   <snprintf@plt>
L12:
  mov    -0x438(%rbp),%rax
L47:
  mov    -0x18(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L34
  call   <__stack_chk_fail@plt>
L34:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D29
data_type: string
name: extract_symbolic_data
arguments: data_tag: D31
data_type: string

tool: D29: rmroot

tool: D31: %s

assistant: ```c
char *get_socket_base_path(char *cmd) {
  char *temp = NULL;
  char *temp1 = NULL;
  char path[1024] = {0};
  char *root_path = NULL;
  if (!strncmp(cmd, "rmroot", 6)) {
    temp = strchr(cmd, '/');
    root_path = my_malloc(128);
    if (root_path == NULL)
      return NULL;
    sprintf(root_path, "%s", temp);
  } else {
    temp = strchr(cmd, '/');
    temp1 = strchr(temp, '\n');
    strncpy(path, temp, strlen(temp) - strlen(temp1));
    root_path = my_malloc(128);
    if (root_path == NULL)
      return NULL;
    temp = my_nstrchr('/', path, 5);
    if (temp == NULL) {
      sprintf(root_path, "%s", path);
    } else {
      snprintf(root_path, strlen(path) - strlen(temp) + 1, "%s", path);
    }
  }
  return root_path;
}
```