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

```asm
<str2datatype>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <strlen@plt>
  cmp    $0x1,%rax
  jbe    L13
  lea    0x1(%rbp),%r13
  mov    %rax,%r12
  mov    %r13,%rdi
  call   <atoi@plt>
  mov    %r12,%rdx
  lea    D106(%rip),%rsi
  mov    %rbp,%rdi
  mov    %eax,%ebx
  call   <strncmp@plt>
  mov    %rax,%r8
  xor    %eax,%eax
  test   %r8,%r8
  jne    L110
L115:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax,%rax,1)
L110:
  mov    $0x1,%edx
  lea    D49(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L155
  sub    $0x1,%ebx
  cmp    $0x1f,%ebx
  jbe    L54
L155:
  mov    %r12,%rdx
  lea    D114(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  mov    %rax,%r8
  mov    $0x40,%eax
  test   %r8,%r8
  je     L115
  mov    %r12,%rdx
  lea    D80(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  mov    %rax,%r8
  mov    $0x80,%eax
  test   %r8,%r8
  je     L115
  mov    %r12,%rdx
  lea    D90(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L158
L162:
  mov    $0x84,%eax
  jmp    L115
L54:
  add    $0x8,%rsp
  mov    %r13,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  jmp    1090 <atoi@plt>
  nopw   0x0(%rax,%rax,1)
L158:
  mov    %r12,%rdx
  lea    D128(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L137
  mov    %r12,%rdx
  lea    D50(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  mov    %rax,%r8
  mov    $0xd0,%eax
  test   %r8,%r8
  je     L115
  mov    %r12,%rdx
  lea    D52(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  mov    %rax,%r8
  mov    $0xd8,%eax
  test   %r8,%r8
  je     L115
  mov    %r12,%rdx
  lea    D37(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  mov    %rax,%r8
  mov    $0xe8,%eax
  test   %r8,%r8
  je     L115
  mov    %r12,%rdx
  lea    D79(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  mov    %rax,%r8
  mov    $0x134,%eax
  test   %r8,%r8
  je     L115
  mov    %r12,%rdx
  lea    D5(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  mov    %rax,%r8
  mov    $0x13c,%eax
  test   %r8,%r8
  je     L115
  mov    %r12,%rdx
  lea    D108(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  mov    %rax,%r8
  mov    $0x14c,%eax
  test   %r8,%r8
  je     L115
  mov    %r12,%rdx
  lea    D45(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L162
  mov    %r12,%rdx
  lea    D99(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L13
  nopw   0x0(%rax,%rax,1)
L137:
  mov    $0xa4,%eax
  jmp    L115
  nopw   0x0(%rax,%rax,1)
L13:
  mov    $0xffffffff,%eax
  jmp    L115
```

tool_calls: name: retrieve_data
arguments: tag: D106
type_guessed: string
name: retrieve_data
arguments: tag: D49
type_guessed: string
name: retrieve_data
arguments: tag: D114
type_guessed: string
name: retrieve_data
arguments: tag: D80
type_guessed: string
name: retrieve_data
arguments: tag: D90
type_guessed: string
name: retrieve_data
arguments: tag: D128
type_guessed: string
name: retrieve_data
arguments: tag: D50
type_guessed: string
name: retrieve_data
arguments: tag: D52
type_guessed: string
name: retrieve_data
arguments: tag: D37
type_guessed: string
name: retrieve_data
arguments: tag: D79
type_guessed: string
name: retrieve_data
arguments: tag: D5
type_guessed: string
name: retrieve_data
arguments: tag: D108
type_guessed: string
name: retrieve_data
arguments: tag: D45
type_guessed: string
name: retrieve_data
arguments: tag: D99
type_guessed: string

tool: D106: P0

tool: D49: P

tool: D114: C32

tool: D80: C64

tool: D90: F32

tool: D128: F64

tool: D50: I8

tool: D52: I16

tool: D37: I32

tool: D79: U8

tool: D5: U16

tool: D108: U32

tool: D45: real

tool: D99: double

assistant: ```c
int str2datatype(const char *datatypestr) {
  int datatype = -1;
  size_t len;
  len = strlen(datatypestr);
  if (len > 1) {
    int ilen = atoi(datatypestr + 1);
    if (strncmp(datatypestr, "P0", len) == 0)
      datatype = 0;
    else if (strncmp(datatypestr, "P", 1) == 0 && ilen > 0 && ilen <= 32)
      datatype = atoi(datatypestr + 1);
    else if (strncmp(datatypestr, "C32", len) == 0)
      datatype = 64;
    else if (strncmp(datatypestr, "C64", len) == 0)
      datatype = 128;
    else if (strncmp(datatypestr, "F32", len) == 0)
      datatype = 132;
    else if (strncmp(datatypestr, "F64", len) == 0)
      datatype = 164;
    else if (strncmp(datatypestr, "I8", len) == 0)
      datatype = 208;
    else if (strncmp(datatypestr, "I16", len) == 0)
      datatype = 216;
    else if (strncmp(datatypestr, "I32", len) == 0)
      datatype = 232;
    else if (strncmp(datatypestr, "U8", len) == 0)
      datatype = 308;
    else if (strncmp(datatypestr, "U16", len) == 0)
      datatype = 316;
    else if (strncmp(datatypestr, "U32", len) == 0)
      datatype = 332;
    else if (strncmp(datatypestr, "real", len) == 0)
      datatype = 132;
    else if (strncmp(datatypestr, "double", len) == 0)
      datatype = 164;
  }
  return (datatype);
}
```