user: 请将以下的汇编代码转换成C语言代码：

```asm
<rfc2045_append_url>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%rcx
  mov    %rsp,%rdx
  lea    0x8(%rsp),%rsi
  call   <get_method_path@plt>
  lea    0x20(%rsp),%rcx
  lea    0x4(%rsp),%rdx
  mov    %rbp,%rdi
  lea    0x18(%rsp),%rsi
  call   <get_method_path@plt>
  mov    0x4(%rsp),%eax
  test   %eax,%eax
  jne    L142
  mov    0x8(%rsp),%r15
  mov    (%rsp),%r14d
  mov    0x10(%rsp),%r13
  mov    %r15,0x18(%rsp)
  mov    %r14d,0x4(%rsp)
  test   %r13,%r13
  je     L170
L150:
  mov    0x20(%rsp),%rdi
  test   %rdi,%rdi
  je     L37
  call   <strlen@plt>
  mov    %rax,%r12
L13:
  mov    %r13,%rdi
  mov    %r14d,%ebp
  call   <strlen@plt>
  add    %rbp,%rax
  lea    0x3(%r12,%rax,1),%rdi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L168
  test   %r14d,%r14d
  jne    L47
L67:
  add    %r12,%rbp
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <strcpy@plt>
  lea    D22(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcat@plt>
  mov    0x20(%rsp),%rsi
  cmpb   $0x2f,(%rsi)
  je     L182
L93:
  mov    %rbp,%rdi
  call   <strcat@plt>
L36:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L102
  add    $0x30,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L182:
  cmpb   $0x2f,0x1(%rsi)
  je     L18
  cmpb   $0x2f,0x0(%rbp)
  jne    L18
  cmpb   $0x2f,0x1(%rbp)
  je     L92
  xchg   %ax,%ax
L18:
  movb   $0x0,0x0(%rbp)
  jmp    L93
  cs nopw 0x0(%rax,%rax,1)
L47:
  mov    %r14d,%edx
  mov    %r15,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    0x10(%rsp),%r13
  mov    0x4(%rsp),%ebp
  jmp    L67
  nopl   0x0(%rax)
L37:
  lea    D29(%rip),%rax
  xor    %r12d,%r12d
  mov    %rax,0x20(%rsp)
  jmp    L13
  nopl   0x0(%rax)
L170:
  lea    D29(%rip),%r13
  mov    %r13,0x10(%rsp)
  jmp    L150
  nopl   0x0(%rax)
L142:
  mov    %rbp,%rdi
  call   <strlen@plt>
  lea    0x1(%rax),%rdi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L168
  mov    %rbp,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  jmp    L36
  nopl   0x0(%rax)
L92:
  mov    $0x2f,%esi
  lea    0x2(%rbp),%rdi
  call   <strchr@plt>
  mov    0x20(%rsp),%rsi
  test   %rax,%rax
  je     L18
  movb   $0x0,(%rax)
  mov    0x20(%rsp),%rsi
  jmp    L93
L168:
  xor    %eax,%eax
  xor    %r12d,%r12d
  call   <rfc2045_enomem@plt>
  jmp    L36
L102:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_tag: D22
type: string
name: retrieve_data
arguments: data_tag: D29
type: string

tool: D22: /

tool: 

assistant: ```c
char *rfc2045_append_url(const char *base, const char *loc) {
  const char *base_method;
  unsigned base_method_l;
  const char *base_path;
  const char *loc_method;
  unsigned loc_method_l;
  const char *loc_path;
  char *buf, *q;
  get_method_path(base, &base_method, &base_method_l, &base_path);
  get_method_path(loc, &loc_method, &loc_method_l, &loc_path);
  if (loc_method_l) {
    buf = malloc(strlen(loc) + 1);
    if (!buf)
      rfc2045_enomem();
    else
      strcpy(buf, loc);
    return (buf);
  }
  loc_method = base_method;
  loc_method_l = base_method_l;
  if (!base_path)
    base_path = "";
  if (!loc_path)
    loc_path = "";
  buf = malloc(loc_method_l + strlen(base_path) + strlen(loc_path) + 3);
  if (!buf) {
    rfc2045_enomem();
    return (0);
  }
  if (loc_method_l)
    memcpy(buf, loc_method, loc_method_l);
  buf[loc_method_l] = 0;
  q = buf + loc_method_l;
  strcat(strcpy(q, base_path), "/");
  if (loc_path[0] == '/') {
    char *r;
    if (loc_path[1] == '/') {
      *q = 0;
    } else if (q[0] == '/' && q[1] == '/' && (r = strchr(q + 2, '/')) != 0) {
      *r = 0;
    } else
      *q = 0;
  }
  strcat(q, loc_path);
  return (buf);
}
```