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

```asm
<nasm_unquote>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  movq   $0x0,-0x8(%rbp)
  movl   $0x0,-0x20(%rbp)
  movl   $0x0,-0x1c(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movzbl (%rax),%eax
  mov    %al,-0x26(%rbp)
  cmpb   $0x0,-0x26(%rbp)
  jne    L420
  mov    $0x0,%eax
  jmp    L586
L420:
  movsbl -0x26(%rbp),%eax
  cmp    $0x60,%eax
  je     L769
  cmp    $0x60,%eax
  jg     L552
  cmp    $0x22,%eax
  je     L50
  cmp    $0x27,%eax
  jne    L552
  jmp    L50
L297:
  addq   $0x1,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movzbl -0x25(%rbp),%edx
  mov    %dl,(%rax)
L50:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,-0x25(%rbp)
  cmpb   $0x0,-0x25(%rbp)
  je     L60
  movzbl -0x25(%rbp),%eax
  cmp    -0x26(%rbp),%al
  jne    L297
L60:
  mov    -0x10(%rbp),%rax
  movb   $0x0,(%rax)
  jmp    L488
L769:
  movl   $0x0,-0x24(%rbp)
  nop
  jmp    L770
L503:
  addq   $0x1,-0x18(%rbp)
  cmpl   $0x4,-0x24(%rbp)
  ja     L770
  mov    -0x24(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  lea    D9(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D9(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  movsbl -0x25(%rbp),%eax
  cmp    $0x5c,%eax
  je     L359
  cmp    $0x60,%eax
  je     L422
  jmp    L221
L359:
  movl   $0x1,-0x24(%rbp)
  jmp    L628
L422:
  subq   $0x1,-0x18(%rbp)
  jmp    L346
L221:
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movzbl -0x25(%rbp),%edx
  mov    %dl,(%rax)
  nop
L628:
  jmp    L770
  movl   $0x0,-0x24(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x1c(%rbp)
  movsbl -0x25(%rbp),%eax
  sub    $0x30,%eax
  cmp    $0x48,%eax
  ja     L648
  mov    %eax,%eax
  lea    0x0(,%rax,4),%rdx
  lea    D6(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D6(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x7,(%rax)
  jmp    L773
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x8,(%rax)
  jmp    L773
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x1b,(%rax)
  jmp    L773
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0xc,(%rax)
  jmp    L773
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0xa,(%rax)
  jmp    L773
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0xd,(%rax)
  jmp    L773
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x9,(%rax)
  jmp    L773
  movl   $0x4,-0x24(%rbp)
  movl   $0x4,-0x20(%rbp)
  jmp    L773
  movl   $0x4,-0x24(%rbp)
  movl   $0x8,-0x20(%rbp)
  jmp    L773
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0xb,(%rax)
  jmp    L773
  movl   $0x2,-0x24(%rbp)
  movl   $0x2,-0x20(%rbp)
  jmp    L773
  movl   $0x3,-0x24(%rbp)
  movl   $0x2,-0x20(%rbp)
  movsbl -0x25(%rbp),%eax
  sub    $0x30,%eax
  mov    %eax,-0x1c(%rbp)
  jmp    L773
L648:
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movzbl -0x25(%rbp),%edx
  mov    %dl,(%rax)
  nop
L773:
  jmp    L770
  cmpb   $0x2f,-0x25(%rbp)
  jle    L697
  cmpb   $0x37,-0x25(%rbp)
  jg     L697
  mov    -0x1c(%rbp),%eax
  lea    0x0(,%rax,8),%edx
  movsbl -0x25(%rbp),%eax
  sub    $0x30,%eax
  add    %edx,%eax
  mov    %eax,-0x1c(%rbp)
  subl   $0x1,-0x20(%rbp)
  cmpl   $0x0,-0x20(%rbp)
  jne    L377
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    -0x1c(%rbp),%edx
  mov    %dl,(%rax)
  movl   $0x0,-0x24(%rbp)
  jmp    L377
L697:
  subq   $0x1,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    -0x1c(%rbp),%edx
  mov    %dl,(%rax)
  movl   $0x0,-0x24(%rbp)
L377:
  jmp    L770
  cmpb   $0x2f,-0x25(%rbp)
  jle    L801
  cmpb   $0x39,-0x25(%rbp)
  jle    L839
L801:
  cmpb   $0x40,-0x25(%rbp)
  jle    L261
  cmpb   $0x46,-0x25(%rbp)
  jle    L839
L261:
  cmpb   $0x60,-0x25(%rbp)
  jle    L456
  cmpb   $0x66,-0x25(%rbp)
  jg     L456
L839:
  mov    -0x1c(%rbp),%eax
  shl    $0x4,%eax
  mov    %eax,%edx
  cmpb   $0x60,-0x25(%rbp)
  jle    L226
  movsbl -0x25(%rbp),%eax
  sub    $0x57,%eax
  jmp    L515
L226:
  cmpb   $0x40,-0x25(%rbp)
  jle    L508
  movsbl -0x25(%rbp),%eax
  sub    $0x37,%eax
  jmp    L515
L508:
  movsbl -0x25(%rbp),%eax
  sub    $0x30,%eax
L515:
  add    %edx,%eax
  mov    %eax,-0x1c(%rbp)
  subl   $0x1,-0x20(%rbp)
  cmpl   $0x0,-0x20(%rbp)
  jne    L436
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    -0x1c(%rbp),%edx
  mov    %dl,(%rax)
  movl   $0x0,-0x24(%rbp)
  jmp    L436
L456:
  subq   $0x1,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  ja     L689
  mov    -0x8(%rbp),%rax
  movzbl -0x1(%rax),%edx
  jmp    L152
L689:
  mov    -0x1c(%rbp),%eax
  mov    %eax,%edx
L152:
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x10(%rbp)
  mov    %dl,(%rax)
  movl   $0x0,-0x24(%rbp)
L436:
  jmp    L770
  cmpb   $0x2f,-0x25(%rbp)
  jle    L792
  cmpb   $0x39,-0x25(%rbp)
  jle    L701
L792:
  cmpb   $0x40,-0x25(%rbp)
  jle    L611
  cmpb   $0x46,-0x25(%rbp)
  jle    L701
L611:
  cmpb   $0x60,-0x25(%rbp)
  jle    L348
  cmpb   $0x66,-0x25(%rbp)
  jg     L348
L701:
  mov    -0x1c(%rbp),%eax
  shl    $0x4,%eax
  mov    %eax,%edx
  cmpb   $0x60,-0x25(%rbp)
  jle    L623
  movsbl -0x25(%rbp),%eax
  sub    $0x57,%eax
  jmp    L731
L623:
  cmpb   $0x40,-0x25(%rbp)
  jle    L306
  movsbl -0x25(%rbp),%eax
  sub    $0x37,%eax
  jmp    L731
L306:
  movsbl -0x25(%rbp),%eax
  sub    $0x30,%eax
L731:
  add    %edx,%eax
  mov    %eax,-0x1c(%rbp)
  subl   $0x1,-0x20(%rbp)
  cmpl   $0x0,-0x20(%rbp)
  jne    L347
  mov    -0x1c(%rbp),%edx
  mov    -0x10(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <emit_utf8@plt>
  mov    %rax,-0x10(%rbp)
  movl   $0x0,-0x24(%rbp)
  jmp    L347
L348:
  subq   $0x1,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jbe    L805
  mov    -0x1c(%rbp),%edx
  mov    -0x10(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <emit_utf8@plt>
  mov    %rax,-0x10(%rbp)
  jmp    L202
L805:
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    -0x8(%rbp),%rdx
  movzbl -0x1(%rdx),%edx
  mov    %dl,(%rax)
L202:
  movl   $0x0,-0x24(%rbp)
L347:
  nop
L770:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,-0x25(%rbp)
  cmpb   $0x0,-0x25(%rbp)
  jne    L503
  cmpl   $0x4,-0x24(%rbp)
  je     L129
  cmpl   $0x4,-0x24(%rbp)
  ja     L829
  cmpl   $0x3,-0x24(%rbp)
  je     L528
  cmpl   $0x3,-0x24(%rbp)
  ja     L829
  cmpl   $0x1,-0x24(%rbp)
  jbe    L619
  cmpl   $0x2,-0x24(%rbp)
  je     L405
  jmp    L829
L528:
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    -0x1c(%rbp),%edx
  mov    %dl,(%rax)
  jmp    L346
L405:
  mov    -0x18(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  ja     L518
  mov    -0x8(%rbp),%rax
  movzbl -0x1(%rax),%edx
  jmp    L165
L518:
  mov    -0x1c(%rbp),%eax
  mov    %eax,%edx
L165:
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x10(%rbp)
  mov    %dl,(%rax)
  jmp    L346
L129:
  mov    -0x18(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jbe    L416
  mov    -0x1c(%rbp),%edx
  mov    -0x10(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <emit_utf8@plt>
  mov    %rax,-0x10(%rbp)
  jmp    L346
L416:
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    -0x8(%rbp),%rdx
  movzbl -0x1(%rdx),%edx
  mov    %dl,(%rax)
  jmp    L346
L619:
  nop
L346:
  jmp    L829
L552:
  mov    -0x38(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L488
L829:
  nop
L488:
  cmpq   $0x0,-0x40(%rbp)
  je     L124
  mov    -0x40(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  mov    %rdx,(%rax)
L124:
  mov    -0x10(%rbp),%rax
  sub    -0x38(%rbp),%rax
L586:
  leave
  ret
```

