user: Translate the below assembly code into C programming language:

```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    L45
  mov    0x8(%rsp),%r15
  mov    (%rsp),%r14d
  mov    0x10(%rsp),%r13
  mov    %r15,0x18(%rsp)
  mov    %r14d,0x4(%rsp)
  test   %r13,%r13
  je     L4
L156:
  mov    0x20(%rsp),%rdi
  test   %rdi,%rdi
  je     L97
  call   <strlen@plt>
  mov    %rax,%r12
L161:
  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     L165
  test   %r14d,%r14d
  jne    L168
L33:
  add    %r12,%rbp
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <strcpy@plt>
  lea    D3(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcat@plt>
  mov    0x20(%rsp),%rsi
  cmpb   $0x2f,(%rsi)
  je     L147
L69:
  mov    %rbp,%rdi
  call   <strcat@plt>
L154:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L15
  add    $0x30,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L147:
  cmpb   $0x2f,0x1(%rsi)
  je     L83
  cmpb   $0x2f,0x0(%rbp)
  jne    L83
  cmpb   $0x2f,0x1(%rbp)
  je     L112
  xchg   %ax,%ax
L83:
  movb   $0x0,0x0(%rbp)
  jmp    L69
  cs nopw 0x0(%rax,%rax,1)
L168:
  mov    %r14d,%edx
  mov    %r15,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    0x10(%rsp),%r13
  mov    0x4(%rsp),%ebp
  jmp    L33
  nopl   0x0(%rax)
L97:
  lea    D9(%rip),%rax
  xor    %r12d,%r12d
  mov    %rax,0x20(%rsp)
  jmp    L161
  nopl   0x0(%rax)
L4:
  lea    D9(%rip),%r13
  mov    %r13,0x10(%rsp)
  jmp    L156
  nopl   0x0(%rax)
L45:
  mov    %rbp,%rdi
  call   <strlen@plt>
  lea    0x1(%rax),%rdi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L165
  mov    %rbp,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  jmp    L154
  nopl   0x0(%rax)
L112:
  mov    $0x2f,%esi
  lea    0x2(%rbp),%rdi
  call   <strchr@plt>
  mov    0x20(%rsp),%rsi
  test   %rax,%rax
  je     L83
  movb   $0x0,(%rax)
  mov    0x20(%rsp),%rsi
  jmp    L69
L165:
  xor    %eax,%eax
  xor    %r12d,%r12d
  call   <rfc2045_enomem@plt>
  jmp    L154
L15:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_label: D3
type: string
name: unpack_data
arguments: data_label: D9
type: string

tool: D3: /

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