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

```asm
<format_url_recoded>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %rcx,-0x40(%rbp)
  mov    %r8,-0x48(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L26
  lea    D24(%rip),%rax
  mov    %rax,-0x18(%rbp)
L26:
  mov    -0x8(%rbp),%rax
  cmp    -0x30(%rbp),%rax
  jae    L21
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  mov    -0x28(%rbp),%rdx
  add    %rdx,%rax
  movb   $0x22,(%rax)
L21:
  movq   $0x0,-0x10(%rbp)
  jmp    L10
L117:
  mov    -0x18(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x19(%rbp)
  cmpb   $0x25,-0x19(%rbp)
  jne    L32
  mov    -0x10(%rbp),%rax
  cmp    -0x48(%rbp),%rax
  jae    L2
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L2
  addq   $0x1,-0x10(%rbp)
  mov    -0x18(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  sub    $0x30,%eax
  shl    $0x4,%eax
  mov    %al,-0x19(%rbp)
L2:
  mov    -0x10(%rbp),%rax
  cmp    -0x48(%rbp),%rax
  jae    L32
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L32
  addq   $0x1,-0x10(%rbp)
  mov    -0x18(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  sub    $0x30,%eax
  or     %al,-0x19(%rbp)
L32:
  movzbl -0x19(%rbp),%eax
  mov    %eax,%edi
  call   <isprint@plt>
  test   %rax,%rax
  je     L68
  cmpb   $0x22,-0x19(%rbp)
  je     L68
  cmpb   $0x5c,-0x19(%rbp)
  je     L68
  cmpb   $0x25,-0x19(%rbp)
  je     L68
  cmpb   $0x3d,-0x19(%rbp)
  je     L68
  cmpb   $0x26,-0x19(%rbp)
  je     L68
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  mov    -0x28(%rbp),%rdx
  add    %rax,%rdx
  movzbl -0x19(%rbp),%eax
  mov    %al,(%rdx)
  jmp    L33
L68:
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  mov    -0x28(%rbp),%rdx
  add    %rdx,%rax
  movb   $0x25,(%rax)
  movzbl -0x19(%rbp),%eax
  shr    $0x4,%al
  movzbl %al,%eax
  and    $0xf,%eax
  mov    %eax,%ecx
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  mov    -0x28(%rbp),%rdx
  add    %rax,%rdx
  movslq %ecx,%rax
  lea    D23(%rip),%rcx
  movzbl (%rax,%rcx,1),%eax
  mov    %al,(%rdx)
  movzbl -0x19(%rbp),%eax
  and    $0xf,%eax
  mov    %eax,%ecx
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  mov    -0x28(%rbp),%rdx
  add    %rax,%rdx
  movslq %ecx,%rax
  lea    D23(%rip),%rcx
  movzbl (%rax,%rcx,1),%eax
  mov    %al,(%rdx)
L33:
  addq   $0x1,-0x10(%rbp)
L10:
  mov    -0x8(%rbp),%rax
  add    $0x6,%rax
  cmp    %rax,-0x30(%rbp)
  jbe    L37
  mov    -0x10(%rbp),%rax
  cmp    -0x48(%rbp),%rax
  jb     L117
L37:
  mov    -0x30(%rbp),%rax
  sub    $0x1,%rax
  cmp    %rax,-0x8(%rbp)
  jae    L3
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  mov    -0x28(%rbp),%rdx
  add    %rdx,%rax
  movb   $0x22,(%rax)
  mov    -0x28(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
L3:
  mov    -0x30(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x38(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  mov    %rdx,(%rax)
  nop
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: label: D24
datatype: string
name: disassemble_data
arguments: label: D23
datatype: string

tool: 

tool: D23: 0123456789ABCDEF

assistant: ```c
void format_url_recoded(char *valbuf, size_t sizeof_valbuf, size_t *r_vallen, const void *v_value, size_t length) {
  const unsigned char *value = (const unsigned char *)v_value;
  size_t i;
  size_t vallen = *r_vallen;
  if (value == 0)
    value = (const unsigned char *)"";
  if (vallen < sizeof_valbuf)
    valbuf[vallen++] = '\"';
  for (i = 0; vallen + 6 < sizeof_valbuf && i < length; i++) {
    unsigned char c = value[i];
    if (c == '%') {
      if (i < length && isdigit(value[i + 1]))
        c = (unsigned char)((value[++i] - '0') << 4);
      if (i < length && isdigit(value[i + 1]))
        c |= (unsigned char)((value[++i] - '0'));
    }
    if (isprint(c) && c != '\"' && c != '\\' && c != '%' && c != '=' && c != '&') {
      valbuf[vallen++] = (char)c;
    } else {
      valbuf[vallen++] = '%';
      valbuf[vallen++] = "0123456789ABCDEF"[(c >> 4) & 0x0F];
      valbuf[vallen++] = "0123456789ABCDEF"[(c >> 0) & 0x0F];
    }
  }
  if (vallen < sizeof_valbuf - 1) {
    valbuf[vallen++] = '\"';
    valbuf[vallen] = '\0';
  }
  valbuf[sizeof_valbuf - 1] = '\0';
  *r_vallen = vallen;
}
```