user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<string_to_char>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x5c,%al
  jne    L132
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  cmp    $0x78,%eax
  jg     L413
  cmp    $0x5c,%eax
  jge    L187
  cmp    $0x20,%eax
  je     L200
  cmp    $0x20,%eax
  jl     L413
  sub    $0x30,%eax
  cmp    $0x7,%eax
  ja     L413
  jmp    L545
L187:
  sub    $0x5c,%eax
  cmp    $0x1c,%eax
  ja     L413
  mov    %eax,%eax
  lea    0x0(,%rax,4),%rdx
  lea    D0(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D0(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
L200:
  movl   $0x20,-0xc(%rbp)
  jmp    L360
  movl   $0x5c,-0xc(%rbp)
  jmp    L360
  movl   $0x8,-0xc(%rbp)
  jmp    L360
  movl   $0xc,-0xc(%rbp)
  jmp    L360
  movl   $0xa,-0xc(%rbp)
  jmp    L360
  movl   $0xd,-0xc(%rbp)
  jmp    L360
  movl   $0x9,-0xc(%rbp)
  jmp    L360
  mov    -0x8(%rbp),%rax
  movzbl 0x2(%rax),%eax
  mov    %al,-0xe(%rbp)
  mov    -0x8(%rbp),%rax
  movzbl 0x3(%rax),%eax
  mov    %al,-0xd(%rbp)
  movsbl -0xe(%rbp),%eax
  mov    %eax,%edi
  call   <isxdigit@plt>
  test   %eax,%eax
  je     L89
  movsbl -0xe(%rbp),%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %eax,%eax
  je     L289
  movzbl -0xe(%rbp),%eax
  sub    $0x30,%eax
  mov    %al,-0xe(%rbp)
  jmp    L58
L289:
  movsbl -0xe(%rbp),%eax
  mov    %eax,%edi
  call   <isupper@plt>
  test   %eax,%eax
  je     L539
  movzbl -0xe(%rbp),%eax
  sub    $0x41,%eax
  mov    %al,-0xe(%rbp)
  jmp    L58
L539:
  movzbl -0xe(%rbp),%eax
  sub    $0x61,%eax
  mov    %al,-0xe(%rbp)
L58:
  movsbl -0xd(%rbp),%eax
  mov    %eax,%edi
  call   <isxdigit@plt>
  test   %eax,%eax
  je     L344
  movsbl -0xd(%rbp),%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %eax,%eax
  je     L192
  movzbl -0xd(%rbp),%eax
  sub    $0x30,%eax
  mov    %al,-0xd(%rbp)
  jmp    L57
L192:
  movsbl -0xd(%rbp),%eax
  mov    %eax,%edi
  call   <isupper@plt>
  test   %eax,%eax
  je     L49
  movzbl -0xd(%rbp),%eax
  sub    $0x41,%eax
  mov    %al,-0xd(%rbp)
  jmp    L57
L49:
  movzbl -0xd(%rbp),%eax
  sub    $0x61,%eax
  mov    %al,-0xd(%rbp)
L57:
  movsbl -0xe(%rbp),%eax
  shl    $0x4,%eax
  mov    %eax,%edx
  movsbl -0xd(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0xc(%rbp)
  addq   $0x1,-0x8(%rbp)
  jmp    L360
L344:
  movsbl -0xe(%rbp),%eax
  mov    %eax,-0xc(%rbp)
  jmp    L360
L89:
  movl   $0x78,-0xc(%rbp)
  jmp    L360
L545:
  mov    -0x8(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L211
  mov    -0x8(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  cmp    $0x37,%al
  jg     L211
  mov    -0x8(%rbp),%rax
  add    $0x3,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L467
  mov    -0x8(%rbp),%rax
  add    $0x3,%rax
  movzbl (%rax),%eax
  cmp    $0x37,%al
  jg     L467
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  lea    0x0(,%rax,8),%edx
  mov    -0x8(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  add    %edx,%eax
  lea    0x0(,%rax,8),%edx
  mov    -0x8(%rbp),%rax
  add    $0x3,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  add    %edx,%eax
  mov    %eax,-0xc(%rbp)
  addq   $0x2,-0x8(%rbp)
  jmp    L195
L467:
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  lea    0x0(,%rax,8),%edx
  mov    -0x8(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  add    %edx,%eax
  mov    %eax,-0xc(%rbp)
  addq   $0x1,-0x8(%rbp)
  jmp    L195
L211:
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  mov    %eax,-0xc(%rbp)
  jmp    L360
L195:
  jmp    L360
L413:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,-0xc(%rbp)
  subq   $0x1,-0x8(%rbp)
  nop
L360:
  addq   $0x2,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    -0xc(%rbp),%eax
  jmp    L405
L132:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x4d,%al
  jne    L227
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  jne    L227
  movl   $0x8000,-0xc(%rbp)
  addq   $0x2,-0x8(%rbp)
  jmp    L218
L227:
  movl   $0x0,-0xc(%rbp)
L218:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x5e,%al
  jne    L466
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x5c,%al
  jne    L60
  addq   $0x1,-0x8(%rbp)
L60:
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x3f,%al
  jne    L334
  addl   $0x7f,-0xc(%rbp)
  jmp    L504
L334:
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x3f,%al
  jle    L349
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x5f,%al
  jg     L349
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x40,%eax
  or     %eax,-0xc(%rbp)
  jmp    L504
L349:
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x60,%al
  jle    L179
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x7a,%al
  jg     L179
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x60,%eax
  mov    %eax,-0xc(%rbp)
  jmp    L504
L179:
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L26
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isspace@plt>
  test   %rax,%rax
  je     L381
L26:
  movl   $0x5e,-0xc(%rbp)
  jmp    L504
L381:
  mov    $0xffffffff,%eax
  jmp    L405
L504:
  addq   $0x2,-0x8(%rbp)
  jmp    L168
L466:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  or     %eax,-0xc(%rbp)
  addq   $0x1,-0x8(%rbp)
L168:
  mov    -0x18(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  mov    %rdx,(%rax)
  cmpl   $0x0,-0xc(%rbp)
  jns    L150
  addl   $0x100,-0xc(%rbp)
L150:
  mov    -0xc(%rbp),%eax
L405:
  leave
  ret
```

assistant: ```c
int string_to_char(char **ptr) {
  char *str;
  int i;
  char c1, c2;
  str = *ptr;
  if (str[0] == '\\') {
    switch (str[1]) {
    case ' ':
      i = ' ';
      break;
    case '\\':
      i = '\\';
      break;
    case 'b':
      i = '\b';
      break;
    case 'f':
      i = '\f';
      break;
    case 'n':
      i = '\n';
      break;
    case 'r':
      i = '\r';
      break;
    case 't':
      i = '\t';
      break;
    case 'x':
      c1 = str[2];
      c2 = str[3];
      if (isxdigit(c1)) {
        if (isdigit(c1))
          c1 -= '0';
        else if (isupper(c1))
          c1 -= 'A';
        else
          c1 -= 'a';
        if (isxdigit(c2)) {
          if (isdigit(c2))
            c2 -= '0';
          else if (isupper(c2))
            c2 -= 'A';
          else
            c2 -= 'a';
          i = c1 * 0x10 + c2;
          str++;
        } else
          i = c1;
      } else
        i = 'x';
      break;
    case '0':
    case '1':
    case '2':
    case '3':
    case '4':
    case '5':
    case '6':
    case '7':
      if (str[2] >= '0' && str[2] <= '7') {
        if (str[3] >= '0' && str[3] <= '7') {
          i = (str[1] - '0') * 0100 + (str[2] - '0') * 010 + (str[3] - '0');
          str += 2;
        } else {
          i = (str[1] - '0') * 010 + (str[2] - '0');
          str++;
        }
      } else
        i = str[1] - '0';
      break;
    default:
      i = str[0];
      --str;
      break;
    }
    str += 2;
    *ptr = str;
    return i;
  }
  if (str[0] == 'M' && str[1] == '-') {
    i = 0x8000;
    str += 2;
  } else
    i = 0;
  if (str[0] == '^') {
    if (str[1] == '\\')
      ++str;
    if (str[1] == '?')
      i += 0x7f;
    else if (str[1] >= '@' && str[1] <= '_')
      i |= str[1] - '@';
    else if (str[1] >= 'a' && str[1] <= 'z')
      i = str[1] - 'a' + 1;
    else if (str[1] == '\0' || isspace(str[1]))
      i = '^';
    else
      return -1;
    str += 2;
  } else {
    i |= str[0];
    str++;
  }
  *ptr = str;
  if (i < 0)
    i += 256;
  return i;
}
```