user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<urlencode_put>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x38,%rsp
  mov    %rdx,(%rsp)
  mov    %rcx,0x18(%rsp)
  mov    %rdi,0x10(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  setne  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  xor    %edi,%edi
  test   %rbx,%rbx
  setne  %dil
  xor    %ebp,%ebp
  xor    %r13d,%r13d
  xor    %ebx,%ebx
  call   <assert@plt>
  xor    %edx,%edx
  xor    %esi,%esi
  xor    %edi,%edi
  call   <mbtowc@plt>
  lea    0x27(%rsp),%rax
  xor    %r15d,%r15d
  mov    %rax,0x8(%rsp)
  jmp    L135
  nopl   (%rax)
L138:
  mov    0x10(%rsp),%rax
  add    $0x1,%r13d
  mov    %dil,(%rax,%r15,1)
L89:
  mov    %r13d,%r15d
  lea    0x1(%rbx),%eax
  mov    %r15,%r14
  cmp    0x18(%rsp),%rbx
  jae    L75
  cmp    %r15,%r12
  jbe    L75
  mov    %eax,%ebx
L135:
  mov    D0(%rip),%rax
  mov    0x8(%rsp),%rdi
  mov    %ebp,%esi
  mov    %r15,%r14
  add    (%rsp),%rsi
  mov    (%rax),%edx
  call   <mbtowc@plt>
  movsbl 0x27(%rsp),%edi
  add    %eax,%ebp
  test   %dil,%dil
  je     L75
  cmp    $0x20,%dil
  jne    L131
  cmp    %r15,%r12
  ja     L7
L131:
  call   <iswalnum@plt>
  movsbl 0x27(%rsp),%edi
  test   %rax,%rax
  jne    L189
  lea    -0x2d(%rdi),%eax
  cmp    $0x1,%al
  jbe    L189
  cmp    $0x7e,%dil
  jne    L91
L189:
  cmp    %r15,%r12
  ja     L138
  call   <isASCIIcompat_char@plt>
L94:
  cmpb   $0x7f,0x27(%rsp)
  je     L79
L86:
  cmp    %r15,%r12
  ja     L170
L75:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L64
  add    $0x38,%rsp
  mov    %r14,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L7:
  mov    0x10(%rsp),%rax
  add    $0x1,%r13d
  movb   $0x2b,(%rax,%r15,1)
  jmp    L89
  nopl   0x0(%rax,%rax,1)
L79:
  lea    0x2(%r13),%eax
  cmp    %r12,%rax
  jae    L86
  mov    0x10(%rsp),%rax
  lea    0x1(%r13),%edi
  mov    $0x7f,%esi
  mov    %rdi,%r13
  movb   $0x25,(%rax,%r15,1)
  add    %rax,%rdi
  call   <hexadecimal@plt>
  add    %eax,%r13d
  jmp    L89
  nopw   0x0(%rax,%rax,1)
L91:
  call   <isASCIIcompat_char@plt>
  test   %rax,%rax
  je     L94
  cmp    %r15,%r12
  jbe    L94
  mov    0x10(%rsp),%rax
  lea    0x1(%r13),%edi
  movzbl 0x27(%rsp),%esi
  mov    %rdi,%r13
  movb   $0x25,(%rax,%r15,1)
  add    %rax,%rdi
  call   <hexadecimal@plt>
  add    %eax,%r13d
  jmp    L89
L170:
  mov    0x10(%rsp),%rax
  lea    0x1(%r13),%r14d
  movb   $0x2a,(%rax,%r15,1)
  jmp    L75
L64:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
size_t urlencode_put(char *result, size_t result_max, const char *multibyte_input, size_t input_len) {
  assert(NULL != result);
  assert(NULL != multibyte_input);
  unsigned int i = 0;
  unsigned int r = 0;
  unsigned int offset = 0;
  wchar_t current;
  mbtowc(NULL, NULL, 0);
  do {
    offset += mbtowc(&current, (multibyte_input) + (offset), MB_CUR_MAX);
    if (current == 0) {
      break;
    } else if (current == ' ' && r < result_max) {
      result[r++] = '+';
      continue;
    } else if ((iswalnum(current) || current == '-' || current == '.' || current == '~') && r < result_max) {
      result[r++] = current;
    } else if (isASCIIcompat_char(current) && r < result_max) {
      result[r++] = '%';
      r += hexadecimal(result + r, (unsigned int)(current & 0xFF));
    } else if (current >= 0x7F && current <= 0x7FFFFFFF && (r + 2) < result_max) {
      result[r++] = '%';
      r += hexadecimal(result + r, (unsigned int)current);
    } else if (result_max > r) {
      result[r++] = '*';
      break;
    }
  } while ((i++) < input_len && (r < result_max));
  return r;
}
```