user: 请从给定的汇编指令推导出C源代码:

```asm
<urlencode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %rcx,-0x40(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L56
L70:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jbe    L47
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jbe    L51
L47:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x60,%al
  jbe    L15
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x7a,%al
  jbe    L51
L15:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x40,%al
  jbe    L40
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x5a,%al
  jbe    L51
L40:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x5f,%al
  je     L51
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  je     L51
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L57
L51:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%ecx
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  jmp    L99
L57:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  jne    L16
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x2b,(%rax)
  jmp    L99
L16:
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x25,(%rax)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  shr    $0x4,%al
  movzbl %al,%eax
  cltq
  lea    D12(%rip),%rdx
  movzbl (%rax,%rdx,1),%ecx
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xf,%eax
  cltq
  lea    D12(%rip),%rdx
  movzbl (%rax,%rdx,1),%ecx
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
L99:
  addq   $0x1,-0x18(%rbp)
L56:
  mov    -0x18(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jb     L70
  mov    -0x10(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x10(%rbp),%rax
  sub    -0x38(%rbp),%rax
  mov    %eax,%edx
  mov    -0x40(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x38(%rbp),%rax
  pop    %rbp
  ret
```

assistant: ```c
char *urlencode(const char *src, const int src_len, char *dest, int *dest_len) {
  static unsigned char hex_chars[] = "0123456789ABCDEF";
  const unsigned char *pSrc;
  const unsigned char *pEnd;
  char *pDest;
  pDest = dest;
  pEnd = (unsigned char *)src + src_len;
  for (pSrc = (unsigned char *)src; pSrc < pEnd; pSrc++) {
    if ((*pSrc >= '0' && *pSrc <= '9') || (*pSrc >= 'a' && *pSrc <= 'z') || (*pSrc >= 'A' && *pSrc <= 'Z') || (*pSrc == '_' || *pSrc == '-' || *pSrc == '.')) {
      *pDest++ = *pSrc;
    } else if (*pSrc == ' ') {
      *pDest++ = '+';
    } else {
      *pDest++ = '%';
      *pDest++ = hex_chars[(*pSrc) >> 4];
      *pDest++ = hex_chars[(*pSrc) & 0x0F];
    }
  }
  *pDest = '\0';
  *dest_len = pDest - dest;
  return dest;
}
```