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

```asm
<json_parse_codepoint>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x24(%rbp)
  movl   $0x0,-0x1c(%rbp)
  jmp    L42
L48:
  mov    -0x1c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x25(%rbp)
  movsbl -0x25(%rbp),%eax
  mov    %eax,%edi
  call   <isxdigit@plt>
  test   %eax,%eax
  jne    L110
  mov    $0x0,%eax
  jmp    L94
L110:
  cmpb   $0x2f,-0x25(%rbp)
  jle    L47
  cmpb   $0x39,-0x25(%rbp)
  jg     L47
  movsbl -0x25(%rbp),%eax
  sub    $0x30,%eax
  mov    %eax,-0x20(%rbp)
  jmp    L74
L47:
  cmpb   $0x60,-0x25(%rbp)
  jle    L130
  cmpb   $0x66,-0x25(%rbp)
  jg     L130
  movsbl -0x25(%rbp),%eax
  sub    $0x57,%eax
  mov    %eax,-0x20(%rbp)
  jmp    L74
L130:
  movsbl -0x25(%rbp),%eax
  sub    $0x37,%eax
  mov    %eax,-0x20(%rbp)
L74:
  mov    $0x3,%eax
  sub    -0x1c(%rbp),%eax
  shl    $0x2,%eax
  mov    -0x20(%rbp),%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  or     %eax,-0x24(%rbp)
  addl   $0x1,-0x1c(%rbp)
L42:
  cmpl   $0x3,-0x1c(%rbp)
  jle    L48
  cmpl   $0x7f,-0x24(%rbp)
  jg     L102
  movq   $0x1,-0x18(%rbp)
  mov    -0x24(%rbp),%eax
  mov    %al,-0xb(%rbp)
  jmp    L170
L102:
  cmpl   $0x7ff,-0x24(%rbp)
  jg     L97
  movq   $0x2,-0x18(%rbp)
  mov    -0x24(%rbp),%eax
  sar    $0x6,%eax
  or     $0xffffffc0,%eax
  mov    %al,-0xb(%rbp)
  mov    -0x24(%rbp),%eax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %al,-0xa(%rbp)
  jmp    L170
L97:
  movq   $0x3,-0x18(%rbp)
  mov    -0x24(%rbp),%eax
  sar    $0xc,%eax
  or     $0xffffffe0,%eax
  mov    %al,-0xb(%rbp)
  mov    -0x24(%rbp),%eax
  sar    $0x6,%eax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %al,-0xa(%rbp)
  mov    -0x24(%rbp),%eax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %al,-0x9(%rbp)
L170:
  cmpq   $0x0,-0x40(%rbp)
  je     L11
  mov    -0x48(%rbp),%rax
  cmp    -0x18(%rbp),%rax
  jae    L18
  mov    $0x0,%eax
  jmp    L94
L18:
  mov    -0x18(%rbp),%rdx
  lea    -0xb(%rbp),%rcx
  mov    -0x40(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
L11:
  mov    -0x18(%rbp),%rax
L94:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L115
  call   <__stack_chk_fail@plt>
L115:
  leave
  ret
```

assistant: ```c
size_t json_parse_codepoint(const char *str, char *buf, size_t size) {
  uint16_t codepoint = 0;
  char utf8[3];
  size_t len;
  int hex;
  char c;
  int i;
  for (i = 0; i < 4; i++) {
    c = str[i];
    if (!isxdigit(c))
      return 0;
    if (c >= '0' && c <= '9')
      hex = c - '0';
    else if (c >= 'a' && c <= 'f')
      hex = c - 'a' + 10;
    else
      hex = c - 'A' + 10;
    codepoint |= hex << (12 - i * 4);
  }
  if (codepoint <= 0x7f) {
    len = 1;
    utf8[0] = codepoint;
  } else if (codepoint <= 0x7ff) {
    len = 2;
    utf8[0] = 0xc0 | (codepoint >> 6);
    utf8[1] = 0x80 | (codepoint & 0x3f);
  } else {
    len = 3;
    utf8[0] = (0xe0 | (codepoint >> 12));
    utf8[1] = (0x80 | ((codepoint >> 6) & 0x3f));
    utf8[2] = (0x80 | (codepoint & 0x3f));
  }
  if (buf) {
    if (size < len)
      return 0;
    memcpy(buf, utf8, len);
  }
  return len;
}
```