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

```asm
<unescape_seq>:
  endbr64
  movzbl (%rsi),%eax
  mov    %rsi,%rcx
  mov    %rdx,%r9
  mov    %rdi,%rsi
  test   %al,%al
  je     L153
  xor    %edx,%edx
L176:
  sub    $0x1,%edx
  cmp    $0x1,%edx
  ja     L263
  mov    %rsi,%rdx
  mov    %rcx,%r8
L27:
  mov    %al,(%rdx)
  add    $0x1,%rsi
  xor    %edx,%edx
  cmp    $0x5c,%al
  movzbl 0x1(%r8),%eax
  sete   %dl
  lea    0x1(%r8),%rcx
  add    %edx,%edx
  test   %al,%al
  jne    L176
L187:
  mov    %esi,%eax
  mov    %rcx,%r8
  sub    %edi,%eax
L169:
  movb   $0x0,(%rsi)
  mov    %eax,(%r9)
  mov    %r8,%rax
  ret
  nopl   (%rax)
L206:
  movzbl 0x1(%rcx),%eax
  lea    0x1(%rcx),%r8
  test   %al,%al
  je     L53
  lea    -0x41(%rax),%edx
  lea    0x2(%rcx),%r8
  cmp    $0x1e,%dl
  ja     L50
  and    $0x1f,%eax
  lea    0x1(%rsi),%rdx
  mov    %al,(%rsi)
  movzbl 0x2(%rcx),%eax
  test   %al,%al
  je     L78
L105:
  mov    %rdx,%rsi
L120:
  mov    %r8,%rcx
L263:
  cmp    $0x5e,%al
  je     L206
  cmp    $0x5c,%al
  je     L26
  cmp    $0x3d,%al
  je     L187
  add    $0x1,%rcx
  mov    %al,(%rsi)
  add    $0x1,%rsi
  movzbl (%rcx),%eax
  test   %al,%al
  jne    L263
  jmp    L187
  nopw   0x0(%rax,%rax,1)
L50:
  cmp    $0x3f,%al
  je     L157
  movzbl 0x2(%rcx),%eax
  test   %al,%al
  jne    L120
L53:
  mov    %esi,%eax
  movb   $0x0,(%rsi)
  sub    %edi,%eax
  mov    %eax,(%r9)
  mov    %r8,%rax
  ret
  xchg   %ax,%ax
L26:
  movzbl 0x1(%rcx),%eax
  lea    0x1(%rcx),%r8
  test   %al,%al
  je     L53
L17:
  lea    -0x30(%rax),%ecx
  cmp    $0x7,%cl
  ja     L24
  movzbl 0x1(%r8),%edx
  lea    0x1(%rsi),%r11
  sub    $0x30,%edx
  cmp    $0x7,%dl
  ja     L225
  movzbl 0x2(%r8),%r10d
  sub    $0x30,%r10d
  cmp    $0x7,%r10b
  ja     L225
  shl    $0x6,%ecx
  shl    $0x3,%edx
  or     %r10d,%ecx
  or     %ecx,%edx
  mov    %dl,(%rsi)
  movzbl 0x3(%r8),%eax
  lea    0x3(%r8),%rdx
  test   %al,%al
  je     L266
  mov    %r11,%rsi
  mov    %rdx,%r8
  jmp    L17
  cs nopw 0x0(%rax,%rax,1)
L225:
  mov    %al,(%rsi)
  movzbl 0x1(%r8),%eax
  lea    0x1(%r8),%rcx
  test   %al,%al
  je     L267
  mov    %r11,%rsi
  jmp    L263
  nopw   0x0(%rax,%rax,1)
L24:
  mov    %rsi,%rdx
  jmp    L27
  nopl   0x0(%rax,%rax,1)
L157:
  movb   $0x7f,(%rsi)
  movzbl 0x2(%rcx),%eax
  lea    0x1(%rsi),%rdx
  test   %al,%al
  jne    L105
L78:
  mov    %edx,%eax
  mov    %rdx,%rsi
  sub    %edi,%eax
  jmp    L169
L153:
  mov    %rcx,%r8
  xor    %eax,%eax
  jmp    L169
L267:
  mov    %r11d,%eax
  mov    %r11,%rsi
  mov    %rcx,%r8
  sub    %edi,%eax
  jmp    L169
L266:
  mov    %r11d,%eax
  mov    %r11,%rsi
  mov    %rdx,%r8
  sub    %edi,%eax
  jmp    L169
```

assistant: ```c
char *unescape_seq(char *buf, char *seq, int *seqlen) {
  char c, *start = buf;
  enum { NORM, ESCSINGLE, ESCAPE, CARET, DONE } state = NORM;
  for (; (c = *seq); seq++) {
    switch (state) {
    case NORM:
      if (c == '^')
        state = CARET;
      else if (c == '\\')
        state = ESCSINGLE;
      else if (c == '=')
        state = DONE;
      else
        *(buf++) = c;
      break;
    case CARET:
      if (c > 0x40 && c < 0x60)
        *(buf++) = c & 0x1f;
      else if (c == '?')
        *(buf++) = 0x7f;
      state = NORM;
      break;
    case ESCSINGLE:
    case ESCAPE:
      if (state == ESCSINGLE && ((seq[0]) >= '0' && (seq[0]) <= '7') && ((seq[1]) >= '0' && (seq[1]) <= '7') && ((seq[2]) >= '0' && (seq[2]) <= '7')) {
        *(buf++) = (((seq[0] - '0') << 6) | ((seq[1] - '0') << 3) | (seq[2] - '0'));
        seq += 2;
      } else {
        *(buf++) = c;
        if (c == '\\')
          state = ESCAPE;
        else
          state = NORM;
      }
      break;
    default:
      break;
    }
    if (state == DONE)
      break;
  }
  *buf = '\0';
  *seqlen = buf - start;
  return seq;
}
```