user: Converte this assembly snippet into its equivalent C code:

```asm
<BTSHASP_GetRegId>:
  endbr64
  push   %rbp
  movzbl (%rdi),%edx
  mov    %rdi,%rbp
  lea    -0x44(%rdx),%eax
  cmp    $0x2e,%al
  ja     L32
  lea    D1(%rip),%rcx
  movzbl %al,%eax
  movslq (%rcx,%rax,4),%rax
  add    %rcx,%rax
  notrack jmp *%rax
  cs nopw 0x0(%rax,%rax,1)
L32:
  lea    D110(%rip),%rsi
  mov    %rbp,%rdi
  call   <btshasp_stricmp@plt>
  mov    %eax,%r8d
  mov    $0xf,%eax
  test   %r8d,%r8d
  je     L6
  lea    D118(%rip),%rsi
  mov    %rbp,%rdi
  call   <btshasp_stricmp@plt>
  mov    %eax,%r8d
  mov    $0x30,%eax
  test   %r8d,%r8d
  je     L6
  lea    D48(%rip),%rsi
  mov    %rbp,%rdi
  call   <btshasp_stricmp@plt>
  mov    %eax,%r8d
  mov    $0x31,%eax
  test   %r8d,%r8d
  je     L6
  lea    D77(%rip),%rsi
  mov    %rbp,%rdi
  call   <btshasp_stricmp@plt>
  mov    %eax,%r8d
  mov    $0x32,%eax
  test   %r8d,%r8d
  je     L6
  lea    D50(%rip),%rsi
  mov    %rbp,%rdi
  call   <btshasp_stricmp@plt>
  test   %eax,%eax
  jne    L62
  mov    $0x33,%eax
L6:
  pop    %rbp
  ret
  xchg   %ax,%ax
  and    $0xffffffdf,%edx
  mov    $0x11,%eax
  mov    $0x21,%ecx
  mov    $0x2a,%esi
  cmp    $0x44,%dl
  mov    $0x20,%edx
  cmovne %eax,%ecx
  mov    $0x1a,%eax
  cmovne %eax,%esi
  mov    $0x10,%eax
  cmove  %edx,%eax
  movzbl 0x2(%rdi),%edx
  cmp    $0x30,%dl
  je     L140
  cmp    $0x31,%dl
  je     L238
  sub    $0x30,%edx
  cmp    $0x9,%dl
  jbe    L87
L175:
  lea    D45(%rip),%rsi
  mov    %rbp,%rdi
  call   <btshasp_stricmp@plt>
  mov    %eax,%r8d
  mov    $0x38,%eax
  test   %r8d,%r8d
  je     L6
  lea    D66(%rip),%rsi
  mov    %rbp,%rdi
  call   <btshasp_stricmp@plt>
  mov    %eax,%r8d
  mov    $0x39,%eax
  test   %r8d,%r8d
  je     L6
L62:
  mov    $0xffffffff,%eax
  pop    %rbp
  ret
  nopw   0x0(%rax,%rax,1)
  lea    D8(%rip),%rsi
  call   <btshasp_stricmp@plt>
  mov    %eax,%r8d
  mov    $0x34,%eax
  test   %r8d,%r8d
  je     L6
  lea    D80(%rip),%rsi
  mov    %rbp,%rdi
  call   <btshasp_stricmp@plt>
  mov    %eax,%r8d
  mov    $0x35,%eax
  test   %r8d,%r8d
  jne    L62
  pop    %rbp
  ret
  nopl   0x0(%rax,%rax,1)
  movzbl 0x1(%rdi),%eax
  cmp    $0x30,%al
  je     L156
  cmp    $0x31,%al
  jne    L220
  movzbl 0x2(%rdi),%eax
  lea    -0x30(%rax),%edx
  cmp    $0x5,%dl
  ja     L107
  cmpb   $0x0,0x3(%rdi)
  jne    L62
  sub    $0x26,%eax
  jmp    L223
  cs nopw 0x0(%rax,%rax,1)
  lea    D65(%rip),%rsi
  call   <btshasp_stricmp@plt>
  mov    %eax,%r8d
  mov    $0x36,%eax
  test   %r8d,%r8d
  je     L6
  lea    D59(%rip),%rsi
  mov    %rbp,%rdi
  call   <btshasp_stricmp@plt>
  mov    %eax,%r8d
  mov    $0x37,%eax
  test   %r8d,%r8d
  jne    L62
  pop    %rbp
  ret
  nop
L156:
  movzbl 0x2(%rdi),%edx
  lea    -0x30(%rdx),%eax
  cmp    $0x9,%al
  ja     L61
  cmpb   $0x0,0x3(%rdi)
  jne    L62
  jmp    L223
  nopw   0x0(%rax,%rax,1)
L140:
  movzbl 0x3(%rdi),%edx
  lea    -0x30(%rdx),%ecx
  cmp    $0x9,%cl
  ja     L278
  movsbl %cl,%ecx
  add    %ecx,%eax
  cmpb   $0x0,0x4(%rdi)
  jne    L175
  pop    %rbp
  ret
  nopl   (%rax)
L144:
  mov    %ecx,%eax
L278:
  test   %dl,%dl
  jne    L175
  pop    %rbp
  ret
  nopl   0x0(%rax)
L220:
  sub    $0x30,%eax
  cmp    $0x9,%al
  ja     L62
  cmpb   $0x0,0x2(%rdi)
  jne    L62
L223:
  movsbl %al,%eax
  pop    %rbp
  ret
  nopw   0x0(%rax,%rax,1)
L87:
  movsbl %dl,%edx
  add    %edx,%eax
  cmpb   $0x0,0x3(%rdi)
  jne    L175
  pop    %rbp
  ret
  nopl   0x0(%rax)
L61:
  xor    %eax,%eax
  test   %dl,%dl
  jne    L62
  pop    %rbp
  ret
  nopl   0x0(%rax)
L107:
  test   %al,%al
  jne    L62
  mov    $0x1,%eax
  pop    %rbp
  ret
  nopw   0x0(%rax,%rax,1)
L238:
  movzbl 0x3(%rdi),%edx
  lea    -0x30(%rdx),%eax
  cmp    $0x5,%al
  ja     L144
  movsbl %al,%eax
  add    %esi,%eax
  cmpb   $0x0,0x4(%rdi)
  jne    L175
  pop    %rbp
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D110
type_infered: string
name: extract_symbolic_data
arguments: label: D118
type_infered: string
name: extract_symbolic_data
arguments: label: D48
type_infered: string
name: extract_symbolic_data
arguments: label: D77
type_infered: string
name: extract_symbolic_data
arguments: label: D50
type_infered: string
name: extract_symbolic_data
arguments: label: D45
type_infered: string
name: extract_symbolic_data
arguments: label: D66
type_infered: string
name: extract_symbolic_data
arguments: label: D8
type_infered: string
name: extract_symbolic_data
arguments: label: D80
type_infered: string
name: extract_symbolic_data
arguments: label: D65
type_infered: string
name: extract_symbolic_data
arguments: label: D59
type_infered: string

tool: D110: sp

tool: D118: sr

tool: D48: gbr

tool: D77: vbr

tool: D50: tbr

tool: D45: fpscr

tool: D66: fpul

tool: D8: mach

tool: D80: macl

tool: D65: pr

tool: D59: pc

assistant: ```c
int BTSHASP_GetRegId(char *str) {
  int i, t;
  switch (str[0]) {
  case 'F':
  case 'f':
  case 'D':
  case 'd':
    t = 0x10;
    if ((str[0] == 'D') || (str[0] == 'd'))
      t = 0x20;
    if (str[2] == '0') {
      if ((str[3] >= '0') && (str[3] <= '9') && !str[4]) {
        return (t + (str[3] - '0'));
      }
      if (!str[3])
        return (t);
    } else if (str[2] == '1') {
      if ((str[3] >= '0') && (str[3] <= '5') && !str[4]) {
        return (t + 10 + (str[3] - '0'));
      }
      if (!str[3])
        return (t + 1);
    } else if ((str[2] >= '0') && (str[2] <= '9') && !str[3]) {
      return (t + (str[2] - '0'));
    }
    if (!btshasp_stricmp(str, "fpscr"))
      return (0x38);
    if (!btshasp_stricmp(str, "fpul"))
      return (0x39);
    break;
  case 'R':
  case 'r':
    t = 0x00;
    if (str[1] == '0') {
      if ((str[2] >= '0') && (str[2] <= '9') && !str[3]) {
        return (t + (str[2] - '0'));
      }
      if (!str[2])
        return (t);
    }
    if (str[1] == '1') {
      if ((str[2] >= '0') && (str[2] <= '5') && !str[3]) {
        return (t + 10 + (str[2] - '0'));
      }
      if (!str[2]) {
        return (t + 1);
      }
    } else if ((str[1] >= '0') && (str[1] <= '9') && !str[2]) {
      return (t + (str[1] - '0'));
    }
    break;
  case 'M':
  case 'm':
    if (!btshasp_stricmp(str, "mach"))
      return (0x34);
    if (!btshasp_stricmp(str, "macl"))
      return (0x35);
    break;
  case 'P':
  case 'p':
    if (!btshasp_stricmp(str, "pr"))
      return (0x36);
    if (!btshasp_stricmp(str, "pc"))
      return (0x37);
    break;
  default:
    if (!btshasp_stricmp(str, "sp"))
      return (0x0F);
    if (!btshasp_stricmp(str, "sr"))
      return (0x30);
    if (!btshasp_stricmp(str, "gbr"))
      return (0x31);
    if (!btshasp_stricmp(str, "vbr"))
      return (0x32);
    if (!btshasp_stricmp(str, "tbr"))
      return (0x33);
    break;
  }
  return (-1);
}
```