assistant: ```c
size_t nasm_unquote(char *str, char **ep) {
  char bq;
  char *p, *q;
  char *escp = NULL;
  char c;
  enum unq_state {
    st_start,
    st_backslash,
    st_hex,
    st_oct,
    st_ucs,
  } state;
  int ndig = 0;
  int32_t nval = 0;
  p = q = str;
  bq = *p++;
  if (!bq)
    return 0;
  switch (bq) {
  case '\'':
  case '\"':
    while ((c = *p) && c != bq) {
      p++;
      *q++ = c;
    }
    *q = '\0';
    break;
  case '`':
    state = st_start;
    while ((c = *p)) {
      p++;
      switch (state) {
      case st_start:
        switch (c) {
        case '\\':
          state = st_backslash;
          break;
        case '`':
          p--;
          goto out;
        default:
          *q++ = c;
          break;
        }
        break;
      case st_backslash:
        state = st_start;
        escp = p;
        nval = 0;
        switch (c) {
        case 'a':
          *q++ = 7;
          break;
        case 'b':
          *q++ = 8;
          break;
        case 'e':
          *q++ = 27;
          break;
        case 'f':
          *q++ = 12;
          break;
        case 'n':
          *q++ = 10;
          break;
        case 'r':
          *q++ = 13;
          break;
        case 't':
          *q++ = 9;
          break;
        case 'u':
          state = st_ucs;
          ndig = 4;
          break;
        case 'U':
          state = st_ucs;
          ndig = 8;
          break;
        case 'v':
          *q++ = 11;
          break;
        case 'x':
        case 'X':
          state = st_hex;
          ndig = 2;
          break;
        case '0':
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7':
          state = st_oct;
          ndig = 2;
          nval = c - '0';
          break;
        default:
          *q++ = c;
          break;
        }
        break;
      case st_oct:
        if (c >= '0' && c <= '7') {
          nval = (nval << 3) + (c - '0');
          if (!--ndig) {
            *q++ = nval;
            state = st_start;
          }
        } else {
          p--;
          *q++ = nval;
          state = st_start;
        }
        break;
      case st_hex:
        if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f')) {
          nval = (nval << 4) + ((c) >= 'a' ? (c) - 'a' + 10 : (c) >= 'A' ? (c) - 'A' + 10 : (c) - '0');
          if (!--ndig) {
            *q++ = nval;
            state = st_start;
          }
        } else {
          p--;
          *q++ = (p > escp) ? nval : escp[-1];
          state = st_start;
        }
        break;
      case st_ucs:
        if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f')) {
          nval = (nval << 4) + ((c) >= 'a' ? (c) - 'a' + 10 : (c) >= 'A' ? (c) - 'A' + 10 : (c) - '0');
          if (!--ndig) {
            q = emit_utf8(q, nval);
            state = st_start;
          }
        } else {
          p--;
          if (p > escp)
            q = emit_utf8(q, nval);
          else
            *q++ = escp[-1];
          state = st_start;
        }
        break;
      }
    }
    switch (state) {
    case st_start:
    case st_backslash:
      break;
    case st_oct:
      *q++ = nval;
      break;
    case st_hex:
      *q++ = (p > escp) ? nval : escp[-1];
      break;
    case st_ucs:
      if (p > escp)
        q = emit_utf8(q, nval);
      else
        *q++ = escp[-1];
      break;
    }
  out:
    break;
  default:
    p = q = strchr(str, '\0');
    break;
  }
  if (ep)
    *ep = p;
  return q - str;
}
```